27 */ |
27 */ |
28 |
28 |
29 #ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH |
29 #ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH |
30 #define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH |
30 #define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH |
31 |
31 |
32 #include "hb-private.hh" |
32 #include "hb.hh" |
33 |
33 |
34 |
34 |
35 #line 36 "hb-ot-shape-complex-khmer-machine.hh" |
35 #line 36 "hb-ot-shape-complex-khmer-machine.hh" |
36 static const unsigned char _khmer_syllable_machine_trans_keys[] = { |
36 static const unsigned char _khmer_syllable_machine_trans_keys[] = { |
37 7u, 7u, 1u, 16u, 13u, 13u, 1u, 16u, 7u, 13u, 7u, 7u, 1u, 16u, 13u, 13u, |
37 5u, 26u, 5u, 21u, 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, 5u, 26u, 5u, 21u, |
38 1u, 16u, 7u, 13u, 1u, 16u, 3u, 14u, 3u, 14u, 5u, 14u, 3u, 14u, 5u, 14u, |
38 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, 5u, 26u, 5u, 21u, 1u, 16u, 5u, 21u, |
39 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, 3u, 14u, 5u, 14u, |
39 5u, 26u, 5u, 21u, 5u, 26u, 5u, 21u, 5u, 26u, 1u, 16u, 1u, 29u, 5u, 29u, |
40 3u, 14u, 5u, 14u, 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, |
40 5u, 29u, 5u, 29u, 22u, 22u, 5u, 22u, 5u, 29u, 5u, 29u, 5u, 29u, 5u, 26u, |
41 3u, 14u, 7u, 13u, 7u, 7u, 1u, 16u, 0 |
41 5u, 29u, 5u, 29u, 22u, 22u, 5u, 22u, 5u, 29u, 5u, 29u, 1u, 16u, 5u, 29u, |
|
42 5u, 29u, 0 |
42 }; |
43 }; |
43 |
44 |
44 static const char _khmer_syllable_machine_key_spans[] = { |
45 static const char _khmer_syllable_machine_key_spans[] = { |
45 1, 16, 1, 16, 7, 1, 16, 1, |
46 22, 17, 22, 17, 16, 17, 22, 17, |
46 16, 7, 16, 12, 12, 10, 12, 10, |
47 22, 17, 16, 17, 22, 17, 16, 17, |
47 1, 11, 6, 1, 6, 12, 12, 10, |
48 22, 17, 22, 17, 22, 16, 29, 25, |
48 12, 10, 1, 11, 6, 1, 6, 12, |
49 25, 25, 1, 18, 25, 25, 25, 22, |
49 12, 7, 1, 16 |
50 25, 25, 1, 18, 25, 25, 16, 25, |
|
51 25 |
50 }; |
52 }; |
51 |
53 |
52 static const short _khmer_syllable_machine_index_offsets[] = { |
54 static const short _khmer_syllable_machine_index_offsets[] = { |
53 0, 2, 19, 21, 38, 46, 48, 65, |
55 0, 23, 41, 64, 82, 99, 117, 140, |
54 67, 84, 92, 109, 122, 135, 146, 159, |
56 158, 181, 199, 216, 234, 257, 275, 292, |
55 170, 172, 184, 191, 193, 200, 213, 226, |
57 310, 333, 351, 374, 392, 415, 432, 462, |
56 237, 250, 261, 263, 275, 282, 284, 291, |
58 488, 514, 540, 542, 561, 587, 613, 639, |
57 304, 317, 325, 327 |
59 662, 688, 714, 716, 735, 761, 787, 804, |
|
60 830 |
58 }; |
61 }; |
59 |
62 |
60 static const char _khmer_syllable_machine_indicies[] = { |
63 static const char _khmer_syllable_machine_indicies[] = { |
61 1, 0, 2, 2, 0, 0, 0, 0, |
64 1, 1, 0, 0, 0, 0, 0, 0, |
62 0, 0, 0, 0, 0, 0, 0, 0, |
65 0, 0, 0, 0, 0, 0, 0, 2, |
63 0, 2, 0, 3, 0, 4, 4, 0, |
66 3, 0, 0, 0, 0, 4, 0, 1, |
64 0, 0, 0, 0, 0, 0, 0, 0, |
67 1, 0, 0, 0, 0, 0, 0, 0, |
65 0, 0, 0, 0, 4, 0, 1, 0, |
68 0, 0, 0, 0, 0, 0, 0, 3, |
66 0, 0, 0, 0, 5, 0, 7, 6, |
69 0, 1, 1, 0, 0, 0, 0, 0, |
67 8, 8, 6, 6, 6, 6, 6, 6, |
70 0, 0, 0, 0, 0, 0, 0, 0, |
68 6, 6, 6, 6, 6, 6, 6, 8, |
71 0, 3, 0, 0, 0, 0, 4, 0, |
69 6, 9, 6, 10, 10, 6, 6, 6, |
72 5, 5, 0, 0, 0, 0, 0, 0, |
70 6, 6, 6, 6, 6, 6, 6, 6, |
73 0, 0, 0, 0, 0, 0, 0, 0, |
71 6, 6, 10, 6, 7, 6, 6, 6, |
74 4, 0, 6, 6, 0, 0, 0, 0, |
72 6, 6, 11, 6, 4, 4, 13, 12, |
75 0, 0, 0, 0, 0, 0, 0, 0, |
73 14, 15, 7, 16, 12, 12, 4, 4, |
76 0, 6, 0, 7, 7, 0, 0, 0, |
74 11, 17, 12, 4, 12, 19, 18, 20, |
77 0, 0, 0, 0, 0, 0, 0, 0, |
75 21, 1, 22, 18, 18, 18, 18, 5, |
78 0, 0, 0, 8, 0, 9, 9, 0, |
76 23, 18, 24, 18, 21, 21, 1, 22, |
79 0, 0, 0, 0, 0, 0, 0, 0, |
77 18, 18, 18, 18, 18, 23, 18, 21, |
80 0, 0, 0, 0, 0, 10, 0, 0, |
78 21, 1, 22, 18, 18, 18, 18, 18, |
81 0, 0, 4, 0, 9, 9, 0, 0, |
79 23, 18, 25, 18, 21, 21, 1, 22, |
82 0, 0, 0, 0, 0, 0, 0, 0, |
80 18, 18, 18, 18, 18, 26, 18, 21, |
83 0, 0, 0, 0, 10, 0, 11, 11, |
81 21, 1, 22, 18, 18, 18, 18, 18, |
84 0, 0, 0, 0, 0, 0, 0, 0, |
82 26, 18, 27, 18, 28, 18, 29, 18, |
85 0, 0, 0, 0, 0, 0, 12, 0, |
83 18, 22, 18, 18, 18, 18, 3, 18, |
86 0, 0, 0, 4, 0, 11, 11, 0, |
84 30, 18, 18, 18, 18, 22, 18, 22, |
87 0, 0, 0, 0, 0, 0, 0, 0, |
85 18, 28, 18, 18, 18, 18, 22, 18, |
88 0, 0, 0, 0, 0, 12, 0, 13, |
86 19, 18, 21, 21, 1, 22, 18, 18, |
89 13, 0, 0, 0, 0, 0, 0, 0, |
87 18, 18, 18, 23, 18, 32, 31, 33, |
90 0, 0, 0, 0, 0, 0, 13, 0, |
88 33, 7, 16, 31, 31, 31, 31, 31, |
91 15, 15, 14, 14, 14, 14, 14, 14, |
89 34, 31, 33, 33, 7, 16, 31, 31, |
92 14, 14, 14, 14, 14, 14, 14, 14, |
90 31, 31, 31, 34, 31, 35, 31, 33, |
93 16, 14, 15, 15, 17, 17, 17, 17, |
91 33, 7, 16, 31, 31, 31, 31, 31, |
94 17, 17, 17, 17, 17, 17, 17, 17, |
92 36, 31, 33, 33, 7, 16, 31, 31, |
95 17, 17, 16, 17, 17, 17, 17, 18, |
93 31, 31, 31, 36, 31, 37, 31, 38, |
96 17, 19, 19, 17, 17, 17, 17, 17, |
94 31, 39, 31, 31, 16, 31, 31, 31, |
97 17, 17, 17, 17, 17, 17, 17, 17, |
95 31, 9, 31, 40, 31, 31, 31, 31, |
98 17, 18, 17, 20, 20, 17, 17, 17, |
96 16, 31, 16, 31, 38, 31, 31, 31, |
99 17, 17, 17, 17, 17, 17, 17, 17, |
97 31, 16, 31, 13, 31, 41, 33, 7, |
100 17, 17, 20, 17, 21, 21, 17, 17, |
98 16, 31, 31, 31, 31, 11, 34, 31, |
101 17, 17, 17, 17, 17, 17, 17, 17, |
99 13, 31, 33, 33, 7, 16, 31, 31, |
102 17, 17, 17, 17, 22, 17, 23, 23, |
100 31, 31, 31, 34, 31, 7, 42, 42, |
103 17, 17, 17, 17, 17, 17, 17, 17, |
101 42, 42, 42, 11, 42, 7, 42, 10, |
104 17, 17, 17, 17, 17, 17, 24, 17, |
102 10, 42, 42, 42, 42, 42, 42, 42, |
105 17, 17, 17, 18, 17, 23, 23, 17, |
103 42, 42, 42, 42, 42, 42, 10, 42, |
106 17, 17, 17, 17, 17, 17, 17, 17, |
|
107 17, 17, 17, 17, 17, 24, 17, 25, |
|
108 25, 17, 17, 17, 17, 17, 17, 17, |
|
109 17, 17, 17, 17, 17, 17, 17, 26, |
|
110 17, 17, 17, 17, 18, 17, 25, 25, |
|
111 17, 17, 17, 17, 17, 17, 17, 17, |
|
112 17, 17, 17, 17, 17, 17, 26, 17, |
|
113 15, 15, 17, 17, 17, 17, 17, 17, |
|
114 17, 17, 17, 17, 17, 17, 17, 27, |
|
115 16, 17, 17, 17, 17, 18, 17, 28, |
|
116 28, 17, 17, 17, 17, 17, 17, 17, |
|
117 17, 17, 17, 17, 17, 17, 28, 17, |
|
118 13, 13, 29, 29, 30, 30, 29, 29, |
|
119 29, 29, 2, 2, 29, 31, 29, 13, |
|
120 29, 29, 29, 29, 16, 20, 29, 29, |
|
121 29, 18, 24, 26, 22, 29, 33, 33, |
|
122 32, 32, 32, 32, 32, 32, 32, 34, |
|
123 32, 32, 32, 32, 32, 2, 3, 6, |
|
124 32, 32, 32, 4, 10, 12, 8, 32, |
|
125 35, 35, 32, 32, 32, 32, 32, 32, |
|
126 32, 36, 32, 32, 32, 32, 32, 32, |
|
127 3, 6, 32, 32, 32, 4, 10, 12, |
|
128 8, 32, 5, 5, 32, 32, 32, 32, |
|
129 32, 32, 32, 36, 32, 32, 32, 32, |
|
130 32, 32, 4, 6, 32, 32, 32, 32, |
|
131 32, 32, 8, 32, 6, 32, 7, 7, |
|
132 32, 32, 32, 32, 32, 32, 32, 36, |
|
133 32, 32, 32, 32, 32, 32, 8, 6, |
|
134 32, 37, 37, 32, 32, 32, 32, 32, |
|
135 32, 32, 36, 32, 32, 32, 32, 32, |
|
136 32, 10, 6, 32, 32, 32, 4, 32, |
|
137 32, 8, 32, 38, 38, 32, 32, 32, |
|
138 32, 32, 32, 32, 36, 32, 32, 32, |
|
139 32, 32, 32, 12, 6, 32, 32, 32, |
|
140 4, 10, 32, 8, 32, 35, 35, 32, |
|
141 32, 32, 32, 32, 32, 32, 34, 32, |
|
142 32, 32, 32, 32, 32, 3, 6, 32, |
|
143 32, 32, 4, 10, 12, 8, 32, 15, |
|
144 15, 39, 39, 39, 39, 39, 39, 39, |
|
145 39, 39, 39, 39, 39, 39, 39, 16, |
|
146 39, 39, 39, 39, 18, 39, 41, 41, |
|
147 40, 40, 40, 40, 40, 40, 40, 42, |
|
148 40, 40, 40, 40, 40, 40, 16, 20, |
|
149 40, 40, 40, 18, 24, 26, 22, 40, |
|
150 19, 19, 40, 40, 40, 40, 40, 40, |
|
151 40, 42, 40, 40, 40, 40, 40, 40, |
|
152 18, 20, 40, 40, 40, 40, 40, 40, |
|
153 22, 40, 20, 40, 21, 21, 40, 40, |
|
154 40, 40, 40, 40, 40, 42, 40, 40, |
|
155 40, 40, 40, 40, 22, 20, 40, 43, |
|
156 43, 40, 40, 40, 40, 40, 40, 40, |
|
157 42, 40, 40, 40, 40, 40, 40, 24, |
|
158 20, 40, 40, 40, 18, 40, 40, 22, |
|
159 40, 44, 44, 40, 40, 40, 40, 40, |
|
160 40, 40, 42, 40, 40, 40, 40, 40, |
|
161 40, 26, 20, 40, 40, 40, 18, 24, |
|
162 40, 22, 40, 28, 28, 39, 39, 39, |
|
163 39, 39, 39, 39, 39, 39, 39, 39, |
|
164 39, 39, 28, 39, 45, 45, 40, 40, |
|
165 40, 40, 40, 40, 40, 46, 40, 40, |
|
166 40, 40, 40, 27, 16, 20, 40, 40, |
|
167 40, 18, 24, 26, 22, 40, 41, 41, |
|
168 40, 40, 40, 40, 40, 40, 40, 46, |
|
169 40, 40, 40, 40, 40, 40, 16, 20, |
|
170 40, 40, 40, 18, 24, 26, 22, 40, |
104 0 |
171 0 |
105 }; |
172 }; |
106 |
173 |
107 static const char _khmer_syllable_machine_trans_targs[] = { |
174 static const char _khmer_syllable_machine_trans_targs[] = { |
108 10, 14, 17, 20, 11, 21, 10, 24, |
175 22, 1, 30, 24, 25, 3, 26, 5, |
109 27, 30, 31, 32, 10, 22, 33, 34, |
176 27, 7, 28, 9, 29, 23, 22, 11, |
110 26, 35, 10, 12, 4, 0, 16, 3, |
177 32, 22, 33, 13, 34, 15, 35, 17, |
111 13, 15, 1, 10, 18, 2, 19, 10, |
178 36, 19, 37, 40, 39, 22, 31, 38, |
112 23, 5, 8, 25, 6, 10, 28, 7, |
179 22, 0, 10, 2, 4, 6, 8, 22, |
113 29, 9, 10 |
180 22, 12, 14, 16, 18, 20, 21 |
114 }; |
181 }; |
115 |
182 |
116 static const char _khmer_syllable_machine_trans_actions[] = { |
183 static const char _khmer_syllable_machine_trans_actions[] = { |
117 1, 2, 2, 0, 2, 2, 3, 2, |
184 1, 0, 2, 2, 2, 0, 0, 0, |
118 2, 0, 2, 2, 6, 2, 0, 0, |
185 2, 0, 2, 0, 2, 2, 3, 0, |
119 0, 0, 7, 2, 0, 0, 0, 0, |
186 4, 5, 2, 0, 0, 0, 2, 0, |
120 2, 2, 0, 8, 0, 0, 0, 9, |
187 2, 0, 2, 4, 4, 8, 9, 0, |
121 2, 0, 0, 2, 0, 10, 0, 0, |
188 10, 0, 0, 0, 0, 0, 0, 11, |
122 0, 0, 11 |
189 12, 0, 0, 0, 0, 0, 0 |
123 }; |
190 }; |
124 |
191 |
125 static const char _khmer_syllable_machine_to_state_actions[] = { |
192 static const char _khmer_syllable_machine_to_state_actions[] = { |
126 0, 0, 0, 0, 0, 0, 0, 0, |
193 0, 0, 0, 0, 0, 0, 0, 0, |
127 0, 0, 4, 0, 0, 0, 0, 0, |
194 0, 0, 0, 0, 0, 0, 0, 0, |
128 0, 0, 0, 0, 0, 0, 0, 0, |
195 0, 0, 0, 0, 0, 0, 6, 0, |
129 0, 0, 0, 0, 0, 0, 0, 0, |
196 0, 0, 0, 0, 0, 0, 0, 0, |
130 0, 0, 0, 0 |
197 0, 0, 0, 0, 0, 0, 0, 0, |
|
198 0 |
131 }; |
199 }; |
132 |
200 |
133 static const char _khmer_syllable_machine_from_state_actions[] = { |
201 static const char _khmer_syllable_machine_from_state_actions[] = { |
134 0, 0, 0, 0, 0, 0, 0, 0, |
202 0, 0, 0, 0, 0, 0, 0, 0, |
135 0, 0, 5, 0, 0, 0, 0, 0, |
203 0, 0, 0, 0, 0, 0, 0, 0, |
136 0, 0, 0, 0, 0, 0, 0, 0, |
204 0, 0, 0, 0, 0, 0, 7, 0, |
137 0, 0, 0, 0, 0, 0, 0, 0, |
205 0, 0, 0, 0, 0, 0, 0, 0, |
138 0, 0, 0, 0 |
206 0, 0, 0, 0, 0, 0, 0, 0, |
|
207 0 |
139 }; |
208 }; |
140 |
209 |
141 static const unsigned char _khmer_syllable_machine_eof_trans[] = { |
210 static const unsigned char _khmer_syllable_machine_eof_trans[] = { |
142 1, 1, 1, 1, 1, 7, 7, 7, |
211 1, 1, 1, 1, 1, 1, 1, 1, |
143 7, 7, 0, 19, 19, 19, 19, 19, |
212 1, 1, 1, 15, 18, 18, 18, 18, |
144 19, 19, 19, 19, 19, 19, 32, 32, |
213 18, 18, 18, 18, 18, 18, 0, 33, |
145 32, 32, 32, 32, 32, 32, 32, 32, |
214 33, 33, 33, 33, 33, 33, 33, 40, |
146 32, 43, 43, 43 |
215 41, 41, 41, 41, 41, 41, 40, 41, |
147 }; |
216 41 |
148 |
217 }; |
149 static const int khmer_syllable_machine_start = 10; |
218 |
150 static const int khmer_syllable_machine_first_final = 10; |
219 static const int khmer_syllable_machine_start = 22; |
|
220 static const int khmer_syllable_machine_first_final = 22; |
151 static const int khmer_syllable_machine_error = -1; |
221 static const int khmer_syllable_machine_error = -1; |
152 |
222 |
153 static const int khmer_syllable_machine_en_main = 10; |
223 static const int khmer_syllable_machine_en_main = 22; |
154 |
224 |
155 |
225 |
156 #line 36 "hb-ot-shape-complex-khmer-machine.rl" |
226 #line 36 "hb-ot-shape-complex-khmer-machine.rl" |
157 |
227 |
158 |
228 |
159 |
229 |
160 #line 74 "hb-ot-shape-complex-khmer-machine.rl" |
230 #line 80 "hb-ot-shape-complex-khmer-machine.rl" |
161 |
231 |
162 |
232 |
163 #define found_syllable(syllable_type) \ |
233 #define found_syllable(syllable_type) \ |
164 HB_STMT_START { \ |
234 HB_STMT_START { \ |
165 if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \ |
235 if (0) fprintf (stderr, "syllable %d..%d %s\n", ts, te, #syllable_type); \ |
166 for (unsigned int i = last; i < p+1; i++) \ |
236 for (unsigned int i = ts; i < te; i++) \ |
167 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
237 info[i].syllable() = (syllable_serial << 4) | syllable_type; \ |
168 last = p+1; \ |
|
169 syllable_serial++; \ |
238 syllable_serial++; \ |
170 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
239 if (unlikely (syllable_serial == 16)) syllable_serial = 1; \ |
171 } HB_STMT_END |
240 } HB_STMT_END |
172 |
241 |
173 static void |
242 static void |
174 find_syllables (hb_buffer_t *buffer) |
243 find_syllables (hb_buffer_t *buffer) |
175 { |
244 { |
176 unsigned int p, pe, eof, ts HB_UNUSED, te, act HB_UNUSED; |
245 unsigned int p, pe, eof, ts, te, act HB_UNUSED; |
177 int cs; |
246 int cs; |
178 hb_glyph_info_t *info = buffer->info; |
247 hb_glyph_info_t *info = buffer->info; |
179 |
248 |
180 #line 181 "hb-ot-shape-complex-khmer-machine.hh" |
249 #line 250 "hb-ot-shape-complex-khmer-machine.hh" |
181 { |
250 { |
182 cs = khmer_syllable_machine_start; |
251 cs = khmer_syllable_machine_start; |
183 ts = 0; |
252 ts = 0; |
184 te = 0; |
253 te = 0; |
185 act = 0; |
254 act = 0; |
186 } |
255 } |
187 |
256 |
188 #line 95 "hb-ot-shape-complex-khmer-machine.rl" |
257 #line 100 "hb-ot-shape-complex-khmer-machine.rl" |
189 |
258 |
190 |
259 |
191 p = 0; |
260 p = 0; |
192 pe = eof = buffer->len; |
261 pe = eof = buffer->len; |
193 |
262 |
194 unsigned int last = 0; |
|
195 unsigned int syllable_serial = 1; |
263 unsigned int syllable_serial = 1; |
196 |
264 |
197 #line 198 "hb-ot-shape-complex-khmer-machine.hh" |
265 #line 266 "hb-ot-shape-complex-khmer-machine.hh" |
198 { |
266 { |
199 int _slen; |
267 int _slen; |
200 int _trans; |
268 int _trans; |
201 const unsigned char *_keys; |
269 const unsigned char *_keys; |
202 const char *_inds; |
270 const char *_inds; |
203 if ( p == pe ) |
271 if ( p == pe ) |
204 goto _test_eof; |
272 goto _test_eof; |
205 _resume: |
273 _resume: |
206 switch ( _khmer_syllable_machine_from_state_actions[cs] ) { |
274 switch ( _khmer_syllable_machine_from_state_actions[cs] ) { |
207 case 5: |
275 case 7: |
208 #line 1 "NONE" |
276 #line 1 "NONE" |
209 {ts = p;} |
277 {ts = p;} |
210 break; |
278 break; |
211 #line 212 "hb-ot-shape-complex-khmer-machine.hh" |
279 #line 280 "hb-ot-shape-complex-khmer-machine.hh" |
212 } |
280 } |
213 |
281 |
214 _keys = _khmer_syllable_machine_trans_keys + (cs<<1); |
282 _keys = _khmer_syllable_machine_trans_keys + (cs<<1); |
215 _inds = _khmer_syllable_machine_indicies + _khmer_syllable_machine_index_offsets[cs]; |
283 _inds = _khmer_syllable_machine_indicies + _khmer_syllable_machine_index_offsets[cs]; |
216 |
284 |