1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/harfbuzz/src/hb-ot-shape-complex-sea-machine.hh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,224 @@ 1.4 + 1.5 +#line 1 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.6 +/* 1.7 + * Copyright © 2011,2012,2013 Google, Inc. 1.8 + * 1.9 + * This is part of HarfBuzz, a text shaping library. 1.10 + * 1.11 + * Permission is hereby granted, without written agreement and without 1.12 + * license or royalty fees, to use, copy, modify, and distribute this 1.13 + * software and its documentation for any purpose, provided that the 1.14 + * above copyright notice and the following two paragraphs appear in 1.15 + * all copies of this software. 1.16 + * 1.17 + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 1.18 + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1.19 + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 1.20 + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 1.21 + * DAMAGE. 1.22 + * 1.23 + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 1.24 + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 1.25 + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 1.26 + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 1.27 + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 1.28 + * 1.29 + * Google Author(s): Behdad Esfahbod 1.30 + */ 1.31 + 1.32 +#ifndef HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH 1.33 +#define HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH 1.34 + 1.35 +#include "hb-private.hh" 1.36 + 1.37 + 1.38 +#line 36 "hb-ot-shape-complex-sea-machine.hh.tmp" 1.39 +static const unsigned char _sea_syllable_machine_trans_keys[] = { 1.40 + 1u, 1u, 1u, 1u, 1u, 29u, 3u, 29u, 3u, 29u, 1u, 1u, 0 1.41 +}; 1.42 + 1.43 +static const char _sea_syllable_machine_key_spans[] = { 1.44 + 1, 1, 29, 27, 27, 1 1.45 +}; 1.46 + 1.47 +static const char _sea_syllable_machine_index_offsets[] = { 1.48 + 0, 2, 4, 34, 62, 90 1.49 +}; 1.50 + 1.51 +static const char _sea_syllable_machine_indicies[] = { 1.52 + 1, 0, 3, 2, 1, 1, 3, 5, 1.53 + 4, 4, 4, 4, 4, 3, 4, 1, 1.54 + 4, 4, 4, 4, 3, 4, 4, 4, 1.55 + 4, 3, 4, 4, 4, 3, 3, 3, 1.56 + 3, 4, 1, 7, 6, 6, 6, 6, 1.57 + 6, 1, 6, 6, 6, 6, 6, 6, 1.58 + 1, 6, 6, 6, 6, 1, 6, 6, 1.59 + 6, 1, 1, 1, 1, 6, 3, 9, 1.60 + 8, 8, 8, 8, 8, 3, 8, 8, 1.61 + 8, 8, 8, 8, 3, 8, 8, 8, 1.62 + 8, 3, 8, 8, 8, 3, 3, 3, 1.63 + 3, 8, 3, 10, 0 1.64 +}; 1.65 + 1.66 +static const char _sea_syllable_machine_trans_targs[] = { 1.67 + 2, 3, 2, 4, 2, 5, 2, 0, 1.68 + 2, 1, 2 1.69 +}; 1.70 + 1.71 +static const char _sea_syllable_machine_trans_actions[] = { 1.72 + 1, 2, 3, 2, 6, 0, 7, 0, 1.73 + 8, 0, 9 1.74 +}; 1.75 + 1.76 +static const char _sea_syllable_machine_to_state_actions[] = { 1.77 + 0, 0, 4, 0, 0, 0 1.78 +}; 1.79 + 1.80 +static const char _sea_syllable_machine_from_state_actions[] = { 1.81 + 0, 0, 5, 0, 0, 0 1.82 +}; 1.83 + 1.84 +static const char _sea_syllable_machine_eof_trans[] = { 1.85 + 1, 3, 0, 7, 9, 11 1.86 +}; 1.87 + 1.88 +static const int sea_syllable_machine_start = 2; 1.89 +static const int sea_syllable_machine_first_final = 2; 1.90 +static const int sea_syllable_machine_error = -1; 1.91 + 1.92 +static const int sea_syllable_machine_en_main = 2; 1.93 + 1.94 + 1.95 +#line 36 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.96 + 1.97 + 1.98 + 1.99 +#line 67 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.100 + 1.101 + 1.102 +#define found_syllable(syllable_type) \ 1.103 + HB_STMT_START { \ 1.104 + if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ 1.105 + for (unsigned int i = last; i < p+1; i++) \ 1.106 + info[i].syllable() = (syllable_serial << 4) | syllable_type; \ 1.107 + last = p+1; \ 1.108 + syllable_serial++; \ 1.109 + if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ 1.110 + } HB_STMT_END 1.111 + 1.112 +static void 1.113 +find_syllables (hb_buffer_t *buffer) 1.114 +{ 1.115 + unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; 1.116 + int cs; 1.117 + hb_glyph_info_t *info = buffer->info; 1.118 + 1.119 +#line 117 "hb-ot-shape-complex-sea-machine.hh.tmp" 1.120 + { 1.121 + cs = sea_syllable_machine_start; 1.122 + ts = 0; 1.123 + te = 0; 1.124 + act = 0; 1.125 + } 1.126 + 1.127 +#line 88 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.128 + 1.129 + 1.130 + p = 0; 1.131 + pe = eof = buffer->len; 1.132 + 1.133 + unsigned int last = 0; 1.134 + unsigned int syllable_serial = 1; 1.135 + 1.136 +#line 134 "hb-ot-shape-complex-sea-machine.hh.tmp" 1.137 + { 1.138 + int _slen; 1.139 + int _trans; 1.140 + const unsigned char *_keys; 1.141 + const char *_inds; 1.142 + if ( p == pe ) 1.143 + goto _test_eof; 1.144 +_resume: 1.145 + switch ( _sea_syllable_machine_from_state_actions[cs] ) { 1.146 + case 5: 1.147 +#line 1 "NONE" 1.148 + {ts = p;} 1.149 + break; 1.150 +#line 148 "hb-ot-shape-complex-sea-machine.hh.tmp" 1.151 + } 1.152 + 1.153 + _keys = _sea_syllable_machine_trans_keys + (cs<<1); 1.154 + _inds = _sea_syllable_machine_indicies + _sea_syllable_machine_index_offsets[cs]; 1.155 + 1.156 + _slen = _sea_syllable_machine_key_spans[cs]; 1.157 + _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].sea_category()) && 1.158 + ( info[p].sea_category()) <= _keys[1] ? 1.159 + ( info[p].sea_category()) - _keys[0] : _slen ]; 1.160 + 1.161 +_eof_trans: 1.162 + cs = _sea_syllable_machine_trans_targs[_trans]; 1.163 + 1.164 + if ( _sea_syllable_machine_trans_actions[_trans] == 0 ) 1.165 + goto _again; 1.166 + 1.167 + switch ( _sea_syllable_machine_trans_actions[_trans] ) { 1.168 + case 2: 1.169 +#line 1 "NONE" 1.170 + {te = p+1;} 1.171 + break; 1.172 + case 6: 1.173 +#line 63 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.174 + {te = p+1;{ found_syllable (non_sea_cluster); }} 1.175 + break; 1.176 + case 7: 1.177 +#line 61 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.178 + {te = p;p--;{ found_syllable (consonant_syllable); }} 1.179 + break; 1.180 + case 8: 1.181 +#line 62 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.182 + {te = p;p--;{ found_syllable (broken_cluster); }} 1.183 + break; 1.184 + case 9: 1.185 +#line 63 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.186 + {te = p;p--;{ found_syllable (non_sea_cluster); }} 1.187 + break; 1.188 + case 1: 1.189 +#line 61 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.190 + {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} 1.191 + break; 1.192 + case 3: 1.193 +#line 62 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.194 + {{p = ((te))-1;}{ found_syllable (broken_cluster); }} 1.195 + break; 1.196 +#line 194 "hb-ot-shape-complex-sea-machine.hh.tmp" 1.197 + } 1.198 + 1.199 +_again: 1.200 + switch ( _sea_syllable_machine_to_state_actions[cs] ) { 1.201 + case 4: 1.202 +#line 1 "NONE" 1.203 + {ts = 0;} 1.204 + break; 1.205 +#line 203 "hb-ot-shape-complex-sea-machine.hh.tmp" 1.206 + } 1.207 + 1.208 + if ( ++p != pe ) 1.209 + goto _resume; 1.210 + _test_eof: {} 1.211 + if ( p == eof ) 1.212 + { 1.213 + if ( _sea_syllable_machine_eof_trans[cs] > 0 ) { 1.214 + _trans = _sea_syllable_machine_eof_trans[cs] - 1; 1.215 + goto _eof_trans; 1.216 + } 1.217 + } 1.218 + 1.219 + } 1.220 + 1.221 +#line 97 "../../src/hb-ot-shape-complex-sea-machine.rl" 1.222 + 1.223 +} 1.224 + 1.225 +#undef found_syllable 1.226 + 1.227 +#endif /* HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH */