OLD | NEW |
1 | 1 |
2 #line 1 "../../src/hb-ot-shape-complex-indic-machine.rl" | 2 #line 1 "hb-ot-shape-complex-indic-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_INDIC_MACHINE_HH | 29 #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH |
30 #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH | 30 #define HB_OT_SHAPE_COMPLEX_INDIC_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-indic-machine.hh.tmp" | 35 #line 36 "hb-ot-shape-complex-indic-machine.hh.tmp" |
36 static const unsigned char _indic_syllable_machine_trans_keys[] = { | 36 static const unsigned char _indic_syllable_machine_trans_keys[] = { |
37 1u, 16u, 13u, 13u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, | 37 1u, 16u, 13u, 13u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, |
38 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 4u, 4u, 6u, 6u, | 38 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 4u, 4u, 6u, 6u, |
39 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, 4u, 7u, | 39 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, 4u, 7u, |
40 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, | 40 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, |
41 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 1u, 16u, 13u, 13u, 5u, 7u, 5u, 7u, | 41 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 1u, 16u, 13u, 13u, 5u, 7u, 5u, 7u, |
42 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, | 42 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, 5u, 7u, 7u, 7u, 5u, 7u, |
43 5u, 7u, 7u, 7u, 4u, 4u, 6u, 6u, 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, | 43 5u, 7u, 7u, 7u, 4u, 4u, 6u, 6u, 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, |
44 4u, 7u, 6u, 6u, 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, | 44 4u, 7u, 6u, 6u, 16u, 16u, 4u, 7u, 6u, 6u, 16u, 16u, 4u, 14u, 4u, 14u, |
45 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, | 45 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, 4u, 14u, |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 194, 194, 343 | 1238 194, 194, 343 |
1239 }; | 1239 }; |
1240 | 1240 |
1241 static const int indic_syllable_machine_start = 170; | 1241 static const int indic_syllable_machine_start = 170; |
1242 static const int indic_syllable_machine_first_final = 170; | 1242 static const int indic_syllable_machine_first_final = 170; |
1243 static const int indic_syllable_machine_error = -1; | 1243 static const int indic_syllable_machine_error = -1; |
1244 | 1244 |
1245 static const int indic_syllable_machine_en_main = 170; | 1245 static const int indic_syllable_machine_en_main = 170; |
1246 | 1246 |
1247 | 1247 |
1248 #line 36 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1248 #line 36 "hb-ot-shape-complex-indic-machine.rl" |
1249 | 1249 |
1250 | 1250 |
1251 | 1251 |
1252 #line 91 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1252 #line 91 "hb-ot-shape-complex-indic-machine.rl" |
1253 | 1253 |
1254 | 1254 |
1255 #define found_syllable(syllable_type) \ | 1255 #define found_syllable(syllable_type) \ |
1256 HB_STMT_START { \ | 1256 HB_STMT_START { \ |
1257 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type);
\ | 1257 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type);
\ |
1258 for (unsigned int i = last; i < p+1; i++) \ | 1258 for (unsigned int i = last; i < p+1; i++) \ |
1259 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ | 1259 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
1260 last = p+1; \ | 1260 last = p+1; \ |
1261 syllable_serial++; \ | 1261 syllable_serial++; \ |
1262 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ | 1262 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
1263 } HB_STMT_END | 1263 } HB_STMT_END |
1264 | 1264 |
1265 static void | 1265 static void |
1266 find_syllables (hb_buffer_t *buffer) | 1266 find_syllables (hb_buffer_t *buffer) |
1267 { | 1267 { |
1268 unsigned int p, pe, eof, ts HB_UNUSED, te, act; | 1268 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; |
1269 int cs; | 1269 int cs; |
1270 hb_glyph_info_t *info = buffer->info; | 1270 hb_glyph_info_t *info = buffer->info; |
1271 | 1271 |
1272 #line 1273 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" | 1272 #line 1273 "hb-ot-shape-complex-indic-machine.hh.tmp" |
1273 { | 1273 { |
1274 cs = indic_syllable_machine_start; | 1274 cs = indic_syllable_machine_start; |
1275 ts = 0; | 1275 ts = 0; |
1276 te = 0; | 1276 te = 0; |
1277 act = 0; | 1277 act = 0; |
1278 } | 1278 } |
1279 | 1279 |
1280 #line 112 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1280 #line 112 "hb-ot-shape-complex-indic-machine.rl" |
1281 | 1281 |
1282 | 1282 |
1283 p = 0; | 1283 p = 0; |
1284 pe = eof = buffer->len; | 1284 pe = eof = buffer->len; |
1285 | 1285 |
1286 unsigned int last = 0; | 1286 unsigned int last = 0; |
1287 unsigned int syllable_serial = 1; | 1287 unsigned int syllable_serial = 1; |
1288 | 1288 |
1289 #line 1290 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" | 1289 #line 1290 "hb-ot-shape-complex-indic-machine.hh.tmp" |
1290 { | 1290 { |
1291 int _slen; | 1291 int _slen; |
1292 int _trans; | 1292 int _trans; |
1293 const unsigned char *_keys; | 1293 const unsigned char *_keys; |
1294 const short *_inds; | 1294 const short *_inds; |
1295 if ( p == pe ) | 1295 if ( p == pe ) |
1296 goto _test_eof; | 1296 goto _test_eof; |
1297 _resume: | 1297 _resume: |
1298 switch ( _indic_syllable_machine_from_state_actions[cs] ) { | 1298 switch ( _indic_syllable_machine_from_state_actions[cs] ) { |
1299 case 10: | 1299 case 10: |
1300 #line 1 "NONE" | 1300 #line 1 "NONE" |
1301 {ts = p;} | 1301 {ts = p;} |
1302 break; | 1302 break; |
1303 #line 1304 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" | 1303 #line 1304 "hb-ot-shape-complex-indic-machine.hh.tmp" |
1304 } | 1304 } |
1305 | 1305 |
1306 _keys = _indic_syllable_machine_trans_keys + (cs<<1); | 1306 _keys = _indic_syllable_machine_trans_keys + (cs<<1); |
1307 _inds = _indic_syllable_machine_indicies + _indic_syllable_machine_index
_offsets[cs]; | 1307 _inds = _indic_syllable_machine_indicies + _indic_syllable_machine_index
_offsets[cs]; |
1308 | 1308 |
1309 _slen = _indic_syllable_machine_key_spans[cs]; | 1309 _slen = _indic_syllable_machine_key_spans[cs]; |
1310 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].indic_category()) && | 1310 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].indic_category()) && |
1311 ( info[p].indic_category()) <= _keys[1] ? | 1311 ( info[p].indic_category()) <= _keys[1] ? |
1312 ( info[p].indic_category()) - _keys[0] : _slen ]; | 1312 ( info[p].indic_category()) - _keys[0] : _slen ]; |
1313 | 1313 |
1314 _eof_trans: | 1314 _eof_trans: |
1315 cs = _indic_syllable_machine_trans_targs[_trans]; | 1315 cs = _indic_syllable_machine_trans_targs[_trans]; |
1316 | 1316 |
1317 if ( _indic_syllable_machine_trans_actions[_trans] == 0 ) | 1317 if ( _indic_syllable_machine_trans_actions[_trans] == 0 ) |
1318 goto _again; | 1318 goto _again; |
1319 | 1319 |
1320 switch ( _indic_syllable_machine_trans_actions[_trans] ) { | 1320 switch ( _indic_syllable_machine_trans_actions[_trans] ) { |
1321 case 2: | 1321 case 2: |
1322 #line 1 "NONE" | 1322 #line 1 "NONE" |
1323 {te = p+1;} | 1323 {te = p+1;} |
1324 break; | 1324 break; |
1325 case 14: | 1325 case 14: |
1326 #line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1326 #line 83 "hb-ot-shape-complex-indic-machine.rl" |
1327 {te = p+1;{ found_syllable (consonant_syllable); }} | 1327 {te = p+1;{ found_syllable (consonant_syllable); }} |
1328 break; | 1328 break; |
1329 case 16: | 1329 case 16: |
1330 #line 84 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1330 #line 84 "hb-ot-shape-complex-indic-machine.rl" |
1331 {te = p+1;{ found_syllable (vowel_syllable); }} | 1331 {te = p+1;{ found_syllable (vowel_syllable); }} |
1332 break; | 1332 break; |
1333 case 21: | 1333 case 21: |
1334 #line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1334 #line 85 "hb-ot-shape-complex-indic-machine.rl" |
1335 {te = p+1;{ found_syllable (standalone_cluster); }} | 1335 {te = p+1;{ found_syllable (standalone_cluster); }} |
1336 break; | 1336 break; |
1337 case 18: | 1337 case 18: |
1338 #line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1338 #line 86 "hb-ot-shape-complex-indic-machine.rl" |
1339 {te = p+1;{ found_syllable (broken_cluster); }} | 1339 {te = p+1;{ found_syllable (broken_cluster); }} |
1340 break; | 1340 break; |
1341 case 11: | 1341 case 11: |
1342 #line 87 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1342 #line 87 "hb-ot-shape-complex-indic-machine.rl" |
1343 {te = p+1;{ found_syllable (non_indic_cluster); }} | 1343 {te = p+1;{ found_syllable (non_indic_cluster); }} |
1344 break; | 1344 break; |
1345 case 13: | 1345 case 13: |
1346 #line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1346 #line 83 "hb-ot-shape-complex-indic-machine.rl" |
1347 {te = p;p--;{ found_syllable (consonant_syllable); }} | 1347 {te = p;p--;{ found_syllable (consonant_syllable); }} |
1348 break; | 1348 break; |
1349 case 15: | 1349 case 15: |
1350 #line 84 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1350 #line 84 "hb-ot-shape-complex-indic-machine.rl" |
1351 {te = p;p--;{ found_syllable (vowel_syllable); }} | 1351 {te = p;p--;{ found_syllable (vowel_syllable); }} |
1352 break; | 1352 break; |
1353 case 20: | 1353 case 20: |
1354 #line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1354 #line 85 "hb-ot-shape-complex-indic-machine.rl" |
1355 {te = p;p--;{ found_syllable (standalone_cluster); }} | 1355 {te = p;p--;{ found_syllable (standalone_cluster); }} |
1356 break; | 1356 break; |
1357 case 17: | 1357 case 17: |
1358 #line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1358 #line 86 "hb-ot-shape-complex-indic-machine.rl" |
1359 {te = p;p--;{ found_syllable (broken_cluster); }} | 1359 {te = p;p--;{ found_syllable (broken_cluster); }} |
1360 break; | 1360 break; |
1361 case 19: | 1361 case 19: |
1362 #line 87 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1362 #line 87 "hb-ot-shape-complex-indic-machine.rl" |
1363 {te = p;p--;{ found_syllable (non_indic_cluster); }} | 1363 {te = p;p--;{ found_syllable (non_indic_cluster); }} |
1364 break; | 1364 break; |
1365 case 1: | 1365 case 1: |
1366 #line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1366 #line 83 "hb-ot-shape-complex-indic-machine.rl" |
1367 {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} | 1367 {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} |
1368 break; | 1368 break; |
1369 case 3: | 1369 case 3: |
1370 #line 84 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1370 #line 84 "hb-ot-shape-complex-indic-machine.rl" |
1371 {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} | 1371 {{p = ((te))-1;}{ found_syllable (vowel_syllable); }} |
1372 break; | 1372 break; |
1373 case 7: | 1373 case 7: |
1374 #line 85 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1374 #line 85 "hb-ot-shape-complex-indic-machine.rl" |
1375 {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} | 1375 {{p = ((te))-1;}{ found_syllable (standalone_cluster); }} |
1376 break; | 1376 break; |
1377 case 4: | 1377 case 4: |
1378 #line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1378 #line 86 "hb-ot-shape-complex-indic-machine.rl" |
1379 {{p = ((te))-1;}{ found_syllable (broken_cluster); }} | 1379 {{p = ((te))-1;}{ found_syllable (broken_cluster); }} |
1380 break; | 1380 break; |
1381 case 5: | 1381 case 5: |
1382 #line 1 "NONE" | 1382 #line 1 "NONE" |
1383 { switch( act ) { | 1383 { switch( act ) { |
1384 case 1: | 1384 case 1: |
1385 {{p = ((te))-1;} found_syllable (consonant_syllable); } | 1385 {{p = ((te))-1;} found_syllable (consonant_syllable); } |
1386 break; | 1386 break; |
1387 case 4: | 1387 case 4: |
1388 {{p = ((te))-1;} found_syllable (broken_cluster); } | 1388 {{p = ((te))-1;} found_syllable (broken_cluster); } |
1389 break; | 1389 break; |
1390 case 5: | 1390 case 5: |
1391 {{p = ((te))-1;} found_syllable (non_indic_cluster); } | 1391 {{p = ((te))-1;} found_syllable (non_indic_cluster); } |
1392 break; | 1392 break; |
1393 } | 1393 } |
1394 } | 1394 } |
1395 break; | 1395 break; |
1396 case 8: | 1396 case 8: |
1397 #line 1 "NONE" | 1397 #line 1 "NONE" |
1398 {te = p+1;} | 1398 {te = p+1;} |
1399 #line 83 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1399 #line 83 "hb-ot-shape-complex-indic-machine.rl" |
1400 {act = 1;} | 1400 {act = 1;} |
1401 break; | 1401 break; |
1402 case 6: | 1402 case 6: |
1403 #line 1 "NONE" | 1403 #line 1 "NONE" |
1404 {te = p+1;} | 1404 {te = p+1;} |
1405 #line 86 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1405 #line 86 "hb-ot-shape-complex-indic-machine.rl" |
1406 {act = 4;} | 1406 {act = 4;} |
1407 break; | 1407 break; |
1408 case 12: | 1408 case 12: |
1409 #line 1 "NONE" | 1409 #line 1 "NONE" |
1410 {te = p+1;} | 1410 {te = p+1;} |
1411 #line 87 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1411 #line 87 "hb-ot-shape-complex-indic-machine.rl" |
1412 {act = 5;} | 1412 {act = 5;} |
1413 break; | 1413 break; |
1414 #line 1415 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" | 1414 #line 1415 "hb-ot-shape-complex-indic-machine.hh.tmp" |
1415 } | 1415 } |
1416 | 1416 |
1417 _again: | 1417 _again: |
1418 switch ( _indic_syllable_machine_to_state_actions[cs] ) { | 1418 switch ( _indic_syllable_machine_to_state_actions[cs] ) { |
1419 case 9: | 1419 case 9: |
1420 #line 1 "NONE" | 1420 #line 1 "NONE" |
1421 {ts = 0;} | 1421 {ts = 0;} |
1422 break; | 1422 break; |
1423 #line 1424 "../../src/hb-ot-shape-complex-indic-machine.hh.tmp" | 1423 #line 1424 "hb-ot-shape-complex-indic-machine.hh.tmp" |
1424 } | 1424 } |
1425 | 1425 |
1426 if ( ++p != pe ) | 1426 if ( ++p != pe ) |
1427 goto _resume; | 1427 goto _resume; |
1428 _test_eof: {} | 1428 _test_eof: {} |
1429 if ( p == eof ) | 1429 if ( p == eof ) |
1430 { | 1430 { |
1431 if ( _indic_syllable_machine_eof_trans[cs] > 0 ) { | 1431 if ( _indic_syllable_machine_eof_trans[cs] > 0 ) { |
1432 _trans = _indic_syllable_machine_eof_trans[cs] - 1; | 1432 _trans = _indic_syllable_machine_eof_trans[cs] - 1; |
1433 goto _eof_trans; | 1433 goto _eof_trans; |
1434 } | 1434 } |
1435 } | 1435 } |
1436 | 1436 |
1437 } | 1437 } |
1438 | 1438 |
1439 #line 121 "../../src/hb-ot-shape-complex-indic-machine.rl" | 1439 #line 121 "hb-ot-shape-complex-indic-machine.rl" |
1440 | 1440 |
1441 } | 1441 } |
1442 | 1442 |
1443 #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */ | 1443 #endif /* HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH */ |
OLD | NEW |