1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 // This file is available under and governed by the GNU General Public 26 // License version 2 only, as published by the Free Software Foundation. 27 // However, the following notice accompanied the original version of this 28 // file: 29 // 30 31 #line 1 "hb-ot-shape-complex-myanmar-machine.rl" 32 /* 33 * Copyright © 2011,2012 Google, Inc. 34 * 35 * This is part of HarfBuzz, a text shaping library. 36 * 37 * Permission is hereby granted, without written agreement and without 38 * license or royalty fees, to use, copy, modify, and distribute this 39 * software and its documentation for any purpose, provided that the 40 * above copyright notice and the following two paragraphs appear in 41 * all copies of this software. 42 * 43 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 44 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 45 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 46 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 47 * DAMAGE. 48 * 49 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 50 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 51 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 52 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 53 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 54 * 55 * Google Author(s): Behdad Esfahbod 56 */ 57 58 #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH 59 #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH 60 61 #include "hb-private.hh" 62 63 64 #line 36 "hb-ot-shape-complex-myanmar-machine.hh" 65 static const unsigned char _myanmar_syllable_machine_trans_keys[] = { 66 1u, 31u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 67 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u, 68 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, 5u, 8u, 69 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 70 3u, 30u, 3u, 29u, 1u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 71 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 8u, 8u, 0 72 }; 73 74 static const char _myanmar_syllable_machine_key_spans[] = { 75 31, 28, 25, 4, 25, 23, 21, 21, 76 27, 27, 27, 27, 16, 27, 27, 27, 77 27, 27, 27, 27, 27, 27, 25, 4, 78 25, 23, 21, 21, 27, 27, 27, 27, 79 28, 27, 30, 27, 27, 27, 27, 27, 80 27, 27, 27, 27, 1 81 }; 82 83 static const short _myanmar_syllable_machine_index_offsets[] = { 84 0, 32, 61, 87, 92, 118, 142, 164, 85 186, 214, 242, 270, 298, 315, 343, 371, 86 399, 427, 455, 483, 511, 539, 567, 593, 87 598, 624, 648, 670, 692, 720, 748, 776, 88 804, 833, 861, 892, 920, 948, 976, 1004, 89 1032, 1060, 1088, 1116, 1144 90 }; 91 92 static const char _myanmar_syllable_machine_indicies[] = { 93 1, 1, 2, 3, 4, 4, 0, 5, 94 0, 6, 1, 0, 0, 0, 0, 7, 95 0, 8, 1, 0, 9, 10, 11, 12, 96 13, 14, 15, 16, 17, 18, 19, 0, 97 21, 22, 23, 23, 20, 24, 20, 25, 98 20, 20, 20, 20, 20, 20, 20, 26, 99 20, 20, 27, 28, 29, 30, 31, 32, 100 33, 34, 35, 36, 20, 23, 23, 20, 101 24, 20, 20, 20, 20, 20, 20, 20, 102 20, 20, 37, 20, 20, 20, 20, 20, 103 20, 31, 20, 20, 20, 35, 20, 23, 104 23, 20, 24, 20, 23, 23, 20, 24, 105 20, 20, 20, 20, 20, 20, 20, 20, 106 20, 20, 20, 20, 20, 20, 20, 20, 107 31, 20, 20, 20, 35, 20, 38, 20, 108 23, 23, 20, 24, 20, 31, 20, 20, 109 20, 20, 20, 20, 20, 39, 20, 20, 110 20, 20, 20, 20, 31, 20, 23, 23, 111 20, 24, 20, 20, 20, 20, 20, 20, 112 20, 20, 20, 39, 20, 20, 20, 20, 113 20, 20, 31, 20, 23, 23, 20, 24, 114 20, 20, 20, 20, 20, 20, 20, 20, 115 20, 20, 20, 20, 20, 20, 20, 20, 116 31, 20, 21, 20, 23, 23, 20, 24, 117 20, 25, 20, 20, 20, 20, 20, 20, 118 20, 40, 20, 20, 40, 20, 20, 20, 119 31, 41, 20, 20, 35, 20, 21, 20, 120 23, 23, 20, 24, 20, 25, 20, 20, 121 20, 20, 20, 20, 20, 20, 20, 20, 122 20, 20, 20, 20, 31, 20, 20, 20, 123 35, 20, 21, 20, 23, 23, 20, 24, 124 20, 25, 20, 20, 20, 20, 20, 20, 125 20, 40, 20, 20, 20, 20, 20, 20, 126 31, 41, 20, 20, 35, 20, 21, 20, 127 23, 23, 20, 24, 20, 25, 20, 20, 128 20, 20, 20, 20, 20, 20, 20, 20, 129 20, 20, 20, 20, 31, 41, 20, 20, 130 35, 20, 1, 1, 20, 20, 20, 20, 131 20, 20, 20, 20, 20, 20, 20, 20, 132 20, 1, 20, 21, 20, 23, 23, 20, 133 24, 20, 25, 20, 20, 20, 20, 20, 134 20, 20, 26, 20, 20, 27, 28, 29, 135 30, 31, 32, 33, 34, 35, 20, 21, 136 20, 23, 23, 20, 24, 20, 25, 20, 137 20, 20, 20, 20, 20, 20, 34, 20, 138 20, 20, 20, 20, 20, 31, 32, 33, 139 34, 35, 20, 21, 20, 23, 23, 20, 140 24, 20, 25, 20, 20, 20, 20, 20, 141 20, 20, 20, 20, 20, 20, 20, 20, 142 20, 31, 32, 33, 34, 35, 20, 21, 143 20, 23, 23, 20, 24, 20, 25, 20, 144 20, 20, 20, 20, 20, 20, 20, 20, 145 20, 20, 20, 20, 20, 31, 32, 33, 146 20, 35, 20, 21, 20, 23, 23, 20, 147 24, 20, 25, 20, 20, 20, 20, 20, 148 20, 20, 20, 20, 20, 20, 20, 20, 149 20, 31, 20, 33, 20, 35, 20, 21, 150 20, 23, 23, 20, 24, 20, 25, 20, 151 20, 20, 20, 20, 20, 20, 34, 20, 152 20, 27, 20, 29, 20, 31, 32, 33, 153 34, 35, 20, 21, 20, 23, 23, 20, 154 24, 20, 25, 20, 20, 20, 20, 20, 155 20, 20, 34, 20, 20, 27, 20, 20, 156 20, 31, 32, 33, 34, 35, 20, 21, 157 20, 23, 23, 20, 24, 20, 25, 20, 158 20, 20, 20, 20, 20, 20, 34, 20, 159 20, 27, 28, 29, 20, 31, 32, 33, 160 34, 35, 20, 21, 22, 23, 23, 20, 161 24, 20, 25, 20, 20, 20, 20, 20, 162 20, 20, 26, 20, 20, 27, 28, 29, 163 30, 31, 32, 33, 34, 35, 20, 3, 164 3, 42, 5, 42, 42, 42, 42, 42, 165 42, 42, 42, 42, 43, 42, 42, 42, 166 42, 42, 42, 13, 42, 42, 42, 17, 167 42, 3, 3, 42, 5, 42, 3, 3, 168 42, 5, 42, 42, 42, 42, 42, 42, 169 42, 42, 42, 42, 42, 42, 42, 42, 170 42, 42, 13, 42, 42, 42, 17, 42, 171 44, 42, 3, 3, 42, 5, 42, 13, 172 42, 42, 42, 42, 42, 42, 42, 45, 173 42, 42, 42, 42, 42, 42, 13, 42, 174 3, 3, 42, 5, 42, 42, 42, 42, 175 42, 42, 42, 42, 42, 45, 42, 42, 176 42, 42, 42, 42, 13, 42, 3, 3, 177 42, 5, 42, 42, 42, 42, 42, 42, 178 42, 42, 42, 42, 42, 42, 42, 42, 179 42, 42, 13, 42, 2, 42, 3, 3, 180 42, 5, 42, 6, 42, 42, 42, 42, 181 42, 42, 42, 46, 42, 42, 46, 42, 182 42, 42, 13, 47, 42, 42, 17, 42, 183 2, 42, 3, 3, 42, 5, 42, 6, 184 42, 42, 42, 42, 42, 42, 42, 42, 185 42, 42, 42, 42, 42, 42, 13, 42, 186 42, 42, 17, 42, 2, 42, 3, 3, 187 42, 5, 42, 6, 42, 42, 42, 42, 188 42, 42, 42, 46, 42, 42, 42, 42, 189 42, 42, 13, 47, 42, 42, 17, 42, 190 2, 42, 3, 3, 42, 5, 42, 6, 191 42, 42, 42, 42, 42, 42, 42, 42, 192 42, 42, 42, 42, 42, 42, 13, 47, 193 42, 42, 17, 42, 21, 22, 23, 23, 194 20, 24, 20, 25, 20, 20, 20, 20, 195 20, 20, 20, 48, 20, 20, 27, 28, 196 29, 30, 31, 32, 33, 34, 35, 36, 197 20, 21, 49, 23, 23, 20, 24, 20, 198 25, 20, 20, 20, 20, 20, 20, 20, 199 26, 20, 20, 27, 28, 29, 30, 31, 200 32, 33, 34, 35, 20, 1, 1, 2, 201 3, 3, 3, 42, 5, 42, 6, 1, 202 42, 42, 42, 42, 1, 42, 8, 1, 203 42, 9, 10, 11, 12, 13, 14, 15, 204 16, 17, 18, 42, 2, 42, 3, 3, 205 42, 5, 42, 6, 42, 42, 42, 42, 206 42, 42, 42, 8, 42, 42, 9, 10, 207 11, 12, 13, 14, 15, 16, 17, 42, 208 2, 42, 3, 3, 42, 5, 42, 6, 209 42, 42, 42, 42, 42, 42, 42, 16, 210 42, 42, 42, 42, 42, 42, 13, 14, 211 15, 16, 17, 42, 2, 42, 3, 3, 212 42, 5, 42, 6, 42, 42, 42, 42, 213 42, 42, 42, 42, 42, 42, 42, 42, 214 42, 42, 13, 14, 15, 16, 17, 42, 215 2, 42, 3, 3, 42, 5, 42, 6, 216 42, 42, 42, 42, 42, 42, 42, 42, 217 42, 42, 42, 42, 42, 42, 13, 14, 218 15, 42, 17, 42, 2, 42, 3, 3, 219 42, 5, 42, 6, 42, 42, 42, 42, 220 42, 42, 42, 42, 42, 42, 42, 42, 221 42, 42, 13, 42, 15, 42, 17, 42, 222 2, 42, 3, 3, 42, 5, 42, 6, 223 42, 42, 42, 42, 42, 42, 42, 16, 224 42, 42, 9, 42, 11, 42, 13, 14, 225 15, 16, 17, 42, 2, 42, 3, 3, 226 42, 5, 42, 6, 42, 42, 42, 42, 227 42, 42, 42, 16, 42, 42, 9, 42, 228 42, 42, 13, 14, 15, 16, 17, 42, 229 2, 42, 3, 3, 42, 5, 42, 6, 230 42, 42, 42, 42, 42, 42, 42, 16, 231 42, 42, 9, 10, 11, 42, 13, 14, 232 15, 16, 17, 42, 2, 3, 3, 3, 233 42, 5, 42, 6, 42, 42, 42, 42, 234 42, 42, 42, 8, 42, 42, 9, 10, 235 11, 12, 13, 14, 15, 16, 17, 42, 236 51, 50, 0 237 }; 238 239 static const char _myanmar_syllable_machine_trans_targs[] = { 240 0, 1, 22, 0, 0, 23, 29, 32, 241 35, 36, 40, 41, 42, 25, 38, 39, 242 37, 28, 43, 44, 0, 2, 12, 0, 243 3, 9, 13, 14, 18, 19, 20, 5, 244 16, 17, 15, 8, 21, 4, 6, 7, 245 10, 11, 0, 24, 26, 27, 30, 31, 246 33, 34, 0, 0 247 }; 248 249 static const char _myanmar_syllable_machine_trans_actions[] = { 250 3, 0, 0, 4, 5, 0, 0, 0, 251 0, 0, 0, 0, 0, 0, 0, 0, 252 0, 0, 0, 0, 6, 0, 0, 7, 253 0, 0, 0, 0, 0, 0, 0, 0, 254 0, 0, 0, 0, 0, 0, 0, 0, 255 0, 0, 8, 0, 0, 0, 0, 0, 256 0, 0, 9, 10 257 }; 258 259 static const char _myanmar_syllable_machine_to_state_actions[] = { 260 1, 0, 0, 0, 0, 0, 0, 0, 261 0, 0, 0, 0, 0, 0, 0, 0, 262 0, 0, 0, 0, 0, 0, 0, 0, 263 0, 0, 0, 0, 0, 0, 0, 0, 264 0, 0, 0, 0, 0, 0, 0, 0, 265 0, 0, 0, 0, 0 266 }; 267 268 static const char _myanmar_syllable_machine_from_state_actions[] = { 269 2, 0, 0, 0, 0, 0, 0, 0, 270 0, 0, 0, 0, 0, 0, 0, 0, 271 0, 0, 0, 0, 0, 0, 0, 0, 272 0, 0, 0, 0, 0, 0, 0, 0, 273 0, 0, 0, 0, 0, 0, 0, 0, 274 0, 0, 0, 0, 0 275 }; 276 277 static const short _myanmar_syllable_machine_eof_trans[] = { 278 0, 21, 21, 21, 21, 21, 21, 21, 279 21, 21, 21, 21, 21, 21, 21, 21, 280 21, 21, 21, 21, 21, 21, 43, 43, 281 43, 43, 43, 43, 43, 43, 43, 43, 282 21, 21, 43, 43, 43, 43, 43, 43, 283 43, 43, 43, 43, 51 284 }; 285 286 static const int myanmar_syllable_machine_start = 0; 287 static const int myanmar_syllable_machine_first_final = 0; 288 static const int myanmar_syllable_machine_error = -1; 289 290 static const int myanmar_syllable_machine_en_main = 0; 291 292 293 #line 36 "hb-ot-shape-complex-myanmar-machine.rl" 294 295 296 297 #line 93 "hb-ot-shape-complex-myanmar-machine.rl" 298 299 300 #define found_syllable(syllable_type) \ 301 HB_STMT_START { \ 302 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ 303 for (unsigned int i = last; i < p+1; i++) \ 304 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ 305 last = p+1; \ 306 syllable_serial++; \ 307 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ 308 } HB_STMT_END 309 310 static void 311 find_syllables (hb_buffer_t *buffer) 312 { 313 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; 314 int cs; 315 hb_glyph_info_t *info = buffer->info; 316 317 #line 289 "hb-ot-shape-complex-myanmar-machine.hh" 318 { 319 cs = myanmar_syllable_machine_start; 320 ts = 0; 321 te = 0; 322 act = 0; 323 } 324 325 #line 114 "hb-ot-shape-complex-myanmar-machine.rl" 326 327 328 p = 0; 329 pe = eof = buffer->len; 330 331 unsigned int last = 0; 332 unsigned int syllable_serial = 1; 333 334 #line 306 "hb-ot-shape-complex-myanmar-machine.hh" 335 { 336 int _slen; 337 int _trans; 338 const unsigned char *_keys; 339 const char *_inds; 340 if ( p == pe ) 341 goto _test_eof; 342 _resume: 343 switch ( _myanmar_syllable_machine_from_state_actions[cs] ) { 344 case 2: 345 #line 1 "NONE" 346 {ts = p;} 347 break; 348 #line 320 "hb-ot-shape-complex-myanmar-machine.hh" 349 } 350 351 _keys = _myanmar_syllable_machine_trans_keys + (cs<<1); 352 _inds = _myanmar_syllable_machine_indicies + _myanmar_syllable_machine_index_offsets[cs]; 353 354 _slen = _myanmar_syllable_machine_key_spans[cs]; 355 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].myanmar_category()) && 356 ( info[p].myanmar_category()) <= _keys[1] ? 357 ( info[p].myanmar_category()) - _keys[0] : _slen ]; 358 359 _eof_trans: 360 cs = _myanmar_syllable_machine_trans_targs[_trans]; 361 362 if ( _myanmar_syllable_machine_trans_actions[_trans] == 0 ) 363 goto _again; 364 365 switch ( _myanmar_syllable_machine_trans_actions[_trans] ) { 366 case 7: 367 #line 85 "hb-ot-shape-complex-myanmar-machine.rl" 368 {te = p+1;{ found_syllable (consonant_syllable); }} 369 break; 370 case 5: 371 #line 86 "hb-ot-shape-complex-myanmar-machine.rl" 372 {te = p+1;{ found_syllable (non_myanmar_cluster); }} 373 break; 374 case 10: 375 #line 87 "hb-ot-shape-complex-myanmar-machine.rl" 376 {te = p+1;{ found_syllable (punctuation_cluster); }} 377 break; 378 case 4: 379 #line 88 "hb-ot-shape-complex-myanmar-machine.rl" 380 {te = p+1;{ found_syllable (broken_cluster); }} 381 break; 382 case 3: 383 #line 89 "hb-ot-shape-complex-myanmar-machine.rl" 384 {te = p+1;{ found_syllable (non_myanmar_cluster); }} 385 break; 386 case 6: 387 #line 85 "hb-ot-shape-complex-myanmar-machine.rl" 388 {te = p;p--;{ found_syllable (consonant_syllable); }} 389 break; 390 case 8: 391 #line 88 "hb-ot-shape-complex-myanmar-machine.rl" 392 {te = p;p--;{ found_syllable (broken_cluster); }} 393 break; 394 case 9: 395 #line 89 "hb-ot-shape-complex-myanmar-machine.rl" 396 {te = p;p--;{ found_syllable (non_myanmar_cluster); }} 397 break; 398 #line 370 "hb-ot-shape-complex-myanmar-machine.hh" 399 } 400 401 _again: 402 switch ( _myanmar_syllable_machine_to_state_actions[cs] ) { 403 case 1: 404 #line 1 "NONE" 405 {ts = 0;} 406 break; 407 #line 379 "hb-ot-shape-complex-myanmar-machine.hh" 408 } 409 410 if ( ++p != pe ) 411 goto _resume; 412 _test_eof: {} 413 if ( p == eof ) 414 { 415 if ( _myanmar_syllable_machine_eof_trans[cs] > 0 ) { 416 _trans = _myanmar_syllable_machine_eof_trans[cs] - 1; 417 goto _eof_trans; 418 } 419 } 420 421 } 422 423 #line 123 "hb-ot-shape-complex-myanmar-machine.rl" 424 425 } 426 427 #undef found_syllable 428 429 #endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH */