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