OLD | NEW |
1 | 1 |
2 #line 1 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 2 #line 1 "hb-ot-shape-complex-myanmar-machine.rl" |
3 /* | 3 /* |
4 * Copyright © 2011,2012 Google, Inc. | 4 * Copyright © 2011,2012 Google, Inc. |
5 * | 5 * |
6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
7 * | 7 * |
8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
11 * above copyright notice and the following two paragraphs appear in | 11 * above copyright notice and the following two paragraphs appear in |
12 * all copies of this software. | 12 * all copies of this software. |
(...skipping 12 matching lines...) Expand all Loading... |
25 * | 25 * |
26 * Google Author(s): Behdad Esfahbod | 26 * Google Author(s): Behdad Esfahbod |
27 */ | 27 */ |
28 | 28 |
29 #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH | 29 #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH |
30 #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH | 30 #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH |
31 | 31 |
32 #include "hb-private.hh" | 32 #include "hb-private.hh" |
33 | 33 |
34 | 34 |
35 #line 36 "../../src/hb-ot-shape-complex-myanmar-machine.hh" | 35 #line 36 "hb-ot-shape-complex-myanmar-machine.hh" |
36 static const unsigned char _myanmar_syllable_machine_trans_keys[] = { | 36 static 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, | 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, | 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, | 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, | 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, | 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 | 42 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 8u, 8u, 0 |
43 }; | 43 }; |
44 | 44 |
45 static const char _myanmar_syllable_machine_key_spans[] = { | 45 static const char _myanmar_syllable_machine_key_spans[] = { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 43, 43, 43, 43, 51 | 254 43, 43, 43, 43, 51 |
255 }; | 255 }; |
256 | 256 |
257 static const int myanmar_syllable_machine_start = 0; | 257 static const int myanmar_syllable_machine_start = 0; |
258 static const int myanmar_syllable_machine_first_final = 0; | 258 static const int myanmar_syllable_machine_first_final = 0; |
259 static const int myanmar_syllable_machine_error = -1; | 259 static const int myanmar_syllable_machine_error = -1; |
260 | 260 |
261 static const int myanmar_syllable_machine_en_main = 0; | 261 static const int myanmar_syllable_machine_en_main = 0; |
262 | 262 |
263 | 263 |
264 #line 36 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 264 #line 36 "hb-ot-shape-complex-myanmar-machine.rl" |
265 | 265 |
266 | 266 |
267 | 267 |
268 #line 93 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 268 #line 93 "hb-ot-shape-complex-myanmar-machine.rl" |
269 | 269 |
270 | 270 |
271 #define found_syllable(syllable_type) \ | 271 #define found_syllable(syllable_type) \ |
272 HB_STMT_START { \ | 272 HB_STMT_START { \ |
273 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type);
\ | 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++) \ | 274 for (unsigned int i = last; i < p+1; i++) \ |
275 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ | 275 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
276 last = p+1; \ | 276 last = p+1; \ |
277 syllable_serial++; \ | 277 syllable_serial++; \ |
278 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ | 278 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
279 } HB_STMT_END | 279 } HB_STMT_END |
280 | 280 |
281 static void | 281 static void |
282 find_syllables (hb_buffer_t *buffer) | 282 find_syllables (hb_buffer_t *buffer) |
283 { | 283 { |
284 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; | 284 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; |
285 int cs; | 285 int cs; |
286 hb_glyph_info_t *info = buffer->info; | 286 hb_glyph_info_t *info = buffer->info; |
287 | 287 |
288 #line 289 "../../src/hb-ot-shape-complex-myanmar-machine.hh" | 288 #line 289 "hb-ot-shape-complex-myanmar-machine.hh" |
289 { | 289 { |
290 cs = myanmar_syllable_machine_start; | 290 cs = myanmar_syllable_machine_start; |
291 ts = 0; | 291 ts = 0; |
292 te = 0; | 292 te = 0; |
293 act = 0; | 293 act = 0; |
294 } | 294 } |
295 | 295 |
296 #line 114 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 296 #line 114 "hb-ot-shape-complex-myanmar-machine.rl" |
297 | 297 |
298 | 298 |
299 p = 0; | 299 p = 0; |
300 pe = eof = buffer->len; | 300 pe = eof = buffer->len; |
301 | 301 |
302 unsigned int last = 0; | 302 unsigned int last = 0; |
303 unsigned int syllable_serial = 1; | 303 unsigned int syllable_serial = 1; |
304 | 304 |
305 #line 306 "../../src/hb-ot-shape-complex-myanmar-machine.hh" | 305 #line 306 "hb-ot-shape-complex-myanmar-machine.hh" |
306 { | 306 { |
307 int _slen; | 307 int _slen; |
308 int _trans; | 308 int _trans; |
309 const unsigned char *_keys; | 309 const unsigned char *_keys; |
310 const char *_inds; | 310 const char *_inds; |
311 if ( p == pe ) | 311 if ( p == pe ) |
312 goto _test_eof; | 312 goto _test_eof; |
313 _resume: | 313 _resume: |
314 switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { | 314 switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { |
315 case 2: | 315 case 2: |
316 #line 1 "NONE" | 316 #line 1 "NONE" |
317 {ts = p;} | 317 {ts = p;} |
318 break; | 318 break; |
319 #line 320 "../../src/hb-ot-shape-complex-myanmar-machine.hh" | 319 #line 320 "hb-ot-shape-complex-myanmar-machine.hh" |
320 } | 320 } |
321 | 321 |
322 _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); | 322 _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); |
323 _inds = _myanmar_syllable_machine_indicies + _myanmar_syllable_machine_i
ndex_offsets[cs]; | 323 _inds = _myanmar_syllable_machine_indicies + _myanmar_syllable_machine_i
ndex_offsets[cs]; |
324 | 324 |
325 _slen = _myanmar_syllable_machine_key_spans[cs]; | 325 _slen = _myanmar_syllable_machine_key_spans[cs]; |
326 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].myanmar_category()) && | 326 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].myanmar_category()) && |
327 ( info[p].myanmar_category()) <= _keys[1] ? | 327 ( info[p].myanmar_category()) <= _keys[1] ? |
328 ( info[p].myanmar_category()) - _keys[0] : _slen ]; | 328 ( info[p].myanmar_category()) - _keys[0] : _slen ]; |
329 | 329 |
330 _eof_trans: | 330 _eof_trans: |
331 cs = _myanmar_syllable_machine_trans_targs[_trans]; | 331 cs = _myanmar_syllable_machine_trans_targs[_trans]; |
332 | 332 |
333 if ( _myanmar_syllable_machine_trans_actions[_trans] == 0 ) | 333 if ( _myanmar_syllable_machine_trans_actions[_trans] == 0 ) |
334 goto _again; | 334 goto _again; |
335 | 335 |
336 switch ( _myanmar_syllable_machine_trans_actions[_trans] ) { | 336 switch ( _myanmar_syllable_machine_trans_actions[_trans] ) { |
337 case 7: | 337 case 7: |
338 #line 85 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 338 #line 85 "hb-ot-shape-complex-myanmar-machine.rl" |
339 {te = p+1;{ found_syllable (consonant_syllable); }} | 339 {te = p+1;{ found_syllable (consonant_syllable); }} |
340 break; | 340 break; |
341 case 5: | 341 case 5: |
342 #line 86 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 342 #line 86 "hb-ot-shape-complex-myanmar-machine.rl" |
343 {te = p+1;{ found_syllable (non_myanmar_cluster); }} | 343 {te = p+1;{ found_syllable (non_myanmar_cluster); }} |
344 break; | 344 break; |
345 case 10: | 345 case 10: |
346 #line 87 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 346 #line 87 "hb-ot-shape-complex-myanmar-machine.rl" |
347 {te = p+1;{ found_syllable (punctuation_cluster); }} | 347 {te = p+1;{ found_syllable (punctuation_cluster); }} |
348 break; | 348 break; |
349 case 4: | 349 case 4: |
350 #line 88 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 350 #line 88 "hb-ot-shape-complex-myanmar-machine.rl" |
351 {te = p+1;{ found_syllable (broken_cluster); }} | 351 {te = p+1;{ found_syllable (broken_cluster); }} |
352 break; | 352 break; |
353 case 3: | 353 case 3: |
354 #line 89 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 354 #line 89 "hb-ot-shape-complex-myanmar-machine.rl" |
355 {te = p+1;{ found_syllable (non_myanmar_cluster); }} | 355 {te = p+1;{ found_syllable (non_myanmar_cluster); }} |
356 break; | 356 break; |
357 case 6: | 357 case 6: |
358 #line 85 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 358 #line 85 "hb-ot-shape-complex-myanmar-machine.rl" |
359 {te = p;p--;{ found_syllable (consonant_syllable); }} | 359 {te = p;p--;{ found_syllable (consonant_syllable); }} |
360 break; | 360 break; |
361 case 8: | 361 case 8: |
362 #line 88 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 362 #line 88 "hb-ot-shape-complex-myanmar-machine.rl" |
363 {te = p;p--;{ found_syllable (broken_cluster); }} | 363 {te = p;p--;{ found_syllable (broken_cluster); }} |
364 break; | 364 break; |
365 case 9: | 365 case 9: |
366 #line 89 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 366 #line 89 "hb-ot-shape-complex-myanmar-machine.rl" |
367 {te = p;p--;{ found_syllable (non_myanmar_cluster); }} | 367 {te = p;p--;{ found_syllable (non_myanmar_cluster); }} |
368 break; | 368 break; |
369 #line 370 "../../src/hb-ot-shape-complex-myanmar-machine.hh" | 369 #line 370 "hb-ot-shape-complex-myanmar-machine.hh" |
370 } | 370 } |
371 | 371 |
372 _again: | 372 _again: |
373 switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { | 373 switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { |
374 case 1: | 374 case 1: |
375 #line 1 "NONE" | 375 #line 1 "NONE" |
376 {ts = 0;} | 376 {ts = 0;} |
377 break; | 377 break; |
378 #line 379 "../../src/hb-ot-shape-complex-myanmar-machine.hh" | 378 #line 379 "hb-ot-shape-complex-myanmar-machine.hh" |
379 } | 379 } |
380 | 380 |
381 if ( ++p != pe ) | 381 if ( ++p != pe ) |
382 goto _resume; | 382 goto _resume; |
383 _test_eof: {} | 383 _test_eof: {} |
384 if ( p == eof ) | 384 if ( p == eof ) |
385 { | 385 { |
386 if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { | 386 if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { |
387 _trans = _myanmar_syllable_machine_eof_trans[cs] - 1; | 387 _trans = _myanmar_syllable_machine_eof_trans[cs] - 1; |
388 goto _eof_trans; | 388 goto _eof_trans; |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 } | 392 } |
393 | 393 |
394 #line 123 "../../src/hb-ot-shape-complex-myanmar-machine.rl" | 394 #line 123 "hb-ot-shape-complex-myanmar-machine.rl" |
395 | 395 |
396 } | 396 } |
397 | 397 |
398 #undef found_syllable | 398 #undef found_syllable |
399 | 399 |
400 #endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH */ | 400 #endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH */ |
OLD | NEW |