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