2 #line 1 "hb-buffer-deserialize-text-unicode.rl"
4 * Copyright © 2013 Google, Inc.
6 * This is part of HarfBuzz, a text shaping library.
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.
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
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.
26 * Google Author(s): Behdad Esfahbod
29 #ifndef HB_BUFFER_DESERIALIZE_TEXT_UNICODE_HH
30 #define HB_BUFFER_DESERIALIZE_TEXT_UNICODE_HH
35 #line 36 "hb-buffer-deserialize-text-unicode.hh"
36 static const unsigned char _deserialize_text_unicode_trans_keys
[] = {
37 0u, 0u, 9u, 117u, 43u, 102u, 48u, 102u, 48u, 57u, 9u, 124u, 9u, 124u, 9u, 124u,
41 static const char _deserialize_text_unicode_key_spans
[] = {
42 0, 109, 60, 55, 10, 116, 116, 116,
46 static const short _deserialize_text_unicode_index_offsets
[] = {
47 0, 0, 110, 171, 227, 238, 355, 472,
51 static const char _deserialize_text_unicode_indicies
[] = {
53 1, 1, 1, 1, 1, 1, 1, 1,
54 1, 1, 1,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1, 1,
94 1, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1,
96 1, 1, 10, 1, 11, 11, 11, 11,
97 11, 1, 1, 1, 1, 1, 1, 1,
98 1, 1, 1, 1, 1, 1, 1, 1,
99 1, 1, 1, 11, 1, 1, 1, 1,
100 1, 1, 1, 1, 1, 1, 1, 1,
101 1, 1, 1, 1, 1, 1, 1, 1,
102 1, 1, 1, 1, 1, 1, 1, 1,
103 1, 1, 1, 1, 1, 1, 1, 1,
104 1, 1, 1, 1, 1, 1, 1, 1,
105 1, 1, 1, 1, 1, 1, 1, 1,
106 1, 1, 1, 1, 1, 1, 1, 1,
107 1, 1, 1, 1, 1, 1, 1, 1,
108 1, 1, 1, 1, 1, 1, 1, 1,
109 1, 1, 1, 1, 1, 1, 1, 1,
110 1, 1, 1, 1, 1, 1, 1, 0,
111 1, 12, 12, 12, 12, 12, 1, 1,
112 1, 1, 1, 1, 1, 1, 1, 1,
113 1, 1, 1, 1, 1, 1, 1, 1,
114 12, 1, 1, 1, 1, 1, 1, 1,
115 1, 1, 1, 1, 1, 1, 1, 1,
116 1, 1, 1, 1, 1, 1, 1, 1,
117 1, 1, 1, 1, 1, 1, 1, 1,
118 1, 1, 1, 1, 1, 1, 1, 1,
119 1, 1, 1, 1, 1, 1, 1, 1,
120 1, 1, 1, 1, 1, 1, 1, 1,
121 1, 1, 1, 1, 1, 1, 1, 1,
122 1, 1, 1, 1, 1, 1, 1, 1,
123 1, 1, 1, 1, 1, 1, 1, 1,
124 1, 1, 1, 1, 1, 1, 1, 1,
125 1, 1, 1, 1, 13, 1, 12, 12,
126 12, 12, 12, 1, 1, 1, 1, 1,
127 1, 1, 1, 1, 1, 1, 1, 1,
128 1, 1, 1, 1, 1, 12, 1, 1,
129 1, 1, 1, 1, 1, 1, 1, 1,
130 1, 1, 1, 1, 1, 14, 14, 14,
131 14, 14, 14, 14, 14, 14, 14, 1,
132 1, 1, 1, 1, 1, 1, 1, 1,
133 1, 1, 1, 1, 1, 1, 1, 1,
134 1, 1, 1, 1, 1, 1, 1, 1,
135 1, 1, 1, 1, 1, 1, 1, 1,
136 1, 1, 1, 1, 1, 1, 1, 1,
137 1, 1, 1, 1, 1, 1, 1, 1,
138 1, 1, 1, 1, 1, 1, 1, 1,
139 1, 1, 1, 1, 1, 1, 1, 1,
143 static const char _deserialize_text_unicode_trans_targs
[] = {
144 1, 0, 2, 3, 5, 7, 8, 6,
148 static const char _deserialize_text_unicode_trans_actions
[] = {
149 0, 0, 1, 0, 2, 2, 2, 3,
153 static const char _deserialize_text_unicode_eof_actions
[] = {
154 0, 0, 0, 0, 0, 3, 0, 5,
158 static const int deserialize_text_unicode_start
= 1;
159 static const int deserialize_text_unicode_first_final
= 5;
160 static const int deserialize_text_unicode_error
= 0;
162 static const int deserialize_text_unicode_en_main
= 1;
165 #line 79 "hb-buffer-deserialize-text-unicode.rl"
169 _hb_buffer_deserialize_text_unicode (hb_buffer_t
*buffer
,
171 unsigned int buf_len
,
172 const char **end_ptr
,
175 const char *p
= buf
, *pe
= buf
+ buf_len
, *eof
= pe
, *orig_pe
= pe
;
177 while (p
< pe
&& ISSPACE (*p
))
179 if (p
< pe
&& *p
== (buffer
->len
? '|' : '<'))
182 const char *end
= strchr ((char *) p
, '>');
187 end
= strrchr ((char *) p
, '|');
195 const char *tok
= nullptr;
197 hb_glyph_info_t info
= {0};
198 const hb_glyph_position_t pos
= {0};
200 #line 201 "hb-buffer-deserialize-text-unicode.hh"
202 cs
= deserialize_text_unicode_start
;
205 #line 206 "hb-buffer-deserialize-text-unicode.hh"
209 const unsigned char *_keys
;
216 _keys
= _deserialize_text_unicode_trans_keys
+ (cs
<<1);
217 _inds
= _deserialize_text_unicode_indicies
+ _deserialize_text_unicode_index_offsets
[cs
];
219 _slen
= _deserialize_text_unicode_key_spans
[cs
];
220 _trans
= _inds
[ _slen
> 0 && _keys
[0] <=(*p
) &&
222 (*p
) - _keys
[0] : _slen
];
224 cs
= _deserialize_text_unicode_trans_targs
[_trans
];
226 if ( _deserialize_text_unicode_trans_actions
[_trans
] == 0 )
229 switch ( _deserialize_text_unicode_trans_actions
[_trans
] ) {
231 #line 38 "hb-buffer-deserialize-text-unicode.rl"
233 hb_memset (&info
, 0, sizeof (info
));
237 #line 51 "hb-buffer-deserialize-text-unicode.rl"
243 #line 55 "hb-buffer-deserialize-text-unicode.rl"
244 {if (!parse_hex (tok
, p
, &info
.codepoint
)) return false; }
247 #line 55 "hb-buffer-deserialize-text-unicode.rl"
248 {if (!parse_hex (tok
, p
, &info
.codepoint
)) return false; }
249 #line 42 "hb-buffer-deserialize-text-unicode.rl"
251 buffer
->add_info (info
);
252 if (unlikely (!buffer
->successful
))
254 if (buffer
->have_positions
)
255 buffer
->pos
[buffer
->len
- 1] = pos
;
260 #line 57 "hb-buffer-deserialize-text-unicode.rl"
261 { if (!parse_uint (tok
, p
, &info
.cluster
)) return false; }
262 #line 42 "hb-buffer-deserialize-text-unicode.rl"
264 buffer
->add_info (info
);
265 if (unlikely (!buffer
->successful
))
267 if (buffer
->have_positions
)
268 buffer
->pos
[buffer
->len
- 1] = pos
;
272 #line 273 "hb-buffer-deserialize-text-unicode.hh"
283 switch ( _deserialize_text_unicode_eof_actions
[cs
] ) {
285 #line 55 "hb-buffer-deserialize-text-unicode.rl"
286 {if (!parse_hex (tok
, p
, &info
.codepoint
)) return false; }
287 #line 42 "hb-buffer-deserialize-text-unicode.rl"
289 buffer
->add_info (info
);
290 if (unlikely (!buffer
->successful
))
292 if (buffer
->have_positions
)
293 buffer
->pos
[buffer
->len
- 1] = pos
;
298 #line 57 "hb-buffer-deserialize-text-unicode.rl"
299 { if (!parse_uint (tok
, p
, &info
.cluster
)) return false; }
300 #line 42 "hb-buffer-deserialize-text-unicode.rl"
302 buffer
->add_info (info
);
303 if (unlikely (!buffer
->successful
))
305 if (buffer
->have_positions
)
306 buffer
->pos
[buffer
->len
- 1] = pos
;
310 #line 311 "hb-buffer-deserialize-text-unicode.hh"
317 #line 115 "hb-buffer-deserialize-text-unicode.rl"
320 if (pe
< orig_pe
&& *pe
== '>')
332 #endif /* HB_BUFFER_DESERIALIZE_TEXT_UNICODE_HH */