2 #line 1 "hb-ot-shape-complex-sea-machine.rl"
4 * Copyright © 2011,2012,2013 Google, Inc.
6 * This is part of HarfBuzz, a text shaping library.
8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the
11 * above copyright notice and the following two paragraphs appear in
12 * all copies of this software.
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
26 * Google Author(s): Behdad Esfahbod
29 #ifndef HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH
30 #define HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH
32 #include "hb-private.hh"
35 #line 36 "hb-ot-shape-complex-sea-machine.hh.tmp"
36 static const unsigned char _sea_syllable_machine_trans_keys
[] = {
37 1u, 1u, 1u, 1u, 1u, 29u, 3u, 29u, 3u, 29u, 1u, 1u, 0
40 static const char _sea_syllable_machine_key_spans
[] = {
44 static const char _sea_syllable_machine_index_offsets
[] = {
48 static const char _sea_syllable_machine_indicies
[] = {
49 1, 0, 3, 2, 1, 1, 3, 5,
50 4, 4, 4, 4, 4, 3, 4, 1,
51 4, 4, 4, 4, 3, 4, 4, 4,
52 4, 3, 4, 4, 4, 3, 3, 3,
53 3, 4, 1, 7, 6, 6, 6, 6,
54 6, 1, 6, 6, 6, 6, 6, 6,
55 1, 6, 6, 6, 6, 1, 6, 6,
56 6, 1, 1, 1, 1, 6, 3, 9,
57 8, 8, 8, 8, 8, 3, 8, 8,
58 8, 8, 8, 8, 3, 8, 8, 8,
59 8, 3, 8, 8, 8, 3, 3, 3,
63 static const char _sea_syllable_machine_trans_targs
[] = {
64 2, 3, 2, 4, 2, 5, 2, 0,
68 static const char _sea_syllable_machine_trans_actions
[] = {
69 1, 2, 3, 2, 6, 0, 7, 0,
73 static const char _sea_syllable_machine_to_state_actions
[] = {
77 static const char _sea_syllable_machine_from_state_actions
[] = {
81 static const char _sea_syllable_machine_eof_trans
[] = {
85 static const int sea_syllable_machine_start
= 2;
86 static const int sea_syllable_machine_first_final
= 2;
87 static const int sea_syllable_machine_error
= -1;
89 static const int sea_syllable_machine_en_main
= 2;
92 #line 36 "hb-ot-shape-complex-sea-machine.rl"
96 #line 67 "hb-ot-shape-complex-sea-machine.rl"
99 #define found_syllable(syllable_type) \
101 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \
102 for (unsigned int i = last; i < p+1; i++) \
103 info[i].syllable() = (syllable_serial << 4) | syllable_type; \
106 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \
110 find_syllables (hb_buffer_t
*buffer
)
112 unsigned int p
, pe
, eof
, ts HB_UNUSED
, te HB_UNUSED
, act HB_UNUSED
;
114 hb_glyph_info_t
*info
= buffer
->info
;
116 #line 117 "hb-ot-shape-complex-sea-machine.hh.tmp"
118 cs
= sea_syllable_machine_start
;
124 #line 88 "hb-ot-shape-complex-sea-machine.rl"
128 pe
= eof
= buffer
->len
;
130 unsigned int last
= 0;
131 unsigned int syllable_serial
= 1;
133 #line 134 "hb-ot-shape-complex-sea-machine.hh.tmp"
137 const unsigned char *_keys
;
142 switch ( _sea_syllable_machine_from_state_actions
[cs
] ) {
147 #line 148 "hb-ot-shape-complex-sea-machine.hh.tmp"
150 _keys
= _sea_syllable_machine_trans_keys
+ (cs
<<1);
151 _inds
= _sea_syllable_machine_indicies
+ _sea_syllable_machine_index_offsets
[cs
];
153 _slen
= _sea_syllable_machine_key_spans
[cs
];
154 _trans
= _inds
[ _slen
> 0 && _keys
[0] <=( info
[p
].sea_category()) &&
155 ( info
[p
].sea_category()) <= _keys
[1] ?
156 ( info
[p
].sea_category()) - _keys
[0] : _slen
];
159 cs
= _sea_syllable_machine_trans_targs
[_trans
];
161 if ( _sea_syllable_machine_trans_actions
[_trans
] == 0 )
164 switch ( _sea_syllable_machine_trans_actions
[_trans
] ) {
170 #line 63 "hb-ot-shape-complex-sea-machine.rl"
171 {te
= p
+1;{ found_syllable (non_sea_cluster
); }}
174 #line 61 "hb-ot-shape-complex-sea-machine.rl"
175 {te
= p
;p
--;{ found_syllable (consonant_syllable
); }}
178 #line 62 "hb-ot-shape-complex-sea-machine.rl"
179 {te
= p
;p
--;{ found_syllable (broken_cluster
); }}
182 #line 63 "hb-ot-shape-complex-sea-machine.rl"
183 {te
= p
;p
--;{ found_syllable (non_sea_cluster
); }}
186 #line 61 "hb-ot-shape-complex-sea-machine.rl"
187 {{p
= ((te
))-1;}{ found_syllable (consonant_syllable
); }}
190 #line 62 "hb-ot-shape-complex-sea-machine.rl"
191 {{p
= ((te
))-1;}{ found_syllable (broken_cluster
); }}
193 #line 194 "hb-ot-shape-complex-sea-machine.hh.tmp"
197 switch ( _sea_syllable_machine_to_state_actions
[cs
] ) {
202 #line 203 "hb-ot-shape-complex-sea-machine.hh.tmp"
210 if ( _sea_syllable_machine_eof_trans
[cs
] > 0 ) {
211 _trans
= _sea_syllable_machine_eof_trans
[cs
] - 1;
218 #line 97 "hb-ot-shape-complex-sea-machine.rl"
222 #undef found_syllable
224 #endif /* HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH */