1 | |
2 | #line 1 "hb-ot-shape-complex-myanmar-machine.rl" |
3 | /* |
4 | * Copyright © 2011,2012 Google, Inc. |
5 | * |
6 | * This is part of HarfBuzz, a text shaping library. |
7 | * |
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. |
13 | * |
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 |
18 | * DAMAGE. |
19 | * |
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. |
25 | * |
26 | * Google Author(s): Behdad Esfahbod |
27 | */ |
28 | |
29 | #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH |
30 | #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH |
31 | |
32 | #include "hb.hh" |
33 | |
34 | |
35 | #line 36 "hb-ot-shape-complex-myanmar-machine.hh" |
36 | static const unsigned char _myanmar_syllable_machine_trans_keys[] = { |
37 | 1u, 32u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, |
38 | 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u, |
39 | 3u, 29u, 3u, 29u, 3u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, |
40 | 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, |
41 | 3u, 29u, 3u, 30u, 3u, 29u, 1u, 32u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, |
42 | 3u, 29u, 3u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 32u, 8u, 8u, |
43 | 0 |
44 | }; |
45 | |
46 | static const char _myanmar_syllable_machine_key_spans[] = { |
47 | 32, 28, 25, 4, 25, 23, 21, 21, |
48 | 27, 27, 27, 27, 16, 27, 27, 27, |
49 | 27, 27, 28, 27, 27, 27, 27, 25, |
50 | 4, 25, 23, 21, 21, 27, 27, 27, |
51 | 27, 28, 27, 32, 27, 27, 27, 27, |
52 | 27, 28, 27, 27, 27, 27, 32, 1 |
53 | }; |
54 | |
55 | static const short _myanmar_syllable_machine_index_offsets[] = { |
56 | 0, 33, 62, 88, 93, 119, 143, 165, |
57 | 187, 215, 243, 271, 299, 316, 344, 372, |
58 | 400, 428, 456, 485, 513, 541, 569, 597, |
59 | 623, 628, 654, 678, 700, 722, 750, 778, |
60 | 806, 834, 863, 891, 924, 952, 980, 1008, |
61 | 1036, 1064, 1093, 1121, 1149, 1177, 1205, 1238 |
62 | }; |
63 | |
64 | static const char _myanmar_syllable_machine_indicies[] = { |
65 | 1, 1, 2, 3, 4, 4, 0, 5, |
66 | 0, 6, 1, 0, 0, 0, 0, 7, |
67 | 0, 8, 9, 0, 10, 11, 12, 13, |
68 | 14, 15, 16, 17, 18, 19, 20, 1, |
69 | 0, 22, 23, 24, 24, 21, 25, 21, |
70 | 26, 21, 21, 21, 21, 21, 21, 21, |
71 | 27, 21, 21, 28, 29, 30, 31, 32, |
72 | 33, 34, 35, 36, 37, 21, 24, 24, |
73 | 21, 25, 21, 21, 21, 21, 21, 21, |
74 | 21, 21, 21, 38, 21, 21, 21, 21, |
75 | 21, 21, 32, 21, 21, 21, 36, 21, |
76 | 24, 24, 21, 25, 21, 24, 24, 21, |
77 | 25, 21, 21, 21, 21, 21, 21, 21, |
78 | 21, 21, 21, 21, 21, 21, 21, 21, |
79 | 21, 32, 21, 21, 21, 36, 21, 39, |
80 | 21, 24, 24, 21, 25, 21, 32, 21, |
81 | 21, 21, 21, 21, 21, 21, 40, 21, |
82 | 21, 21, 21, 21, 21, 32, 21, 24, |
83 | 24, 21, 25, 21, 21, 21, 21, 21, |
84 | 21, 21, 21, 21, 40, 21, 21, 21, |
85 | 21, 21, 21, 32, 21, 24, 24, 21, |
86 | 25, 21, 21, 21, 21, 21, 21, 21, |
87 | 21, 21, 21, 21, 21, 21, 21, 21, |
88 | 21, 32, 21, 22, 21, 24, 24, 21, |
89 | 25, 21, 26, 21, 21, 21, 21, 21, |
90 | 21, 21, 41, 21, 21, 41, 21, 21, |
91 | 21, 32, 42, 21, 21, 36, 21, 22, |
92 | 21, 24, 24, 21, 25, 21, 26, 21, |
93 | 21, 21, 21, 21, 21, 21, 21, 21, |
94 | 21, 21, 21, 21, 21, 32, 21, 21, |
95 | 21, 36, 21, 22, 21, 24, 24, 21, |
96 | 25, 21, 26, 21, 21, 21, 21, 21, |
97 | 21, 21, 41, 21, 21, 21, 21, 21, |
98 | 21, 32, 42, 21, 21, 36, 21, 22, |
99 | 21, 24, 24, 21, 25, 21, 26, 21, |
100 | 21, 21, 21, 21, 21, 21, 21, 21, |
101 | 21, 21, 21, 21, 21, 32, 42, 21, |
102 | 21, 36, 21, 1, 1, 21, 21, 21, |
103 | 21, 21, 21, 21, 21, 21, 21, 21, |
104 | 21, 21, 1, 21, 22, 21, 24, 24, |
105 | 21, 25, 21, 26, 21, 21, 21, 21, |
106 | 21, 21, 21, 27, 21, 21, 28, 29, |
107 | 30, 31, 32, 33, 34, 35, 36, 21, |
108 | 22, 21, 24, 24, 21, 25, 21, 26, |
109 | 21, 21, 21, 21, 21, 21, 21, 43, |
110 | 21, 21, 21, 21, 21, 21, 32, 33, |
111 | 34, 35, 36, 21, 22, 21, 24, 24, |
112 | 21, 25, 21, 26, 21, 21, 21, 21, |
113 | 21, 21, 21, 21, 21, 21, 21, 21, |
114 | 21, 21, 32, 33, 34, 35, 36, 21, |
115 | 22, 21, 24, 24, 21, 25, 21, 26, |
116 | 21, 21, 21, 21, 21, 21, 21, 21, |
117 | 21, 21, 21, 21, 21, 21, 32, 33, |
118 | 34, 21, 36, 21, 22, 21, 24, 24, |
119 | 21, 25, 21, 26, 21, 21, 21, 21, |
120 | 21, 21, 21, 21, 21, 21, 21, 21, |
121 | 21, 21, 32, 21, 34, 21, 36, 21, |
122 | 22, 21, 24, 24, 21, 25, 21, 26, |
123 | 21, 21, 21, 21, 21, 21, 21, 21, |
124 | 21, 21, 21, 21, 21, 21, 32, 33, |
125 | 34, 35, 36, 43, 21, 22, 21, 24, |
126 | 24, 21, 25, 21, 26, 21, 21, 21, |
127 | 21, 21, 21, 21, 43, 21, 21, 28, |
128 | 21, 30, 21, 32, 33, 34, 35, 36, |
129 | 21, 22, 21, 24, 24, 21, 25, 21, |
130 | 26, 21, 21, 21, 21, 21, 21, 21, |
131 | 43, 21, 21, 28, 21, 21, 21, 32, |
132 | 33, 34, 35, 36, 21, 22, 21, 24, |
133 | 24, 21, 25, 21, 26, 21, 21, 21, |
134 | 21, 21, 21, 21, 43, 21, 21, 28, |
135 | 29, 30, 21, 32, 33, 34, 35, 36, |
136 | 21, 22, 23, 24, 24, 21, 25, 21, |
137 | 26, 21, 21, 21, 21, 21, 21, 21, |
138 | 27, 21, 21, 28, 29, 30, 31, 32, |
139 | 33, 34, 35, 36, 21, 3, 3, 44, |
140 | 5, 44, 44, 44, 44, 44, 44, 44, |
141 | 44, 44, 45, 44, 44, 44, 44, 44, |
142 | 44, 14, 44, 44, 44, 18, 44, 3, |
143 | 3, 44, 5, 44, 3, 3, 44, 5, |
144 | 44, 44, 44, 44, 44, 44, 44, 44, |
145 | 44, 44, 44, 44, 44, 44, 44, 44, |
146 | 14, 44, 44, 44, 18, 44, 46, 44, |
147 | 3, 3, 44, 5, 44, 14, 44, 44, |
148 | 44, 44, 44, 44, 44, 47, 44, 44, |
149 | 44, 44, 44, 44, 14, 44, 3, 3, |
150 | 44, 5, 44, 44, 44, 44, 44, 44, |
151 | 44, 44, 44, 47, 44, 44, 44, 44, |
152 | 44, 44, 14, 44, 3, 3, 44, 5, |
153 | 44, 44, 44, 44, 44, 44, 44, 44, |
154 | 44, 44, 44, 44, 44, 44, 44, 44, |
155 | 14, 44, 2, 44, 3, 3, 44, 5, |
156 | 44, 6, 44, 44, 44, 44, 44, 44, |
157 | 44, 48, 44, 44, 48, 44, 44, 44, |
158 | 14, 49, 44, 44, 18, 44, 2, 44, |
159 | 3, 3, 44, 5, 44, 6, 44, 44, |
160 | 44, 44, 44, 44, 44, 44, 44, 44, |
161 | 44, 44, 44, 44, 14, 44, 44, 44, |
162 | 18, 44, 2, 44, 3, 3, 44, 5, |
163 | 44, 6, 44, 44, 44, 44, 44, 44, |
164 | 44, 48, 44, 44, 44, 44, 44, 44, |
165 | 14, 49, 44, 44, 18, 44, 2, 44, |
166 | 3, 3, 44, 5, 44, 6, 44, 44, |
167 | 44, 44, 44, 44, 44, 44, 44, 44, |
168 | 44, 44, 44, 44, 14, 49, 44, 44, |
169 | 18, 44, 22, 23, 24, 24, 21, 25, |
170 | 21, 26, 21, 21, 21, 21, 21, 21, |
171 | 21, 50, 21, 21, 28, 29, 30, 31, |
172 | 32, 33, 34, 35, 36, 37, 21, 22, |
173 | 51, 24, 24, 21, 25, 21, 26, 21, |
174 | 21, 21, 21, 21, 21, 21, 27, 21, |
175 | 21, 28, 29, 30, 31, 32, 33, 34, |
176 | 35, 36, 21, 1, 1, 2, 3, 3, |
177 | 3, 44, 5, 44, 6, 1, 44, 44, |
178 | 44, 44, 1, 44, 8, 44, 44, 10, |
179 | 11, 12, 13, 14, 15, 16, 17, 18, |
180 | 19, 44, 1, 44, 2, 44, 3, 3, |
181 | 44, 5, 44, 6, 44, 44, 44, 44, |
182 | 44, 44, 44, 8, 44, 44, 10, 11, |
183 | 12, 13, 14, 15, 16, 17, 18, 44, |
184 | 2, 44, 3, 3, 44, 5, 44, 6, |
185 | 44, 44, 44, 44, 44, 44, 44, 52, |
186 | 44, 44, 44, 44, 44, 44, 14, 15, |
187 | 16, 17, 18, 44, 2, 44, 3, 3, |
188 | 44, 5, 44, 6, 44, 44, 44, 44, |
189 | 44, 44, 44, 44, 44, 44, 44, 44, |
190 | 44, 44, 14, 15, 16, 17, 18, 44, |
191 | 2, 44, 3, 3, 44, 5, 44, 6, |
192 | 44, 44, 44, 44, 44, 44, 44, 44, |
193 | 44, 44, 44, 44, 44, 44, 14, 15, |
194 | 16, 44, 18, 44, 2, 44, 3, 3, |
195 | 44, 5, 44, 6, 44, 44, 44, 44, |
196 | 44, 44, 44, 44, 44, 44, 44, 44, |
197 | 44, 44, 14, 44, 16, 44, 18, 44, |
198 | 2, 44, 3, 3, 44, 5, 44, 6, |
199 | 44, 44, 44, 44, 44, 44, 44, 44, |
200 | 44, 44, 44, 44, 44, 44, 14, 15, |
201 | 16, 17, 18, 52, 44, 2, 44, 3, |
202 | 3, 44, 5, 44, 6, 44, 44, 44, |
203 | 44, 44, 44, 44, 52, 44, 44, 10, |
204 | 44, 12, 44, 14, 15, 16, 17, 18, |
205 | 44, 2, 44, 3, 3, 44, 5, 44, |
206 | 6, 44, 44, 44, 44, 44, 44, 44, |
207 | 52, 44, 44, 10, 44, 44, 44, 14, |
208 | 15, 16, 17, 18, 44, 2, 44, 3, |
209 | 3, 44, 5, 44, 6, 44, 44, 44, |
210 | 44, 44, 44, 44, 52, 44, 44, 10, |
211 | 11, 12, 44, 14, 15, 16, 17, 18, |
212 | 44, 2, 3, 3, 3, 44, 5, 44, |
213 | 6, 44, 44, 44, 44, 44, 44, 44, |
214 | 8, 44, 44, 10, 11, 12, 13, 14, |
215 | 15, 16, 17, 18, 44, 1, 1, 53, |
216 | 53, 53, 53, 53, 53, 53, 53, 1, |
217 | 53, 53, 53, 53, 1, 53, 53, 53, |
218 | 53, 53, 53, 53, 53, 53, 53, 53, |
219 | 53, 53, 53, 53, 1, 53, 54, 53, |
220 | 0 |
221 | }; |
222 | |
223 | static const char _myanmar_syllable_machine_trans_targs[] = { |
224 | 0, 1, 23, 0, 0, 24, 30, 33, |
225 | 36, 46, 37, 42, 43, 44, 26, 39, |
226 | 40, 41, 29, 45, 47, 0, 2, 12, |
227 | 0, 3, 9, 13, 14, 19, 20, 21, |
228 | 5, 16, 17, 18, 8, 22, 4, 6, |
229 | 7, 10, 11, 15, 0, 25, 27, 28, |
230 | 31, 32, 34, 35, 38, 0, 0 |
231 | }; |
232 | |
233 | static const char _myanmar_syllable_machine_trans_actions[] = { |
234 | 3, 0, 0, 4, 5, 0, 0, 0, |
235 | 0, 0, 0, 0, 0, 0, 0, 0, |
236 | 0, 0, 0, 0, 0, 6, 0, 0, |
237 | 7, 0, 0, 0, 0, 0, 0, 0, |
238 | 0, 0, 0, 0, 0, 0, 0, 0, |
239 | 0, 0, 0, 0, 8, 0, 0, 0, |
240 | 0, 0, 0, 0, 0, 9, 10 |
241 | }; |
242 | |
243 | static const char _myanmar_syllable_machine_to_state_actions[] = { |
244 | 1, 0, 0, 0, 0, 0, 0, 0, |
245 | 0, 0, 0, 0, 0, 0, 0, 0, |
246 | 0, 0, 0, 0, 0, 0, 0, 0, |
247 | 0, 0, 0, 0, 0, 0, 0, 0, |
248 | 0, 0, 0, 0, 0, 0, 0, 0, |
249 | 0, 0, 0, 0, 0, 0, 0, 0 |
250 | }; |
251 | |
252 | static const char _myanmar_syllable_machine_from_state_actions[] = { |
253 | 2, 0, 0, 0, 0, 0, 0, 0, |
254 | 0, 0, 0, 0, 0, 0, 0, 0, |
255 | 0, 0, 0, 0, 0, 0, 0, 0, |
256 | 0, 0, 0, 0, 0, 0, 0, 0, |
257 | 0, 0, 0, 0, 0, 0, 0, 0, |
258 | 0, 0, 0, 0, 0, 0, 0, 0 |
259 | }; |
260 | |
261 | static const short _myanmar_syllable_machine_eof_trans[] = { |
262 | 0, 22, 22, 22, 22, 22, 22, 22, |
263 | 22, 22, 22, 22, 22, 22, 22, 22, |
264 | 22, 22, 22, 22, 22, 22, 22, 45, |
265 | 45, 45, 45, 45, 45, 45, 45, 45, |
266 | 45, 22, 22, 45, 45, 45, 45, 45, |
267 | 45, 45, 45, 45, 45, 45, 54, 54 |
268 | }; |
269 | |
270 | static const int myanmar_syllable_machine_start = 0; |
271 | static const int myanmar_syllable_machine_first_final = 0; |
272 | static const int myanmar_syllable_machine_error = -1; |
273 | |
274 | static const int myanmar_syllable_machine_en_main = 0; |
275 | |
276 | |
277 | #line 36 "hb-ot-shape-complex-myanmar-machine.rl" |
278 | |
279 | |
280 | |
281 | #line 94 "hb-ot-shape-complex-myanmar-machine.rl" |
282 | |
283 | |
284 | #define found_syllable(syllable_type) \ |
285 | HB_STMT_START { \ |
286 | if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ |
287 | for (unsigned int i = ts; i < te; i++) \ |
288 | info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
289 | syllable_serial++; \ |
290 | if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
291 | } HB_STMT_END |
292 | |
293 | static void |
294 | find_syllables (hb_buffer_t *buffer) |
295 | { |
296 | unsigned int p, pe, eof, ts, te, act HB_UNUSED; |
297 | int cs; |
298 | hb_glyph_info_t *info = buffer->info; |
299 | |
300 | #line 301 "hb-ot-shape-complex-myanmar-machine.hh" |
301 | { |
302 | cs = myanmar_syllable_machine_start; |
303 | ts = 0; |
304 | te = 0; |
305 | act = 0; |
306 | } |
307 | |
308 | #line 114 "hb-ot-shape-complex-myanmar-machine.rl" |
309 | |
310 | |
311 | p = 0; |
312 | pe = eof = buffer->len; |
313 | |
314 | unsigned int syllable_serial = 1; |
315 | |
316 | #line 317 "hb-ot-shape-complex-myanmar-machine.hh" |
317 | { |
318 | int _slen; |
319 | int _trans; |
320 | const unsigned char *_keys; |
321 | const char *_inds; |
322 | if ( p == pe ) |
323 | goto _test_eof; |
324 | _resume: |
325 | switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { |
326 | case 2: |
327 | #line 1 "NONE" |
328 | {ts = p;} |
329 | break; |
330 | #line 331 "hb-ot-shape-complex-myanmar-machine.hh" |
331 | } |
332 | |
333 | _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); |
334 | _inds = _myanmar_syllable_machine_indicies + _myanmar_syllable_machine_index_offsets[cs]; |
335 | |
336 | _slen = _myanmar_syllable_machine_key_spans[cs]; |
337 | _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].myanmar_category()) && |
338 | ( info[p].myanmar_category()) <= _keys[1] ? |
339 | ( info[p].myanmar_category()) - _keys[0] : _slen ]; |
340 | |
341 | _eof_trans: |
342 | cs = _myanmar_syllable_machine_trans_targs[_trans]; |
343 | |
344 | if ( _myanmar_syllable_machine_trans_actions[_trans] == 0 ) |
345 | goto _again; |
346 | |
347 | switch ( _myanmar_syllable_machine_trans_actions[_trans] ) { |
348 | case 7: |
349 | #line 86 "hb-ot-shape-complex-myanmar-machine.rl" |
350 | {te = p+1;{ found_syllable (consonant_syllable); }} |
351 | break; |
352 | case 5: |
353 | #line 87 "hb-ot-shape-complex-myanmar-machine.rl" |
354 | {te = p+1;{ found_syllable (non_myanmar_cluster); }} |
355 | break; |
356 | case 10: |
357 | #line 88 "hb-ot-shape-complex-myanmar-machine.rl" |
358 | {te = p+1;{ found_syllable (punctuation_cluster); }} |
359 | break; |
360 | case 4: |
361 | #line 89 "hb-ot-shape-complex-myanmar-machine.rl" |
362 | {te = p+1;{ found_syllable (broken_cluster); }} |
363 | break; |
364 | case 3: |
365 | #line 90 "hb-ot-shape-complex-myanmar-machine.rl" |
366 | {te = p+1;{ found_syllable (non_myanmar_cluster); }} |
367 | break; |
368 | case 6: |
369 | #line 86 "hb-ot-shape-complex-myanmar-machine.rl" |
370 | {te = p;p--;{ found_syllable (consonant_syllable); }} |
371 | break; |
372 | case 8: |
373 | #line 89 "hb-ot-shape-complex-myanmar-machine.rl" |
374 | {te = p;p--;{ found_syllable (broken_cluster); }} |
375 | break; |
376 | case 9: |
377 | #line 90 "hb-ot-shape-complex-myanmar-machine.rl" |
378 | {te = p;p--;{ found_syllable (non_myanmar_cluster); }} |
379 | break; |
380 | #line 381 "hb-ot-shape-complex-myanmar-machine.hh" |
381 | } |
382 | |
383 | _again: |
384 | switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { |
385 | case 1: |
386 | #line 1 "NONE" |
387 | {ts = 0;} |
388 | break; |
389 | #line 390 "hb-ot-shape-complex-myanmar-machine.hh" |
390 | } |
391 | |
392 | if ( ++p != pe ) |
393 | goto _resume; |
394 | _test_eof: {} |
395 | if ( p == eof ) |
396 | { |
397 | if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { |
398 | _trans = _myanmar_syllable_machine_eof_trans[cs] - 1; |
399 | goto _eof_trans; |
400 | } |
401 | } |
402 | |
403 | } |
404 | |
405 | #line 122 "hb-ot-shape-complex-myanmar-machine.rl" |
406 | |
407 | } |
408 | |
409 | #undef found_syllable |
410 | |
411 | #endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH */ |
412 | |