Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/harfbuzz/src/hb-ot-shape-complex-khmer-machine.hh
Line
Count
Source (jump to first uncovered line)
1
2
#line 1 "hb-ot-shape-complex-khmer-machine.rl"
3
/*
4
 * Copyright © 2011,2012  Google, Inc.
5
 *
6
 *  This is part of HarfBuzz, a text shaping library.
7
 *
8
 * Permission is hereby granted, without written agreement and without
9
 * license or royalty fees, to use, copy, modify, and distribute this
10
 * software and its documentation for any purpose, provided that the
11
 * above copyright notice and the following two paragraphs appear in
12
 * all copies of this software.
13
 *
14
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18
 * DAMAGE.
19
 *
20
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25
 *
26
 * Google Author(s): Behdad Esfahbod
27
 */
28
29
#ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH
30
#define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH
31
32
#include "hb.hh"
33
34
35
#line 36 "hb-ot-shape-complex-khmer-machine.hh"
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, 
38
  1u, 16u, 7u, 13u, 1u, 16u, 3u, 14u, 3u, 14u, 5u, 14u, 3u, 14u, 5u, 14u, 
39
  8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, 3u, 14u, 5u, 14u, 
40
  3u, 14u, 5u, 14u, 8u, 8u, 3u, 13u, 3u, 8u, 8u, 8u, 3u, 8u, 3u, 14u, 
41
  3u, 14u, 7u, 13u, 7u, 7u, 1u, 16u, 0
