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", last, p+1, #syllable_type); \ |
287 | for (unsigned int i = last; i < p+1; i++) \ |
288 | info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
289 | last = p+1; \ |
290 | syllable_serial++; \ |
291 | if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
292 | } HB_STMT_END |
293 | |
294 | static void |
295 | find_syllables (hb_buffer_t *buffer) |
296 | { |
297 | unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; |
298 | int cs; |
299 | hb_glyph_info_t *info = buffer->info; |
300 | |
301 | #line 302 "hb-ot-shape-complex-myanmar-machine.hh" |
302 | { |
303 | cs = myanmar_syllable_machine_start; |
304 | ts = 0; |
305 | te = 0; |
306 | act = 0; |
307 | } |
308 | |
309 | #line 115 "hb-ot-shape-complex-myanmar-machine.rl" |
310 | |
311 | |
312 | p = 0; |
313 | pe = eof = buffer->len; |
314 | |
315 | unsigned int last = 0; |
316 | unsigned int syllable_serial = 1; |
317 | |
318 | #line 319 "hb-ot-shape-complex-myanmar-machine.hh" |
319 | { |
320 | int _slen; |
321 | int _trans; |
322 | const unsigned char *_keys; |
323 | const char *_inds; |
324 | if ( p == pe ) |
325 | goto _test_eof; |
326 | _resume: |
327 | switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { |
328 | case 2: |
329 | #line 1 "NONE" |
330 | {ts = p;} |
331 | break; |
332 | #line 333 "hb-ot-shape-complex-myanmar-machine.hh" |
333 | } |
334 | |
335 | _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); |
336 | _inds = _myanmar_syllable_machine_indicies + _myanmar_syllable_machine_index_offsets[cs]; |
337 | |
338 | _slen = _myanmar_syllable_machine_key_spans[cs]; |
339 | _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].myanmar_category()) && |
340 | ( info[p].myanmar_category()) <= _keys[1] ? |
341 | ( info[p].myanmar_category()) - _keys[0] : _slen ]; |
342 | |
343 | _eof_trans: |
344 | cs = _myanmar_syllable_machine_trans_targs[_trans]; |
345 | |
346 | if ( _myanmar_syllable_machine_trans_actions[_trans] == 0 ) |
347 | goto _again; |
348 | |
349 | switch ( _myanmar_syllable_machine_trans_actions[_trans] ) { |
350 | case 7: |
351 | #line 86 "hb-ot-shape-complex-myanmar-machine.rl" |
352 | {te = p+1;{ found_syllable (consonant_syllable); }} |
353 | break; |
354 | case 5: |
355 | #line 87 "hb-ot-shape-complex-myanmar-machine.rl" |
356 | {te = p+1;{ found_syllable (non_myanmar_cluster); }} |
357 | break; |
358 | case 10: |
359 | #line 88 "hb-ot-shape-complex-myanmar-machine.rl" |
360 | {te = p+1;{ found_syllable (punctuation_cluster); }} |
361 | break; |
362 | case 4: |
363 | #line 89 "hb-ot-shape-complex-myanmar-machine.rl" |
364 | {te = p+1;{ found_syllable (broken_cluster); }} |
365 | break; |
366 | case 3: |
367 | #line 90 "hb-ot-shape-complex-myanmar-machine.rl" |
368 | {te = p+1;{ found_syllable (non_myanmar_cluster); }} |
369 | break; |
370 | case 6: |
371 | #line 86 "hb-ot-shape-complex-myanmar-machine.rl" |
372 | {te = p;p--;{ found_syllable (consonant_syllable); }} |
373 | break; |
374 | case 8: |
375 | #line 89 "hb-ot-shape-complex-myanmar-machine.rl" |
376 | {te = p;p--;{ found_syllable (broken_cluster); }} |
377 | break; |
378 | case 9: |
379 | #line 90 "hb-ot-shape-complex-myanmar-machine.rl" |
380 | {te = p;p--;{ found_syllable (non_myanmar_cluster); }} |
381 | break; |
382 | #line 383 "hb-ot-shape-complex-myanmar-machine.hh" |
383 | } |
384 | |
385 | _again: |
386 | switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { |
387 | case 1: |
388 | #line 1 "NONE" |
389 | {ts = 0;} |
390 | break; |
391 | #line 392 "hb-ot-shape-complex-myanmar-machine.hh" |
392 | } |
393 | |
394 | if ( ++p != pe ) |
395 | goto _resume; |
396 | _test_eof: {} |
397 | if ( p == eof ) |
398 | { |
399 | if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { |
400 | _trans = _myanmar_syllable_machine_eof_trans[cs] - 1; |
401 | goto _eof_trans; |
402 | } |
403 | } |
404 | |
405 | } |
406 | |
407 | #line 124 "hb-ot-shape-complex-myanmar-machine.rl" |
408 | |
409 | } |
410 | |
411 | #undef found_syllable |
412 | |
413 | #endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH */ |
414 | |