nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #line 2 "dtd_preparse.c" |
2 | /* Include this before everything else, for various large-file definitions */ |
||
3 | #include "config.h" |
||
4 | |||
5 | #line 6 "dtd_preparse.c" |
||
6 | |||
7 | #define YY_INT_ALIGNED short int |
||
8 | |||
9 | /* A lexical scanner generated by flex */ |
||
10 | |||
11 | #define FLEX_SCANNER |
||
12 | #define YY_FLEX_MAJOR_VERSION 2 |
||
13 | #define YY_FLEX_MINOR_VERSION 6 |
||
14 | #define YY_FLEX_SUBMINOR_VERSION 0 |
||
15 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
||
16 | #define FLEX_BETA |
||
17 | #endif |
||
18 | |||
19 | /* First, we deal with platform-specific or compiler-specific issues. */ |
||
20 | |||
21 | /* begin standard C headers. */ |
||
22 | #include <stdio.h> |
||
23 | #include <string.h> |
||
24 | #include <errno.h> |
||
25 | #include <stdlib.h> |
||
26 | |||
27 | /* end standard C headers. */ |
||
28 | |||
29 | /* flex integer type definitions */ |
||
30 | |||
31 | #ifndef FLEXINT_H |
||
32 | #define FLEXINT_H |
||
33 | |||
34 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
||
35 | |||
36 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
||
37 | |||
38 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
||
39 | * if you want the limit (max/min) macros for int types. |
||
40 | */ |
||
41 | #ifndef __STDC_LIMIT_MACROS |
||
42 | #define __STDC_LIMIT_MACROS 1 |
||
43 | #endif |
||
44 | |||
45 | #include <inttypes.h> |
||
46 | typedef int8_t flex_int8_t; |
||
47 | typedef uint8_t flex_uint8_t; |
||
48 | typedef int16_t flex_int16_t; |
||
49 | typedef uint16_t flex_uint16_t; |
||
50 | typedef int32_t flex_int32_t; |
||
51 | typedef uint32_t flex_uint32_t; |
||
52 | #else |
||
53 | typedef signed char flex_int8_t; |
||
54 | typedef short int flex_int16_t; |
||
55 | typedef int flex_int32_t; |
||
56 | typedef unsigned char flex_uint8_t; |
||
57 | typedef unsigned short int flex_uint16_t; |
||
58 | typedef unsigned int flex_uint32_t; |
||
59 | |||
60 | /* Limits of integral types. */ |
||
61 | #ifndef INT8_MIN |
||
62 | #define INT8_MIN (-128) |
||
63 | #endif |
||
64 | #ifndef INT16_MIN |
||
65 | #define INT16_MIN (-32767-1) |
||
66 | #endif |
||
67 | #ifndef INT32_MIN |
||
68 | #define INT32_MIN (-2147483647-1) |
||
69 | #endif |
||
70 | #ifndef INT8_MAX |
||
71 | #define INT8_MAX (127) |
||
72 | #endif |
||
73 | #ifndef INT16_MAX |
||
74 | #define INT16_MAX (32767) |
||
75 | #endif |
||
76 | #ifndef INT32_MAX |
||
77 | #define INT32_MAX (2147483647) |
||
78 | #endif |
||
79 | #ifndef UINT8_MAX |
||
80 | #define UINT8_MAX (255U) |
||
81 | #endif |
||
82 | #ifndef UINT16_MAX |
||
83 | #define UINT16_MAX (65535U) |
||
84 | #endif |
||
85 | #ifndef UINT32_MAX |
||
86 | #define UINT32_MAX (4294967295U) |
||
87 | #endif |
||
88 | |||
89 | #endif /* ! C99 */ |
||
90 | |||
91 | #endif /* ! FLEXINT_H */ |
||
92 | |||
93 | #ifdef __cplusplus |
||
94 | |||
95 | /* The "const" storage-class-modifier is valid. */ |
||
96 | #define YY_USE_CONST |
||
97 | |||
98 | #else /* ! __cplusplus */ |
||
99 | |||
100 | /* C99 requires __STDC__ to be defined as 1. */ |
||
101 | #if defined (__STDC__) |
||
102 | |||
103 | #define YY_USE_CONST |
||
104 | |||
105 | #endif /* defined (__STDC__) */ |
||
106 | #endif /* ! __cplusplus */ |
||
107 | |||
108 | #ifdef YY_USE_CONST |
||
109 | #define yyconst const |
||
110 | #else |
||
111 | #define yyconst |
||
112 | #endif |
||
113 | |||
114 | /* Returned upon end-of-file. */ |
||
115 | #define YY_NULL 0 |
||
116 | |||
117 | /* Promotes a possibly negative, possibly signed char to an unsigned |
||
118 | * integer for use as an array index. If the signed char is negative, |
||
119 | * we want to instead treat it as an 8-bit unsigned char, hence the |
||
120 | * double cast. |
||
121 | */ |
||
122 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
||
123 | |||
124 | /* An opaque pointer. */ |
||
125 | #ifndef YY_TYPEDEF_YY_SCANNER_T |
||
126 | #define YY_TYPEDEF_YY_SCANNER_T |
||
127 | typedef void* yyscan_t; |
||
128 | #endif |
||
129 | |||
130 | /* For convenience, these vars (plus the bison vars far below) |
||
131 | are macros in the reentrant scanner. */ |
||
132 | #define yyin yyg->yyin_r |
||
133 | #define yyout yyg->yyout_r |
||
134 | #define yyextra yyg->yyextra_r |
||
135 | #define yyleng yyg->yyleng_r |
||
136 | #define yytext yyg->yytext_r |
||
137 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
||
138 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
||
139 | #define yy_flex_debug yyg->yy_flex_debug_r |
||
140 | |||
141 | /* Enter a start condition. This macro really ought to take a parameter, |
||
142 | * but we do it the disgusting crufty way forced on us by the ()-less |
||
143 | * definition of BEGIN. |
||
144 | */ |
||
145 | #define BEGIN yyg->yy_start = 1 + 2 * |
||
146 | |||
147 | /* Translate the current start state into a value that can be later handed |
||
148 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
||
149 | * compatibility. |
||
150 | */ |
||
151 | #define YY_START ((yyg->yy_start - 1) / 2) |
||
152 | #define YYSTATE YY_START |
||
153 | |||
154 | /* Action number for EOF rule of a given start state. */ |
||
155 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
||
156 | |||
157 | /* Special action meaning "start processing a new file". */ |
||
158 | #define YY_NEW_FILE Dtd_PreParse_restart(yyin ,yyscanner ) |
||
159 | |||
160 | #define YY_END_OF_BUFFER_CHAR 0 |
||
161 | |||
162 | /* Size of default input buffer. */ |
||
163 | #ifndef YY_BUF_SIZE |
||
164 | #ifdef __ia64__ |
||
165 | /* On IA-64, the buffer size is 16k, not 8k. |
||
166 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
||
167 | * Ditto for the __ia64__ case accordingly. |
||
168 | */ |
||
169 | #define YY_BUF_SIZE 32768 |
||
170 | #else |
||
171 | #define YY_BUF_SIZE 16384 |
||
172 | #endif /* __ia64__ */ |
||
173 | #endif |
||
174 | |||
175 | /* The state buf must be large enough to hold one state per character in the main buffer. |
||
176 | */ |
||
177 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
||
178 | |||
179 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
||
180 | #define YY_TYPEDEF_YY_BUFFER_STATE |
||
181 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
||
182 | #endif |
||
183 | |||
184 | #ifndef YY_TYPEDEF_YY_SIZE_T |
||
185 | #define YY_TYPEDEF_YY_SIZE_T |
||
186 | typedef size_t yy_size_t; |
||
187 | #endif |
||
188 | |||
189 | #define EOB_ACT_CONTINUE_SCAN 0 |
||
190 | #define EOB_ACT_END_OF_FILE 1 |
||
191 | #define EOB_ACT_LAST_MATCH 2 |
||
192 | |||
193 | #define YY_LESS_LINENO(n) |
||
194 | #define YY_LINENO_REWIND_TO(ptr) |
||
195 | |||
196 | /* Return all but the first "n" matched characters back to the input stream. */ |
||
197 | #define yyless(n) \ |
||
198 | do \ |
||
199 | { \ |
||
200 | /* Undo effects of setting up yytext. */ \ |
||
201 | int yyless_macro_arg = (n); \ |
||
202 | YY_LESS_LINENO(yyless_macro_arg);\ |
||
203 | *yy_cp = yyg->yy_hold_char; \ |
||
204 | YY_RESTORE_YY_MORE_OFFSET \ |
||
205 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
||
206 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
||
207 | } \ |
||
208 | while ( 0 ) |
||
209 | |||
210 | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) |
||
211 | |||
212 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
||
213 | #define YY_STRUCT_YY_BUFFER_STATE |
||
214 | struct yy_buffer_state |
||
215 | { |
||
216 | FILE *yy_input_file; |
||
217 | |||
218 | char *yy_ch_buf; /* input buffer */ |
||
219 | char *yy_buf_pos; /* current position in input buffer */ |
||
220 | |||
221 | /* Size of input buffer in bytes, not including room for EOB |
||
222 | * characters. |
||
223 | */ |
||
224 | yy_size_t yy_buf_size; |
||
225 | |||
226 | /* Number of characters read into yy_ch_buf, not including EOB |
||
227 | * characters. |
||
228 | */ |
||
229 | int yy_n_chars; |
||
230 | |||
231 | /* Whether we "own" the buffer - i.e., we know we created it, |
||
232 | * and can realloc() it to grow it, and should free() it to |
||
233 | * delete it. |
||
234 | */ |
||
235 | int yy_is_our_buffer; |
||
236 | |||
237 | /* Whether this is an "interactive" input source; if so, and |
||
238 | * if we're using stdio for input, then we want to use getc() |
||
239 | * instead of fread(), to make sure we stop fetching input after |
||
240 | * each newline. |
||
241 | */ |
||
242 | int yy_is_interactive; |
||
243 | |||
244 | /* Whether we're considered to be at the beginning of a line. |
||
245 | * If so, '^' rules will be active on the next match, otherwise |
||
246 | * not. |
||
247 | */ |
||
248 | int yy_at_bol; |
||
249 | |||
250 | int yy_bs_lineno; /**< The line count. */ |
||
251 | int yy_bs_column; /**< The column count. */ |
||
252 | |||
253 | /* Whether to try to fill the input buffer when we reach the |
||
254 | * end of it. |
||
255 | */ |
||
256 | int yy_fill_buffer; |
||
257 | |||
258 | int yy_buffer_status; |
||
259 | |||
260 | #define YY_BUFFER_NEW 0 |
||
261 | #define YY_BUFFER_NORMAL 1 |
||
262 | /* When an EOF's been seen but there's still some text to process |
||
263 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
||
264 | * shouldn't try reading from the input source any more. We might |
||
265 | * still have a bunch of tokens to match, though, because of |
||
266 | * possible backing-up. |
||
267 | * |
||
268 | * When we actually see the EOF, we change the status to "new" |
||
269 | * (via Dtd_PreParse_restart()), so that the user can continue scanning by |
||
270 | * just pointing yyin at a new input file. |
||
271 | */ |
||
272 | #define YY_BUFFER_EOF_PENDING 2 |
||
273 | |||
274 | }; |
||
275 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
||
276 | |||
277 | /* We provide macros for accessing buffer states in case in the |
||
278 | * future we want to put the buffer states in a more general |
||
279 | * "scanner state". |
||
280 | * |
||
281 | * Returns the top of the stack, or NULL. |
||
282 | */ |
||
283 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ |
||
284 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ |
||
285 | : NULL) |
||
286 | |||
287 | /* Same as previous macro, but useful when we know that the buffer stack is not |
||
288 | * NULL or when we need an lvalue. For internal use only. |
||
289 | */ |
||
290 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
||
291 | |||
292 | void Dtd_PreParse_restart (FILE *input_file ,yyscan_t yyscanner ); |
||
293 | void Dtd_PreParse__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); |
||
294 | YY_BUFFER_STATE Dtd_PreParse__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); |
||
295 | void Dtd_PreParse__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); |
||
296 | void Dtd_PreParse__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); |
||
297 | void Dtd_PreParse_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); |
||
298 | void Dtd_PreParse_pop_buffer_state (yyscan_t yyscanner ); |
||
299 | |||
300 | static void Dtd_PreParse_ensure_buffer_stack (yyscan_t yyscanner ); |
||
301 | static void Dtd_PreParse__load_buffer_state (yyscan_t yyscanner ); |
||
302 | static void Dtd_PreParse__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); |
||
303 | |||
304 | #define YY_FLUSH_BUFFER Dtd_PreParse__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) |
||
305 | |||
306 | YY_BUFFER_STATE Dtd_PreParse__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); |
||
307 | YY_BUFFER_STATE Dtd_PreParse__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); |
||
308 | YY_BUFFER_STATE Dtd_PreParse__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); |
||
309 | |||
310 | void *Dtd_PreParse_alloc (yy_size_t ,yyscan_t yyscanner ); |
||
311 | void *Dtd_PreParse_realloc (void *,yy_size_t ,yyscan_t yyscanner ); |
||
312 | void Dtd_PreParse_free (void * ,yyscan_t yyscanner ); |
||
313 | |||
314 | #define yy_new_buffer Dtd_PreParse__create_buffer |
||
315 | |||
316 | #define yy_set_interactive(is_interactive) \ |
||
317 | { \ |
||
318 | if ( ! YY_CURRENT_BUFFER ){ \ |
||
319 | Dtd_PreParse_ensure_buffer_stack (yyscanner); \ |
||
320 | YY_CURRENT_BUFFER_LVALUE = \ |
||
321 | Dtd_PreParse__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ |
||
322 | } \ |
||
323 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
||
324 | } |
||
325 | |||
326 | #define yy_set_bol(at_bol) \ |
||
327 | { \ |
||
328 | if ( ! YY_CURRENT_BUFFER ){\ |
||
329 | Dtd_PreParse_ensure_buffer_stack (yyscanner); \ |
||
330 | YY_CURRENT_BUFFER_LVALUE = \ |
||
331 | Dtd_PreParse__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ |
||
332 | } \ |
||
333 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
||
334 | } |
||
335 | |||
336 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
||
337 | |||
338 | /* Begin user sect3 */ |
||
339 | |||
340 | #define Dtd_PreParse_wrap(yyscanner) (/*CONSTCOND*/1) |
||
341 | #define YY_SKIP_YYWRAP |
||
342 | |||
343 | typedef unsigned char YY_CHAR; |
||
344 | |||
345 | typedef int yy_state_type; |
||
346 | |||
347 | #define yytext_ptr yytext_r |
||
348 | |||
349 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); |
||
350 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); |
||
351 | static int yy_get_next_buffer (yyscan_t yyscanner ); |
||
352 | #if defined(__GNUC__) && __GNUC__ >= 3 |
||
353 | __attribute__((__noreturn__)) |
||
354 | #endif |
||
355 | static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); |
||
356 | |||
357 | /* Done after the current pattern has been matched and before the |
||
358 | * corresponding action - sets up yytext. |
||
359 | */ |
||
360 | #define YY_DO_BEFORE_ACTION \ |
||
361 | yyg->yytext_ptr = yy_bp; \ |
||
362 | yyleng = (size_t) (yy_cp - yy_bp); \ |
||
363 | yyg->yy_hold_char = *yy_cp; \ |
||
364 | *yy_cp = '\0'; \ |
||
365 | yyg->yy_c_buf_p = yy_cp; |
||
366 | |||
367 | #define YY_NUM_RULES 21 |
||
368 | #define YY_END_OF_BUFFER 22 |
||
369 | /* This struct is not used in this scanner, |
||
370 | but its presence is necessary. */ |
||
371 | struct yy_trans_info |
||
372 | { |
||
373 | flex_int32_t yy_verify; |
||
374 | flex_int32_t yy_nxt; |
||
375 | }; |
||
376 | static yyconst flex_int16_t yy_accept[78] = |
||
377 | { 0, |
||
378 | 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, |
||
379 | 0, 0, 0, 0, 0, 0, 22, 21, 11, 21, |
||
380 | 21, 21, 8, 8, 8, 9, 8, 13, 13, 14, |
||
381 | 21, 17, 11, 15, 16, 17, 17, 17, 20, 4, |
||
382 | 5, 4, 4, 4, 0, 2, 0, 3, 0, 13, |
||
383 | 0, 17, 17, 2, 18, 6, 0, 1, 0, 0, |
||
384 | 0, 10, 0, 17, 1, 7, 0, 0, 0, 0, |
||
385 | 0, 19, 0, 0, 0, 12, 0 |
||
386 | } ; |
||
387 | |||
388 | static yyconst YY_CHAR yy_ec[256] = |
||
389 | { 0, |
||
390 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
||
391 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
392 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
393 | 1, 2, 4, 5, 1, 1, 6, 7, 1, 1, |
||
394 | 1, 1, 1, 1, 8, 9, 1, 10, 10, 10, |
||
395 | 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, |
||
396 | 1, 14, 15, 1, 16, 16, 17, 17, 18, 17, |
||
397 | 17, 17, 19, 17, 16, 16, 20, 21, 17, 17, |
||
398 | 17, 17, 22, 23, 17, 17, 17, 17, 24, 17, |
||
399 | 25, 26, 27, 1, 10, 1, 16, 16, 17, 17, |
||
400 | |||
401 | 28, 17, 17, 17, 29, 17, 16, 16, 30, 31, |
||
402 | 17, 17, 17, 17, 32, 33, 17, 17, 17, 17, |
||
403 | 34, 17, 1, 1, 1, 1, 1, 1, 1, 1, |
||
404 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
405 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
406 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
407 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
408 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
410 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
411 | |||
412 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
413 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
414 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
415 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
416 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
||
417 | 1, 1, 1, 1, 1 |
||
418 | } ; |
||
419 | |||
420 | static yyconst YY_CHAR yy_meta[35] = |
||
421 | { 0, |
||
422 | 1, 1, 1, 1, 2, 2, 1, 3, 4, 3, |
||
423 | 4, 5, 1, 1, 1, 6, 6, 6, 6, 6, |
||
424 | 6, 6, 6, 6, 1, 1, 4, 6, 6, 6, |
||
425 | 6, 6, 6, 6 |
||
426 | } ; |
||
427 | |||
428 | static yyconst flex_uint16_t yy_base[86] = |
||
429 | { 0, |
||
430 | 0, 29, 89, 88, 58, 87, 103, 0, 5, 7, |
||
431 | 135, 164, 86, 85, 193, 222, 97, 345, 345, 0, |
||
432 | 69, 0, 345, 345, 0, 84, 64, 61, 60, 345, |
||
433 | 0, 0, 0, 345, 0, 238, 59, 79, 345, 345, |
||
434 | 345, 0, 50, 62, 61, 28, 15, 345, 37, 20, |
||
435 | 6, 0, 272, 17, 345, 345, 1, 345, 39, 1, |
||
436 | 25, 345, 25, 0, 0, 345, 26, 2, 33, 33, |
||
437 | 45, 345, 46, 69, 79, 345, 345, 306, 312, 318, |
||
438 | 324, 2, 328, 334, 338 |
||
439 | } ; |
||
440 | |||
441 | static yyconst flex_int16_t yy_def[86] = |
||
442 | { 0, |
||
443 | 78, 78, 2, 2, 79, 79, 2, 7, 2, 2, |
||
444 | 80, 80, 2, 2, 81, 81, 77, 77, 77, 82, |
||
445 | 77, 77, 77, 77, 82, 77, 77, 83, 83, 77, |
||
446 | 77, 84, 84, 77, 82, 84, 84, 84, 77, 77, |
||
447 | 77, 82, 77, 77, 85, 77, 77, 77, 77, 83, |
||
448 | 77, 84, 77, 84, 77, 77, 85, 77, 77, 77, |
||
449 | 77, 77, 77, 53, 84, 77, 77, 77, 77, 77, |
||
450 | 77, 77, 77, 77, 77, 77, 0, 77, 77, 77, |
||
451 | 77, 77, 77, 77, 77 |
||
452 | } ; |
||
453 | |||
454 | static yyconst flex_uint16_t yy_nxt[380] = |
||
455 | { 0, |
||
456 | 77, 77, 19, 47, 77, 20, 20, 45, 66, 30, |
||
457 | 21, 30, 58, 77, 48, 21, 59, 59, 77, 70, |
||
458 | 21, 77, 60, 51, 21, 77, 31, 63, 31, 70, |
||
459 | 21, 19, 61, 51, 20, 20, 31, 63, 31, 21, |
||
460 | 59, 59, 61, 54, 21, 67, 77, 68, 69, 21, |
||
461 | 62, 71, 72, 21, 46, 67, 61, 68, 69, 21, |
||
462 | 24, 71, 72, 25, 25, 26, 61, 73, 27, 74, |
||
463 | 75, 75, 58, 27, 76, 56, 46, 73, 27, 74, |
||
464 | 75, 75, 27, 55, 76, 54, 77, 46, 27, 24, |
||
465 | 46, 49, 25, 25, 26, 46, 77, 27, 39, 39, |
||
466 | |||
467 | 22, 22, 27, 77, 77, 77, 77, 27, 77, 77, |
||
468 | 77, 27, 77, 77, 77, 77, 77, 27, 28, 29, |
||
469 | 29, 29, 29, 28, 29, 29, 29, 77, 77, 77, |
||
470 | 29, 29, 29, 28, 29, 29, 29, 33, 77, 34, |
||
471 | 35, 36, 77, 77, 77, 37, 77, 77, 77, 77, |
||
472 | 37, 77, 77, 77, 77, 37, 77, 77, 77, 37, |
||
473 | 38, 77, 77, 77, 77, 37, 33, 77, 34, 35, |
||
474 | 36, 77, 77, 77, 37, 77, 77, 77, 77, 37, |
||
475 | 77, 77, 77, 77, 37, 77, 77, 77, 37, 38, |
||
476 | 77, 77, 77, 77, 37, 41, 77, 77, 42, 42, |
||
477 | |||
478 | 77, 77, 77, 43, 77, 77, 77, 44, 43, 77, |
||
479 | 77, 77, 77, 43, 77, 77, 77, 43, 77, 77, |
||
480 | 77, 77, 77, 43, 41, 77, 77, 42, 42, 77, |
||
481 | 77, 77, 43, 77, 77, 77, 44, 43, 77, 77, |
||
482 | 77, 77, 43, 77, 77, 77, 43, 77, 77, 77, |
||
483 | 77, 77, 43, 53, 53, 53, 53, 53, 53, 53, |
||
484 | 53, 53, 77, 77, 77, 53, 53, 53, 53, 53, |
||
485 | 53, 53, 52, 52, 52, 52, 77, 77, 52, 64, |
||
486 | 52, 64, 52, 65, 52, 52, 52, 64, 64, 64, |
||
487 | 64, 64, 64, 64, 64, 64, 52, 52, 52, 64, |
||
488 | |||
489 | 64, 64, 64, 64, 64, 64, 18, 18, 18, 18, |
||
490 | 18, 18, 23, 23, 23, 23, 23, 23, 32, 32, |
||
491 | 32, 32, 32, 32, 40, 40, 40, 40, 40, 40, |
||
492 | 50, 50, 77, 50, 52, 77, 52, 52, 52, 52, |
||
493 | 57, 77, 57, 57, 17, 77, 77, 77, 77, 77, |
||
494 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
||
495 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
||
496 | 77, 77, 77, 77, 77, 77, 77, 77, 77 |
||
497 | } ; |
||
498 | |||
499 | static yyconst flex_int16_t yy_chk[380] = |
||
500 | { 0, |
||
501 | 0, 0, 1, 22, 0, 1, 1, 82, 60, 9, |
||
502 | 1, 10, 57, 0, 22, 1, 47, 47, 0, 68, |
||
503 | 1, 0, 47, 31, 1, 0, 9, 51, 10, 68, |
||
504 | 1, 2, 47, 31, 2, 2, 9, 51, 10, 2, |
||
505 | 59, 59, 47, 54, 2, 61, 50, 63, 67, 2, |
||
506 | 49, 69, 70, 2, 46, 61, 59, 63, 67, 2, |
||
507 | 5, 69, 70, 5, 5, 5, 59, 71, 5, 73, |
||
508 | 74, 74, 45, 5, 74, 44, 43, 71, 5, 73, |
||
509 | 75, 75, 5, 38, 75, 37, 29, 28, 5, 6, |
||
510 | 27, 26, 6, 6, 6, 21, 17, 6, 14, 13, |
||
511 | |||
512 | 4, 3, 6, 0, 0, 0, 0, 6, 0, 0, |
||
513 | 0, 6, 0, 0, 0, 0, 0, 6, 7, 7, |
||
514 | 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, |
||
515 | 7, 7, 7, 7, 7, 7, 7, 11, 0, 11, |
||
516 | 11, 11, 0, 0, 0, 11, 0, 0, 0, 0, |
||
517 | 11, 0, 0, 0, 0, 11, 0, 0, 0, 11, |
||
518 | 11, 0, 0, 0, 0, 11, 12, 0, 12, 12, |
||
519 | 12, 0, 0, 0, 12, 0, 0, 0, 0, 12, |
||
520 | 0, 0, 0, 0, 12, 0, 0, 0, 12, 12, |
||
521 | 0, 0, 0, 0, 12, 15, 0, 0, 15, 15, |
||
522 | |||
523 | 0, 0, 0, 15, 0, 0, 0, 15, 15, 0, |
||
524 | 0, 0, 0, 15, 0, 0, 0, 15, 0, 0, |
||
525 | 0, 0, 0, 15, 16, 0, 0, 16, 16, 0, |
||
526 | 0, 0, 16, 0, 0, 0, 16, 16, 0, 0, |
||
527 | 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, |
||
528 | 0, 0, 16, 36, 36, 36, 36, 36, 36, 36, |
||
529 | 36, 36, 0, 0, 0, 36, 36, 36, 36, 36, |
||
530 | 36, 36, 53, 53, 53, 53, 0, 0, 53, 53, |
||
531 | 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, |
||
532 | 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, |
||
533 | |||
534 | 53, 53, 53, 53, 53, 53, 78, 78, 78, 78, |
||
535 | 78, 78, 79, 79, 79, 79, 79, 79, 80, 80, |
||
536 | 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, |
||
537 | 83, 83, 0, 83, 84, 0, 84, 84, 84, 84, |
||
538 | 85, 0, 85, 85, 77, 77, 77, 77, 77, 77, |
||
539 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
||
540 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, |
||
541 | 77, 77, 77, 77, 77, 77, 77, 77, 77 |
||
542 | } ; |
||
543 | |||
544 | /* The intent behind this definition is that it'll catch |
||
545 | * any uses of REJECT which flex missed. |
||
546 | */ |
||
547 | #define REJECT reject_used_but_not_detected |
||
548 | #define yymore() yymore_used_but_not_detected |
||
549 | #define YY_MORE_ADJ 0 |
||
550 | #define YY_RESTORE_YY_MORE_OFFSET |
||
551 | #line 1 "dtd_preparse.l" |
||
552 | |||
553 | /* |
||
554 | * We want a reentrant scanner. |
||
555 | */ |
||
556 | /* |
||
557 | * We don't use input, so don't generate code for it. |
||
558 | */ |
||
559 | #define YY_NO_INPUT 1 |
||
560 | /* |
||
561 | * We don't use unput, so don't generate code for it. |
||
562 | */ |
||
563 | /* |
||
564 | * We don't read interactively from the terminal. |
||
565 | */ |
||
566 | /* |
||
567 | * We want to stop processing when we get to the end of the input. |
||
568 | */ |
||
569 | /* |
||
570 | * The type for the state we keep for a scanner. |
||
571 | */ |
||
572 | /* |
||
573 | * The language we're scanning is case-insensitive. |
||
574 | */ |
||
575 | /* |
||
576 | * Prefix scanner routines with "Dtd_PreParse_" rather than "yy", so this |
||
577 | * scanner can coexist with other scanners. |
||
578 | */ |
||
579 | /* |
||
580 | * We have to override the memory allocators so that we don't get |
||
581 | * "unused argument" warnings from the yyscanner argument (which |
||
582 | * we don't use, as we have a global memory allocator). |
||
583 | * |
||
584 | * We provide, as macros, our own versions of the routines generated by Flex, |
||
585 | * which just call malloc()/realloc()/free() (as the Flex versions do), |
||
586 | * discarding the extra argument. |
||
587 | */ |
||
588 | #line 63 "dtd_preparse.l" |
||
589 | /* |
||
590 | * dtd_preparse.l |
||
591 | * |
||
592 | * an XML dissector for wireshark |
||
593 | * |
||
594 | * DTD Preparser - import a dtd file into a GString |
||
595 | * including files, removing comments |
||
596 | * and resolving %entities; |
||
597 | * |
||
598 | * Copyright 2004, Luis E. Garcia Ontanon <luis@ontanon.org> |
||
599 | * |
||
600 | * Wireshark - Network traffic analyzer |
||
601 | * By Gerald Combs <gerald@wireshark.org> |
||
602 | * Copyright 1998 Gerald Combs |
||
603 | * |
||
604 | * This program is free software; you can redistribute it and/or |
||
605 | * modify it under the terms of the GNU General Public License |
||
606 | * as published by the Free Software Foundation; either version 2 |
||
607 | * of the License, or (at your option) any later version. |
||
608 | * |
||
609 | * This program is distributed in the hope that it will be useful, |
||
610 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
611 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
612 | * GNU General Public License for more details. |
||
613 | * |
||
614 | * You should have received a copy of the GNU General Public License |
||
615 | * along with this program; if not, write to the Free Software |
||
616 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
617 | */ |
||
618 | |||
619 | #include <glib.h> |
||
620 | #include <string.h> |
||
621 | #include <errno.h> |
||
622 | #include <stdio.h> |
||
623 | #include "dtd.h" |
||
624 | #include <wsutil/file_util.h> |
||
625 | |||
626 | #define ECHO g_string_append(yyextra->current,yytext); |
||
627 | |||
628 | typedef struct { |
||
629 | const gchar* dtd_dirname; |
||
630 | const gchar* filename; |
||
631 | guint linenum; |
||
632 | |||
633 | GString* error; |
||
634 | |||
635 | GHashTable* entities; |
||
636 | GString* current; |
||
637 | GString* output; |
||
638 | gchar* entity_name; |
||
639 | } Dtd_PreParse_scanner_state_t; |
||
640 | |||
641 | static const gchar* replace_entity(Dtd_PreParse_scanner_state_t* state, gchar* s); |
||
642 | static const gchar* location(Dtd_PreParse_scanner_state_t* state); |
||
643 | |||
644 | #define YY_USER_INIT { \ |
||
645 | BEGIN OUTSIDE; \ |
||
646 | } |
||
647 | |||
648 | /* |
||
649 | * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h |
||
650 | */ |
||
651 | #ifdef _WIN32 |
||
652 | #define YY_NO_UNISTD_H |
||
653 | #endif |
||
654 | |||
655 | #ifdef _WIN32 |
||
656 | /* disable Windows VC compiler warning "signed/unsigned mismatch" associated */ |
||
657 | /* with YY_INPUT code generated by flex versions such as 2.5.35. */ |
||
658 | #pragma warning (disable:4018) |
||
659 | #endif |
||
660 | |||
661 | /* |
||
662 | * Sleazy hack to suppress compiler warnings in yy_fatal_error(). |
||
663 | */ |
||
664 | #define YY_EXIT_FAILURE ((void)yyscanner, 2) |
||
665 | |||
666 | /* |
||
667 | * Macros for the allocators, to discard the extra argument. |
||
668 | */ |
||
669 | #define Dtd_PreParse_alloc(size, yyscanner) (void *)malloc(size) |
||
670 | #define Dtd_PreParse_realloc(ptr, size, yyscanner) (void *)realloc((char *)(ptr), (size)) |
||
671 | #define Dtd_PreParse_free(ptr, yyscanner) free((char *)ptr) |
||
672 | |||
673 | |||
674 | #line 675 "dtd_preparse.c" |
||
675 | |||
676 | #define INITIAL 0 |
||
677 | #define OUTSIDE 1 |
||
678 | #define IN_COMMENT 2 |
||
679 | #define IN_ENTITY 3 |
||
680 | #define NAMED_ENTITY 4 |
||
681 | #define IN_QUOTE 5 |
||
682 | #define ENTITY_DONE 6 |
||
683 | #define XMLPI 7 |
||
684 | |||
685 | #ifndef YY_NO_UNISTD_H |
||
686 | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
||
687 | * down here because we want the user's section 1 to have been scanned first. |
||
688 | * The user has a chance to override it with an option. |
||
689 | */ |
||
690 | #include <unistd.h> |
||
691 | #endif |
||
692 | |||
693 | #define YY_EXTRA_TYPE Dtd_PreParse_scanner_state_t * |
||
694 | |||
695 | /* Holds the entire state of the reentrant scanner. */ |
||
696 | struct yyguts_t |
||
697 | { |
||
698 | |||
699 | /* User-defined. Not touched by flex. */ |
||
700 | YY_EXTRA_TYPE yyextra_r; |
||
701 | |||
702 | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
||
703 | FILE *yyin_r, *yyout_r; |
||
704 | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
||
705 | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
||
706 | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ |
||
707 | char yy_hold_char; |
||
708 | int yy_n_chars; |
||
709 | yy_size_t yyleng_r; |
||
710 | char *yy_c_buf_p; |
||
711 | int yy_init; |
||
712 | int yy_start; |
||
713 | int yy_did_buffer_switch_on_eof; |
||
714 | int yy_start_stack_ptr; |
||
715 | int yy_start_stack_depth; |
||
716 | int *yy_start_stack; |
||
717 | yy_state_type yy_last_accepting_state; |
||
718 | char* yy_last_accepting_cpos; |
||
719 | |||
720 | int yylineno_r; |
||
721 | int yy_flex_debug_r; |
||
722 | |||
723 | char *yytext_r; |
||
724 | int yy_more_flag; |
||
725 | int yy_more_len; |
||
726 | |||
727 | }; /* end struct yyguts_t */ |
||
728 | |||
729 | static int yy_init_globals (yyscan_t yyscanner ); |
||
730 | |||
731 | int Dtd_PreParse_lex_init (yyscan_t* scanner); |
||
732 | |||
733 | int Dtd_PreParse_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); |
||
734 | |||
735 | /* Accessor methods to globals. |
||
736 | These are made visible to non-reentrant scanners for convenience. */ |
||
737 | |||
738 | int Dtd_PreParse_lex_destroy (yyscan_t yyscanner ); |
||
739 | |||
740 | int Dtd_PreParse_get_debug (yyscan_t yyscanner ); |
||
741 | |||
742 | void Dtd_PreParse_set_debug (int debug_flag ,yyscan_t yyscanner ); |
||
743 | |||
744 | YY_EXTRA_TYPE Dtd_PreParse_get_extra (yyscan_t yyscanner ); |
||
745 | |||
746 | void Dtd_PreParse_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); |
||
747 | |||
748 | FILE *Dtd_PreParse_get_in (yyscan_t yyscanner ); |
||
749 | |||
750 | void Dtd_PreParse_set_in (FILE * _in_str ,yyscan_t yyscanner ); |
||
751 | |||
752 | FILE *Dtd_PreParse_get_out (yyscan_t yyscanner ); |
||
753 | |||
754 | void Dtd_PreParse_set_out (FILE * _out_str ,yyscan_t yyscanner ); |
||
755 | |||
756 | yy_size_t Dtd_PreParse_get_leng (yyscan_t yyscanner ); |
||
757 | |||
758 | char *Dtd_PreParse_get_text (yyscan_t yyscanner ); |
||
759 | |||
760 | int Dtd_PreParse_get_lineno (yyscan_t yyscanner ); |
||
761 | |||
762 | void Dtd_PreParse_set_lineno (int _line_number ,yyscan_t yyscanner ); |
||
763 | |||
764 | int Dtd_PreParse_get_column (yyscan_t yyscanner ); |
||
765 | |||
766 | void Dtd_PreParse_set_column (int _column_no ,yyscan_t yyscanner ); |
||
767 | |||
768 | /* Macros after this point can all be overridden by user definitions in |
||
769 | * section 1. |
||
770 | */ |
||
771 | |||
772 | #ifndef YY_SKIP_YYWRAP |
||
773 | #ifdef __cplusplus |
||
774 | extern "C" int Dtd_PreParse_wrap (yyscan_t yyscanner ); |
||
775 | #else |
||
776 | extern int Dtd_PreParse_wrap (yyscan_t yyscanner ); |
||
777 | #endif |
||
778 | #endif |
||
779 | |||
780 | #ifndef YY_NO_UNPUT |
||
781 | |||
782 | #endif |
||
783 | |||
784 | #ifndef yytext_ptr |
||
785 | static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); |
||
786 | #endif |
||
787 | |||
788 | #ifdef YY_NEED_STRLEN |
||
789 | static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); |
||
790 | #endif |
||
791 | |||
792 | #ifndef YY_NO_INPUT |
||
793 | |||
794 | #ifdef __cplusplus |
||
795 | static int yyinput (yyscan_t yyscanner ); |
||
796 | #else |
||
797 | static int input (yyscan_t yyscanner ); |
||
798 | #endif |
||
799 | |||
800 | #endif |
||
801 | |||
802 | /* Amount of stuff to slurp up with each read. */ |
||
803 | #ifndef YY_READ_BUF_SIZE |
||
804 | #ifdef __ia64__ |
||
805 | /* On IA-64, the buffer size is 16k, not 8k */ |
||
806 | #define YY_READ_BUF_SIZE 16384 |
||
807 | #else |
||
808 | #define YY_READ_BUF_SIZE 8192 |
||
809 | #endif /* __ia64__ */ |
||
810 | #endif |
||
811 | |||
812 | /* Copy whatever the last rule matched to the standard output. */ |
||
813 | #ifndef ECHO |
||
814 | /* This used to be an fputs(), but since the string might contain NUL's, |
||
815 | * we now use fwrite(). |
||
816 | */ |
||
817 | #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
||
818 | #endif |
||
819 | |||
820 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
||
821 | * is returned in "result". |
||
822 | */ |
||
823 | #ifndef YY_INPUT |
||
824 | #define YY_INPUT(buf,result,max_size) \ |
||
825 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
||
826 | { \ |
||
827 | int c = '*'; \ |
||
828 | size_t n; \ |
||
829 | for ( n = 0; n < max_size && \ |
||
830 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
||
831 | buf[n] = (char) c; \ |
||
832 | if ( c == '\n' ) \ |
||
833 | buf[n++] = (char) c; \ |
||
834 | if ( c == EOF && ferror( yyin ) ) \ |
||
835 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
||
836 | result = n; \ |
||
837 | } \ |
||
838 | else \ |
||
839 | { \ |
||
840 | errno=0; \ |
||
841 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ |
||
842 | { \ |
||
843 | if( errno != EINTR) \ |
||
844 | { \ |
||
845 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
||
846 | break; \ |
||
847 | } \ |
||
848 | errno=0; \ |
||
849 | clearerr(yyin); \ |
||
850 | } \ |
||
851 | }\ |
||
852 | \ |
||
853 | |||
854 | #endif |
||
855 | |||
856 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
||
857 | * we don't want an extra ';' after the "return" because that will cause |
||
858 | * some compilers to complain about unreachable statements. |
||
859 | */ |
||
860 | #ifndef yyterminate |
||
861 | #define yyterminate() return YY_NULL |
||
862 | #endif |
||
863 | |||
864 | /* Number of entries by which start-condition stack grows. */ |
||
865 | #ifndef YY_START_STACK_INCR |
||
866 | #define YY_START_STACK_INCR 25 |
||
867 | #endif |
||
868 | |||
869 | /* Report a fatal error. */ |
||
870 | #ifndef YY_FATAL_ERROR |
||
871 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) |
||
872 | #endif |
||
873 | |||
874 | /* end tables serialization structures and prototypes */ |
||
875 | |||
876 | /* Default declaration of generated scanner - a define so the user can |
||
877 | * easily add parameters. |
||
878 | */ |
||
879 | #ifndef YY_DECL |
||
880 | #define YY_DECL_IS_OURS 1 |
||
881 | |||
882 | extern int Dtd_PreParse_lex (yyscan_t yyscanner); |
||
883 | |||
884 | #define YY_DECL int Dtd_PreParse_lex (yyscan_t yyscanner) |
||
885 | #endif /* !YY_DECL */ |
||
886 | |||
887 | /* Code executed at the beginning of each rule, after yytext and yyleng |
||
888 | * have been set up. |
||
889 | */ |
||
890 | #ifndef YY_USER_ACTION |
||
891 | #define YY_USER_ACTION |
||
892 | #endif |
||
893 | |||
894 | /* Code executed at the end of each rule. */ |
||
895 | #ifndef YY_BREAK |
||
896 | #define YY_BREAK /*LINTED*/break; |
||
897 | #endif |
||
898 | |||
899 | #define YY_RULE_SETUP \ |
||
900 | YY_USER_ACTION |
||
901 | |||
902 | /** The main scanner function which does all the work. |
||
903 | */ |
||
904 | YY_DECL |
||
905 | { |
||
906 | yy_state_type yy_current_state; |
||
907 | char *yy_cp, *yy_bp; |
||
908 | int yy_act; |
||
909 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
910 | |||
911 | if ( !yyg->yy_init ) |
||
912 | { |
||
913 | yyg->yy_init = 1; |
||
914 | |||
915 | #ifdef YY_USER_INIT |
||
916 | YY_USER_INIT; |
||
917 | #endif |
||
918 | |||
919 | if ( ! yyg->yy_start ) |
||
920 | yyg->yy_start = 1; /* first start state */ |
||
921 | |||
922 | if ( ! yyin ) |
||
923 | yyin = stdin; |
||
924 | |||
925 | if ( ! yyout ) |
||
926 | yyout = stdout; |
||
927 | |||
928 | if ( ! YY_CURRENT_BUFFER ) { |
||
929 | Dtd_PreParse_ensure_buffer_stack (yyscanner); |
||
930 | YY_CURRENT_BUFFER_LVALUE = |
||
931 | Dtd_PreParse__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); |
||
932 | } |
||
933 | |||
934 | Dtd_PreParse__load_buffer_state(yyscanner ); |
||
935 | } |
||
936 | |||
937 | { |
||
938 | #line 176 "dtd_preparse.l" |
||
939 | |||
940 | |||
941 | |||
942 | #line 943 "dtd_preparse.c" |
||
943 | |||
944 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
||
945 | { |
||
946 | yy_cp = yyg->yy_c_buf_p; |
||
947 | |||
948 | /* Support of yytext. */ |
||
949 | *yy_cp = yyg->yy_hold_char; |
||
950 | |||
951 | /* yy_bp points to the position in yy_ch_buf of the start of |
||
952 | * the current run. |
||
953 | */ |
||
954 | yy_bp = yy_cp; |
||
955 | |||
956 | yy_current_state = yyg->yy_start; |
||
957 | yy_match: |
||
958 | do |
||
959 | { |
||
960 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
||
961 | if ( yy_accept[yy_current_state] ) |
||
962 | { |
||
963 | yyg->yy_last_accepting_state = yy_current_state; |
||
964 | yyg->yy_last_accepting_cpos = yy_cp; |
||
965 | } |
||
966 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
||
967 | { |
||
968 | yy_current_state = (int) yy_def[yy_current_state]; |
||
969 | if ( yy_current_state >= 78 ) |
||
970 | yy_c = yy_meta[(unsigned int) yy_c]; |
||
971 | } |
||
972 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
||
973 | ++yy_cp; |
||
974 | } |
||
975 | while ( yy_current_state != 77 ); |
||
976 | yy_cp = yyg->yy_last_accepting_cpos; |
||
977 | yy_current_state = yyg->yy_last_accepting_state; |
||
978 | |||
979 | yy_find_action: |
||
980 | yy_act = yy_accept[yy_current_state]; |
||
981 | |||
982 | YY_DO_BEFORE_ACTION; |
||
983 | |||
984 | do_action: /* This label is used only to access EOF actions. */ |
||
985 | |||
986 | switch ( yy_act ) |
||
987 | { /* beginning of action switch */ |
||
988 | case 0: /* must back up */ |
||
989 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
||
990 | *yy_cp = yyg->yy_hold_char; |
||
991 | yy_cp = yyg->yy_last_accepting_cpos; |
||
992 | yy_current_state = yyg->yy_last_accepting_state; |
||
993 | goto yy_find_action; |
||
994 | |||
995 | case 1: |
||
996 | YY_RULE_SETUP |
||
997 | #line 179 "dtd_preparse.l" |
||
998 | if (yyextra->current) g_string_append_printf(yyextra->current,"%s\n%s\n",replace_entity(yyextra, yytext),location(yyextra)); |
||
999 | YY_BREAK |
||
1000 | case 2: |
||
1001 | YY_RULE_SETUP |
||
1002 | #line 181 "dtd_preparse.l" |
||
1003 | if (yyextra->current) g_string_append(yyextra->current," "); |
||
1004 | YY_BREAK |
||
1005 | case 3: |
||
1006 | YY_RULE_SETUP |
||
1007 | #line 183 "dtd_preparse.l" |
||
1008 | { g_string_append(yyextra->current,yytext); BEGIN XMLPI; } |
||
1009 | YY_BREAK |
||
1010 | case 4: |
||
1011 | YY_RULE_SETUP |
||
1012 | #line 184 "dtd_preparse.l" |
||
1013 | { g_string_append(yyextra->current,yytext); } |
||
1014 | YY_BREAK |
||
1015 | case 5: |
||
1016 | /* rule 5 can match eol */ |
||
1017 | YY_RULE_SETUP |
||
1018 | #line 185 "dtd_preparse.l" |
||
1019 | { g_string_append(yyextra->current,yytext); } |
||
1020 | YY_BREAK |
||
1021 | case 6: |
||
1022 | YY_RULE_SETUP |
||
1023 | #line 186 "dtd_preparse.l" |
||
1024 | { g_string_append(yyextra->current,yytext); BEGIN OUTSIDE; } |
||
1025 | YY_BREAK |
||
1026 | case 7: |
||
1027 | YY_RULE_SETUP |
||
1028 | #line 188 "dtd_preparse.l" |
||
1029 | { yyextra->current = NULL; BEGIN IN_COMMENT; } |
||
1030 | YY_BREAK |
||
1031 | case 8: |
||
1032 | /* rule 8 can match eol */ |
||
1033 | #line 190 "dtd_preparse.l" |
||
1034 | case 9: |
||
1035 | /* rule 9 can match eol */ |
||
1036 | YY_RULE_SETUP |
||
1037 | #line 190 "dtd_preparse.l" |
||
1038 | ; |
||
1039 | YY_BREAK |
||
1040 | case 10: |
||
1041 | YY_RULE_SETUP |
||
1042 | #line 191 "dtd_preparse.l" |
||
1043 | { yyextra->current = yyextra->output; BEGIN OUTSIDE; } |
||
1044 | YY_BREAK |
||
1045 | case 11: |
||
1046 | /* rule 11 can match eol */ |
||
1047 | YY_RULE_SETUP |
||
1048 | #line 193 "dtd_preparse.l" |
||
1049 | { |
||
1050 | yyextra->linenum++; |
||
1051 | if (yyextra->current) g_string_append_printf(yyextra->current,"%s\n",location(yyextra)); |
||
1052 | } |
||
1053 | YY_BREAK |
||
1054 | case 12: |
||
1055 | /* rule 12 can match eol */ |
||
1056 | YY_RULE_SETUP |
||
1057 | #line 199 "dtd_preparse.l" |
||
1058 | { BEGIN IN_ENTITY; } |
||
1059 | YY_BREAK |
||
1060 | case 13: |
||
1061 | YY_RULE_SETUP |
||
1062 | #line 200 "dtd_preparse.l" |
||
1063 | { yyextra->entity_name = g_strdup_printf("%%%s;",yytext); BEGIN NAMED_ENTITY; } |
||
1064 | YY_BREAK |
||
1065 | case 14: |
||
1066 | YY_RULE_SETUP |
||
1067 | #line 201 "dtd_preparse.l" |
||
1068 | { yyextra->current = g_string_new(location(yyextra)); BEGIN IN_QUOTE; } |
||
1069 | YY_BREAK |
||
1070 | case 15: |
||
1071 | YY_RULE_SETUP |
||
1072 | #line 202 "dtd_preparse.l" |
||
1073 | { g_hash_table_insert(yyextra->entities,yyextra->entity_name,yyextra->current); BEGIN ENTITY_DONE; } |
||
1074 | YY_BREAK |
||
1075 | case 16: |
||
1076 | #line 204 "dtd_preparse.l" |
||
1077 | case 17: |
||
1078 | /* rule 17 can match eol */ |
||
1079 | #line 205 "dtd_preparse.l" |
||
1080 | case 18: |
||
1081 | /* rule 18 can match eol */ |
||
1082 | YY_RULE_SETUP |
||
1083 | #line 205 "dtd_preparse.l" |
||
1084 | g_string_append(yyextra->current,yytext); |
||
1085 | YY_BREAK |
||
1086 | case 19: |
||
1087 | YY_RULE_SETUP |
||
1088 | #line 206 "dtd_preparse.l" |
||
1089 | { |
||
1090 | g_string_append_printf(yyextra->error,"at %s:%u: file inclusion is not supported!", yyextra->filename, yyextra->linenum); |
||
1091 | yyterminate(); |
||
1092 | } |
||
1093 | YY_BREAK |
||
1094 | case 20: |
||
1095 | YY_RULE_SETUP |
||
1096 | #line 210 "dtd_preparse.l" |
||
1097 | { yyextra->current = yyextra->output; g_string_append(yyextra->current,"\n"); BEGIN OUTSIDE; } |
||
1098 | YY_BREAK |
||
1099 | case 21: |
||
1100 | YY_RULE_SETUP |
||
1101 | #line 212 "dtd_preparse.l" |
||
1102 | ECHO; |
||
1103 | YY_BREAK |
||
1104 | #line 1105 "dtd_preparse.c" |
||
1105 | case YY_STATE_EOF(INITIAL): |
||
1106 | case YY_STATE_EOF(OUTSIDE): |
||
1107 | case YY_STATE_EOF(IN_COMMENT): |
||
1108 | case YY_STATE_EOF(IN_ENTITY): |
||
1109 | case YY_STATE_EOF(NAMED_ENTITY): |
||
1110 | case YY_STATE_EOF(IN_QUOTE): |
||
1111 | case YY_STATE_EOF(ENTITY_DONE): |
||
1112 | case YY_STATE_EOF(XMLPI): |
||
1113 | yyterminate(); |
||
1114 | |||
1115 | case YY_END_OF_BUFFER: |
||
1116 | { |
||
1117 | /* Amount of text matched not including the EOB char. */ |
||
1118 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; |
||
1119 | |||
1120 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
||
1121 | *yy_cp = yyg->yy_hold_char; |
||
1122 | YY_RESTORE_YY_MORE_OFFSET |
||
1123 | |||
1124 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
||
1125 | { |
||
1126 | /* We're scanning a new file or input source. It's |
||
1127 | * possible that this happened because the user |
||
1128 | * just pointed yyin at a new source and called |
||
1129 | * Dtd_PreParse_lex(). If so, then we have to assure |
||
1130 | * consistency between YY_CURRENT_BUFFER and our |
||
1131 | * globals. Here is the right place to do so, because |
||
1132 | * this is the first action (other than possibly a |
||
1133 | * back-up) that will match for the new input source. |
||
1134 | */ |
||
1135 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
||
1136 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
||
1137 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
||
1138 | } |
||
1139 | |||
1140 | /* Note that here we test for yy_c_buf_p "<=" to the position |
||
1141 | * of the first EOB in the buffer, since yy_c_buf_p will |
||
1142 | * already have been incremented past the NUL character |
||
1143 | * (since all states make transitions on EOB to the |
||
1144 | * end-of-buffer state). Contrast this with the test |
||
1145 | * in input(). |
||
1146 | */ |
||
1147 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
||
1148 | { /* This was really a NUL. */ |
||
1149 | yy_state_type yy_next_state; |
||
1150 | |||
1151 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
||
1152 | |||
1153 | yy_current_state = yy_get_previous_state( yyscanner ); |
||
1154 | |||
1155 | /* Okay, we're now positioned to make the NUL |
||
1156 | * transition. We couldn't have |
||
1157 | * yy_get_previous_state() go ahead and do it |
||
1158 | * for us because it doesn't know how to deal |
||
1159 | * with the possibility of jamming (and we don't |
||
1160 | * want to build jamming into it because then it |
||
1161 | * will run more slowly). |
||
1162 | */ |
||
1163 | |||
1164 | yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); |
||
1165 | |||
1166 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1167 | |||
1168 | if ( yy_next_state ) |
||
1169 | { |
||
1170 | /* Consume the NUL. */ |
||
1171 | yy_cp = ++yyg->yy_c_buf_p; |
||
1172 | yy_current_state = yy_next_state; |
||
1173 | goto yy_match; |
||
1174 | } |
||
1175 | |||
1176 | else |
||
1177 | { |
||
1178 | yy_cp = yyg->yy_last_accepting_cpos; |
||
1179 | yy_current_state = yyg->yy_last_accepting_state; |
||
1180 | goto yy_find_action; |
||
1181 | } |
||
1182 | } |
||
1183 | |||
1184 | else switch ( yy_get_next_buffer( yyscanner ) ) |
||
1185 | { |
||
1186 | case EOB_ACT_END_OF_FILE: |
||
1187 | { |
||
1188 | yyg->yy_did_buffer_switch_on_eof = 0; |
||
1189 | |||
1190 | if ( Dtd_PreParse_wrap(yyscanner ) ) |
||
1191 | { |
||
1192 | /* Note: because we've taken care in |
||
1193 | * yy_get_next_buffer() to have set up |
||
1194 | * yytext, we can now set up |
||
1195 | * yy_c_buf_p so that if some total |
||
1196 | * hoser (like flex itself) wants to |
||
1197 | * call the scanner after we return the |
||
1198 | * YY_NULL, it'll still work - another |
||
1199 | * YY_NULL will get returned. |
||
1200 | */ |
||
1201 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1202 | |||
1203 | yy_act = YY_STATE_EOF(YY_START); |
||
1204 | goto do_action; |
||
1205 | } |
||
1206 | |||
1207 | else |
||
1208 | { |
||
1209 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
||
1210 | YY_NEW_FILE; |
||
1211 | } |
||
1212 | break; |
||
1213 | } |
||
1214 | |||
1215 | case EOB_ACT_CONTINUE_SCAN: |
||
1216 | yyg->yy_c_buf_p = |
||
1217 | yyg->yytext_ptr + yy_amount_of_matched_text; |
||
1218 | |||
1219 | yy_current_state = yy_get_previous_state( yyscanner ); |
||
1220 | |||
1221 | yy_cp = yyg->yy_c_buf_p; |
||
1222 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1223 | goto yy_match; |
||
1224 | |||
1225 | case EOB_ACT_LAST_MATCH: |
||
1226 | yyg->yy_c_buf_p = |
||
1227 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
||
1228 | |||
1229 | yy_current_state = yy_get_previous_state( yyscanner ); |
||
1230 | |||
1231 | yy_cp = yyg->yy_c_buf_p; |
||
1232 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
||
1233 | goto yy_find_action; |
||
1234 | } |
||
1235 | break; |
||
1236 | } |
||
1237 | |||
1238 | default: |
||
1239 | YY_FATAL_ERROR( |
||
1240 | "fatal flex scanner internal error--no action found" ); |
||
1241 | } /* end of action switch */ |
||
1242 | } /* end of scanning one token */ |
||
1243 | } /* end of user's declarations */ |
||
1244 | } /* end of Dtd_PreParse_lex */ |
||
1245 | |||
1246 | /* yy_get_next_buffer - try to read in a new buffer |
||
1247 | * |
||
1248 | * Returns a code representing an action: |
||
1249 | * EOB_ACT_LAST_MATCH - |
||
1250 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
||
1251 | * EOB_ACT_END_OF_FILE - end of file |
||
1252 | */ |
||
1253 | static int yy_get_next_buffer (yyscan_t yyscanner) |
||
1254 | { |
||
1255 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1256 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
||
1257 | char *source = yyg->yytext_ptr; |
||
1258 | yy_size_t number_to_move, i; |
||
1259 | int ret_val; |
||
1260 | |||
1261 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
||
1262 | YY_FATAL_ERROR( |
||
1263 | "fatal flex scanner internal error--end of buffer missed" ); |
||
1264 | |||
1265 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
||
1266 | { /* Don't try to fill the buffer, so this is an EOF. */ |
||
1267 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
||
1268 | { |
||
1269 | /* We matched a single character, the EOB, so |
||
1270 | * treat this as a final EOF. |
||
1271 | */ |
||
1272 | return EOB_ACT_END_OF_FILE; |
||
1273 | } |
||
1274 | |||
1275 | else |
||
1276 | { |
||
1277 | /* We matched some text prior to the EOB, first |
||
1278 | * process it. |
||
1279 | */ |
||
1280 | return EOB_ACT_LAST_MATCH; |
||
1281 | } |
||
1282 | } |
||
1283 | |||
1284 | /* Try to read more data. */ |
||
1285 | |||
1286 | /* First move last chars to start of buffer. */ |
||
1287 | number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; |
||
1288 | |||
1289 | for ( i = 0; i < number_to_move; ++i ) |
||
1290 | *(dest++) = *(source++); |
||
1291 | |||
1292 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
||
1293 | /* don't do the read, it's not guaranteed to return an EOF, |
||
1294 | * just force an EOF |
||
1295 | */ |
||
1296 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
||
1297 | |||
1298 | else |
||
1299 | { |
||
1300 | yy_size_t num_to_read = |
||
1301 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
||
1302 | |||
1303 | while ( num_to_read <= 0 ) |
||
1304 | { /* Not enough room in the buffer - grow it. */ |
||
1305 | |||
1306 | /* just a shorter name for the current buffer */ |
||
1307 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
||
1308 | |||
1309 | int yy_c_buf_p_offset = |
||
1310 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
||
1311 | |||
1312 | if ( b->yy_is_our_buffer ) |
||
1313 | { |
||
1314 | yy_size_t new_size = b->yy_buf_size * 2; |
||
1315 | |||
1316 | if ( new_size <= 0 ) |
||
1317 | b->yy_buf_size += b->yy_buf_size / 8; |
||
1318 | else |
||
1319 | b->yy_buf_size *= 2; |
||
1320 | |||
1321 | b->yy_ch_buf = (char *) |
||
1322 | /* Include room in for 2 EOB chars. */ |
||
1323 | Dtd_PreParse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); |
||
1324 | } |
||
1325 | else |
||
1326 | /* Can't grow it, we don't own it. */ |
||
1327 | b->yy_ch_buf = 0; |
||
1328 | |||
1329 | if ( ! b->yy_ch_buf ) |
||
1330 | YY_FATAL_ERROR( |
||
1331 | "fatal error - scanner input buffer overflow" ); |
||
1332 | |||
1333 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
||
1334 | |||
1335 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
||
1336 | number_to_move - 1; |
||
1337 | |||
1338 | } |
||
1339 | |||
1340 | if ( num_to_read > YY_READ_BUF_SIZE ) |
||
1341 | num_to_read = YY_READ_BUF_SIZE; |
||
1342 | |||
1343 | /* Read in more data. */ |
||
1344 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
||
1345 | yyg->yy_n_chars, num_to_read ); |
||
1346 | |||
1347 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
||
1348 | } |
||
1349 | |||
1350 | if ( yyg->yy_n_chars == 0 ) |
||
1351 | { |
||
1352 | if ( number_to_move == YY_MORE_ADJ ) |
||
1353 | { |
||
1354 | ret_val = EOB_ACT_END_OF_FILE; |
||
1355 | Dtd_PreParse_restart(yyin ,yyscanner); |
||
1356 | } |
||
1357 | |||
1358 | else |
||
1359 | { |
||
1360 | ret_val = EOB_ACT_LAST_MATCH; |
||
1361 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
||
1362 | YY_BUFFER_EOF_PENDING; |
||
1363 | } |
||
1364 | } |
||
1365 | |||
1366 | else |
||
1367 | ret_val = EOB_ACT_CONTINUE_SCAN; |
||
1368 | |||
1369 | if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
||
1370 | /* Extend the array by 50%, plus the number we really need. */ |
||
1371 | int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
||
1372 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Dtd_PreParse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); |
||
1373 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
||
1374 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
||
1375 | } |
||
1376 | |||
1377 | yyg->yy_n_chars += number_to_move; |
||
1378 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
||
1379 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
||
1380 | |||
1381 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
||
1382 | |||
1383 | return ret_val; |
||
1384 | } |
||
1385 | |||
1386 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
||
1387 | |||
1388 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) |
||
1389 | { |
||
1390 | yy_state_type yy_current_state; |
||
1391 | char *yy_cp; |
||
1392 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1393 | |||
1394 | yy_current_state = yyg->yy_start; |
||
1395 | |||
1396 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) |
||
1397 | { |
||
1398 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
||
1399 | if ( yy_accept[yy_current_state] ) |
||
1400 | { |
||
1401 | yyg->yy_last_accepting_state = yy_current_state; |
||
1402 | yyg->yy_last_accepting_cpos = yy_cp; |
||
1403 | } |
||
1404 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
||
1405 | { |
||
1406 | yy_current_state = (int) yy_def[yy_current_state]; |
||
1407 | if ( yy_current_state >= 78 ) |
||
1408 | yy_c = yy_meta[(unsigned int) yy_c]; |
||
1409 | } |
||
1410 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
||
1411 | } |
||
1412 | |||
1413 | return yy_current_state; |
||
1414 | } |
||
1415 | |||
1416 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
||
1417 | * |
||
1418 | * synopsis |
||
1419 | * next_state = yy_try_NUL_trans( current_state ); |
||
1420 | */ |
||
1421 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) |
||
1422 | { |
||
1423 | int yy_is_jam; |
||
1424 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ |
||
1425 | char *yy_cp = yyg->yy_c_buf_p; |
||
1426 | |||
1427 | YY_CHAR yy_c = 1; |
||
1428 | if ( yy_accept[yy_current_state] ) |
||
1429 | { |
||
1430 | yyg->yy_last_accepting_state = yy_current_state; |
||
1431 | yyg->yy_last_accepting_cpos = yy_cp; |
||
1432 | } |
||
1433 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
||
1434 | { |
||
1435 | yy_current_state = (int) yy_def[yy_current_state]; |
||
1436 | if ( yy_current_state >= 78 ) |
||
1437 | yy_c = yy_meta[(unsigned int) yy_c]; |
||
1438 | } |
||
1439 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
||
1440 | yy_is_jam = (yy_current_state == 77); |
||
1441 | |||
1442 | (void)yyg; |
||
1443 | return yy_is_jam ? 0 : yy_current_state; |
||
1444 | } |
||
1445 | |||
1446 | #ifndef YY_NO_UNPUT |
||
1447 | |||
1448 | #endif |
||
1449 | |||
1450 | #ifndef YY_NO_INPUT |
||
1451 | #ifdef __cplusplus |
||
1452 | static int yyinput (yyscan_t yyscanner) |
||
1453 | #else |
||
1454 | static int input (yyscan_t yyscanner) |
||
1455 | #endif |
||
1456 | |||
1457 | { |
||
1458 | int c; |
||
1459 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1460 | |||
1461 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
||
1462 | |||
1463 | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
||
1464 | { |
||
1465 | /* yy_c_buf_p now points to the character we want to return. |
||
1466 | * If this occurs *before* the EOB characters, then it's a |
||
1467 | * valid NUL; if not, then we've hit the end of the buffer. |
||
1468 | */ |
||
1469 | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
||
1470 | /* This was really a NUL. */ |
||
1471 | *yyg->yy_c_buf_p = '\0'; |
||
1472 | |||
1473 | else |
||
1474 | { /* need more input */ |
||
1475 | yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; |
||
1476 | ++yyg->yy_c_buf_p; |
||
1477 | |||
1478 | switch ( yy_get_next_buffer( yyscanner ) ) |
||
1479 | { |
||
1480 | case EOB_ACT_LAST_MATCH: |
||
1481 | /* This happens because yy_g_n_b() |
||
1482 | * sees that we've accumulated a |
||
1483 | * token and flags that we need to |
||
1484 | * try matching the token before |
||
1485 | * proceeding. But for input(), |
||
1486 | * there's no matching to consider. |
||
1487 | * So convert the EOB_ACT_LAST_MATCH |
||
1488 | * to EOB_ACT_END_OF_FILE. |
||
1489 | */ |
||
1490 | |||
1491 | /* Reset buffer status. */ |
||
1492 | Dtd_PreParse_restart(yyin ,yyscanner); |
||
1493 | |||
1494 | /*FALLTHROUGH*/ |
||
1495 | |||
1496 | case EOB_ACT_END_OF_FILE: |
||
1497 | { |
||
1498 | if ( Dtd_PreParse_wrap(yyscanner ) ) |
||
1499 | return EOF; |
||
1500 | |||
1501 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
||
1502 | YY_NEW_FILE; |
||
1503 | #ifdef __cplusplus |
||
1504 | return yyinput(yyscanner); |
||
1505 | #else |
||
1506 | return input(yyscanner); |
||
1507 | #endif |
||
1508 | } |
||
1509 | |||
1510 | case EOB_ACT_CONTINUE_SCAN: |
||
1511 | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
||
1512 | break; |
||
1513 | } |
||
1514 | } |
||
1515 | } |
||
1516 | |||
1517 | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
||
1518 | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
||
1519 | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
||
1520 | |||
1521 | return c; |
||
1522 | } |
||
1523 | #endif /* ifndef YY_NO_INPUT */ |
||
1524 | |||
1525 | /** Immediately switch to a different input stream. |
||
1526 | * @param input_file A readable stream. |
||
1527 | * @param yyscanner The scanner object. |
||
1528 | * @note This function does not reset the start condition to @c INITIAL . |
||
1529 | */ |
||
1530 | void Dtd_PreParse_restart (FILE * input_file , yyscan_t yyscanner) |
||
1531 | { |
||
1532 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1533 | |||
1534 | if ( ! YY_CURRENT_BUFFER ){ |
||
1535 | Dtd_PreParse_ensure_buffer_stack (yyscanner); |
||
1536 | YY_CURRENT_BUFFER_LVALUE = |
||
1537 | Dtd_PreParse__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); |
||
1538 | } |
||
1539 | |||
1540 | Dtd_PreParse__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); |
||
1541 | Dtd_PreParse__load_buffer_state(yyscanner ); |
||
1542 | } |
||
1543 | |||
1544 | /** Switch to a different input buffer. |
||
1545 | * @param new_buffer The new input buffer. |
||
1546 | * @param yyscanner The scanner object. |
||
1547 | */ |
||
1548 | void Dtd_PreParse__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
||
1549 | { |
||
1550 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1551 | |||
1552 | /* TODO. We should be able to replace this entire function body |
||
1553 | * with |
||
1554 | * Dtd_PreParse_pop_buffer_state(); |
||
1555 | * Dtd_PreParse_push_buffer_state(new_buffer); |
||
1556 | */ |
||
1557 | Dtd_PreParse_ensure_buffer_stack (yyscanner); |
||
1558 | if ( YY_CURRENT_BUFFER == new_buffer ) |
||
1559 | return; |
||
1560 | |||
1561 | if ( YY_CURRENT_BUFFER ) |
||
1562 | { |
||
1563 | /* Flush out information for old buffer. */ |
||
1564 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
||
1565 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
||
1566 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
||
1567 | } |
||
1568 | |||
1569 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
||
1570 | Dtd_PreParse__load_buffer_state(yyscanner ); |
||
1571 | |||
1572 | /* We don't actually know whether we did this switch during |
||
1573 | * EOF (Dtd_PreParse_wrap()) processing, but the only time this flag |
||
1574 | * is looked at is after Dtd_PreParse_wrap() is called, so it's safe |
||
1575 | * to go ahead and always set it. |
||
1576 | */ |
||
1577 | yyg->yy_did_buffer_switch_on_eof = 1; |
||
1578 | } |
||
1579 | |||
1580 | static void Dtd_PreParse__load_buffer_state (yyscan_t yyscanner) |
||
1581 | { |
||
1582 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1583 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
||
1584 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
||
1585 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
||
1586 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
||
1587 | } |
||
1588 | |||
1589 | /** Allocate and initialize an input buffer state. |
||
1590 | * @param file A readable stream. |
||
1591 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
||
1592 | * @param yyscanner The scanner object. |
||
1593 | * @return the allocated buffer state. |
||
1594 | */ |
||
1595 | YY_BUFFER_STATE Dtd_PreParse__create_buffer (FILE * file, int size , yyscan_t yyscanner) |
||
1596 | { |
||
1597 | YY_BUFFER_STATE b; |
||
1598 | |||
1599 | b = (YY_BUFFER_STATE) Dtd_PreParse_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); |
||
1600 | if ( ! b ) |
||
1601 | YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse__create_buffer()" ); |
||
1602 | |||
1603 | b->yy_buf_size = (yy_size_t)size; |
||
1604 | |||
1605 | /* yy_ch_buf has to be 2 characters longer than the size given because |
||
1606 | * we need to put in 2 end-of-buffer characters. |
||
1607 | */ |
||
1608 | b->yy_ch_buf = (char *) Dtd_PreParse_alloc(b->yy_buf_size + 2 ,yyscanner ); |
||
1609 | if ( ! b->yy_ch_buf ) |
||
1610 | YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse__create_buffer()" ); |
||
1611 | |||
1612 | b->yy_is_our_buffer = 1; |
||
1613 | |||
1614 | Dtd_PreParse__init_buffer(b,file ,yyscanner); |
||
1615 | |||
1616 | return b; |
||
1617 | } |
||
1618 | |||
1619 | /** Destroy the buffer. |
||
1620 | * @param b a buffer created with Dtd_PreParse__create_buffer() |
||
1621 | * @param yyscanner The scanner object. |
||
1622 | */ |
||
1623 | void Dtd_PreParse__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
||
1624 | { |
||
1625 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1626 | |||
1627 | if ( ! b ) |
||
1628 | return; |
||
1629 | |||
1630 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
||
1631 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
||
1632 | |||
1633 | if ( b->yy_is_our_buffer ) |
||
1634 | Dtd_PreParse_free((void *) b->yy_ch_buf ,yyscanner ); |
||
1635 | |||
1636 | Dtd_PreParse_free((void *) b ,yyscanner ); |
||
1637 | } |
||
1638 | |||
1639 | /* Initializes or reinitializes a buffer. |
||
1640 | * This function is sometimes called more than once on the same buffer, |
||
1641 | * such as during a Dtd_PreParse_restart() or at EOF. |
||
1642 | */ |
||
1643 | static void Dtd_PreParse__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) |
||
1644 | |||
1645 | { |
||
1646 | int oerrno = errno; |
||
1647 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1648 | |||
1649 | Dtd_PreParse__flush_buffer(b ,yyscanner); |
||
1650 | |||
1651 | b->yy_input_file = file; |
||
1652 | b->yy_fill_buffer = 1; |
||
1653 | |||
1654 | /* If b is the current buffer, then Dtd_PreParse__init_buffer was _probably_ |
||
1655 | * called from Dtd_PreParse_restart() or through yy_get_next_buffer. |
||
1656 | * In that case, we don't want to reset the lineno or column. |
||
1657 | */ |
||
1658 | if (b != YY_CURRENT_BUFFER){ |
||
1659 | b->yy_bs_lineno = 1; |
||
1660 | b->yy_bs_column = 0; |
||
1661 | } |
||
1662 | |||
1663 | b->yy_is_interactive = 0; |
||
1664 | |||
1665 | errno = oerrno; |
||
1666 | } |
||
1667 | |||
1668 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
||
1669 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
||
1670 | * @param yyscanner The scanner object. |
||
1671 | */ |
||
1672 | void Dtd_PreParse__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
||
1673 | { |
||
1674 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1675 | if ( ! b ) |
||
1676 | return; |
||
1677 | |||
1678 | b->yy_n_chars = 0; |
||
1679 | |||
1680 | /* We always need two end-of-buffer characters. The first causes |
||
1681 | * a transition to the end-of-buffer state. The second causes |
||
1682 | * a jam in that state. |
||
1683 | */ |
||
1684 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
||
1685 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
||
1686 | |||
1687 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
||
1688 | |||
1689 | b->yy_at_bol = 1; |
||
1690 | b->yy_buffer_status = YY_BUFFER_NEW; |
||
1691 | |||
1692 | if ( b == YY_CURRENT_BUFFER ) |
||
1693 | Dtd_PreParse__load_buffer_state(yyscanner ); |
||
1694 | } |
||
1695 | |||
1696 | /** Pushes the new state onto the stack. The new state becomes |
||
1697 | * the current state. This function will allocate the stack |
||
1698 | * if necessary. |
||
1699 | * @param new_buffer The new state. |
||
1700 | * @param yyscanner The scanner object. |
||
1701 | */ |
||
1702 | void Dtd_PreParse_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
||
1703 | { |
||
1704 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1705 | if (new_buffer == NULL) |
||
1706 | return; |
||
1707 | |||
1708 | Dtd_PreParse_ensure_buffer_stack(yyscanner); |
||
1709 | |||
1710 | /* This block is copied from Dtd_PreParse__switch_to_buffer. */ |
||
1711 | if ( YY_CURRENT_BUFFER ) |
||
1712 | { |
||
1713 | /* Flush out information for old buffer. */ |
||
1714 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
||
1715 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
||
1716 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
||
1717 | } |
||
1718 | |||
1719 | /* Only push if top exists. Otherwise, replace top. */ |
||
1720 | if (YY_CURRENT_BUFFER) |
||
1721 | yyg->yy_buffer_stack_top++; |
||
1722 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
||
1723 | |||
1724 | /* copied from Dtd_PreParse__switch_to_buffer. */ |
||
1725 | Dtd_PreParse__load_buffer_state(yyscanner ); |
||
1726 | yyg->yy_did_buffer_switch_on_eof = 1; |
||
1727 | } |
||
1728 | |||
1729 | /** Removes and deletes the top of the stack, if present. |
||
1730 | * The next element becomes the new top. |
||
1731 | * @param yyscanner The scanner object. |
||
1732 | */ |
||
1733 | void Dtd_PreParse_pop_buffer_state (yyscan_t yyscanner) |
||
1734 | { |
||
1735 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1736 | if (!YY_CURRENT_BUFFER) |
||
1737 | return; |
||
1738 | |||
1739 | Dtd_PreParse__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); |
||
1740 | YY_CURRENT_BUFFER_LVALUE = NULL; |
||
1741 | if (yyg->yy_buffer_stack_top > 0) |
||
1742 | --yyg->yy_buffer_stack_top; |
||
1743 | |||
1744 | if (YY_CURRENT_BUFFER) { |
||
1745 | Dtd_PreParse__load_buffer_state(yyscanner ); |
||
1746 | yyg->yy_did_buffer_switch_on_eof = 1; |
||
1747 | } |
||
1748 | } |
||
1749 | |||
1750 | /* Allocates the stack if it does not exist. |
||
1751 | * Guarantees space for at least one push. |
||
1752 | */ |
||
1753 | static void Dtd_PreParse_ensure_buffer_stack (yyscan_t yyscanner) |
||
1754 | { |
||
1755 | yy_size_t num_to_alloc; |
||
1756 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1757 | |||
1758 | if (!yyg->yy_buffer_stack) { |
||
1759 | |||
1760 | /* First allocation is just for 2 elements, since we don't know if this |
||
1761 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
||
1762 | * immediate realloc on the next call. |
||
1763 | */ |
||
1764 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
||
1765 | yyg->yy_buffer_stack = (struct yy_buffer_state**)Dtd_PreParse_alloc |
||
1766 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
||
1767 | , yyscanner); |
||
1768 | if ( ! yyg->yy_buffer_stack ) |
||
1769 | YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse_ensure_buffer_stack()" ); |
||
1770 | |||
1771 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
||
1772 | |||
1773 | yyg->yy_buffer_stack_max = num_to_alloc; |
||
1774 | yyg->yy_buffer_stack_top = 0; |
||
1775 | return; |
||
1776 | } |
||
1777 | |||
1778 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ |
||
1779 | |||
1780 | /* Increase the buffer to prepare for a possible push. */ |
||
1781 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
||
1782 | |||
1783 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
||
1784 | yyg->yy_buffer_stack = (struct yy_buffer_state**)Dtd_PreParse_realloc |
||
1785 | (yyg->yy_buffer_stack, |
||
1786 | num_to_alloc * sizeof(struct yy_buffer_state*) |
||
1787 | , yyscanner); |
||
1788 | if ( ! yyg->yy_buffer_stack ) |
||
1789 | YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse_ensure_buffer_stack()" ); |
||
1790 | |||
1791 | /* zero only the new slots.*/ |
||
1792 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); |
||
1793 | yyg->yy_buffer_stack_max = num_to_alloc; |
||
1794 | } |
||
1795 | } |
||
1796 | |||
1797 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
||
1798 | * @param base the character buffer |
||
1799 | * @param size the size in bytes of the character buffer |
||
1800 | * @param yyscanner The scanner object. |
||
1801 | * @return the newly allocated buffer state object. |
||
1802 | */ |
||
1803 | YY_BUFFER_STATE Dtd_PreParse__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
||
1804 | { |
||
1805 | YY_BUFFER_STATE b; |
||
1806 | |||
1807 | if ( size < 2 || |
||
1808 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
||
1809 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
||
1810 | /* They forgot to leave room for the EOB's. */ |
||
1811 | return 0; |
||
1812 | |||
1813 | b = (YY_BUFFER_STATE) Dtd_PreParse_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); |
||
1814 | if ( ! b ) |
||
1815 | YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse__scan_buffer()" ); |
||
1816 | |||
1817 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
||
1818 | b->yy_buf_pos = b->yy_ch_buf = base; |
||
1819 | b->yy_is_our_buffer = 0; |
||
1820 | b->yy_input_file = 0; |
||
1821 | b->yy_n_chars = b->yy_buf_size; |
||
1822 | b->yy_is_interactive = 0; |
||
1823 | b->yy_at_bol = 1; |
||
1824 | b->yy_fill_buffer = 0; |
||
1825 | b->yy_buffer_status = YY_BUFFER_NEW; |
||
1826 | |||
1827 | Dtd_PreParse__switch_to_buffer(b ,yyscanner ); |
||
1828 | |||
1829 | return b; |
||
1830 | } |
||
1831 | |||
1832 | /** Setup the input buffer state to scan a string. The next call to Dtd_PreParse_lex() will |
||
1833 | * scan from a @e copy of @a str. |
||
1834 | * @param yystr a NUL-terminated string to scan |
||
1835 | * @param yyscanner The scanner object. |
||
1836 | * @return the newly allocated buffer state object. |
||
1837 | * @note If you want to scan bytes that may contain NUL values, then use |
||
1838 | * Dtd_PreParse__scan_bytes() instead. |
||
1839 | */ |
||
1840 | YY_BUFFER_STATE Dtd_PreParse__scan_string (yyconst char * yystr , yyscan_t yyscanner) |
||
1841 | { |
||
1842 | |||
1843 | return Dtd_PreParse__scan_bytes(yystr,strlen(yystr) ,yyscanner); |
||
1844 | } |
||
1845 | |||
1846 | /** Setup the input buffer state to scan the given bytes. The next call to Dtd_PreParse_lex() will |
||
1847 | * scan from a @e copy of @a bytes. |
||
1848 | * @param yybytes the byte buffer to scan |
||
1849 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
||
1850 | * @param yyscanner The scanner object. |
||
1851 | * @return the newly allocated buffer state object. |
||
1852 | */ |
||
1853 | YY_BUFFER_STATE Dtd_PreParse__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) |
||
1854 | { |
||
1855 | YY_BUFFER_STATE b; |
||
1856 | char *buf; |
||
1857 | yy_size_t n; |
||
1858 | yy_size_t i; |
||
1859 | |||
1860 | /* Get memory for full buffer, including space for trailing EOB's. */ |
||
1861 | n = _yybytes_len + 2; |
||
1862 | buf = (char *) Dtd_PreParse_alloc(n ,yyscanner ); |
||
1863 | if ( ! buf ) |
||
1864 | YY_FATAL_ERROR( "out of dynamic memory in Dtd_PreParse__scan_bytes()" ); |
||
1865 | |||
1866 | for ( i = 0; i < _yybytes_len; ++i ) |
||
1867 | buf[i] = yybytes[i]; |
||
1868 | |||
1869 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
||
1870 | |||
1871 | b = Dtd_PreParse__scan_buffer(buf,n ,yyscanner); |
||
1872 | if ( ! b ) |
||
1873 | YY_FATAL_ERROR( "bad buffer in Dtd_PreParse__scan_bytes()" ); |
||
1874 | |||
1875 | /* It's okay to grow etc. this buffer, and we should throw it |
||
1876 | * away when we're done. |
||
1877 | */ |
||
1878 | b->yy_is_our_buffer = 1; |
||
1879 | |||
1880 | return b; |
||
1881 | } |
||
1882 | |||
1883 | #ifndef YY_EXIT_FAILURE |
||
1884 | #define YY_EXIT_FAILURE 2 |
||
1885 | #endif |
||
1886 | |||
1887 | static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) |
||
1888 | { |
||
1889 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1890 | (void)yyg; |
||
1891 | (void) fprintf( stderr, "%s\n", msg ); |
||
1892 | exit( YY_EXIT_FAILURE ); |
||
1893 | } |
||
1894 | |||
1895 | /* Redefine yyless() so it works in section 3 code. */ |
||
1896 | |||
1897 | #undef yyless |
||
1898 | #define yyless(n) \ |
||
1899 | do \ |
||
1900 | { \ |
||
1901 | /* Undo effects of setting up yytext. */ \ |
||
1902 | int yyless_macro_arg = (n); \ |
||
1903 | YY_LESS_LINENO(yyless_macro_arg);\ |
||
1904 | yytext[yyleng] = yyg->yy_hold_char; \ |
||
1905 | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
||
1906 | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
||
1907 | *yyg->yy_c_buf_p = '\0'; \ |
||
1908 | yyleng = yyless_macro_arg; \ |
||
1909 | } \ |
||
1910 | while ( 0 ) |
||
1911 | |||
1912 | /* Accessor methods (get/set functions) to struct members. */ |
||
1913 | |||
1914 | /** Get the user-defined data for this scanner. |
||
1915 | * @param yyscanner The scanner object. |
||
1916 | */ |
||
1917 | YY_EXTRA_TYPE Dtd_PreParse_get_extra (yyscan_t yyscanner) |
||
1918 | { |
||
1919 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1920 | return yyextra; |
||
1921 | } |
||
1922 | |||
1923 | /** Get the current line number. |
||
1924 | * @param yyscanner The scanner object. |
||
1925 | */ |
||
1926 | int Dtd_PreParse_get_lineno (yyscan_t yyscanner) |
||
1927 | { |
||
1928 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1929 | |||
1930 | if (! YY_CURRENT_BUFFER) |
||
1931 | return 0; |
||
1932 | |||
1933 | return yylineno; |
||
1934 | } |
||
1935 | |||
1936 | /** Get the current column number. |
||
1937 | * @param yyscanner The scanner object. |
||
1938 | */ |
||
1939 | int Dtd_PreParse_get_column (yyscan_t yyscanner) |
||
1940 | { |
||
1941 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1942 | |||
1943 | if (! YY_CURRENT_BUFFER) |
||
1944 | return 0; |
||
1945 | |||
1946 | return yycolumn; |
||
1947 | } |
||
1948 | |||
1949 | /** Get the input stream. |
||
1950 | * @param yyscanner The scanner object. |
||
1951 | */ |
||
1952 | FILE *Dtd_PreParse_get_in (yyscan_t yyscanner) |
||
1953 | { |
||
1954 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1955 | return yyin; |
||
1956 | } |
||
1957 | |||
1958 | /** Get the output stream. |
||
1959 | * @param yyscanner The scanner object. |
||
1960 | */ |
||
1961 | FILE *Dtd_PreParse_get_out (yyscan_t yyscanner) |
||
1962 | { |
||
1963 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1964 | return yyout; |
||
1965 | } |
||
1966 | |||
1967 | /** Get the length of the current token. |
||
1968 | * @param yyscanner The scanner object. |
||
1969 | */ |
||
1970 | yy_size_t Dtd_PreParse_get_leng (yyscan_t yyscanner) |
||
1971 | { |
||
1972 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1973 | return yyleng; |
||
1974 | } |
||
1975 | |||
1976 | /** Get the current token. |
||
1977 | * @param yyscanner The scanner object. |
||
1978 | */ |
||
1979 | |||
1980 | char *Dtd_PreParse_get_text (yyscan_t yyscanner) |
||
1981 | { |
||
1982 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1983 | return yytext; |
||
1984 | } |
||
1985 | |||
1986 | /** Set the user-defined data. This data is never touched by the scanner. |
||
1987 | * @param user_defined The data to be associated with this scanner. |
||
1988 | * @param yyscanner The scanner object. |
||
1989 | */ |
||
1990 | void Dtd_PreParse_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) |
||
1991 | { |
||
1992 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
1993 | yyextra = user_defined ; |
||
1994 | } |
||
1995 | |||
1996 | /** Set the current line number. |
||
1997 | * @param _line_number line number |
||
1998 | * @param yyscanner The scanner object. |
||
1999 | */ |
||
2000 | void Dtd_PreParse_set_lineno (int _line_number , yyscan_t yyscanner) |
||
2001 | { |
||
2002 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2003 | |||
2004 | /* lineno is only valid if an input buffer exists. */ |
||
2005 | if (! YY_CURRENT_BUFFER ) |
||
2006 | YY_FATAL_ERROR( "Dtd_PreParse_set_lineno called with no buffer" ); |
||
2007 | |||
2008 | yylineno = _line_number; |
||
2009 | } |
||
2010 | |||
2011 | /** Set the current column. |
||
2012 | * @param _column_no column number |
||
2013 | * @param yyscanner The scanner object. |
||
2014 | */ |
||
2015 | void Dtd_PreParse_set_column (int _column_no , yyscan_t yyscanner) |
||
2016 | { |
||
2017 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2018 | |||
2019 | /* column is only valid if an input buffer exists. */ |
||
2020 | if (! YY_CURRENT_BUFFER ) |
||
2021 | YY_FATAL_ERROR( "Dtd_PreParse_set_column called with no buffer" ); |
||
2022 | |||
2023 | yycolumn = _column_no; |
||
2024 | } |
||
2025 | |||
2026 | /** Set the input stream. This does not discard the current |
||
2027 | * input buffer. |
||
2028 | * @param _in_str A readable stream. |
||
2029 | * @param yyscanner The scanner object. |
||
2030 | * @see Dtd_PreParse__switch_to_buffer |
||
2031 | */ |
||
2032 | void Dtd_PreParse_set_in (FILE * _in_str , yyscan_t yyscanner) |
||
2033 | { |
||
2034 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2035 | yyin = _in_str ; |
||
2036 | } |
||
2037 | |||
2038 | void Dtd_PreParse_set_out (FILE * _out_str , yyscan_t yyscanner) |
||
2039 | { |
||
2040 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2041 | yyout = _out_str ; |
||
2042 | } |
||
2043 | |||
2044 | int Dtd_PreParse_get_debug (yyscan_t yyscanner) |
||
2045 | { |
||
2046 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2047 | return yy_flex_debug; |
||
2048 | } |
||
2049 | |||
2050 | void Dtd_PreParse_set_debug (int _bdebug , yyscan_t yyscanner) |
||
2051 | { |
||
2052 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2053 | yy_flex_debug = _bdebug ; |
||
2054 | } |
||
2055 | |||
2056 | /* Accessor methods for yylval and yylloc */ |
||
2057 | |||
2058 | /* User-visible API */ |
||
2059 | |||
2060 | /* Dtd_PreParse_lex_init is special because it creates the scanner itself, so it is |
||
2061 | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
||
2062 | * That's why we explicitly handle the declaration, instead of using our macros. |
||
2063 | */ |
||
2064 | |||
2065 | int Dtd_PreParse_lex_init(yyscan_t* ptr_yy_globals) |
||
2066 | |||
2067 | { |
||
2068 | if (ptr_yy_globals == NULL){ |
||
2069 | errno = EINVAL; |
||
2070 | return 1; |
||
2071 | } |
||
2072 | |||
2073 | *ptr_yy_globals = (yyscan_t) Dtd_PreParse_alloc ( sizeof( struct yyguts_t ), NULL ); |
||
2074 | |||
2075 | if (*ptr_yy_globals == NULL){ |
||
2076 | errno = ENOMEM; |
||
2077 | return 1; |
||
2078 | } |
||
2079 | |||
2080 | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
||
2081 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
||
2082 | |||
2083 | return yy_init_globals ( *ptr_yy_globals ); |
||
2084 | } |
||
2085 | |||
2086 | /* Dtd_PreParse_lex_init_extra has the same functionality as Dtd_PreParse_lex_init, but follows the |
||
2087 | * convention of taking the scanner as the last argument. Note however, that |
||
2088 | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
||
2089 | * is the reason, too, why this function also must handle its own declaration). |
||
2090 | * The user defined value in the first argument will be available to Dtd_PreParse_alloc in |
||
2091 | * the yyextra field. |
||
2092 | */ |
||
2093 | |||
2094 | int Dtd_PreParse_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) |
||
2095 | |||
2096 | { |
||
2097 | struct yyguts_t dummy_yyguts; |
||
2098 | |||
2099 | Dtd_PreParse_set_extra (yy_user_defined, &dummy_yyguts); |
||
2100 | |||
2101 | if (ptr_yy_globals == NULL){ |
||
2102 | errno = EINVAL; |
||
2103 | return 1; |
||
2104 | } |
||
2105 | |||
2106 | *ptr_yy_globals = (yyscan_t) Dtd_PreParse_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); |
||
2107 | |||
2108 | if (*ptr_yy_globals == NULL){ |
||
2109 | errno = ENOMEM; |
||
2110 | return 1; |
||
2111 | } |
||
2112 | |||
2113 | /* By setting to 0xAA, we expose bugs in |
||
2114 | yy_init_globals. Leave at 0x00 for releases. */ |
||
2115 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
||
2116 | |||
2117 | Dtd_PreParse_set_extra (yy_user_defined, *ptr_yy_globals); |
||
2118 | |||
2119 | return yy_init_globals ( *ptr_yy_globals ); |
||
2120 | } |
||
2121 | |||
2122 | static int yy_init_globals (yyscan_t yyscanner) |
||
2123 | { |
||
2124 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2125 | /* Initialization is the same as for the non-reentrant scanner. |
||
2126 | * This function is called from Dtd_PreParse_lex_destroy(), so don't allocate here. |
||
2127 | */ |
||
2128 | |||
2129 | yyg->yy_buffer_stack = 0; |
||
2130 | yyg->yy_buffer_stack_top = 0; |
||
2131 | yyg->yy_buffer_stack_max = 0; |
||
2132 | yyg->yy_c_buf_p = (char *) 0; |
||
2133 | yyg->yy_init = 0; |
||
2134 | yyg->yy_start = 0; |
||
2135 | |||
2136 | yyg->yy_start_stack_ptr = 0; |
||
2137 | yyg->yy_start_stack_depth = 0; |
||
2138 | yyg->yy_start_stack = NULL; |
||
2139 | |||
2140 | /* Defined in main.c */ |
||
2141 | #ifdef YY_STDINIT |
||
2142 | yyin = stdin; |
||
2143 | yyout = stdout; |
||
2144 | #else |
||
2145 | yyin = (FILE *) 0; |
||
2146 | yyout = (FILE *) 0; |
||
2147 | #endif |
||
2148 | |||
2149 | /* For future reference: Set errno on error, since we are called by |
||
2150 | * Dtd_PreParse_lex_init() |
||
2151 | */ |
||
2152 | return 0; |
||
2153 | } |
||
2154 | |||
2155 | /* Dtd_PreParse_lex_destroy is for both reentrant and non-reentrant scanners. */ |
||
2156 | int Dtd_PreParse_lex_destroy (yyscan_t yyscanner) |
||
2157 | { |
||
2158 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2159 | |||
2160 | /* Pop the buffer stack, destroying each element. */ |
||
2161 | while(YY_CURRENT_BUFFER){ |
||
2162 | Dtd_PreParse__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); |
||
2163 | YY_CURRENT_BUFFER_LVALUE = NULL; |
||
2164 | Dtd_PreParse_pop_buffer_state(yyscanner); |
||
2165 | } |
||
2166 | |||
2167 | /* Destroy the stack itself. */ |
||
2168 | Dtd_PreParse_free(yyg->yy_buffer_stack ,yyscanner); |
||
2169 | yyg->yy_buffer_stack = NULL; |
||
2170 | |||
2171 | /* Destroy the start condition stack. */ |
||
2172 | Dtd_PreParse_free(yyg->yy_start_stack ,yyscanner ); |
||
2173 | yyg->yy_start_stack = NULL; |
||
2174 | |||
2175 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
||
2176 | * Dtd_PreParse_lex() is called, initialization will occur. */ |
||
2177 | yy_init_globals( yyscanner); |
||
2178 | |||
2179 | /* Destroy the main struct (reentrant only). */ |
||
2180 | Dtd_PreParse_free ( yyscanner , yyscanner ); |
||
2181 | yyscanner = NULL; |
||
2182 | return 0; |
||
2183 | } |
||
2184 | |||
2185 | /* |
||
2186 | * Internal utility routines. |
||
2187 | */ |
||
2188 | |||
2189 | #ifndef yytext_ptr |
||
2190 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) |
||
2191 | { |
||
2192 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
||
2193 | (void)yyg; |
||
2194 | |||
2195 | int i; |
||
2196 | for ( i = 0; i < n; ++i ) |
||
2197 | s1[i] = s2[i]; |
||
2198 | } |
||
2199 | #endif |
||
2200 | |||
2201 | #ifdef YY_NEED_STRLEN |
||
2202 | static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) |
||
2203 | { |
||
2204 | int n; |
||
2205 | for ( n = 0; s[n]; ++n ) |
||
2206 | ; |
||
2207 | |||
2208 | return n; |
||
2209 | } |
||
2210 | #endif |
||
2211 | |||
2212 | #define YYTABLES_NAME "yytables" |
||
2213 | |||
2214 | #line 212 "dtd_preparse.l" |
||
2215 | |||
2216 | |||
2217 | |||
2218 | static const gchar* replace_entity(Dtd_PreParse_scanner_state_t* state, gchar* entity) { |
||
2219 | GString* replacement; |
||
2220 | |||
2221 | *entity = '%'; |
||
2222 | |||
2223 | replacement = (GString*)g_hash_table_lookup(state->entities,entity); |
||
2224 | |||
2225 | if (replacement) { |
||
2226 | return replacement->str; |
||
2227 | } else { |
||
2228 | g_string_append_printf(state->error,"dtd_preparse: in file '%s': entity %s does not exists\n", state->filename, entity); |
||
2229 | return ""; |
||
2230 | } |
||
2231 | |||
2232 | } |
||
2233 | |||
2234 | static const gchar* location(Dtd_PreParse_scanner_state_t* state) { |
||
2235 | static gchar* loc = NULL; |
||
2236 | |||
2237 | if (loc) g_free(loc); |
||
2238 | |||
2239 | loc = g_strdup_printf("<? wireshark:location %s:%u ?>", state->filename, state->linenum); |
||
2240 | |||
2241 | return loc; |
||
2242 | } |
||
2243 | |||
2244 | static gboolean free_gstring_hash_items(gpointer k,gpointer v,gpointer p _U_) { |
||
2245 | g_free(k); |
||
2246 | g_string_free((GString*)v,TRUE); |
||
2247 | return TRUE; |
||
2248 | } |
||
2249 | |||
2250 | extern GString* dtd_preparse(const gchar* dname,const gchar* fname, GString* err) { |
||
2251 | gchar* fullname = g_strdup_printf("%s%c%s",dname,G_DIR_SEPARATOR,fname); |
||
2252 | FILE *in; |
||
2253 | yyscan_t scanner; |
||
2254 | Dtd_PreParse_scanner_state_t state; |
||
2255 | |||
2256 | in = ws_fopen(fullname,"r"); |
||
2257 | |||
2258 | if (!in) { |
||
2259 | if (err) |
||
2260 | g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,g_strerror(errno)); |
||
2261 | |||
2262 | return NULL; |
||
2263 | } |
||
2264 | |||
2265 | if (Dtd_PreParse_lex_init(&scanner) != 0) { |
||
2266 | if (err) |
||
2267 | g_string_append_printf(err, "Can't initialize scanner: %s", |
||
2268 | strerror(errno)); |
||
2269 | fclose(in); |
||
2270 | return FALSE; |
||
2271 | } |
||
2272 | |||
2273 | Dtd_PreParse_set_in(in, scanner); |
||
2274 | |||
2275 | state.dtd_dirname = dname; |
||
2276 | state.filename = fname; |
||
2277 | state.linenum = 1; |
||
2278 | |||
2279 | state.error = err; |
||
2280 | |||
2281 | state.entities = g_hash_table_new(g_str_hash,g_str_equal); |
||
2282 | state.current = state.output = g_string_new(location(&state)); |
||
2283 | state.entity_name = NULL; |
||
2284 | |||
2285 | /* Associate the state with the scanner */ |
||
2286 | Dtd_PreParse_set_extra(&state, scanner); |
||
2287 | |||
2288 | Dtd_PreParse_lex(scanner); |
||
2289 | |||
2290 | Dtd_PreParse_lex_destroy(scanner); |
||
2291 | fclose(in); |
||
2292 | |||
2293 | g_hash_table_foreach_remove(state.entities,free_gstring_hash_items,NULL); |
||
2294 | g_hash_table_destroy(state.entities); |
||
2295 | |||
2296 | g_free(fullname); |
||
2297 | |||
2298 | return state.output; |
||
2299 | } |
||
2300 |