42
};
43
44
static const char _khmer_syllable_machine_key_spans[] = {
45
  1, 16, 1, 16, 7, 1, 16, 1, 
46
  16, 7, 16, 12, 12, 10, 12, 10, 
47
  1, 11, 6, 1, 6, 12, 12, 10, 
48
  12, 10, 1, 11, 6, 1, 6, 12, 
49
  12, 7, 1, 16
50
};
51
52
static const short _khmer_syllable_machine_index_offsets[] = {
53
  0, 2, 19, 21, 38, 46, 48, 65, 
54
  67, 84, 92, 109, 122, 135, 146, 159, 
55
  170, 172, 184, 191, 193, 200, 213, 226, 
56
  237, 250, 261, 263, 275, 282, 284, 291, 
57
  304, 317, 325, 327
58
};
59
60
static const char _khmer_syllable_machine_indicies[] = {
61
  1, 0, 2, 2, 0, 0, 0, 0, 
62
  0, 0, 0, 0, 0, 0, 0, 0, 
63
  0, 2, 0, 3, 0, 4, 4, 0, 
64
  0, 0, 0, 0, 0, 0, 0, 0, 
65
  0, 0, 0, 0, 4, 0, 1, 0, 
66
  0, 0, 0, 0, 5, 0, 7, 6, 
67
  8, 8, 6, 6, 6, 6, 6, 6, 
68
  6, 6, 6, 6, 6, 6, 6, 8, 
69
  6, 9, 6, 10, 10, 6, 6, 6, 
70
  6, 6, 6, 6, 6, 6, 6, 6, 
71
  6, 6, 10, 6, 7, 6, 6, 6, 
72
  6, 6, 11, 6, 4, 4, 13, 12, 
73
  14, 15, 7, 16, 12, 12, 4, 4, 
74
  11, 17, 12, 4, 12, 19, 18, 20, 
75
  21, 1, 22, 18, 18, 18, 18, 5, 
76
  23, 18, 24, 18, 21, 21, 1, 22, 
77
  18, 18, 18, 18, 18, 23, 18, 21, 
78
  21, 1, 22, 18, 18, 18, 18, 18, 
79
  23, 18, 25, 18, 21, 21, 1, 22, 
80
  18, 18, 18, 18, 18, 26, 18, 21, 
81
  21, 1, 22, 18, 18, 18, 18, 18, 
82
  26, 18, 27, 18, 28, 18, 29, 18, 
83
  18, 22, 18, 18, 18, 18, 3, 18, 
84
  30, 18, 18, 18, 18, 22, 18, 22, 
85
  18, 28, 18, 18, 18, 18, 22, 18, 
86
  19, 18, 21, 21, 1, 22, 18, 18, 
87
  18, 18, 18, 23, 18, 32, 31, 33, 
88
  33, 7, 16, 31, 31, 31, 31, 31, 
89
  34, 31, 33, 33, 7, 16, 31, 31, 
90
  31, 31, 31, 34, 31, 35, 31, 33, 
91
  33, 7, 16, 31, 31, 31, 31, 31, 
92
  36, 31, 33, 33, 7, 16, 31, 31, 
93
  31, 31, 31, 36, 31, 37, 31, 38, 
94
  31, 39, 31, 31, 16, 31, 31, 31, 
95
  31, 9, 31, 40, 31, 31, 31, 31, 
96
  16, 31, 16, 31, 38, 31, 31, 31, 
97
  31, 16, 31, 13, 31, 41, 33, 7, 
98
  16, 31, 31, 31, 31, 11, 34, 31, 
99
  13, 31, 33, 33, 7, 16, 31, 31, 
100
  31, 31, 31, 34, 31, 7, 42, 42, 
101
  42, 42, 42, 11, 42, 7, 42, 10, 
102
  10, 42, 42, 42, 42, 42, 42, 42, 
103
  42, 42, 42, 42, 42, 42, 10, 42, 
104
  0
105
};
106
107
static const char _khmer_syllable_machine_trans_targs[] = {
108
  10, 14, 17, 20, 11, 21, 10, 24, 
109
  27, 30, 31, 32, 10, 22, 33, 34, 
110
  26, 35, 10, 12, 4, 0, 16, 3, 
111
  13, 15, 1, 10, 18, 2, 19, 10, 
112
  23, 5, 8, 25, 6, 10, 28, 7, 
113
  29, 9, 10
114
};
115
116
static const char _khmer_syllable_machine_trans_actions[] = {
117
  1, 2, 2, 0, 2, 2, 3, 2, 
118
  2, 0, 2, 2, 6, 2, 0, 0, 
119
  0, 0, 7, 2, 0, 0, 0, 0, 
120
  2, 2, 0, 8, 0, 0, 0, 9, 
121
  2, 0, 0, 2, 0, 10, 0, 0, 
122
  0, 0, 11
123
};
124
125
static const char _khmer_syllable_machine_to_state_actions[] = {
126
  0, 0, 0, 0, 0, 0, 0, 0, 
127
  0, 0, 4, 0, 0, 0, 0, 0, 
128
  0, 0, 0, 0, 0, 0, 0, 0, 
129
  0, 0, 0, 0, 0, 0, 0, 0, 
130
  0, 0, 0, 0
131
};
132
133
static const char _khmer_syllable_machine_from_state_actions[] = {
134
  0, 0, 0, 0, 0, 0, 0, 0, 
135
  0, 0, 5, 0, 0, 0, 0, 0, 
136
  0, 0, 0, 0, 0, 0, 0, 0, 
137
  0, 0, 0, 0, 0, 0, 0, 0, 
138
  0, 0, 0, 0
139
};
140
141
static const unsigned char _khmer_syllable_machine_eof_trans[] = {
142
  1, 1, 1, 1, 1, 7, 7, 7, 
143
  7, 7, 0, 19, 19, 19, 19, 19, 
144
  19, 19, 19, 19, 19, 19, 32, 32, 
145
  32, 32, 32, 32, 32, 32, 32, 32, 
146
  32, 43, 43, 43
147
};
148
149
static const int khmer_syllable_machine_start = 10;
150
static const int khmer_syllable_machine_first_final = 10;
151
static const int khmer_syllable_machine_error = -1;
152
153
static const int khmer_syllable_machine_en_main = 10;
154
155
156
#line 36 "hb-ot-shape-complex-khmer-machine.rl"
157
158
159
160
#line 74 "hb-ot-shape-complex-khmer-machine.rl"
161
162
163
#define found_syllable(syllable_type) \
164
0
  HB_STMT_START { \
165
0
    if (0) fprintf (stderr, "syllable %d..%d %s\n", last, p+1, #syllable_type); \
166
0
    for (unsigned int i = last; i < p+1; i++) \
167
0
      info[i].syllable() = (syllable_serial << 4) | syllable_type; \
168
0
    last = p+1; \
169
0
    syllable_serial++; \
170
0
    if (unlikely (syllable_serial == 16)) syllable_serial = 1; \
171
0
  } HB_STMT_END
172
173
static void
174
find_syllables (hb_buffer_t *buffer)
175
0
{
176
0
  unsigned int p, pe, eof, ts HB_UNUSED, te, act HB_UNUSED;
177
0
  int cs;
178
0
  hb_glyph_info_t *info = buffer->info;
179
0
  
180
0
#line 181 "hb-ot-shape-complex-khmer-machine.hh"
181
0
  {
182
0
  cs = khmer_syllable_machine_start;
183
0
  ts = 0;
184
0
  te = 0;
185
0
  act = 0;
186
0
  }
187
0
188
0
#line 95 "hb-ot-shape-complex-khmer-machine.rl"
189
0
190
0
191
0
  p = 0;
192
0
  pe = eof = buffer->len;
193
0
194
0
  unsigned int last = 0;
195
0
  unsigned int syllable_serial = 1;
196
0
  
197
0
#line 198 "hb-ot-shape-complex-khmer-machine.hh"
198
0
  {
199
0
  int _slen;
200
0
  int _trans;
201
0
  const unsigned char *_keys;
202
0
  const char *_inds;
203
0
  if ( p == pe )
204
0
    goto _test_eof;
205
0
_resume:
206
0
  switch ( _khmer_syllable_machine_from_state_actions[cs] ) {
207
0
  case 5:
208
0
#line 1 "NONE"
209
0
  {ts = p;}
210
0
  break;
211
0
#line 212 "hb-ot-shape-complex-khmer-machine.hh"
212
0
  }
213
0
214
0
  _keys = _khmer_syllable_machine_trans_keys + (cs<<1);
215
0
  _inds = _khmer_syllable_machine_indicies + _khmer_syllable_machine_index_offsets[cs];
216
0
217
0
  _slen = _khmer_syllable_machine_key_spans[cs];
218
0
  _trans = _inds[ _slen > 0 && _keys[0] <=( info[p].khmer_category()) &&
219
0
    ( info[p].khmer_category()) <= _keys[1] ?
220
0
    ( info[p].khmer_category()) - _keys[0] : _slen ];
221
0
222
0
_eof_trans:
223
0
  cs = _khmer_syllable_machine_trans_targs[_trans];
224
0
225
0
  if ( _khmer_syllable_machine_trans_actions[_trans] == 0 )
226
0
    goto _again;
227
0
228
0
  switch ( _khmer_syllable_machine_trans_actions[_trans] ) {
229
0
  case 2:
230
0
#line 1 "NONE"
231
0
  {te = p+1;}
232
0
  break;
233
0
  case 8:
234
0
#line 68 "hb-ot-shape-complex-khmer-machine.rl"
235
0
  {te = p+1;{ found_syllable (consonant_syllable); }}
236
0
  break;
237
0
  case 10:
238
0
#line 69 "hb-ot-shape-complex-khmer-machine.rl"
239
0
  {te = p+1;{ found_syllable (broken_cluster); }}
240
0
  break;
241
0
  case 6:
242
0
#line 70 "hb-ot-shape-complex-khmer-machine.rl"
243
0
  {te = p+1;{ found_syllable (non_khmer_cluster); }}
244
0
  break;
245
0
  case 7:
246
0
#line 68 "hb-ot-shape-complex-khmer-machine.rl"
247
0
  {te = p;p--;{ found_syllable (consonant_syllable); }}
248
0
  break;
249
0
  case 9:
250
0
#line 69 "hb-ot-shape-complex-khmer-machine.rl"
251
0
  {te = p;p--;{ found_syllable (broken_cluster); }}
252
0
  break;
253
0
  case 11:
254
0
#line 70 "hb-ot-shape-complex-khmer-machine.rl"
255
0
  {te = p;p--;{ found_syllable (non_khmer_cluster); }}
256
0
  break;
257
0
  case 1:
258
0
#line 68 "hb-ot-shape-complex-khmer-machine.rl"
259
0
  {{p = ((te))-1;}{ found_syllable (consonant_syllable); }}
260
0
  break;
261
0
  case 3:
262
0
#line 69 "hb-ot-shape-complex-khmer-machine.rl"
263
0
  {{p = ((te))-1;}{ found_syllable (broken_cluster); }}
264
0
  break;
265
0
#line 266 "hb-ot-shape-complex-khmer-machine.hh"
266
0
  }
267
0
268
0
_again:
269
0
  switch ( _khmer_syllable_machine_to_state_actions[cs] ) {
270
0
  case 4:
271
0
#line 1 "NONE"
272
0
  {ts = 0;}
273
0
  break;
274
0
#line 275 "hb-ot-shape-complex-khmer-machine.hh"
275
0
  }
276
0
277
0
  if ( ++p != pe )
278
0
    goto _resume;
279
0
  _test_eof: {}
280
0
  if ( p == eof )
281
0
  {
282
0
  if ( _khmer_syllable_machine_eof_trans[cs] > 0 ) {
283
0
    _trans = _khmer_syllable_machine_eof_trans[cs] - 1;
284
0
    goto _eof_trans;
285
0
  }
286
0
  }
287
0
288
0
  }
289
0
290
0
#line 104 "hb-ot-shape-complex-khmer-machine.rl"
291
0
292
0
}
293
294
#endif /* HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH */