OLD | NEW |
1 | 1 |
2 #line 1 "../../src/hb-ot-shape-complex-sea-machine.rl" | 2 #line 1 "hb-ot-shape-complex-sea-machine.rl" |
3 /* | 3 /* |
4 * Copyright © 2011,2012,2013 Google, Inc. | 4 * Copyright © 2011,2012,2013 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_SEA_MACHINE_HH | 29 #ifndef HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH |
30 #define HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH | 30 #define HB_OT_SHAPE_COMPLEX_SEA_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-sea-machine.hh" | 35 #line 36 "hb-ot-shape-complex-sea-machine.hh" |
36 static const unsigned char _sea_syllable_machine_trans_keys[] = { | 36 static const unsigned char _sea_syllable_machine_trans_keys[] = { |
37 1u, 1u, 1u, 1u, 1u, 29u, 3u, 29u, 3u, 29u, 1u, 1u, 0 | 37 1u, 1u, 1u, 1u, 1u, 29u, 3u, 29u, 3u, 29u, 1u, 1u, 0 |
38 }; | 38 }; |
39 | 39 |
40 static const char _sea_syllable_machine_key_spans[] = { | 40 static const char _sea_syllable_machine_key_spans[] = { |
41 1, 1, 29, 27, 27, 1 | 41 1, 1, 29, 27, 27, 1 |
42 }; | 42 }; |
43 | 43 |
44 static const char _sea_syllable_machine_index_offsets[] = { | 44 static const char _sea_syllable_machine_index_offsets[] = { |
45 0, 2, 4, 34, 62, 90 | 45 0, 2, 4, 34, 62, 90 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 1, 3, 0, 7, 9, 11 | 82 1, 3, 0, 7, 9, 11 |
83 }; | 83 }; |
84 | 84 |
85 static const int sea_syllable_machine_start = 2; | 85 static const int sea_syllable_machine_start = 2; |
86 static const int sea_syllable_machine_first_final = 2; | 86 static const int sea_syllable_machine_first_final = 2; |
87 static const int sea_syllable_machine_error = -1; | 87 static const int sea_syllable_machine_error = -1; |
88 | 88 |
89 static const int sea_syllable_machine_en_main = 2; | 89 static const int sea_syllable_machine_en_main = 2; |
90 | 90 |
91 | 91 |
92 #line 36 "../../src/hb-ot-shape-complex-sea-machine.rl" | 92 #line 36 "hb-ot-shape-complex-sea-machine.rl" |
93 | 93 |
94 | 94 |
95 | 95 |
96 #line 67 "../../src/hb-ot-shape-complex-sea-machine.rl" | 96 #line 67 "hb-ot-shape-complex-sea-machine.rl" |
97 | 97 |
98 | 98 |
99 #define found_syllable(syllable_type) \ | 99 #define found_syllable(syllable_type) \ |
100 HB_STMT_START { \ | 100 HB_STMT_START { \ |
101 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type);
\ | 101 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type);
\ |
102 for (unsigned int i = last; i < p+1; i++) \ | 102 for (unsigned int i = last; i < p+1; i++) \ |
103 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ | 103 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
104 last = p+1; \ | 104 last = p+1; \ |
105 syllable_serial++; \ | 105 syllable_serial++; \ |
106 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ | 106 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
107 } HB_STMT_END | 107 } HB_STMT_END |
108 | 108 |
109 static void | 109 static void |
110 find_syllables (hb_buffer_t *buffer) | 110 find_syllables (hb_buffer_t *buffer) |
111 { | 111 { |
112 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; | 112 unsigned int p, pe, eof, ts HB_UNUSED, te HB_UNUSED, act HB_UNUSED; |
113 int cs; | 113 int cs; |
114 hb_glyph_info_t *info = buffer->info; | 114 hb_glyph_info_t *info = buffer->info; |
115 | 115 |
116 #line 117 "../../src/hb-ot-shape-complex-sea-machine.hh" | 116 #line 117 "hb-ot-shape-complex-sea-machine.hh" |
117 { | 117 { |
118 cs = sea_syllable_machine_start; | 118 cs = sea_syllable_machine_start; |
119 ts = 0; | 119 ts = 0; |
120 te = 0; | 120 te = 0; |
121 act = 0; | 121 act = 0; |
122 } | 122 } |
123 | 123 |
124 #line 88 "../../src/hb-ot-shape-complex-sea-machine.rl" | 124 #line 88 "hb-ot-shape-complex-sea-machine.rl" |
125 | 125 |
126 | 126 |
127 p = 0; | 127 p = 0; |
128 pe = eof = buffer->len; | 128 pe = eof = buffer->len; |
129 | 129 |
130 unsigned int last = 0; | 130 unsigned int last = 0; |
131 unsigned int syllable_serial = 1; | 131 unsigned int syllable_serial = 1; |
132 | 132 |
133 #line 134 "../../src/hb-ot-shape-complex-sea-machine.hh" | 133 #line 134 "hb-ot-shape-complex-sea-machine.hh" |
134 { | 134 { |
135 int _slen; | 135 int _slen; |
136 int _trans; | 136 int _trans; |
137 const unsigned char *_keys; | 137 const unsigned char *_keys; |
138 const char *_inds; | 138 const char *_inds; |
139 if ( p == pe ) | 139 if ( p == pe ) |
140 goto _test_eof; | 140 goto _test_eof; |
141 _resume: | 141 _resume: |
142 switch ( _sea_syllable_machine_from_state_actions[cs] ) { | 142 switch ( _sea_syllable_machine_from_state_actions[cs] ) { |
143 case 5: | 143 case 5: |
144 #line 1 "NONE" | 144 #line 1 "NONE" |
145 {ts = p;} | 145 {ts = p;} |
146 break; | 146 break; |
147 #line 148 "../../src/hb-ot-shape-complex-sea-machine.hh" | 147 #line 148 "hb-ot-shape-complex-sea-machine.hh" |
148 } | 148 } |
149 | 149 |
150 _keys = _sea_syllable_machine_trans_keys + (cs<<1); | 150 _keys = _sea_syllable_machine_trans_keys + (cs<<1); |
151 _inds = _sea_syllable_machine_indicies + _sea_syllable_machine_index_off
sets[cs]; | 151 _inds = _sea_syllable_machine_indicies + _sea_syllable_machine_index_off
sets[cs]; |
152 | 152 |
153 _slen = _sea_syllable_machine_key_spans[cs]; | 153 _slen = _sea_syllable_machine_key_spans[cs]; |
154 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].sea_category()) && | 154 _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].sea_category()) && |
155 ( info[p].sea_category()) <= _keys[1] ? | 155 ( info[p].sea_category()) <= _keys[1] ? |
156 ( info[p].sea_category()) - _keys[0] : _slen ]; | 156 ( info[p].sea_category()) - _keys[0] : _slen ]; |
157 | 157 |
158 _eof_trans: | 158 _eof_trans: |
159 cs = _sea_syllable_machine_trans_targs[_trans]; | 159 cs = _sea_syllable_machine_trans_targs[_trans]; |
160 | 160 |
161 if ( _sea_syllable_machine_trans_actions[_trans] == 0 ) | 161 if ( _sea_syllable_machine_trans_actions[_trans] == 0 ) |
162 goto _again; | 162 goto _again; |
163 | 163 |
164 switch ( _sea_syllable_machine_trans_actions[_trans] ) { | 164 switch ( _sea_syllable_machine_trans_actions[_trans] ) { |
165 case 2: | 165 case 2: |
166 #line 1 "NONE" | 166 #line 1 "NONE" |
167 {te = p+1;} | 167 {te = p+1;} |
168 break; | 168 break; |
169 case 6: | 169 case 6: |
170 #line 63 "../../src/hb-ot-shape-complex-sea-machine.rl" | 170 #line 63 "hb-ot-shape-complex-sea-machine.rl" |
171 {te = p+1;{ found_syllable (non_sea_cluster); }} | 171 {te = p+1;{ found_syllable (non_sea_cluster); }} |
172 break; | 172 break; |
173 case 7: | 173 case 7: |
174 #line 61 "../../src/hb-ot-shape-complex-sea-machine.rl" | 174 #line 61 "hb-ot-shape-complex-sea-machine.rl" |
175 {te = p;p--;{ found_syllable (consonant_syllable); }} | 175 {te = p;p--;{ found_syllable (consonant_syllable); }} |
176 break; | 176 break; |
177 case 8: | 177 case 8: |
178 #line 62 "../../src/hb-ot-shape-complex-sea-machine.rl" | 178 #line 62 "hb-ot-shape-complex-sea-machine.rl" |
179 {te = p;p--;{ found_syllable (broken_cluster); }} | 179 {te = p;p--;{ found_syllable (broken_cluster); }} |
180 break; | 180 break; |
181 case 9: | 181 case 9: |
182 #line 63 "../../src/hb-ot-shape-complex-sea-machine.rl" | 182 #line 63 "hb-ot-shape-complex-sea-machine.rl" |
183 {te = p;p--;{ found_syllable (non_sea_cluster); }} | 183 {te = p;p--;{ found_syllable (non_sea_cluster); }} |
184 break; | 184 break; |
185 case 1: | 185 case 1: |
186 #line 61 "../../src/hb-ot-shape-complex-sea-machine.rl" | 186 #line 61 "hb-ot-shape-complex-sea-machine.rl" |
187 {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} | 187 {{p = ((te))-1;}{ found_syllable (consonant_syllable); }} |
188 break; | 188 break; |
189 case 3: | 189 case 3: |
190 #line 62 "../../src/hb-ot-shape-complex-sea-machine.rl" | 190 #line 62 "hb-ot-shape-complex-sea-machine.rl" |
191 {{p = ((te))-1;}{ found_syllable (broken_cluster); }} | 191 {{p = ((te))-1;}{ found_syllable (broken_cluster); }} |
192 break; | 192 break; |
193 #line 194 "../../src/hb-ot-shape-complex-sea-machine.hh" | 193 #line 194 "hb-ot-shape-complex-sea-machine.hh" |
194 } | 194 } |
195 | 195 |
196 _again: | 196 _again: |
197 switch ( _sea_syllable_machine_to_state_actions[cs] ) { | 197 switch ( _sea_syllable_machine_to_state_actions[cs] ) { |
198 case 4: | 198 case 4: |
199 #line 1 "NONE" | 199 #line 1 "NONE" |
200 {ts = 0;} | 200 {ts = 0;} |
201 break; | 201 break; |
202 #line 203 "../../src/hb-ot-shape-complex-sea-machine.hh" | 202 #line 203 "hb-ot-shape-complex-sea-machine.hh" |
203 } | 203 } |
204 | 204 |
205 if ( ++p != pe ) | 205 if ( ++p != pe ) |
206 goto _resume; | 206 goto _resume; |
207 _test_eof: {} | 207 _test_eof: {} |
208 if ( p == eof ) | 208 if ( p == eof ) |
209 { | 209 { |
210 if ( _sea_syllable_machine_eof_trans[cs] > 0 ) { | 210 if ( _sea_syllable_machine_eof_trans[cs] > 0 ) { |
211 _trans = _sea_syllable_machine_eof_trans[cs] - 1; | 211 _trans = _sea_syllable_machine_eof_trans[cs] - 1; |
212 goto _eof_trans; | 212 goto _eof_trans; |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 } | 216 } |
217 | 217 |
218 #line 97 "../../src/hb-ot-shape-complex-sea-machine.rl" | 218 #line 97 "hb-ot-shape-complex-sea-machine.rl" |
219 | 219 |
220 } | 220 } |
221 | 221 |
222 #undef found_syllable | 222 #undef found_syllable |
223 | 223 |
224 #endif /* HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH */ | 224 #endif /* HB_OT_SHAPE_COMPLEX_SEA_MACHINE_HH */ |
OLD | NEW |