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