/work/build/epan/uat_load.c
Line | Count | Source (jump to first uncovered line) |
1 | | #line 2 "/work/build/epan/uat_load.c" |
2 | | /* Include this before everything else, for various large-file definitions */ |
3 | | #include "config.h" |
4 | 0 | #define WS_LOG_DOMAIN LOG_DOMAIN_UAT |
5 | | |
6 | | #include <wireshark.h> |
7 | | |
8 | | /* #define DEBUG_UAT_LOAD 1 */ |
9 | | |
10 | | #line 11 "/work/build/epan/uat_load.c" |
11 | | |
12 | | #define YY_INT_ALIGNED short int |
13 | | |
14 | | /* A lexical scanner generated by flex */ |
15 | | |
16 | | /* %not-for-header */ |
17 | | /* %if-c-only */ |
18 | | /* %if-not-reentrant */ |
19 | | /* %endif */ |
20 | | /* %endif */ |
21 | | /* %ok-for-header */ |
22 | | |
23 | | #define FLEX_SCANNER |
24 | | #define YY_FLEX_MAJOR_VERSION 2 |
25 | | #define YY_FLEX_MINOR_VERSION 6 |
26 | | #define YY_FLEX_SUBMINOR_VERSION 4 |
27 | | #if YY_FLEX_SUBMINOR_VERSION > 0 |
28 | | #define FLEX_BETA |
29 | | #endif |
30 | | |
31 | | /* %if-c++-only */ |
32 | | /* %endif */ |
33 | | |
34 | | /* %if-c-only */ |
35 | | #ifdef yy_create_buffer |
36 | | #define uat_load__create_buffer_ALREADY_DEFINED |
37 | | #else |
38 | 0 | #define yy_create_buffer uat_load__create_buffer |
39 | | #endif |
40 | | |
41 | | #ifdef yy_delete_buffer |
42 | | #define uat_load__delete_buffer_ALREADY_DEFINED |
43 | | #else |
44 | 0 | #define yy_delete_buffer uat_load__delete_buffer |
45 | | #endif |
46 | | |
47 | | #ifdef yy_scan_buffer |
48 | | #define uat_load__scan_buffer_ALREADY_DEFINED |
49 | | #else |
50 | 0 | #define yy_scan_buffer uat_load__scan_buffer |
51 | | #endif |
52 | | |
53 | | #ifdef yy_scan_string |
54 | | #define uat_load__scan_string_ALREADY_DEFINED |
55 | | #else |
56 | | #define yy_scan_string uat_load__scan_string |
57 | | #endif |
58 | | |
59 | | #ifdef yy_scan_bytes |
60 | | #define uat_load__scan_bytes_ALREADY_DEFINED |
61 | | #else |
62 | 0 | #define yy_scan_bytes uat_load__scan_bytes |
63 | | #endif |
64 | | |
65 | | #ifdef yy_init_buffer |
66 | | #define uat_load__init_buffer_ALREADY_DEFINED |
67 | | #else |
68 | 0 | #define yy_init_buffer uat_load__init_buffer |
69 | | #endif |
70 | | |
71 | | #ifdef yy_flush_buffer |
72 | | #define uat_load__flush_buffer_ALREADY_DEFINED |
73 | | #else |
74 | 0 | #define yy_flush_buffer uat_load__flush_buffer |
75 | | #endif |
76 | | |
77 | | #ifdef yy_load_buffer_state |
78 | | #define uat_load__load_buffer_state_ALREADY_DEFINED |
79 | | #else |
80 | 0 | #define yy_load_buffer_state uat_load__load_buffer_state |
81 | | #endif |
82 | | |
83 | | #ifdef yy_switch_to_buffer |
84 | | #define uat_load__switch_to_buffer_ALREADY_DEFINED |
85 | | #else |
86 | 0 | #define yy_switch_to_buffer uat_load__switch_to_buffer |
87 | | #endif |
88 | | |
89 | | #ifdef yypush_buffer_state |
90 | | #define uat_load_push_buffer_state_ALREADY_DEFINED |
91 | | #else |
92 | | #define yypush_buffer_state uat_load_push_buffer_state |
93 | | #endif |
94 | | |
95 | | #ifdef yypop_buffer_state |
96 | | #define uat_load_pop_buffer_state_ALREADY_DEFINED |
97 | | #else |
98 | 0 | #define yypop_buffer_state uat_load_pop_buffer_state |
99 | | #endif |
100 | | |
101 | | #ifdef yyensure_buffer_stack |
102 | | #define uat_load_ensure_buffer_stack_ALREADY_DEFINED |
103 | | #else |
104 | 0 | #define yyensure_buffer_stack uat_load_ensure_buffer_stack |
105 | | #endif |
106 | | |
107 | | #ifdef yylex |
108 | | #define uat_load_lex_ALREADY_DEFINED |
109 | | #else |
110 | | #define yylex uat_load_lex |
111 | | #endif |
112 | | |
113 | | #ifdef yyrestart |
114 | | #define uat_load_restart_ALREADY_DEFINED |
115 | | #else |
116 | 0 | #define yyrestart uat_load_restart |
117 | | #endif |
118 | | |
119 | | #ifdef yylex_init |
120 | | #define uat_load_lex_init_ALREADY_DEFINED |
121 | | #else |
122 | | #define yylex_init uat_load_lex_init |
123 | | #endif |
124 | | |
125 | | #ifdef yylex_init_extra |
126 | | #define uat_load_lex_init_extra_ALREADY_DEFINED |
127 | | #else |
128 | | #define yylex_init_extra uat_load_lex_init_extra |
129 | | #endif |
130 | | |
131 | | #ifdef yylex_destroy |
132 | | #define uat_load_lex_destroy_ALREADY_DEFINED |
133 | | #else |
134 | | #define yylex_destroy uat_load_lex_destroy |
135 | | #endif |
136 | | |
137 | | #ifdef yyget_debug |
138 | | #define uat_load_get_debug_ALREADY_DEFINED |
139 | | #else |
140 | | #define yyget_debug uat_load_get_debug |
141 | | #endif |
142 | | |
143 | | #ifdef yyset_debug |
144 | | #define uat_load_set_debug_ALREADY_DEFINED |
145 | | #else |
146 | | #define yyset_debug uat_load_set_debug |
147 | | #endif |
148 | | |
149 | | #ifdef yyget_extra |
150 | | #define uat_load_get_extra_ALREADY_DEFINED |
151 | | #else |
152 | | #define yyget_extra uat_load_get_extra |
153 | | #endif |
154 | | |
155 | | #ifdef yyset_extra |
156 | | #define uat_load_set_extra_ALREADY_DEFINED |
157 | | #else |
158 | 0 | #define yyset_extra uat_load_set_extra |
159 | | #endif |
160 | | |
161 | | #ifdef yyget_in |
162 | | #define uat_load_get_in_ALREADY_DEFINED |
163 | | #else |
164 | | #define yyget_in uat_load_get_in |
165 | | #endif |
166 | | |
167 | | #ifdef yyset_in |
168 | | #define uat_load_set_in_ALREADY_DEFINED |
169 | | #else |
170 | | #define yyset_in uat_load_set_in |
171 | | #endif |
172 | | |
173 | | #ifdef yyget_out |
174 | | #define uat_load_get_out_ALREADY_DEFINED |
175 | | #else |
176 | | #define yyget_out uat_load_get_out |
177 | | #endif |
178 | | |
179 | | #ifdef yyset_out |
180 | | #define uat_load_set_out_ALREADY_DEFINED |
181 | | #else |
182 | | #define yyset_out uat_load_set_out |
183 | | #endif |
184 | | |
185 | | #ifdef yyget_leng |
186 | | #define uat_load_get_leng_ALREADY_DEFINED |
187 | | #else |
188 | | #define yyget_leng uat_load_get_leng |
189 | | #endif |
190 | | |
191 | | #ifdef yyget_text |
192 | | #define uat_load_get_text_ALREADY_DEFINED |
193 | | #else |
194 | | #define yyget_text uat_load_get_text |
195 | | #endif |
196 | | |
197 | | #ifdef yyget_lineno |
198 | | #define uat_load_get_lineno_ALREADY_DEFINED |
199 | | #else |
200 | | #define yyget_lineno uat_load_get_lineno |
201 | | #endif |
202 | | |
203 | | #ifdef yyset_lineno |
204 | | #define uat_load_set_lineno_ALREADY_DEFINED |
205 | | #else |
206 | | #define yyset_lineno uat_load_set_lineno |
207 | | #endif |
208 | | |
209 | | #ifdef yyget_column |
210 | | #define uat_load_get_column_ALREADY_DEFINED |
211 | | #else |
212 | | #define yyget_column uat_load_get_column |
213 | | #endif |
214 | | |
215 | | #ifdef yyset_column |
216 | | #define uat_load_set_column_ALREADY_DEFINED |
217 | | #else |
218 | | #define yyset_column uat_load_set_column |
219 | | #endif |
220 | | |
221 | | #ifdef yywrap |
222 | | #define uat_load_wrap_ALREADY_DEFINED |
223 | | #else |
224 | 0 | #define yywrap uat_load_wrap |
225 | | #endif |
226 | | |
227 | | /* %endif */ |
228 | | |
229 | | #ifdef yyalloc |
230 | | #define uat_load_alloc_ALREADY_DEFINED |
231 | | #else |
232 | 0 | #define yyalloc uat_load_alloc |
233 | | #endif |
234 | | |
235 | | #ifdef yyrealloc |
236 | | #define uat_load_realloc_ALREADY_DEFINED |
237 | | #else |
238 | 0 | #define yyrealloc uat_load_realloc |
239 | | #endif |
240 | | |
241 | | #ifdef yyfree |
242 | | #define uat_load_free_ALREADY_DEFINED |
243 | | #else |
244 | 0 | #define yyfree uat_load_free |
245 | | #endif |
246 | | |
247 | | /* %if-c-only */ |
248 | | |
249 | | /* %endif */ |
250 | | |
251 | | /* First, we deal with platform-specific or compiler-specific issues. */ |
252 | | |
253 | | /* begin standard C headers. */ |
254 | | /* %if-c-only */ |
255 | | #include <stdio.h> |
256 | | #include <string.h> |
257 | | #include <errno.h> |
258 | | #include <stdlib.h> |
259 | | /* %endif */ |
260 | | |
261 | | /* %if-tables-serialization */ |
262 | | /* %endif */ |
263 | | /* end standard C headers. */ |
264 | | |
265 | | /* %if-c-or-c++ */ |
266 | | /* flex integer type definitions */ |
267 | | |
268 | | #ifndef FLEXINT_H |
269 | | #define FLEXINT_H |
270 | | |
271 | | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
272 | | |
273 | | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
274 | | |
275 | | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
276 | | * if you want the limit (max/min) macros for int types. |
277 | | */ |
278 | | #ifndef __STDC_LIMIT_MACROS |
279 | | #define __STDC_LIMIT_MACROS 1 |
280 | | #endif |
281 | | |
282 | | #include <inttypes.h> |
283 | | typedef int8_t flex_int8_t; |
284 | | typedef uint8_t flex_uint8_t; |
285 | | typedef int16_t flex_int16_t; |
286 | | typedef uint16_t flex_uint16_t; |
287 | | typedef int32_t flex_int32_t; |
288 | | typedef uint32_t flex_uint32_t; |
289 | | #else |
290 | | typedef signed char flex_int8_t; |
291 | | typedef short int flex_int16_t; |
292 | | typedef int flex_int32_t; |
293 | | typedef unsigned char flex_uint8_t; |
294 | | typedef unsigned short int flex_uint16_t; |
295 | | typedef unsigned int flex_uint32_t; |
296 | | |
297 | | /* Limits of integral types. */ |
298 | | #ifndef INT8_MIN |
299 | | #define INT8_MIN (-128) |
300 | | #endif |
301 | | #ifndef INT16_MIN |
302 | | #define INT16_MIN (-32767-1) |
303 | | #endif |
304 | | #ifndef INT32_MIN |
305 | | #define INT32_MIN (-2147483647-1) |
306 | | #endif |
307 | | #ifndef INT8_MAX |
308 | | #define INT8_MAX (127) |
309 | | #endif |
310 | | #ifndef INT16_MAX |
311 | | #define INT16_MAX (32767) |
312 | | #endif |
313 | | #ifndef INT32_MAX |
314 | | #define INT32_MAX (2147483647) |
315 | | #endif |
316 | | #ifndef UINT8_MAX |
317 | | #define UINT8_MAX (255U) |
318 | | #endif |
319 | | #ifndef UINT16_MAX |
320 | | #define UINT16_MAX (65535U) |
321 | | #endif |
322 | | #ifndef UINT32_MAX |
323 | | #define UINT32_MAX (4294967295U) |
324 | | #endif |
325 | | |
326 | | #ifndef SIZE_MAX |
327 | | #define SIZE_MAX (~(size_t)0) |
328 | | #endif |
329 | | |
330 | | #endif /* ! C99 */ |
331 | | |
332 | | #endif /* ! FLEXINT_H */ |
333 | | |
334 | | /* %endif */ |
335 | | |
336 | | /* begin standard C++ headers. */ |
337 | | /* %if-c++-only */ |
338 | | /* %endif */ |
339 | | |
340 | | /* TODO: this is always defined, so inline it */ |
341 | | #define yyconst const |
342 | | |
343 | | #if defined(__GNUC__) && __GNUC__ >= 3 |
344 | | #define yynoreturn __attribute__((__noreturn__)) |
345 | | #else |
346 | | #define yynoreturn |
347 | | #endif |
348 | | |
349 | | /* %not-for-header */ |
350 | | /* Returned upon end-of-file. */ |
351 | 0 | #define YY_NULL 0 |
352 | | /* %ok-for-header */ |
353 | | |
354 | | /* %not-for-header */ |
355 | | /* Promotes a possibly negative, possibly signed char to an |
356 | | * integer in range [0..255] for use as an array index. |
357 | | */ |
358 | 0 | #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) |
359 | | /* %ok-for-header */ |
360 | | |
361 | | /* %if-reentrant */ |
362 | | |
363 | | /* An opaque pointer. */ |
364 | | #ifndef YY_TYPEDEF_YY_SCANNER_T |
365 | | #define YY_TYPEDEF_YY_SCANNER_T |
366 | | typedef void* yyscan_t; |
367 | | #endif |
368 | | |
369 | | /* For convenience, these vars (plus the bison vars far below) |
370 | | are macros in the reentrant scanner. */ |
371 | 0 | #define yyin yyg->yyin_r |
372 | 0 | #define yyout yyg->yyout_r |
373 | 0 | #define yyextra yyg->yyextra_r |
374 | 0 | #define yyleng yyg->yyleng_r |
375 | 0 | #define yytext yyg->yytext_r |
376 | 0 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
377 | 0 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
378 | 0 | #define yy_flex_debug yyg->yy_flex_debug_r |
379 | | |
380 | | /* %endif */ |
381 | | |
382 | | /* %if-not-reentrant */ |
383 | | /* %endif */ |
384 | | |
385 | | /* Enter a start condition. This macro really ought to take a parameter, |
386 | | * but we do it the disgusting crufty way forced on us by the ()-less |
387 | | * definition of BEGIN. |
388 | | */ |
389 | 0 | #define BEGIN yyg->yy_start = 1 + 2 * |
390 | | /* Translate the current start state into a value that can be later handed |
391 | | * to BEGIN to return to the state. The YYSTATE alias is for lex |
392 | | * compatibility. |
393 | | */ |
394 | | #define YY_START ((yyg->yy_start - 1) / 2) |
395 | | #define YYSTATE YY_START |
396 | | /* Action number for EOF rule of a given start state. */ |
397 | 0 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
398 | | /* Special action meaning "start processing a new file". */ |
399 | 0 | #define YY_NEW_FILE yyrestart( yyin , yyscanner ) |
400 | 0 | #define YY_END_OF_BUFFER_CHAR 0 |
401 | | |
402 | | /* Size of default input buffer. */ |
403 | | #ifndef YY_BUF_SIZE |
404 | | #ifdef __ia64__ |
405 | | /* On IA-64, the buffer size is 16k, not 8k. |
406 | | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
407 | | * Ditto for the __ia64__ case accordingly. |
408 | | */ |
409 | | #define YY_BUF_SIZE 32768 |
410 | | #else |
411 | 0 | #define YY_BUF_SIZE 16384 |
412 | | #endif /* __ia64__ */ |
413 | | #endif |
414 | | |
415 | | /* The state buf must be large enough to hold one state per character in the main buffer. |
416 | | */ |
417 | | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
418 | | |
419 | | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
420 | | #define YY_TYPEDEF_YY_BUFFER_STATE |
421 | | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
422 | | #endif |
423 | | |
424 | | #ifndef YY_TYPEDEF_YY_SIZE_T |
425 | | #define YY_TYPEDEF_YY_SIZE_T |
426 | | typedef size_t yy_size_t; |
427 | | #endif |
428 | | |
429 | | /* %if-not-reentrant */ |
430 | | /* %endif */ |
431 | | |
432 | | /* %if-c-only */ |
433 | | /* %if-not-reentrant */ |
434 | | /* %endif */ |
435 | | /* %endif */ |
436 | | |
437 | 0 | #define EOB_ACT_CONTINUE_SCAN 0 |
438 | 0 | #define EOB_ACT_END_OF_FILE 1 |
439 | 0 | #define EOB_ACT_LAST_MATCH 2 |
440 | | |
441 | | #define YY_LESS_LINENO(n) |
442 | | #define YY_LINENO_REWIND_TO(ptr) |
443 | | |
444 | | /* Return all but the first "n" matched characters back to the input stream. */ |
445 | | #define yyless(n) \ |
446 | 0 | do \ |
447 | 0 | { \ |
448 | 0 | /* Undo effects of setting up yytext. */ \ |
449 | 0 | int yyless_macro_arg = (n); \ |
450 | 0 | YY_LESS_LINENO(yyless_macro_arg);\ |
451 | 0 | *yy_cp = yyg->yy_hold_char; \ |
452 | 0 | YY_RESTORE_YY_MORE_OFFSET \ |
453 | 0 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
454 | 0 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
455 | 0 | } \ |
456 | 0 | while ( 0 ) |
457 | | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) |
458 | | |
459 | | #ifndef YY_STRUCT_YY_BUFFER_STATE |
460 | | #define YY_STRUCT_YY_BUFFER_STATE |
461 | | struct yy_buffer_state |
462 | | { |
463 | | /* %if-c-only */ |
464 | | FILE *yy_input_file; |
465 | | /* %endif */ |
466 | | |
467 | | /* %if-c++-only */ |
468 | | /* %endif */ |
469 | | |
470 | | char *yy_ch_buf; /* input buffer */ |
471 | | char *yy_buf_pos; /* current position in input buffer */ |
472 | | |
473 | | /* Size of input buffer in bytes, not including room for EOB |
474 | | * characters. |
475 | | */ |
476 | | int yy_buf_size; |
477 | | |
478 | | /* Number of characters read into yy_ch_buf, not including EOB |
479 | | * characters. |
480 | | */ |
481 | | int yy_n_chars; |
482 | | |
483 | | /* Whether we "own" the buffer - i.e., we know we created it, |
484 | | * and can realloc() it to grow it, and should free() it to |
485 | | * delete it. |
486 | | */ |
487 | | int yy_is_our_buffer; |
488 | | |
489 | | /* Whether this is an "interactive" input source; if so, and |
490 | | * if we're using stdio for input, then we want to use getc() |
491 | | * instead of fread(), to make sure we stop fetching input after |
492 | | * each newline. |
493 | | */ |
494 | | int yy_is_interactive; |
495 | | |
496 | | /* Whether we're considered to be at the beginning of a line. |
497 | | * If so, '^' rules will be active on the next match, otherwise |
498 | | * not. |
499 | | */ |
500 | | int yy_at_bol; |
501 | | |
502 | | int yy_bs_lineno; /**< The line count. */ |
503 | | int yy_bs_column; /**< The column count. */ |
504 | | |
505 | | /* Whether to try to fill the input buffer when we reach the |
506 | | * end of it. |
507 | | */ |
508 | | int yy_fill_buffer; |
509 | | |
510 | | int yy_buffer_status; |
511 | | |
512 | 0 | #define YY_BUFFER_NEW 0 |
513 | 0 | #define YY_BUFFER_NORMAL 1 |
514 | | /* When an EOF's been seen but there's still some text to process |
515 | | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
516 | | * shouldn't try reading from the input source any more. We might |
517 | | * still have a bunch of tokens to match, though, because of |
518 | | * possible backing-up. |
519 | | * |
520 | | * When we actually see the EOF, we change the status to "new" |
521 | | * (via yyrestart()), so that the user can continue scanning by |
522 | | * just pointing yyin at a new input file. |
523 | | */ |
524 | 0 | #define YY_BUFFER_EOF_PENDING 2 |
525 | | |
526 | | }; |
527 | | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
528 | | |
529 | | /* %if-c-only Standard (non-C++) definition */ |
530 | | /* %not-for-header */ |
531 | | /* %if-not-reentrant */ |
532 | | /* %endif */ |
533 | | /* %ok-for-header */ |
534 | | |
535 | | /* %endif */ |
536 | | |
537 | | /* We provide macros for accessing buffer states in case in the |
538 | | * future we want to put the buffer states in a more general |
539 | | * "scanner state". |
540 | | * |
541 | | * Returns the top of the stack, or NULL. |
542 | | */ |
543 | 0 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ |
544 | 0 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ |
545 | 0 | : NULL) |
546 | | /* Same as previous macro, but useful when we know that the buffer stack is not |
547 | | * NULL or when we need an lvalue. For internal use only. |
548 | | */ |
549 | 0 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
550 | | |
551 | | /* %if-c-only Standard (non-C++) definition */ |
552 | | |
553 | | /* %if-not-reentrant */ |
554 | | /* %not-for-header */ |
555 | | /* %ok-for-header */ |
556 | | |
557 | | /* %endif */ |
558 | | |
559 | | void yyrestart ( FILE *input_file , yyscan_t yyscanner ); |
560 | | void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
561 | | YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); |
562 | | void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
563 | | void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
564 | | void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
565 | | void yypop_buffer_state ( yyscan_t yyscanner ); |
566 | | |
567 | | static void yyensure_buffer_stack ( yyscan_t yyscanner ); |
568 | | static void yy_load_buffer_state ( yyscan_t yyscanner ); |
569 | | static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); |
570 | | #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) |
571 | | |
572 | | YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); |
573 | | YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); |
574 | | YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); |
575 | | |
576 | | /* %endif */ |
577 | | |
578 | | void *yyalloc ( yy_size_t , yyscan_t yyscanner ); |
579 | | void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); |
580 | | void yyfree ( void * , yyscan_t yyscanner ); |
581 | | |
582 | | #define yy_new_buffer yy_create_buffer |
583 | | #define yy_set_interactive(is_interactive) \ |
584 | | { \ |
585 | | if ( ! YY_CURRENT_BUFFER ){ \ |
586 | | yyensure_buffer_stack (yyscanner); \ |
587 | | YY_CURRENT_BUFFER_LVALUE = \ |
588 | | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
589 | | } \ |
590 | | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
591 | | } |
592 | | #define yy_set_bol(at_bol) \ |
593 | | { \ |
594 | | if ( ! YY_CURRENT_BUFFER ){\ |
595 | | yyensure_buffer_stack (yyscanner); \ |
596 | | YY_CURRENT_BUFFER_LVALUE = \ |
597 | | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
598 | | } \ |
599 | | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
600 | | } |
601 | | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
602 | | |
603 | | /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ |
604 | | /* Begin user sect3 */ |
605 | | |
606 | 0 | #define uat_load_wrap(yyscanner) (/*CONSTCOND*/1) |
607 | | #define YY_SKIP_YYWRAP |
608 | | |
609 | | #define FLEX_DEBUG |
610 | | typedef flex_uint8_t YY_CHAR; |
611 | | |
612 | | typedef int yy_state_type; |
613 | | |
614 | 0 | #define yytext_ptr yytext_r |
615 | | |
616 | | /* %% [1.5] DFA */ |
617 | | |
618 | | /* %if-c-only Standard (non-C++) definition */ |
619 | | |
620 | | static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); |
621 | | static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); |
622 | | static int yy_get_next_buffer ( yyscan_t yyscanner ); |
623 | | static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); |
624 | | |
625 | | /* %endif */ |
626 | | |
627 | | /* Done after the current pattern has been matched and before the |
628 | | * corresponding action - sets up yytext. |
629 | | */ |
630 | | #define YY_DO_BEFORE_ACTION \ |
631 | 0 | yyg->yytext_ptr = yy_bp; \ |
632 | 0 | /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ |
633 | 0 | yyleng = (int) (yy_cp - yy_bp); \ |
634 | 0 | yyg->yy_hold_char = *yy_cp; \ |
635 | 0 | *yy_cp = '\0'; \ |
636 | 0 | /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ |
637 | 0 | yyg->yy_c_buf_p = yy_cp; |
638 | | /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ |
639 | | #define YY_NUM_RULES 18 |
640 | 0 | #define YY_END_OF_BUFFER 19 |
641 | | /* This struct is not used in this scanner, |
642 | | but its presence is necessary. */ |
643 | | struct yy_trans_info |
644 | | { |
645 | | flex_int32_t yy_verify; |
646 | | flex_int32_t yy_nxt; |
647 | | }; |
648 | | static const flex_int16_t yy_accept[76] = |
649 | | { 0, |
650 | | 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, |
651 | | 0, 0, 19, 17, 17, 16, 17, 18, 1, 2, |
652 | | 18, 18, 18, 4, 18, 1, 5, 18, 10, 10, |
653 | | 9, 10, 8, 13, 13, 12, 13, 13, 15, 15, |
654 | | 14, 15, 0, 16, 0, 1, 2, 0, 4, 0, |
655 | | 6, 0, 0, 3, 7, 1, 5, 0, 0, 9, |
656 | | 0, 8, 0, 12, 0, 0, 0, 0, 14, 0, |
657 | | 6, 0, 0, 11, 0 |
658 | | } ; |
659 | | |
660 | | static const YY_CHAR yy_ec[256] = |
661 | | { 0, |
662 | | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
663 | | 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, |
664 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
665 | | 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, |
666 | | 1, 1, 1, 7, 1, 1, 1, 8, 8, 8, |
667 | | 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, |
668 | | 1, 1, 1, 1, 8, 8, 8, 8, 8, 8, |
669 | | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
670 | | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
671 | | 1, 9, 1, 1, 1, 1, 8, 8, 8, 8, |
672 | | |
673 | | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
674 | | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
675 | | 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, |
676 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
677 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
678 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
679 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
680 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
681 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
682 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
683 | | |
684 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
685 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
686 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
687 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
688 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
689 | | 1, 1, 1, 1, 1 |
690 | | } ; |
691 | | |
692 | | static const YY_CHAR yy_meta[10] = |
693 | | { 0, |
694 | | 1, 1, 2, 1, 1, 1, 1, 1, 1 |
695 | | } ; |
696 | | |
697 | | static const flex_int16_t yy_base[81] = |
698 | | { 0, |
699 | | 0, 3, 7, 0, 15, 0, 21, 0, 30, 0, |
700 | | 38, 41, 102, 103, 44, 103, 98, 103, 47, 103, |
701 | | 97, 50, 96, 103, 90, 58, 103, 94, 103, 64, |
702 | | 103, 93, 103, 103, 70, 103, 92, 89, 103, 76, |
703 | | 103, 81, 0, 103, 80, 0, 103, 79, 103, 76, |
704 | | 103, 71, 72, 103, 62, 0, 103, 66, 0, 103, |
705 | | 61, 103, 0, 103, 60, 53, 52, 0, 103, 53, |
706 | | 0, 45, 47, 15, 103, 85, 87, 89, 91, 0 |
707 | | } ; |
708 | | |
709 | | static const flex_int16_t yy_def[81] = |
710 | | { 0, |
711 | | 76, 76, 75, 3, 3, 5, 75, 7, 75, 9, |
712 | | 77, 77, 75, 75, 75, 75, 75, 75, 75, 75, |
713 | | 75, 78, 79, 75, 75, 75, 75, 75, 75, 75, |
714 | | 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, |
715 | | 75, 75, 15, 75, 75, 19, 75, 75, 75, 78, |
716 | | 75, 50, 79, 75, 75, 26, 75, 75, 30, 75, |
717 | | 75, 75, 35, 75, 75, 75, 80, 40, 75, 75, |
718 | | 50, 75, 80, 80, 0, 75, 75, 75, 75, 75 |
719 | | } ; |
720 | | |
721 | | static const flex_int16_t yy_nxt[113] = |
722 | | { 0, |
723 | | 73, 15, 16, 17, 15, 16, 17, 18, 19, 20, |
724 | | 21, 22, 23, 24, 25, 18, 26, 27, 28, 74, |
725 | | 18, 29, 30, 31, 32, 29, 29, 33, 29, 29, |
726 | | 34, 35, 36, 37, 34, 34, 38, 34, 34, 40, |
727 | | 41, 42, 40, 41, 42, 43, 44, 45, 46, 47, |
728 | | 48, 74, 55, 49, 51, 69, 74, 67, 52, 56, |
729 | | 57, 58, 64, 60, 49, 59, 60, 61, 57, 72, |
730 | | 62, 63, 64, 65, 54, 71, 66, 68, 69, 70, |
731 | | 51, 47, 44, 69, 52, 14, 14, 39, 39, 50, |
732 | | 50, 53, 53, 67, 64, 60, 57, 55, 54, 47, |
733 | | |
734 | | 44, 75, 13, 75, 75, 75, 75, 75, 75, 75, |
735 | | 75, 75 |
736 | | } ; |
737 | | |
738 | | static const flex_int16_t yy_chk[113] = |
739 | | { 0, |
740 | | 80, 1, 1, 1, 2, 2, 2, 3, 3, 3, |
741 | | 3, 3, 3, 3, 3, 3, 5, 5, 5, 74, |
742 | | 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
743 | | 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, |
744 | | 11, 11, 12, 12, 12, 15, 15, 15, 19, 19, |
745 | | 19, 73, 72, 19, 22, 70, 67, 66, 22, 26, |
746 | | 26, 26, 65, 61, 26, 30, 30, 30, 58, 55, |
747 | | 30, 35, 35, 35, 53, 52, 35, 40, 40, 40, |
748 | | 50, 48, 45, 42, 50, 76, 76, 77, 77, 78, |
749 | | 78, 79, 79, 38, 37, 32, 28, 25, 23, 21, |
750 | | |
751 | | 17, 13, 75, 75, 75, 75, 75, 75, 75, 75, |
752 | | 75, 75 |
753 | | } ; |
754 | | |
755 | | static const flex_int16_t yy_rule_linenum[18] = |
756 | | { 0, |
757 | | 230, 231, 232, 234, 249, 258, 271, 287, 300, 334, |
758 | | 338, 344, 379, 383, 384, 386, 387 |
759 | | } ; |
760 | | |
761 | | /* The intent behind this definition is that it'll catch |
762 | | * any uses of REJECT which flex missed. |
763 | | */ |
764 | | #define REJECT reject_used_but_not_detected |
765 | | #define yymore() yymore_used_but_not_detected |
766 | 0 | #define YY_MORE_ADJ 0 |
767 | | #define YY_RESTORE_YY_MORE_OFFSET |
768 | | #line 1 "/src/wireshark/epan/uat_load.l" |
769 | | |
770 | | /* |
771 | | * We want a reentrant scanner. |
772 | | */ |
773 | | /* |
774 | | * We don't use input, so don't generate code for it. |
775 | | */ |
776 | | #define YY_NO_INPUT 1 |
777 | | /* |
778 | | * We don't use unput, so don't generate code for it. |
779 | | */ |
780 | | /* |
781 | | * We don't read interactively from the terminal. |
782 | | */ |
783 | | /* |
784 | | * We want to stop processing when we get to the end of the input. |
785 | | */ |
786 | | /* |
787 | | * The type for the state we keep for a scanner. |
788 | | */ |
789 | | /* |
790 | | * We have to override the memory allocators so that we don't get |
791 | | * "unused argument" warnings from the yyscanner argument (which |
792 | | * we don't use, as we have a global memory allocator). |
793 | | * |
794 | | * We provide, as macros, our own versions of the routines generated by Flex, |
795 | | * which just call malloc()/realloc()/free() (as the Flex versions do), |
796 | | * discarding the extra argument. |
797 | | */ |
798 | | /* |
799 | | * Prefix scanner routines with "uat_load_" rather than "yy", so this scanner |
800 | | * can coexist with other scanners. |
801 | | */ |
802 | | #line 61 "/src/wireshark/epan/uat_load.l" |
803 | | /* |
804 | | * uat_load.l |
805 | | * |
806 | | * User Accessible Tables |
807 | | * Maintain an array of user accessible data strucures |
808 | | * One parser to fit them all |
809 | | * |
810 | | * (c) 2007, Luis E. Garcia Ontanon <luis@ontanon.org> |
811 | | * |
812 | | * Wireshark - Network traffic analyzer |
813 | | * By Gerald Combs <gerald@wireshark.org> |
814 | | * Copyright 2001 Gerald Combs |
815 | | * |
816 | | * This program is free software; you can redistribute it and/or |
817 | | * modify it under the terms of the GNU General Public License |
818 | | * as published by the Free Software Foundation; either version 2 |
819 | | * of the License, or (at your option) any later version. |
820 | | * |
821 | | * This program is distributed in the hope that it will be useful, |
822 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
823 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
824 | | * GNU General Public License for more details. |
825 | | * |
826 | | * You should have received a copy of the GNU General Public License |
827 | | * along with this program; if not, write to the Free Software |
828 | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
829 | | */ |
830 | | #include <stdlib.h> |
831 | | #include <stdio.h> |
832 | | #include <string.h> |
833 | | #include <errno.h> |
834 | | |
835 | | #include <glib.h> |
836 | | |
837 | | #include "uat-int.h" |
838 | | #include <wsutil/file_util.h> |
839 | | |
840 | | /* |
841 | | * Disable diagnostics in the code generated by Flex. |
842 | | */ |
843 | | DIAG_OFF_FLEX() |
844 | | |
845 | | typedef struct { |
846 | | uat_t* uat; |
847 | | char *parse_str; |
848 | | |
849 | | char* error; |
850 | | bool valid_record; |
851 | | unsigned colnum; |
852 | | char* ptrx; |
853 | | unsigned len; |
854 | | void* record; |
855 | | unsigned linenum; |
856 | | size_t parse_str_pos; |
857 | | } uat_load_scanner_state_t; |
858 | | |
859 | | /* |
860 | | * Signal a fatal error and stops parsing. |
861 | | * Since the record is internal to the parsing process, its contents must also |
862 | | * be cleared before terminating. Any values that are not handled yet (ptrx) |
863 | | * must also be freed. |
864 | | */ |
865 | 0 | #define ERROR(fmtd) do { \ |
866 | 0 | char* fmt_str = ws_strdup_printf fmtd; \ |
867 | 0 | g_free(yyextra->error); \ |
868 | 0 | yyextra->error = ws_strdup_printf("%s:%d: %s",yyextra->uat->filename,yyextra->linenum,fmt_str); \ |
869 | 0 | g_free(fmt_str); \ |
870 | 0 | if (yyextra->uat->free_cb) { \ |
871 | 0 | yyextra->uat->free_cb(yyextra->record); \ |
872 | 0 | } \ |
873 | 0 | g_free(yyextra->ptrx); \ |
874 | 0 | yyterminate(); \ |
875 | 0 | } while(0) |
876 | | |
877 | | /* |
878 | | * Sets the field of the current (scanner-internal) record, using the parsed |
879 | | * value. If the field validation function exists and returns an error, then |
880 | | * the record is marked as invalid and an error message is stored such that it |
881 | | * can be shown after parsing. (If other errors occur after this issue, then |
882 | | * this message will be overwritten though.) |
883 | | */ |
884 | | #define SET_FIELD() \ |
885 | 0 | { char* errx; \ |
886 | 0 | if (yyextra->uat->fields[yyextra->colnum].cb.chk) { \ |
887 | 0 | if ( ! yyextra->uat->fields[yyextra->colnum].cb.chk(yyextra->record, yyextra->ptrx, yyextra->len, yyextra->uat->fields[yyextra->colnum].cbdata.chk, yyextra->uat->fields[yyextra->colnum].fld_data, &errx) ) { \ |
888 | 0 | g_free(yyextra->error); \ |
889 | 0 | yyextra->error = ws_strdup_printf("%s:%d: %s",yyextra->uat->filename,yyextra->linenum,errx); \ |
890 | 0 | g_free(errx); \ |
891 | 0 | yyextra->valid_record = false; \ |
892 | 0 | }\ |
893 | 0 | }\ |
894 | 0 | yyextra->uat->fields[yyextra->colnum].cb.set(yyextra->record, yyextra->ptrx, yyextra->len, yyextra->uat->fields[yyextra->colnum].cbdata.set, yyextra->uat->fields[yyextra->colnum].fld_data);\ |
895 | 0 | g_free(yyextra->ptrx);\ |
896 | 0 | yyextra->ptrx = NULL;\ |
897 | 0 | yyextra->colnum++; \ |
898 | 0 | } while(0) |
899 | | |
900 | | #ifdef DEBUG_UAT_LOAD |
901 | | #define DUMP_FIELD(str) \ |
902 | | { unsigned i; printf("%s: %s='",str,yyextra->uat->fields[yyextra->colnum].name); for(i=0;i<yyextra->len;i++) if (yyextra->uat->fields[yyextra->colnum].mode == PT_TXTMOD_HEXBYTES) { printf("%.2x ",((uint8_t*)yyextra->ptrx)[i]); } else putc(yyextra->ptrx[i],stdout); printf("'[%d]\n",yyextra->len); } |
903 | | |
904 | | #define DUMP(str) printf("%s\n",str) |
905 | | #else |
906 | | #define DUMP_FIELD(s) |
907 | | #define DUMP(s) |
908 | | #endif |
909 | | |
910 | | /* Modified version of YY_INPUT generated by Flex 2.91 */ |
911 | | #define YY_INPUT(buf,result,max_size) \ |
912 | 0 | if ( yyextra->parse_str ) \ |
913 | 0 | { \ |
914 | 0 | size_t n = 0; \ |
915 | 0 | size_t pslen = strlen(yyextra->parse_str); \ |
916 | 0 | if (yyextra->parse_str_pos < pslen) \ |
917 | 0 | { \ |
918 | 0 | n = pslen - yyextra->parse_str_pos; \ |
919 | 0 | if (n > max_size) n = max_size; \ |
920 | 0 | memcpy(buf, yyextra->parse_str + yyextra->parse_str_pos, n); \ |
921 | 0 | yyextra->parse_str_pos += n; \ |
922 | 0 | } \ |
923 | 0 | result = n; \ |
924 | 0 | } \ |
925 | 0 | else \ |
926 | 0 | { \ |
927 | 0 | errno=0; \ |
928 | 0 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ |
929 | 0 | { \ |
930 | 0 | if( errno != EINTR) \ |
931 | 0 | { \ |
932 | 0 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
933 | 0 | break; \ |
934 | 0 | } \ |
935 | 0 | errno=0; \ |
936 | 0 | clearerr(yyin); \ |
937 | 0 | } \ |
938 | 0 | } |
939 | | |
940 | | /* |
941 | | * XXX |
942 | | * quoted_string below fails badly on "...\\" |
943 | | * workarround in uat_save(), using /x5c and /x22 |
944 | | */ |
945 | | |
946 | 0 | #define YY_USER_INIT BEGIN START_OF_LINE; |
947 | | |
948 | | /* |
949 | | * Sleazy hack to suppress compiler warnings in yy_fatal_error(). |
950 | | */ |
951 | 0 | #define YY_EXIT_FAILURE ((void)yyscanner, 2) |
952 | | |
953 | | /* |
954 | | * Macros for the allocators, to discard the extra argument. |
955 | | */ |
956 | 0 | #define uat_load_alloc(size, yyscanner) (void *)malloc(size) |
957 | 0 | #define uat_load_realloc(ptr, size, yyscanner) (void *)realloc((char *)(ptr), (size)) |
958 | 0 | #define uat_load_free(ptr, yyscanner) free((char *)ptr) |
959 | | |
960 | | #line 961 "/work/build/epan/uat_load.c" |
961 | | |
962 | | #line 963 "/work/build/epan/uat_load.c" |
963 | | |
964 | | #define INITIAL 0 |
965 | 0 | #define START_OF_LINE 1 |
966 | 0 | #define NEXT_FIELD 2 |
967 | 0 | #define SEPARATOR 3 |
968 | 0 | #define END_OF_RECORD 4 |
969 | | #define ERRORED 5 |
970 | | |
971 | | #ifndef YY_NO_UNISTD_H |
972 | | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
973 | | * down here because we want the user's section 1 to have been scanned first. |
974 | | * The user has a chance to override it with an option. |
975 | | */ |
976 | | /* %if-c-only */ |
977 | | #include <unistd.h> |
978 | | /* %endif */ |
979 | | /* %if-c++-only */ |
980 | | /* %endif */ |
981 | | #endif |
982 | | |
983 | | #define YY_EXTRA_TYPE uat_load_scanner_state_t * |
984 | | |
985 | | /* %if-c-only Reentrant structure and macros (non-C++). */ |
986 | | /* %if-reentrant */ |
987 | | |
988 | | /* Holds the entire state of the reentrant scanner. */ |
989 | | struct yyguts_t |
990 | | { |
991 | | |
992 | | /* User-defined. Not touched by flex. */ |
993 | | YY_EXTRA_TYPE yyextra_r; |
994 | | |
995 | | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
996 | | FILE *yyin_r, *yyout_r; |
997 | | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
998 | | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
999 | | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ |
1000 | | char yy_hold_char; |
1001 | | int yy_n_chars; |
1002 | | int yyleng_r; |
1003 | | char *yy_c_buf_p; |
1004 | | int yy_init; |
1005 | | int yy_start; |
1006 | | int yy_did_buffer_switch_on_eof; |
1007 | | int yy_start_stack_ptr; |
1008 | | int yy_start_stack_depth; |
1009 | | int *yy_start_stack; |
1010 | | yy_state_type yy_last_accepting_state; |
1011 | | char* yy_last_accepting_cpos; |
1012 | | |
1013 | | int yylineno_r; |
1014 | | int yy_flex_debug_r; |
1015 | | |
1016 | | char *yytext_r; |
1017 | | int yy_more_flag; |
1018 | | int yy_more_len; |
1019 | | |
1020 | | }; /* end struct yyguts_t */ |
1021 | | |
1022 | | /* %if-c-only */ |
1023 | | |
1024 | | static int yy_init_globals ( yyscan_t yyscanner ); |
1025 | | |
1026 | | /* %endif */ |
1027 | | |
1028 | | /* %if-reentrant */ |
1029 | | |
1030 | | int yylex_init (yyscan_t* scanner); |
1031 | | |
1032 | | int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); |
1033 | | |
1034 | | /* %endif */ |
1035 | | |
1036 | | /* %endif End reentrant structures and macros. */ |
1037 | | |
1038 | | /* Accessor methods to globals. |
1039 | | These are made visible to non-reentrant scanners for convenience. */ |
1040 | | |
1041 | | int yylex_destroy ( yyscan_t yyscanner ); |
1042 | | |
1043 | | int yyget_debug ( yyscan_t yyscanner ); |
1044 | | |
1045 | | void yyset_debug ( int debug_flag , yyscan_t yyscanner ); |
1046 | | |
1047 | | YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); |
1048 | | |
1049 | | void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); |
1050 | | |
1051 | | FILE *yyget_in ( yyscan_t yyscanner ); |
1052 | | |
1053 | | void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); |
1054 | | |
1055 | | FILE *yyget_out ( yyscan_t yyscanner ); |
1056 | | |
1057 | | void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); |
1058 | | |
1059 | | int yyget_leng ( yyscan_t yyscanner ); |
1060 | | |
1061 | | char *yyget_text ( yyscan_t yyscanner ); |
1062 | | |
1063 | | int yyget_lineno ( yyscan_t yyscanner ); |
1064 | | |
1065 | | void yyset_lineno ( int _line_number , yyscan_t yyscanner ); |
1066 | | |
1067 | | int yyget_column ( yyscan_t yyscanner ); |
1068 | | |
1069 | | void yyset_column ( int _column_no , yyscan_t yyscanner ); |
1070 | | |
1071 | | /* %if-bison-bridge */ |
1072 | | /* %endif */ |
1073 | | |
1074 | | /* Macros after this point can all be overridden by user definitions in |
1075 | | * section 1. |
1076 | | */ |
1077 | | |
1078 | | #ifndef YY_SKIP_YYWRAP |
1079 | | #ifdef __cplusplus |
1080 | | extern "C" int yywrap ( yyscan_t yyscanner ); |
1081 | | #else |
1082 | | extern int yywrap ( yyscan_t yyscanner ); |
1083 | | #endif |
1084 | | #endif |
1085 | | |
1086 | | /* %not-for-header */ |
1087 | | #ifndef YY_NO_UNPUT |
1088 | | |
1089 | | #endif |
1090 | | /* %ok-for-header */ |
1091 | | |
1092 | | /* %endif */ |
1093 | | |
1094 | | #ifndef yytext_ptr |
1095 | | static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); |
1096 | | #endif |
1097 | | |
1098 | | #ifdef YY_NEED_STRLEN |
1099 | | static int yy_flex_strlen ( const char * , yyscan_t yyscanner); |
1100 | | #endif |
1101 | | |
1102 | | #ifndef YY_NO_INPUT |
1103 | | /* %if-c-only Standard (non-C++) definition */ |
1104 | | /* %not-for-header */ |
1105 | | #ifdef __cplusplus |
1106 | | static int yyinput ( yyscan_t yyscanner ); |
1107 | | #else |
1108 | | static int input ( yyscan_t yyscanner ); |
1109 | | #endif |
1110 | | /* %ok-for-header */ |
1111 | | |
1112 | | /* %endif */ |
1113 | | #endif |
1114 | | |
1115 | | /* %if-c-only */ |
1116 | | |
1117 | | /* %endif */ |
1118 | | |
1119 | | /* Amount of stuff to slurp up with each read. */ |
1120 | | #ifndef YY_READ_BUF_SIZE |
1121 | | #ifdef __ia64__ |
1122 | | /* On IA-64, the buffer size is 16k, not 8k */ |
1123 | | #define YY_READ_BUF_SIZE 16384 |
1124 | | #else |
1125 | 0 | #define YY_READ_BUF_SIZE 8192 |
1126 | | #endif /* __ia64__ */ |
1127 | | #endif |
1128 | | |
1129 | | /* Copy whatever the last rule matched to the standard output. */ |
1130 | | #ifndef ECHO |
1131 | | /* %if-c-only Standard (non-C++) definition */ |
1132 | | /* This used to be an fputs(), but since the string might contain NUL's, |
1133 | | * we now use fwrite(). |
1134 | | */ |
1135 | 0 | #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) |
1136 | | /* %endif */ |
1137 | | /* %if-c++-only C++ definition */ |
1138 | | /* %endif */ |
1139 | | #endif |
1140 | | |
1141 | | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
1142 | | * is returned in "result". |
1143 | | */ |
1144 | | #ifndef YY_INPUT |
1145 | | #define YY_INPUT(buf,result,max_size) \ |
1146 | | /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ |
1147 | | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
1148 | | { \ |
1149 | | int c = '*'; \ |
1150 | | int n; \ |
1151 | | for ( n = 0; n < max_size && \ |
1152 | | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
1153 | | buf[n] = (char) c; \ |
1154 | | if ( c == '\n' ) \ |
1155 | | buf[n++] = (char) c; \ |
1156 | | if ( c == EOF && ferror( yyin ) ) \ |
1157 | | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1158 | | result = n; \ |
1159 | | } \ |
1160 | | else \ |
1161 | | { \ |
1162 | | errno=0; \ |
1163 | | while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ |
1164 | | { \ |
1165 | | if( errno != EINTR) \ |
1166 | | { \ |
1167 | | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1168 | | break; \ |
1169 | | } \ |
1170 | | errno=0; \ |
1171 | | clearerr(yyin); \ |
1172 | | } \ |
1173 | | }\ |
1174 | | \ |
1175 | | /* %if-c++-only C++ definition \ */\ |
1176 | | /* %endif */ |
1177 | | |
1178 | | #endif |
1179 | | |
1180 | | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
1181 | | * we don't want an extra ';' after the "return" because that will cause |
1182 | | * some compilers to complain about unreachable statements. |
1183 | | */ |
1184 | | #ifndef yyterminate |
1185 | 0 | #define yyterminate() return YY_NULL |
1186 | | #endif |
1187 | | |
1188 | | /* Number of entries by which start-condition stack grows. */ |
1189 | | #ifndef YY_START_STACK_INCR |
1190 | | #define YY_START_STACK_INCR 25 |
1191 | | #endif |
1192 | | |
1193 | | /* Report a fatal error. */ |
1194 | | #ifndef YY_FATAL_ERROR |
1195 | | /* %if-c-only */ |
1196 | 0 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) |
1197 | | /* %endif */ |
1198 | | /* %if-c++-only */ |
1199 | | /* %endif */ |
1200 | | #endif |
1201 | | |
1202 | | /* %if-tables-serialization structures and prototypes */ |
1203 | | /* %not-for-header */ |
1204 | | /* %ok-for-header */ |
1205 | | |
1206 | | /* %not-for-header */ |
1207 | | /* %tables-yydmap generated elements */ |
1208 | | /* %endif */ |
1209 | | /* end tables serialization structures and prototypes */ |
1210 | | |
1211 | | /* %ok-for-header */ |
1212 | | |
1213 | | /* Default declaration of generated scanner - a define so the user can |
1214 | | * easily add parameters. |
1215 | | */ |
1216 | | #ifndef YY_DECL |
1217 | | #define YY_DECL_IS_OURS 1 |
1218 | | /* %if-c-only Standard (non-C++) definition */ |
1219 | | |
1220 | | extern int yylex (yyscan_t yyscanner); |
1221 | | |
1222 | | #define YY_DECL int yylex (yyscan_t yyscanner) |
1223 | | /* %endif */ |
1224 | | /* %if-c++-only C++ definition */ |
1225 | | /* %endif */ |
1226 | | #endif /* !YY_DECL */ |
1227 | | |
1228 | | /* Code executed at the beginning of each rule, after yytext and yyleng |
1229 | | * have been set up. |
1230 | | */ |
1231 | | #ifndef YY_USER_ACTION |
1232 | | #define YY_USER_ACTION |
1233 | | #endif |
1234 | | |
1235 | | /* Code executed at the end of each rule. */ |
1236 | | #ifndef YY_BREAK |
1237 | 0 | #define YY_BREAK /*LINTED*/break; |
1238 | | #endif |
1239 | | |
1240 | | /* %% [6.0] YY_RULE_SETUP definition goes here */ |
1241 | | #define YY_RULE_SETUP \ |
1242 | | YY_USER_ACTION |
1243 | | |
1244 | | /* %not-for-header */ |
1245 | | /** The main scanner function which does all the work. |
1246 | | */ |
1247 | | YY_DECL |
1248 | 0 | { |
1249 | 0 | yy_state_type yy_current_state; |
1250 | 0 | char *yy_cp, *yy_bp; |
1251 | 0 | int yy_act; |
1252 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1253 | |
|
1254 | 0 | if ( !yyg->yy_init ) |
1255 | 0 | { |
1256 | 0 | yyg->yy_init = 1; |
1257 | |
|
1258 | 0 | #ifdef YY_USER_INIT |
1259 | 0 | YY_USER_INIT; |
1260 | 0 | #endif |
1261 | |
|
1262 | 0 | if ( ! yyg->yy_start ) |
1263 | 0 | yyg->yy_start = 1; /* first start state */ |
1264 | |
|
1265 | 0 | if ( ! yyin ) |
1266 | | /* %if-c-only */ |
1267 | 0 | yyin = stdin; |
1268 | | /* %endif */ |
1269 | | /* %if-c++-only */ |
1270 | | /* %endif */ |
1271 | |
|
1272 | 0 | if ( ! yyout ) |
1273 | | /* %if-c-only */ |
1274 | 0 | yyout = stdout; |
1275 | | /* %endif */ |
1276 | | /* %if-c++-only */ |
1277 | | /* %endif */ |
1278 | |
|
1279 | 0 | if ( ! YY_CURRENT_BUFFER ) { |
1280 | 0 | yyensure_buffer_stack (yyscanner); |
1281 | 0 | YY_CURRENT_BUFFER_LVALUE = |
1282 | 0 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
1283 | 0 | } |
1284 | |
|
1285 | 0 | yy_load_buffer_state( yyscanner ); |
1286 | 0 | } |
1287 | |
|
1288 | 0 | { |
1289 | | /* %% [7.0] user's declarations go here */ |
1290 | 0 | #line 229 "/src/wireshark/epan/uat_load.l" |
1291 | |
|
1292 | 0 | #line 1293 "/work/build/epan/uat_load.c" |
1293 | |
|
1294 | 0 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
1295 | 0 | { |
1296 | | /* %% [8.0] yymore()-related code goes here */ |
1297 | 0 | yy_cp = yyg->yy_c_buf_p; |
1298 | | |
1299 | | /* Support of yytext. */ |
1300 | 0 | *yy_cp = yyg->yy_hold_char; |
1301 | | |
1302 | | /* yy_bp points to the position in yy_ch_buf of the start of |
1303 | | * the current run. |
1304 | | */ |
1305 | 0 | yy_bp = yy_cp; |
1306 | | |
1307 | | /* %% [9.0] code to set up and find next match goes here */ |
1308 | 0 | yy_current_state = yyg->yy_start; |
1309 | 0 | yy_match: |
1310 | 0 | do |
1311 | 0 | { |
1312 | 0 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
1313 | 0 | if ( yy_accept[yy_current_state] ) |
1314 | 0 | { |
1315 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1316 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1317 | 0 | } |
1318 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1319 | 0 | { |
1320 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1321 | 0 | if ( yy_current_state >= 76 ) |
1322 | 0 | yy_c = yy_meta[yy_c]; |
1323 | 0 | } |
1324 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1325 | 0 | ++yy_cp; |
1326 | 0 | } |
1327 | 0 | while ( yy_current_state != 75 ); |
1328 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1329 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1330 | |
|
1331 | 0 | yy_find_action: |
1332 | | /* %% [10.0] code to find the action number goes here */ |
1333 | 0 | yy_act = yy_accept[yy_current_state]; |
1334 | |
|
1335 | 0 | YY_DO_BEFORE_ACTION; |
1336 | | |
1337 | | /* %% [11.0] code for yylineno update goes here */ |
1338 | |
|
1339 | 0 | do_action: /* This label is used only to access EOF actions. */ |
1340 | | |
1341 | | /* %% [12.0] debug code goes here */ |
1342 | 0 | if ( yy_flex_debug ) |
1343 | 0 | { |
1344 | 0 | if ( yy_act == 0 ) |
1345 | 0 | fprintf( stderr, "--scanner backing up\n" ); |
1346 | 0 | else if ( yy_act < 18 ) |
1347 | 0 | fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", |
1348 | 0 | (long)yy_rule_linenum[yy_act], yytext ); |
1349 | 0 | else if ( yy_act == 18 ) |
1350 | 0 | fprintf( stderr, "--accepting default rule (\"%s\")\n", |
1351 | 0 | yytext ); |
1352 | 0 | else if ( yy_act == 19 ) |
1353 | 0 | fprintf( stderr, "--(end of buffer or a NUL)\n" ); |
1354 | 0 | else |
1355 | 0 | fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); |
1356 | 0 | } |
1357 | |
|
1358 | 0 | switch ( yy_act ) |
1359 | 0 | { /* beginning of action switch */ |
1360 | | /* %% [13.0] actions go here */ |
1361 | 0 | case 0: /* must back up */ |
1362 | | /* undo the effects of YY_DO_BEFORE_ACTION */ |
1363 | 0 | *yy_cp = yyg->yy_hold_char; |
1364 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1365 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1366 | 0 | goto yy_find_action; |
1367 | | |
1368 | 0 | case 1: |
1369 | 0 | YY_RULE_SETUP |
1370 | 0 | #line 230 "/src/wireshark/epan/uat_load.l" |
1371 | 0 | ; |
1372 | 0 | YY_BREAK |
1373 | 0 | case 2: |
1374 | | /* rule 2 can match eol */ |
1375 | 0 | YY_RULE_SETUP |
1376 | 0 | #line 231 "/src/wireshark/epan/uat_load.l" |
1377 | 0 | yyextra->linenum++; |
1378 | 0 | YY_BREAK |
1379 | 0 | case 3: |
1380 | | /* rule 3 can match eol */ |
1381 | 0 | YY_RULE_SETUP |
1382 | 0 | #line 232 "/src/wireshark/epan/uat_load.l" |
1383 | 0 | yyextra->linenum++; |
1384 | 0 | YY_BREAK |
1385 | 0 | case 4: |
1386 | 0 | YY_RULE_SETUP |
1387 | 0 | #line 234 "/src/wireshark/epan/uat_load.l" |
1388 | 0 | { |
1389 | 0 | yyextra->ptrx = g_strdup(""); |
1390 | 0 | yyextra->len = 0; |
1391 | |
|
1392 | 0 | DUMP_FIELD("empty->next"); |
1393 | |
|
1394 | 0 | SET_FIELD(); |
1395 | |
|
1396 | 0 | if ( yyextra->colnum >= yyextra->uat->ncols ) { |
1397 | 0 | ERROR(("more fields than required")); |
1398 | 0 | } |
1399 | | |
1400 | 0 | BEGIN NEXT_FIELD; |
1401 | 0 | } |
1402 | 0 | YY_BREAK |
1403 | 0 | case 5: |
1404 | | /* rule 5 can match eol */ |
1405 | 0 | YY_RULE_SETUP |
1406 | 0 | #line 249 "/src/wireshark/epan/uat_load.l" |
1407 | 0 | { |
1408 | 0 | yyextra->ptrx = g_strdup(""); |
1409 | 0 | yyextra->len = 0; |
1410 | |
|
1411 | 0 | BEGIN END_OF_RECORD; |
1412 | |
|
1413 | 0 | yyless((int) yyleng); |
1414 | 0 | } |
1415 | 0 | YY_BREAK |
1416 | 0 | case 6: |
1417 | | /* rule 6 can match eol */ |
1418 | 0 | YY_RULE_SETUP |
1419 | 0 | #line 258 "/src/wireshark/epan/uat_load.l" |
1420 | 0 | { |
1421 | 0 | yyextra->ptrx = uat_undquote(yytext, (unsigned) yyleng, &yyextra->len); |
1422 | | |
1423 | |
|
1424 | 0 | if (yyextra->colnum < yyextra->uat->ncols - 1) { |
1425 | 0 | DUMP("quoted_str->s"); |
1426 | 0 | BEGIN SEPARATOR; |
1427 | 0 | } else { |
1428 | 0 | DUMP("quoted_str->eor"); |
1429 | 0 | BEGIN END_OF_RECORD; |
1430 | 0 | } |
1431 | 0 | } |
1432 | 0 | YY_BREAK |
1433 | 0 | case 7: |
1434 | 0 | YY_RULE_SETUP |
1435 | 0 | #line 271 "/src/wireshark/epan/uat_load.l" |
1436 | 0 | { |
1437 | 0 | yyextra->ptrx = uat_unbinstring(yytext, (unsigned) yyleng, &yyextra->len); |
1438 | |
|
1439 | 0 | if (!yyextra->ptrx) { |
1440 | 0 | ERROR(("uneven hexstring for field %s",yyextra->uat->fields[yyextra->colnum].name)); |
1441 | 0 | } |
1442 | | |
1443 | 0 | if ( yyextra->colnum < yyextra->uat->ncols - 1 ) { |
1444 | 0 | DUMP("binstring->s"); |
1445 | 0 | BEGIN SEPARATOR; |
1446 | 0 | } else { |
1447 | 0 | DUMP("binstring->eor"); |
1448 | 0 | BEGIN END_OF_RECORD; |
1449 | 0 | } |
1450 | 0 | } |
1451 | 0 | YY_BREAK |
1452 | 0 | case 8: |
1453 | 0 | YY_RULE_SETUP |
1454 | 0 | #line 287 "/src/wireshark/epan/uat_load.l" |
1455 | 0 | { |
1456 | |
|
1457 | 0 | DUMP_FIELD("separator->next"); |
1458 | |
|
1459 | 0 | SET_FIELD(); |
1460 | |
|
1461 | 0 | if ( yyextra->colnum >= yyextra->uat->ncols ) { |
1462 | 0 | ERROR(("more fields than required")); |
1463 | 0 | } |
1464 | | |
1465 | 0 | BEGIN NEXT_FIELD; |
1466 | 0 | } |
1467 | 0 | YY_BREAK |
1468 | 0 | case 9: |
1469 | | /* rule 9 can match eol */ |
1470 | 0 | YY_RULE_SETUP |
1471 | 0 | #line 300 "/src/wireshark/epan/uat_load.l" |
1472 | 0 | { |
1473 | 0 | DUMP("separator->newline"); |
1474 | | |
1475 | | /* |
1476 | | * We've run out of fields. Check to see if we have any default |
1477 | | * values that we can fill in. The field for the current column |
1478 | | * will be filled in below in <END_OF_RECORD>{newline}. |
1479 | | */ |
1480 | 0 | unsigned save_colnum = yyextra->colnum; |
1481 | 0 | yyextra->colnum++; |
1482 | 0 | while (yyextra->colnum < yyextra->uat->ncols) { |
1483 | 0 | if (!yyextra->uat->default_values) { |
1484 | 0 | break; |
1485 | 0 | } |
1486 | 0 | const char *default_value = yyextra->uat->default_values[yyextra->colnum]; |
1487 | 0 | if (!default_value) { |
1488 | 0 | break; |
1489 | 0 | } |
1490 | 0 | yyextra->uat->fields[yyextra->colnum].cb.set(yyextra->record, default_value, (unsigned) strlen(default_value), yyextra->uat->fields[yyextra->colnum].cbdata.set, yyextra->uat->fields[yyextra->colnum].fld_data); |
1491 | 0 | ws_log(WS_LOG_DOMAIN, LOG_LEVEL_INFO, "%s:%d: Set %s to %s.", |
1492 | 0 | yyextra->uat->filename, yyextra->linenum, yyextra->uat->fields[yyextra->colnum].name, default_value); |
1493 | 0 | yyextra->colnum++; |
1494 | 0 | } |
1495 | |
|
1496 | 0 | if (yyextra->colnum < yyextra->uat->ncols) { |
1497 | 0 | ERROR(("expecting field %s", yyextra->uat->fields[yyextra->colnum].name)); |
1498 | 0 | } |
1499 | | |
1500 | 0 | yyextra->colnum = save_colnum; |
1501 | 0 | yyextra->linenum++; |
1502 | 0 | BEGIN END_OF_RECORD; |
1503 | 0 | yyless(0); |
1504 | 0 | } |
1505 | 0 | YY_BREAK |
1506 | 0 | case 10: |
1507 | 0 | YY_RULE_SETUP |
1508 | 0 | #line 334 "/src/wireshark/epan/uat_load.l" |
1509 | 0 | { |
1510 | 0 | ERROR(("unexpected char '%s' while looking for field %s",yytext,yyextra->uat->fields[yyextra->colnum].name)); |
1511 | 0 | } |
1512 | 0 | YY_BREAK |
1513 | 0 | case 11: |
1514 | 0 | YY_RULE_SETUP |
1515 | 0 | #line 338 "/src/wireshark/epan/uat_load.l" |
1516 | 0 | { |
1517 | | /* If we wanted to be really fancy we could retain the extra data. */ |
1518 | 0 | ws_log(WS_LOG_DOMAIN, LOG_LEVEL_WARNING, "%s:%d: More fields than required. Discarding '%s'.", |
1519 | 0 | yyextra->uat->filename, yyextra->linenum, yytext); |
1520 | 0 | } |
1521 | 0 | YY_BREAK |
1522 | 0 | case 12: |
1523 | | /* rule 12 can match eol */ |
1524 | 0 | YY_RULE_SETUP |
1525 | 0 | #line 344 "/src/wireshark/epan/uat_load.l" |
1526 | 0 | { |
1527 | 0 | void* rec; |
1528 | 0 | char* err = NULL; |
1529 | |
|
1530 | 0 | yyextra->linenum++; |
1531 | |
|
1532 | 0 | DUMP_FIELD("newline->start"); |
1533 | |
|
1534 | 0 | SET_FIELD(); |
1535 | | |
1536 | | /* Last field was processed, try to store the full record in the UAT. */ |
1537 | 0 | rec = uat_add_record(yyextra->uat, yyextra->record, yyextra->valid_record); |
1538 | |
|
1539 | 0 | if ((yyextra->uat->update_cb) && (rec != NULL)) { |
1540 | 0 | if (!yyextra->uat->update_cb(rec,&err)) { |
1541 | 0 | g_free(yyextra->error); |
1542 | 0 | yyextra->error = err; |
1543 | 0 | yyterminate(); |
1544 | 0 | } |
1545 | 0 | } |
1546 | | |
1547 | | /* The record was duplicated to the UAT above, now free our fields. */ |
1548 | 0 | if (yyextra->uat->free_cb) { |
1549 | 0 | yyextra->uat->free_cb(yyextra->record); |
1550 | 0 | } |
1551 | 0 | memset(yyextra->record, 0, yyextra->uat->record_size); |
1552 | |
|
1553 | 0 | yyextra->valid_record = true; |
1554 | 0 | yyextra->colnum = 0; |
1555 | 0 | yyextra->ptrx = NULL; |
1556 | 0 | yyextra->len = 0; |
1557 | |
|
1558 | 0 | BEGIN START_OF_LINE; |
1559 | 0 | } |
1560 | 0 | YY_BREAK |
1561 | 0 | case 13: |
1562 | 0 | YY_RULE_SETUP |
1563 | 0 | #line 379 "/src/wireshark/epan/uat_load.l" |
1564 | 0 | { |
1565 | 0 | ERROR(("unexpected char %s while looking for end of line", yytext)); |
1566 | 0 | } |
1567 | 0 | YY_BREAK |
1568 | 0 | case 14: |
1569 | | /* rule 14 can match eol */ |
1570 | 0 | YY_RULE_SETUP |
1571 | 0 | #line 383 "/src/wireshark/epan/uat_load.l" |
1572 | 0 | { yyextra->linenum++; BEGIN START_OF_LINE; } |
1573 | 0 | YY_BREAK |
1574 | 0 | case 15: |
1575 | 0 | YY_RULE_SETUP |
1576 | 0 | #line 384 "/src/wireshark/epan/uat_load.l" |
1577 | 0 | ; |
1578 | 0 | YY_BREAK |
1579 | 0 | case 16: |
1580 | | /* rule 16 can match eol */ |
1581 | 0 | YY_RULE_SETUP |
1582 | 0 | #line 386 "/src/wireshark/epan/uat_load.l" |
1583 | 0 | { yyextra->linenum++; ERROR(("incomplete record")); } |
1584 | 0 | YY_BREAK |
1585 | 0 | case 17: |
1586 | 0 | YY_RULE_SETUP |
1587 | 0 | #line 387 "/src/wireshark/epan/uat_load.l" |
1588 | 0 | { ERROR(("unexpected input")); } |
1589 | 0 | YY_BREAK |
1590 | 0 | case 18: |
1591 | 0 | YY_RULE_SETUP |
1592 | 0 | #line 389 "/src/wireshark/epan/uat_load.l" |
1593 | 0 | ECHO; |
1594 | 0 | YY_BREAK |
1595 | 0 | #line 1596 "/work/build/epan/uat_load.c" |
1596 | 0 | case YY_STATE_EOF(INITIAL): |
1597 | 0 | case YY_STATE_EOF(START_OF_LINE): |
1598 | 0 | case YY_STATE_EOF(NEXT_FIELD): |
1599 | 0 | case YY_STATE_EOF(SEPARATOR): |
1600 | 0 | case YY_STATE_EOF(END_OF_RECORD): |
1601 | 0 | case YY_STATE_EOF(ERRORED): |
1602 | 0 | yyterminate(); |
1603 | | |
1604 | 0 | case YY_END_OF_BUFFER: |
1605 | 0 | { |
1606 | | /* Amount of text matched not including the EOB char. */ |
1607 | 0 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; |
1608 | | |
1609 | | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
1610 | 0 | *yy_cp = yyg->yy_hold_char; |
1611 | 0 | YY_RESTORE_YY_MORE_OFFSET |
1612 | |
|
1613 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
1614 | 0 | { |
1615 | | /* We're scanning a new file or input source. It's |
1616 | | * possible that this happened because the user |
1617 | | * just pointed yyin at a new source and called |
1618 | | * yylex(). If so, then we have to assure |
1619 | | * consistency between YY_CURRENT_BUFFER and our |
1620 | | * globals. Here is the right place to do so, because |
1621 | | * this is the first action (other than possibly a |
1622 | | * back-up) that will match for the new input source. |
1623 | | */ |
1624 | 0 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1625 | | /* %if-c-only */ |
1626 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
1627 | | /* %endif */ |
1628 | | /* %if-c++-only */ |
1629 | | /* %endif */ |
1630 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
1631 | 0 | } |
1632 | | |
1633 | | /* Note that here we test for yy_c_buf_p "<=" to the position |
1634 | | * of the first EOB in the buffer, since yy_c_buf_p will |
1635 | | * already have been incremented past the NUL character |
1636 | | * (since all states make transitions on EOB to the |
1637 | | * end-of-buffer state). Contrast this with the test |
1638 | | * in input(). |
1639 | | */ |
1640 | 0 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
1641 | 0 | { /* This was really a NUL. */ |
1642 | 0 | yy_state_type yy_next_state; |
1643 | |
|
1644 | 0 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
1645 | |
|
1646 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1647 | | |
1648 | | /* Okay, we're now positioned to make the NUL |
1649 | | * transition. We couldn't have |
1650 | | * yy_get_previous_state() go ahead and do it |
1651 | | * for us because it doesn't know how to deal |
1652 | | * with the possibility of jamming (and we don't |
1653 | | * want to build jamming into it because then it |
1654 | | * will run more slowly). |
1655 | | */ |
1656 | |
|
1657 | 0 | yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); |
1658 | |
|
1659 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1660 | |
|
1661 | 0 | if ( yy_next_state ) |
1662 | 0 | { |
1663 | | /* Consume the NUL. */ |
1664 | 0 | yy_cp = ++yyg->yy_c_buf_p; |
1665 | 0 | yy_current_state = yy_next_state; |
1666 | 0 | goto yy_match; |
1667 | 0 | } |
1668 | | |
1669 | 0 | else |
1670 | 0 | { |
1671 | | /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ |
1672 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1673 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1674 | 0 | goto yy_find_action; |
1675 | 0 | } |
1676 | 0 | } |
1677 | | |
1678 | 0 | else switch ( yy_get_next_buffer( yyscanner ) ) |
1679 | 0 | { |
1680 | 0 | case EOB_ACT_END_OF_FILE: |
1681 | 0 | { |
1682 | 0 | yyg->yy_did_buffer_switch_on_eof = 0; |
1683 | |
|
1684 | 0 | if ( yywrap( yyscanner ) ) |
1685 | 0 | { |
1686 | | /* Note: because we've taken care in |
1687 | | * yy_get_next_buffer() to have set up |
1688 | | * yytext, we can now set up |
1689 | | * yy_c_buf_p so that if some total |
1690 | | * hoser (like flex itself) wants to |
1691 | | * call the scanner after we return the |
1692 | | * YY_NULL, it'll still work - another |
1693 | | * YY_NULL will get returned. |
1694 | | */ |
1695 | 0 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
1696 | |
|
1697 | 0 | yy_act = YY_STATE_EOF(YY_START); |
1698 | 0 | goto do_action; |
1699 | 0 | } |
1700 | | |
1701 | 0 | else |
1702 | 0 | { |
1703 | 0 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
1704 | 0 | YY_NEW_FILE; |
1705 | 0 | } |
1706 | 0 | break; |
1707 | 0 | } |
1708 | | |
1709 | 0 | case EOB_ACT_CONTINUE_SCAN: |
1710 | 0 | yyg->yy_c_buf_p = |
1711 | 0 | yyg->yytext_ptr + yy_amount_of_matched_text; |
1712 | |
|
1713 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1714 | |
|
1715 | 0 | yy_cp = yyg->yy_c_buf_p; |
1716 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1717 | 0 | goto yy_match; |
1718 | | |
1719 | 0 | case EOB_ACT_LAST_MATCH: |
1720 | 0 | yyg->yy_c_buf_p = |
1721 | 0 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
1722 | |
|
1723 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1724 | |
|
1725 | 0 | yy_cp = yyg->yy_c_buf_p; |
1726 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1727 | 0 | goto yy_find_action; |
1728 | 0 | } |
1729 | 0 | break; |
1730 | 0 | } |
1731 | | |
1732 | 0 | default: |
1733 | 0 | YY_FATAL_ERROR( |
1734 | 0 | "fatal flex scanner internal error--no action found" ); |
1735 | 0 | } /* end of action switch */ |
1736 | 0 | } /* end of scanning one token */ |
1737 | 0 | } /* end of user's declarations */ |
1738 | 0 | } /* end of yylex */ |
1739 | | /* %ok-for-header */ |
1740 | | |
1741 | | /* %if-c++-only */ |
1742 | | /* %not-for-header */ |
1743 | | /* %ok-for-header */ |
1744 | | |
1745 | | /* %endif */ |
1746 | | |
1747 | | /* yy_get_next_buffer - try to read in a new buffer |
1748 | | * |
1749 | | * Returns a code representing an action: |
1750 | | * EOB_ACT_LAST_MATCH - |
1751 | | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1752 | | * EOB_ACT_END_OF_FILE - end of file |
1753 | | */ |
1754 | | /* %if-c-only */ |
1755 | | static int yy_get_next_buffer (yyscan_t yyscanner) |
1756 | | /* %endif */ |
1757 | | /* %if-c++-only */ |
1758 | | /* %endif */ |
1759 | 0 | { |
1760 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1761 | 0 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
1762 | 0 | char *source = yyg->yytext_ptr; |
1763 | 0 | int number_to_move, i; |
1764 | 0 | int ret_val; |
1765 | |
|
1766 | 0 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
1767 | 0 | YY_FATAL_ERROR( |
1768 | 0 | "fatal flex scanner internal error--end of buffer missed" ); |
1769 | | |
1770 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
1771 | 0 | { /* Don't try to fill the buffer, so this is an EOF. */ |
1772 | 0 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
1773 | 0 | { |
1774 | | /* We matched a single character, the EOB, so |
1775 | | * treat this as a final EOF. |
1776 | | */ |
1777 | 0 | return EOB_ACT_END_OF_FILE; |
1778 | 0 | } |
1779 | | |
1780 | 0 | else |
1781 | 0 | { |
1782 | | /* We matched some text prior to the EOB, first |
1783 | | * process it. |
1784 | | */ |
1785 | 0 | return EOB_ACT_LAST_MATCH; |
1786 | 0 | } |
1787 | 0 | } |
1788 | | |
1789 | | /* Try to read more data. */ |
1790 | | |
1791 | | /* First move last chars to start of buffer. */ |
1792 | 0 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); |
1793 | |
|
1794 | 0 | for ( i = 0; i < number_to_move; ++i ) |
1795 | 0 | *(dest++) = *(source++); |
1796 | |
|
1797 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
1798 | | /* don't do the read, it's not guaranteed to return an EOF, |
1799 | | * just force an EOF |
1800 | | */ |
1801 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
1802 | | |
1803 | 0 | else |
1804 | 0 | { |
1805 | 0 | int num_to_read = |
1806 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1807 | |
|
1808 | 0 | while ( num_to_read <= 0 ) |
1809 | 0 | { /* Not enough room in the buffer - grow it. */ |
1810 | | |
1811 | | /* just a shorter name for the current buffer */ |
1812 | 0 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
1813 | |
|
1814 | 0 | int yy_c_buf_p_offset = |
1815 | 0 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
1816 | |
|
1817 | 0 | if ( b->yy_is_our_buffer ) |
1818 | 0 | { |
1819 | 0 | int new_size = b->yy_buf_size * 2; |
1820 | |
|
1821 | 0 | if ( new_size <= 0 ) |
1822 | 0 | b->yy_buf_size += b->yy_buf_size / 8; |
1823 | 0 | else |
1824 | 0 | b->yy_buf_size *= 2; |
1825 | |
|
1826 | 0 | b->yy_ch_buf = (char *) |
1827 | | /* Include room in for 2 EOB chars. */ |
1828 | 0 | yyrealloc( (void *) b->yy_ch_buf, |
1829 | 0 | (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
1830 | 0 | } |
1831 | 0 | else |
1832 | | /* Can't grow it, we don't own it. */ |
1833 | 0 | b->yy_ch_buf = NULL; |
1834 | |
|
1835 | 0 | if ( ! b->yy_ch_buf ) |
1836 | 0 | YY_FATAL_ERROR( |
1837 | 0 | "fatal error - scanner input buffer overflow" ); |
1838 | | |
1839 | 0 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
1840 | |
|
1841 | 0 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
1842 | 0 | number_to_move - 1; |
1843 | |
|
1844 | 0 | } |
1845 | | |
1846 | 0 | if ( num_to_read > YY_READ_BUF_SIZE ) |
1847 | 0 | num_to_read = YY_READ_BUF_SIZE; |
1848 | | |
1849 | | /* Read in more data. */ |
1850 | 0 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
1851 | 0 | yyg->yy_n_chars, num_to_read ); |
1852 | |
|
1853 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
1854 | 0 | } |
1855 | | |
1856 | 0 | if ( yyg->yy_n_chars == 0 ) |
1857 | 0 | { |
1858 | 0 | if ( number_to_move == YY_MORE_ADJ ) |
1859 | 0 | { |
1860 | 0 | ret_val = EOB_ACT_END_OF_FILE; |
1861 | 0 | yyrestart( yyin , yyscanner); |
1862 | 0 | } |
1863 | | |
1864 | 0 | else |
1865 | 0 | { |
1866 | 0 | ret_val = EOB_ACT_LAST_MATCH; |
1867 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
1868 | 0 | YY_BUFFER_EOF_PENDING; |
1869 | 0 | } |
1870 | 0 | } |
1871 | | |
1872 | 0 | else |
1873 | 0 | ret_val = EOB_ACT_CONTINUE_SCAN; |
1874 | |
|
1875 | 0 | if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
1876 | | /* Extend the array by 50%, plus the number we really need. */ |
1877 | 0 | int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
1878 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( |
1879 | 0 | (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); |
1880 | 0 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
1881 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
1882 | | /* "- 2" to take care of EOB's */ |
1883 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); |
1884 | 0 | } |
1885 | | |
1886 | 0 | yyg->yy_n_chars += number_to_move; |
1887 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
1888 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
1889 | |
|
1890 | 0 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
1891 | |
|
1892 | 0 | return ret_val; |
1893 | 0 | } |
1894 | | |
1895 | | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
1896 | | |
1897 | | /* %if-c-only */ |
1898 | | /* %not-for-header */ |
1899 | | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) |
1900 | | /* %endif */ |
1901 | | /* %if-c++-only */ |
1902 | | /* %endif */ |
1903 | 0 | { |
1904 | 0 | yy_state_type yy_current_state; |
1905 | 0 | char *yy_cp; |
1906 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1907 | | |
1908 | | /* %% [15.0] code to get the start state into yy_current_state goes here */ |
1909 | 0 | yy_current_state = yyg->yy_start; |
1910 | |
|
1911 | 0 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) |
1912 | 0 | { |
1913 | | /* %% [16.0] code to find the next state goes here */ |
1914 | 0 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
1915 | 0 | if ( yy_accept[yy_current_state] ) |
1916 | 0 | { |
1917 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1918 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1919 | 0 | } |
1920 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1921 | 0 | { |
1922 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1923 | 0 | if ( yy_current_state >= 76 ) |
1924 | 0 | yy_c = yy_meta[yy_c]; |
1925 | 0 | } |
1926 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1927 | 0 | } |
1928 | |
|
1929 | 0 | return yy_current_state; |
1930 | 0 | } |
1931 | | |
1932 | | /* yy_try_NUL_trans - try to make a transition on the NUL character |
1933 | | * |
1934 | | * synopsis |
1935 | | * next_state = yy_try_NUL_trans( current_state ); |
1936 | | */ |
1937 | | /* %if-c-only */ |
1938 | | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) |
1939 | | /* %endif */ |
1940 | | /* %if-c++-only */ |
1941 | | /* %endif */ |
1942 | 0 | { |
1943 | 0 | int yy_is_jam; |
1944 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ |
1945 | | /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ |
1946 | 0 | char *yy_cp = yyg->yy_c_buf_p; |
1947 | |
|
1948 | 0 | YY_CHAR yy_c = 1; |
1949 | 0 | if ( yy_accept[yy_current_state] ) |
1950 | 0 | { |
1951 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1952 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1953 | 0 | } |
1954 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1955 | 0 | { |
1956 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1957 | 0 | if ( yy_current_state >= 76 ) |
1958 | 0 | yy_c = yy_meta[yy_c]; |
1959 | 0 | } |
1960 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1961 | 0 | yy_is_jam = (yy_current_state == 75); |
1962 | |
|
1963 | 0 | (void)yyg; |
1964 | 0 | return yy_is_jam ? 0 : yy_current_state; |
1965 | 0 | } |
1966 | | |
1967 | | #ifndef YY_NO_UNPUT |
1968 | | /* %if-c-only */ |
1969 | | |
1970 | | /* %endif */ |
1971 | | #endif |
1972 | | |
1973 | | /* %if-c-only */ |
1974 | | #ifndef YY_NO_INPUT |
1975 | | #ifdef __cplusplus |
1976 | | static int yyinput (yyscan_t yyscanner) |
1977 | | #else |
1978 | | static int input (yyscan_t yyscanner) |
1979 | | #endif |
1980 | | |
1981 | | /* %endif */ |
1982 | | /* %if-c++-only */ |
1983 | | /* %endif */ |
1984 | | { |
1985 | | int c; |
1986 | | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1987 | | |
1988 | | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
1989 | | |
1990 | | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
1991 | | { |
1992 | | /* yy_c_buf_p now points to the character we want to return. |
1993 | | * If this occurs *before* the EOB characters, then it's a |
1994 | | * valid NUL; if not, then we've hit the end of the buffer. |
1995 | | */ |
1996 | | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
1997 | | /* This was really a NUL. */ |
1998 | | *yyg->yy_c_buf_p = '\0'; |
1999 | | |
2000 | | else |
2001 | | { /* need more input */ |
2002 | | int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); |
2003 | | ++yyg->yy_c_buf_p; |
2004 | | |
2005 | | switch ( yy_get_next_buffer( yyscanner ) ) |
2006 | | { |
2007 | | case EOB_ACT_LAST_MATCH: |
2008 | | /* This happens because yy_g_n_b() |
2009 | | * sees that we've accumulated a |
2010 | | * token and flags that we need to |
2011 | | * try matching the token before |
2012 | | * proceeding. But for input(), |
2013 | | * there's no matching to consider. |
2014 | | * So convert the EOB_ACT_LAST_MATCH |
2015 | | * to EOB_ACT_END_OF_FILE. |
2016 | | */ |
2017 | | |
2018 | | /* Reset buffer status. */ |
2019 | | yyrestart( yyin , yyscanner); |
2020 | | |
2021 | | /*FALLTHROUGH*/ |
2022 | | |
2023 | | case EOB_ACT_END_OF_FILE: |
2024 | | { |
2025 | | if ( yywrap( yyscanner ) ) |
2026 | | return 0; |
2027 | | |
2028 | | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
2029 | | YY_NEW_FILE; |
2030 | | #ifdef __cplusplus |
2031 | | return yyinput(yyscanner); |
2032 | | #else |
2033 | | return input(yyscanner); |
2034 | | #endif |
2035 | | } |
2036 | | |
2037 | | case EOB_ACT_CONTINUE_SCAN: |
2038 | | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
2039 | | break; |
2040 | | } |
2041 | | } |
2042 | | } |
2043 | | |
2044 | | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
2045 | | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
2046 | | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
2047 | | |
2048 | | /* %% [19.0] update BOL and yylineno */ |
2049 | | |
2050 | | return c; |
2051 | | } |
2052 | | /* %if-c-only */ |
2053 | | #endif /* ifndef YY_NO_INPUT */ |
2054 | | /* %endif */ |
2055 | | |
2056 | | /** Immediately switch to a different input stream. |
2057 | | * @param input_file A readable stream. |
2058 | | * @param yyscanner The scanner object. |
2059 | | * @note This function does not reset the start condition to @c INITIAL . |
2060 | | */ |
2061 | | /* %if-c-only */ |
2062 | | void yyrestart (FILE * input_file , yyscan_t yyscanner) |
2063 | | /* %endif */ |
2064 | | /* %if-c++-only */ |
2065 | | /* %endif */ |
2066 | 0 | { |
2067 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2068 | |
|
2069 | 0 | if ( ! YY_CURRENT_BUFFER ){ |
2070 | 0 | yyensure_buffer_stack (yyscanner); |
2071 | 0 | YY_CURRENT_BUFFER_LVALUE = |
2072 | 0 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
2073 | 0 | } |
2074 | |
|
2075 | 0 | yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); |
2076 | 0 | yy_load_buffer_state( yyscanner ); |
2077 | 0 | } |
2078 | | |
2079 | | /* %if-c++-only */ |
2080 | | /* %endif */ |
2081 | | |
2082 | | /** Switch to a different input buffer. |
2083 | | * @param new_buffer The new input buffer. |
2084 | | * @param yyscanner The scanner object. |
2085 | | */ |
2086 | | /* %if-c-only */ |
2087 | | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
2088 | | /* %endif */ |
2089 | | /* %if-c++-only */ |
2090 | | /* %endif */ |
2091 | 0 | { |
2092 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2093 | | |
2094 | | /* TODO. We should be able to replace this entire function body |
2095 | | * with |
2096 | | * yypop_buffer_state(); |
2097 | | * yypush_buffer_state(new_buffer); |
2098 | | */ |
2099 | 0 | yyensure_buffer_stack (yyscanner); |
2100 | 0 | if ( YY_CURRENT_BUFFER == new_buffer ) |
2101 | 0 | return; |
2102 | | |
2103 | 0 | if ( YY_CURRENT_BUFFER ) |
2104 | 0 | { |
2105 | | /* Flush out information for old buffer. */ |
2106 | 0 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
2107 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
2108 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2109 | 0 | } |
2110 | |
|
2111 | 0 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2112 | 0 | yy_load_buffer_state( yyscanner ); |
2113 | | |
2114 | | /* We don't actually know whether we did this switch during |
2115 | | * EOF (yywrap()) processing, but the only time this flag |
2116 | | * is looked at is after yywrap() is called, so it's safe |
2117 | | * to go ahead and always set it. |
2118 | | */ |
2119 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2120 | 0 | } |
2121 | | |
2122 | | /* %if-c-only */ |
2123 | | static void yy_load_buffer_state (yyscan_t yyscanner) |
2124 | | /* %endif */ |
2125 | | /* %if-c++-only */ |
2126 | | /* %endif */ |
2127 | 0 | { |
2128 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2129 | 0 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
2130 | 0 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
2131 | | /* %if-c-only */ |
2132 | 0 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
2133 | | /* %endif */ |
2134 | | /* %if-c++-only */ |
2135 | | /* %endif */ |
2136 | 0 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
2137 | 0 | } |
2138 | | |
2139 | | /** Allocate and initialize an input buffer state. |
2140 | | * @param file A readable stream. |
2141 | | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
2142 | | * @param yyscanner The scanner object. |
2143 | | * @return the allocated buffer state. |
2144 | | */ |
2145 | | /* %if-c-only */ |
2146 | | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
2147 | | /* %endif */ |
2148 | | /* %if-c++-only */ |
2149 | | /* %endif */ |
2150 | 0 | { |
2151 | 0 | YY_BUFFER_STATE b; |
2152 | | |
2153 | 0 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
2154 | 0 | if ( ! b ) |
2155 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
2156 | | |
2157 | 0 | b->yy_buf_size = size; |
2158 | | |
2159 | | /* yy_ch_buf has to be 2 characters longer than the size given because |
2160 | | * we need to put in 2 end-of-buffer characters. |
2161 | | */ |
2162 | 0 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
2163 | 0 | if ( ! b->yy_ch_buf ) |
2164 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
2165 | | |
2166 | 0 | b->yy_is_our_buffer = 1; |
2167 | |
|
2168 | 0 | yy_init_buffer( b, file , yyscanner); |
2169 | |
|
2170 | 0 | return b; |
2171 | 0 | } |
2172 | | |
2173 | | /* %if-c++-only */ |
2174 | | /* %endif */ |
2175 | | |
2176 | | /** Destroy the buffer. |
2177 | | * @param b a buffer created with yy_create_buffer() |
2178 | | * @param yyscanner The scanner object. |
2179 | | */ |
2180 | | /* %if-c-only */ |
2181 | | void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
2182 | | /* %endif */ |
2183 | | /* %if-c++-only */ |
2184 | | /* %endif */ |
2185 | 0 | { |
2186 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2187 | |
|
2188 | 0 | if ( ! b ) |
2189 | 0 | return; |
2190 | | |
2191 | 0 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
2192 | 0 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
2193 | |
|
2194 | 0 | if ( b->yy_is_our_buffer ) |
2195 | 0 | yyfree( (void *) b->yy_ch_buf , yyscanner ); |
2196 | |
|
2197 | 0 | yyfree( (void *) b , yyscanner ); |
2198 | 0 | } |
2199 | | |
2200 | | /* Initializes or reinitializes a buffer. |
2201 | | * This function is sometimes called more than once on the same buffer, |
2202 | | * such as during a yyrestart() or at EOF. |
2203 | | */ |
2204 | | /* %if-c-only */ |
2205 | | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) |
2206 | | /* %endif */ |
2207 | | /* %if-c++-only */ |
2208 | | /* %endif */ |
2209 | | |
2210 | 0 | { |
2211 | 0 | int oerrno = errno; |
2212 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2213 | |
|
2214 | 0 | yy_flush_buffer( b , yyscanner); |
2215 | | |
2216 | | /* %if-c-only */ |
2217 | 0 | b->yy_input_file = file; |
2218 | | /* %endif */ |
2219 | | /* %if-c++-only */ |
2220 | | /* %endif */ |
2221 | 0 | b->yy_fill_buffer = 1; |
2222 | | |
2223 | | /* If b is the current buffer, then yy_init_buffer was _probably_ |
2224 | | * called from yyrestart() or through yy_get_next_buffer. |
2225 | | * In that case, we don't want to reset the lineno or column. |
2226 | | */ |
2227 | 0 | if (b != YY_CURRENT_BUFFER){ |
2228 | 0 | b->yy_bs_lineno = 1; |
2229 | 0 | b->yy_bs_column = 0; |
2230 | 0 | } |
2231 | | |
2232 | | /* %if-c-only */ |
2233 | |
|
2234 | 0 | b->yy_is_interactive = 0; |
2235 | | |
2236 | | /* %endif */ |
2237 | | /* %if-c++-only */ |
2238 | | /* %endif */ |
2239 | 0 | errno = oerrno; |
2240 | 0 | } |
2241 | | |
2242 | | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
2243 | | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
2244 | | * @param yyscanner The scanner object. |
2245 | | */ |
2246 | | /* %if-c-only */ |
2247 | | void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
2248 | | /* %endif */ |
2249 | | /* %if-c++-only */ |
2250 | | /* %endif */ |
2251 | 0 | { |
2252 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2253 | 0 | if ( ! b ) |
2254 | 0 | return; |
2255 | | |
2256 | 0 | b->yy_n_chars = 0; |
2257 | | |
2258 | | /* We always need two end-of-buffer characters. The first causes |
2259 | | * a transition to the end-of-buffer state. The second causes |
2260 | | * a jam in that state. |
2261 | | */ |
2262 | 0 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
2263 | 0 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
2264 | |
|
2265 | 0 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
2266 | |
|
2267 | 0 | b->yy_at_bol = 1; |
2268 | 0 | b->yy_buffer_status = YY_BUFFER_NEW; |
2269 | |
|
2270 | 0 | if ( b == YY_CURRENT_BUFFER ) |
2271 | 0 | yy_load_buffer_state( yyscanner ); |
2272 | 0 | } |
2273 | | |
2274 | | /* %if-c-or-c++ */ |
2275 | | /** Pushes the new state onto the stack. The new state becomes |
2276 | | * the current state. This function will allocate the stack |
2277 | | * if necessary. |
2278 | | * @param new_buffer The new state. |
2279 | | * @param yyscanner The scanner object. |
2280 | | */ |
2281 | | /* %if-c-only */ |
2282 | | void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
2283 | | /* %endif */ |
2284 | | /* %if-c++-only */ |
2285 | | /* %endif */ |
2286 | 0 | { |
2287 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2288 | 0 | if (new_buffer == NULL) |
2289 | 0 | return; |
2290 | | |
2291 | 0 | yyensure_buffer_stack(yyscanner); |
2292 | | |
2293 | | /* This block is copied from yy_switch_to_buffer. */ |
2294 | 0 | if ( YY_CURRENT_BUFFER ) |
2295 | 0 | { |
2296 | | /* Flush out information for old buffer. */ |
2297 | 0 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
2298 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
2299 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2300 | 0 | } |
2301 | | |
2302 | | /* Only push if top exists. Otherwise, replace top. */ |
2303 | 0 | if (YY_CURRENT_BUFFER) |
2304 | 0 | yyg->yy_buffer_stack_top++; |
2305 | 0 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2306 | | |
2307 | | /* copied from yy_switch_to_buffer. */ |
2308 | 0 | yy_load_buffer_state( yyscanner ); |
2309 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2310 | 0 | } |
2311 | | /* %endif */ |
2312 | | |
2313 | | /* %if-c-or-c++ */ |
2314 | | /** Removes and deletes the top of the stack, if present. |
2315 | | * The next element becomes the new top. |
2316 | | * @param yyscanner The scanner object. |
2317 | | */ |
2318 | | /* %if-c-only */ |
2319 | | void yypop_buffer_state (yyscan_t yyscanner) |
2320 | | /* %endif */ |
2321 | | /* %if-c++-only */ |
2322 | | /* %endif */ |
2323 | 0 | { |
2324 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2325 | 0 | if (!YY_CURRENT_BUFFER) |
2326 | 0 | return; |
2327 | | |
2328 | 0 | yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); |
2329 | 0 | YY_CURRENT_BUFFER_LVALUE = NULL; |
2330 | 0 | if (yyg->yy_buffer_stack_top > 0) |
2331 | 0 | --yyg->yy_buffer_stack_top; |
2332 | |
|
2333 | 0 | if (YY_CURRENT_BUFFER) { |
2334 | 0 | yy_load_buffer_state( yyscanner ); |
2335 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2336 | 0 | } |
2337 | 0 | } |
2338 | | /* %endif */ |
2339 | | |
2340 | | /* %if-c-or-c++ */ |
2341 | | /* Allocates the stack if it does not exist. |
2342 | | * Guarantees space for at least one push. |
2343 | | */ |
2344 | | /* %if-c-only */ |
2345 | | static void yyensure_buffer_stack (yyscan_t yyscanner) |
2346 | | /* %endif */ |
2347 | | /* %if-c++-only */ |
2348 | | /* %endif */ |
2349 | 0 | { |
2350 | 0 | yy_size_t num_to_alloc; |
2351 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2352 | |
|
2353 | 0 | if (!yyg->yy_buffer_stack) { |
2354 | | |
2355 | | /* First allocation is just for 2 elements, since we don't know if this |
2356 | | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
2357 | | * immediate realloc on the next call. |
2358 | | */ |
2359 | 0 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
2360 | 0 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc |
2361 | 0 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
2362 | 0 | , yyscanner); |
2363 | 0 | if ( ! yyg->yy_buffer_stack ) |
2364 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2365 | | |
2366 | 0 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
2367 | |
|
2368 | 0 | yyg->yy_buffer_stack_max = num_to_alloc; |
2369 | 0 | yyg->yy_buffer_stack_top = 0; |
2370 | 0 | return; |
2371 | 0 | } |
2372 | | |
2373 | 0 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ |
2374 | | |
2375 | | /* Increase the buffer to prepare for a possible push. */ |
2376 | 0 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
2377 | |
|
2378 | 0 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
2379 | 0 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc |
2380 | 0 | (yyg->yy_buffer_stack, |
2381 | 0 | num_to_alloc * sizeof(struct yy_buffer_state*) |
2382 | 0 | , yyscanner); |
2383 | 0 | if ( ! yyg->yy_buffer_stack ) |
2384 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2385 | | |
2386 | | /* zero only the new slots.*/ |
2387 | 0 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); |
2388 | 0 | yyg->yy_buffer_stack_max = num_to_alloc; |
2389 | 0 | } |
2390 | 0 | } |
2391 | | /* %endif */ |
2392 | | |
2393 | | /* %if-c-only */ |
2394 | | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
2395 | | * @param base the character buffer |
2396 | | * @param size the size in bytes of the character buffer |
2397 | | * @param yyscanner The scanner object. |
2398 | | * @return the newly allocated buffer state object. |
2399 | | */ |
2400 | | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
2401 | 0 | { |
2402 | 0 | YY_BUFFER_STATE b; |
2403 | | |
2404 | 0 | if ( size < 2 || |
2405 | 0 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
2406 | 0 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
2407 | | /* They forgot to leave room for the EOB's. */ |
2408 | 0 | return NULL; |
2409 | | |
2410 | 0 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
2411 | 0 | if ( ! b ) |
2412 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
2413 | | |
2414 | 0 | b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
2415 | 0 | b->yy_buf_pos = b->yy_ch_buf = base; |
2416 | 0 | b->yy_is_our_buffer = 0; |
2417 | 0 | b->yy_input_file = NULL; |
2418 | 0 | b->yy_n_chars = b->yy_buf_size; |
2419 | 0 | b->yy_is_interactive = 0; |
2420 | 0 | b->yy_at_bol = 1; |
2421 | 0 | b->yy_fill_buffer = 0; |
2422 | 0 | b->yy_buffer_status = YY_BUFFER_NEW; |
2423 | |
|
2424 | 0 | yy_switch_to_buffer( b , yyscanner ); |
2425 | |
|
2426 | 0 | return b; |
2427 | 0 | } |
2428 | | /* %endif */ |
2429 | | |
2430 | | /* %if-c-only */ |
2431 | | /** Setup the input buffer state to scan a string. The next call to yylex() will |
2432 | | * scan from a @e copy of @a str. |
2433 | | * @param yystr a NUL-terminated string to scan |
2434 | | * @param yyscanner The scanner object. |
2435 | | * @return the newly allocated buffer state object. |
2436 | | * @note If you want to scan bytes that may contain NUL values, then use |
2437 | | * yy_scan_bytes() instead. |
2438 | | */ |
2439 | | YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) |
2440 | 0 | { |
2441 | | |
2442 | 0 | return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); |
2443 | 0 | } |
2444 | | /* %endif */ |
2445 | | |
2446 | | /* %if-c-only */ |
2447 | | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
2448 | | * scan from a @e copy of @a bytes. |
2449 | | * @param yybytes the byte buffer to scan |
2450 | | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2451 | | * @param yyscanner The scanner object. |
2452 | | * @return the newly allocated buffer state object. |
2453 | | */ |
2454 | | YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) |
2455 | 0 | { |
2456 | 0 | YY_BUFFER_STATE b; |
2457 | 0 | char *buf; |
2458 | 0 | yy_size_t n; |
2459 | 0 | int i; |
2460 | | |
2461 | | /* Get memory for full buffer, including space for trailing EOB's. */ |
2462 | 0 | n = (yy_size_t) (_yybytes_len + 2); |
2463 | 0 | buf = (char *) yyalloc( n , yyscanner ); |
2464 | 0 | if ( ! buf ) |
2465 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
2466 | | |
2467 | 0 | for ( i = 0; i < _yybytes_len; ++i ) |
2468 | 0 | buf[i] = yybytes[i]; |
2469 | |
|
2470 | 0 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
2471 | |
|
2472 | 0 | b = yy_scan_buffer( buf, n , yyscanner); |
2473 | 0 | if ( ! b ) |
2474 | 0 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
2475 | | |
2476 | | /* It's okay to grow etc. this buffer, and we should throw it |
2477 | | * away when we're done. |
2478 | | */ |
2479 | 0 | b->yy_is_our_buffer = 1; |
2480 | |
|
2481 | 0 | return b; |
2482 | 0 | } |
2483 | | /* %endif */ |
2484 | | |
2485 | | #ifndef YY_EXIT_FAILURE |
2486 | | #define YY_EXIT_FAILURE 2 |
2487 | | #endif |
2488 | | |
2489 | | /* %if-c-only */ |
2490 | | static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) |
2491 | 0 | { |
2492 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2493 | 0 | (void)yyg; |
2494 | 0 | fprintf( stderr, "%s\n", msg ); |
2495 | 0 | exit( YY_EXIT_FAILURE ); |
2496 | 0 | } |
2497 | | /* %endif */ |
2498 | | /* %if-c++-only */ |
2499 | | /* %endif */ |
2500 | | |
2501 | | /* Redefine yyless() so it works in section 3 code. */ |
2502 | | |
2503 | | #undef yyless |
2504 | | #define yyless(n) \ |
2505 | | do \ |
2506 | | { \ |
2507 | | /* Undo effects of setting up yytext. */ \ |
2508 | | int yyless_macro_arg = (n); \ |
2509 | | YY_LESS_LINENO(yyless_macro_arg);\ |
2510 | | yytext[yyleng] = yyg->yy_hold_char; \ |
2511 | | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
2512 | | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
2513 | | *yyg->yy_c_buf_p = '\0'; \ |
2514 | | yyleng = yyless_macro_arg; \ |
2515 | | } \ |
2516 | | while ( 0 ) |
2517 | | |
2518 | | /* Accessor methods (get/set functions) to struct members. */ |
2519 | | |
2520 | | /* %if-c-only */ |
2521 | | /* %if-reentrant */ |
2522 | | |
2523 | | /** Get the user-defined data for this scanner. |
2524 | | * @param yyscanner The scanner object. |
2525 | | */ |
2526 | | YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) |
2527 | 0 | { |
2528 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2529 | 0 | return yyextra; |
2530 | 0 | } |
2531 | | |
2532 | | /* %endif */ |
2533 | | |
2534 | | /** Get the current line number. |
2535 | | * @param yyscanner The scanner object. |
2536 | | */ |
2537 | | int yyget_lineno (yyscan_t yyscanner) |
2538 | 0 | { |
2539 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2540 | |
|
2541 | 0 | if (! YY_CURRENT_BUFFER) |
2542 | 0 | return 0; |
2543 | | |
2544 | 0 | return yylineno; |
2545 | 0 | } |
2546 | | |
2547 | | /** Get the current column number. |
2548 | | * @param yyscanner The scanner object. |
2549 | | */ |
2550 | | int yyget_column (yyscan_t yyscanner) |
2551 | 0 | { |
2552 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2553 | |
|
2554 | 0 | if (! YY_CURRENT_BUFFER) |
2555 | 0 | return 0; |
2556 | | |
2557 | 0 | return yycolumn; |
2558 | 0 | } |
2559 | | |
2560 | | /** Get the input stream. |
2561 | | * @param yyscanner The scanner object. |
2562 | | */ |
2563 | | FILE *yyget_in (yyscan_t yyscanner) |
2564 | 0 | { |
2565 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2566 | 0 | return yyin; |
2567 | 0 | } |
2568 | | |
2569 | | /** Get the output stream. |
2570 | | * @param yyscanner The scanner object. |
2571 | | */ |
2572 | | FILE *yyget_out (yyscan_t yyscanner) |
2573 | 0 | { |
2574 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2575 | 0 | return yyout; |
2576 | 0 | } |
2577 | | |
2578 | | /** Get the length of the current token. |
2579 | | * @param yyscanner The scanner object. |
2580 | | */ |
2581 | | int yyget_leng (yyscan_t yyscanner) |
2582 | 0 | { |
2583 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2584 | 0 | return yyleng; |
2585 | 0 | } |
2586 | | |
2587 | | /** Get the current token. |
2588 | | * @param yyscanner The scanner object. |
2589 | | */ |
2590 | | |
2591 | | char *yyget_text (yyscan_t yyscanner) |
2592 | 0 | { |
2593 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2594 | 0 | return yytext; |
2595 | 0 | } |
2596 | | |
2597 | | /* %if-reentrant */ |
2598 | | |
2599 | | /** Set the user-defined data. This data is never touched by the scanner. |
2600 | | * @param user_defined The data to be associated with this scanner. |
2601 | | * @param yyscanner The scanner object. |
2602 | | */ |
2603 | | void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) |
2604 | 0 | { |
2605 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2606 | 0 | yyextra = user_defined ; |
2607 | 0 | } |
2608 | | |
2609 | | /* %endif */ |
2610 | | |
2611 | | /** Set the current line number. |
2612 | | * @param _line_number line number |
2613 | | * @param yyscanner The scanner object. |
2614 | | */ |
2615 | | void yyset_lineno (int _line_number , yyscan_t yyscanner) |
2616 | 0 | { |
2617 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2618 | | |
2619 | | /* lineno is only valid if an input buffer exists. */ |
2620 | 0 | if (! YY_CURRENT_BUFFER ) |
2621 | 0 | YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); |
2622 | | |
2623 | 0 | yylineno = _line_number; |
2624 | 0 | } |
2625 | | |
2626 | | /** Set the current column. |
2627 | | * @param _column_no column number |
2628 | | * @param yyscanner The scanner object. |
2629 | | */ |
2630 | | void yyset_column (int _column_no , yyscan_t yyscanner) |
2631 | 0 | { |
2632 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2633 | | |
2634 | | /* column is only valid if an input buffer exists. */ |
2635 | 0 | if (! YY_CURRENT_BUFFER ) |
2636 | 0 | YY_FATAL_ERROR( "yyset_column called with no buffer" ); |
2637 | | |
2638 | 0 | yycolumn = _column_no; |
2639 | 0 | } |
2640 | | |
2641 | | /** Set the input stream. This does not discard the current |
2642 | | * input buffer. |
2643 | | * @param _in_str A readable stream. |
2644 | | * @param yyscanner The scanner object. |
2645 | | * @see yy_switch_to_buffer |
2646 | | */ |
2647 | | void yyset_in (FILE * _in_str , yyscan_t yyscanner) |
2648 | 0 | { |
2649 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2650 | 0 | yyin = _in_str ; |
2651 | 0 | } |
2652 | | |
2653 | | void yyset_out (FILE * _out_str , yyscan_t yyscanner) |
2654 | 0 | { |
2655 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2656 | 0 | yyout = _out_str ; |
2657 | 0 | } |
2658 | | |
2659 | | int yyget_debug (yyscan_t yyscanner) |
2660 | 0 | { |
2661 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2662 | 0 | return yy_flex_debug; |
2663 | 0 | } |
2664 | | |
2665 | | void yyset_debug (int _bdebug , yyscan_t yyscanner) |
2666 | 0 | { |
2667 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2668 | 0 | yy_flex_debug = _bdebug ; |
2669 | 0 | } |
2670 | | |
2671 | | /* %endif */ |
2672 | | |
2673 | | /* %if-reentrant */ |
2674 | | /* Accessor methods for yylval and yylloc */ |
2675 | | |
2676 | | /* %if-bison-bridge */ |
2677 | | /* %endif */ |
2678 | | |
2679 | | /* User-visible API */ |
2680 | | |
2681 | | /* yylex_init is special because it creates the scanner itself, so it is |
2682 | | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
2683 | | * That's why we explicitly handle the declaration, instead of using our macros. |
2684 | | */ |
2685 | | int yylex_init(yyscan_t* ptr_yy_globals) |
2686 | 0 | { |
2687 | 0 | if (ptr_yy_globals == NULL){ |
2688 | 0 | errno = EINVAL; |
2689 | 0 | return 1; |
2690 | 0 | } |
2691 | | |
2692 | 0 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); |
2693 | |
|
2694 | 0 | if (*ptr_yy_globals == NULL){ |
2695 | 0 | errno = ENOMEM; |
2696 | 0 | return 1; |
2697 | 0 | } |
2698 | | |
2699 | | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
2700 | 0 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
2701 | |
|
2702 | 0 | return yy_init_globals ( *ptr_yy_globals ); |
2703 | 0 | } |
2704 | | |
2705 | | /* yylex_init_extra has the same functionality as yylex_init, but follows the |
2706 | | * convention of taking the scanner as the last argument. Note however, that |
2707 | | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
2708 | | * is the reason, too, why this function also must handle its own declaration). |
2709 | | * The user defined value in the first argument will be available to yyalloc in |
2710 | | * the yyextra field. |
2711 | | */ |
2712 | | int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) |
2713 | 0 | { |
2714 | 0 | struct yyguts_t dummy_yyguts; |
2715 | |
|
2716 | 0 | yyset_extra (yy_user_defined, &dummy_yyguts); |
2717 | |
|
2718 | 0 | if (ptr_yy_globals == NULL){ |
2719 | 0 | errno = EINVAL; |
2720 | 0 | return 1; |
2721 | 0 | } |
2722 | | |
2723 | 0 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); |
2724 | |
|
2725 | 0 | if (*ptr_yy_globals == NULL){ |
2726 | 0 | errno = ENOMEM; |
2727 | 0 | return 1; |
2728 | 0 | } |
2729 | | |
2730 | | /* By setting to 0xAA, we expose bugs in |
2731 | | yy_init_globals. Leave at 0x00 for releases. */ |
2732 | 0 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
2733 | |
|
2734 | 0 | yyset_extra (yy_user_defined, *ptr_yy_globals); |
2735 | |
|
2736 | 0 | return yy_init_globals ( *ptr_yy_globals ); |
2737 | 0 | } |
2738 | | |
2739 | | /* %endif if-c-only */ |
2740 | | |
2741 | | /* %if-c-only */ |
2742 | | static int yy_init_globals (yyscan_t yyscanner) |
2743 | 0 | { |
2744 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2745 | | /* Initialization is the same as for the non-reentrant scanner. |
2746 | | * This function is called from yylex_destroy(), so don't allocate here. |
2747 | | */ |
2748 | |
|
2749 | 0 | yyg->yy_buffer_stack = NULL; |
2750 | 0 | yyg->yy_buffer_stack_top = 0; |
2751 | 0 | yyg->yy_buffer_stack_max = 0; |
2752 | 0 | yyg->yy_c_buf_p = NULL; |
2753 | 0 | yyg->yy_init = 0; |
2754 | 0 | yyg->yy_start = 0; |
2755 | |
|
2756 | 0 | yyg->yy_start_stack_ptr = 0; |
2757 | 0 | yyg->yy_start_stack_depth = 0; |
2758 | 0 | yyg->yy_start_stack = NULL; |
2759 | | |
2760 | | /* Defined in main.c */ |
2761 | | #ifdef YY_STDINIT |
2762 | | yyin = stdin; |
2763 | | yyout = stdout; |
2764 | | #else |
2765 | 0 | yyin = NULL; |
2766 | 0 | yyout = NULL; |
2767 | 0 | #endif |
2768 | | |
2769 | | /* For future reference: Set errno on error, since we are called by |
2770 | | * yylex_init() |
2771 | | */ |
2772 | 0 | return 0; |
2773 | 0 | } |
2774 | | /* %endif */ |
2775 | | |
2776 | | /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ |
2777 | | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2778 | | int yylex_destroy (yyscan_t yyscanner) |
2779 | 0 | { |
2780 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2781 | | |
2782 | | /* Pop the buffer stack, destroying each element. */ |
2783 | 0 | while(YY_CURRENT_BUFFER){ |
2784 | 0 | yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); |
2785 | 0 | YY_CURRENT_BUFFER_LVALUE = NULL; |
2786 | 0 | yypop_buffer_state(yyscanner); |
2787 | 0 | } |
2788 | | |
2789 | | /* Destroy the stack itself. */ |
2790 | 0 | yyfree(yyg->yy_buffer_stack , yyscanner); |
2791 | 0 | yyg->yy_buffer_stack = NULL; |
2792 | | |
2793 | | /* Destroy the start condition stack. */ |
2794 | 0 | yyfree( yyg->yy_start_stack , yyscanner ); |
2795 | 0 | yyg->yy_start_stack = NULL; |
2796 | | |
2797 | | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
2798 | | * yylex() is called, initialization will occur. */ |
2799 | 0 | yy_init_globals( yyscanner); |
2800 | | |
2801 | | /* %if-reentrant */ |
2802 | | /* Destroy the main struct (reentrant only). */ |
2803 | 0 | yyfree ( yyscanner , yyscanner ); |
2804 | 0 | yyscanner = NULL; |
2805 | | /* %endif */ |
2806 | 0 | return 0; |
2807 | 0 | } |
2808 | | /* %endif */ |
2809 | | |
2810 | | /* |
2811 | | * Internal utility routines. |
2812 | | */ |
2813 | | |
2814 | | #ifndef yytext_ptr |
2815 | | static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) |
2816 | | { |
2817 | | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2818 | | (void)yyg; |
2819 | | |
2820 | | int i; |
2821 | | for ( i = 0; i < n; ++i ) |
2822 | | s1[i] = s2[i]; |
2823 | | } |
2824 | | #endif |
2825 | | |
2826 | | #ifdef YY_NEED_STRLEN |
2827 | | static int yy_flex_strlen (const char * s , yyscan_t yyscanner) |
2828 | | { |
2829 | | int n; |
2830 | | for ( n = 0; s[n]; ++n ) |
2831 | | ; |
2832 | | |
2833 | | return n; |
2834 | | } |
2835 | | #endif |
2836 | | |
2837 | | /* %if-tables-serialization definitions */ |
2838 | | /* %define-yytables The name for this specific scanner's tables. */ |
2839 | | #define YYTABLES_NAME "yytables" |
2840 | | /* %endif */ |
2841 | | |
2842 | | /* %ok-for-header */ |
2843 | | |
2844 | | #line 389 "/src/wireshark/epan/uat_load.l" |
2845 | | |
2846 | | |
2847 | | /* |
2848 | | * Turn diagnostics back on, so we check the code that we've written. |
2849 | | */ |
2850 | | DIAG_ON_FLEX() |
2851 | | |
2852 | | bool |
2853 | | uat_load(uat_t *uat, const char *filename, char **errx) |
2854 | 1.75k | { |
2855 | 1.75k | char *fname; |
2856 | 1.75k | FILE *in; |
2857 | 1.75k | yyscan_t scanner; |
2858 | 1.75k | uat_load_scanner_state_t state; |
2859 | | |
2860 | 1.75k | if (filename) { |
2861 | 0 | fname = g_strdup(filename); |
2862 | 1.75k | } else { |
2863 | 1.75k | fname = uat_get_actual_filename(uat, false); |
2864 | 1.75k | } |
2865 | | |
2866 | 1.75k | if (!fname) { |
2867 | 1.75k | UAT_UPDATE(uat); |
2868 | | |
2869 | 1.75k | if (uat->post_update_cb) |
2870 | 1.13k | uat->post_update_cb(); |
2871 | | |
2872 | 1.75k | return true; |
2873 | 1.75k | } |
2874 | | |
2875 | | |
2876 | 0 | if (!(in = ws_fopen(fname,"r"))) { |
2877 | 0 | *errx = g_strdup(g_strerror(errno)); |
2878 | 0 | g_free(fname); |
2879 | 0 | return false; |
2880 | 0 | } |
2881 | | |
2882 | 0 | if (uat_load_lex_init(&scanner) != 0) { |
2883 | 0 | *errx = g_strdup(g_strerror(errno)); |
2884 | 0 | fclose(in); |
2885 | 0 | g_free(fname); |
2886 | 0 | return false; |
2887 | 0 | } |
2888 | | |
2889 | 0 | uat_load_set_in(in, scanner); |
2890 | |
|
2891 | 0 | state.uat = uat; |
2892 | 0 | state.parse_str = NULL; /* we're reading from a file */ |
2893 | |
|
2894 | 0 | state.error = NULL; |
2895 | 0 | state.valid_record = true; |
2896 | 0 | state.colnum = 0; |
2897 | 0 | state.ptrx = NULL; |
2898 | 0 | state.len = 0; |
2899 | 0 | state.record = g_malloc0(uat->record_size); |
2900 | 0 | state.linenum = 1; |
2901 | 0 | state.parse_str_pos = 0; |
2902 | |
|
2903 | 0 | DUMP(fname); |
2904 | 0 | g_free(fname); /* we're done with the file name now */ |
2905 | | |
2906 | | /* Associate the state with the scanner */ |
2907 | 0 | uat_load_set_extra(&state, scanner); |
2908 | |
|
2909 | 0 | uat_load_lex(scanner); |
2910 | |
|
2911 | 0 | uat_load_lex_destroy(scanner); |
2912 | 0 | g_free(state.record); |
2913 | 0 | fclose(in); |
2914 | |
|
2915 | 0 | uat->changed = false; |
2916 | 0 | uat->loaded = true; |
2917 | 0 | UAT_UPDATE(uat); |
2918 | |
|
2919 | 0 | if (state.error) { |
2920 | 0 | *errx = state.error; |
2921 | 0 | return false; |
2922 | 0 | } |
2923 | | |
2924 | 0 | if (uat->post_update_cb) |
2925 | 0 | uat->post_update_cb(); |
2926 | |
|
2927 | 0 | *errx = NULL; |
2928 | 0 | return true; |
2929 | 0 | } |
2930 | | |
2931 | | bool |
2932 | | uat_load_str(uat_t *uat, const char *entry, char **err) |
2933 | 0 | { |
2934 | 0 | yyscan_t scanner; |
2935 | 0 | uat_load_scanner_state_t state; |
2936 | |
|
2937 | 0 | state.uat = uat; |
2938 | 0 | state.parse_str = ws_strdup_printf("%s\n", entry); /* Records must end with a newline */ |
2939 | |
|
2940 | 0 | state.error = NULL; |
2941 | 0 | state.valid_record = true; |
2942 | 0 | state.colnum = 0; |
2943 | 0 | state.ptrx = NULL; |
2944 | 0 | state.len = 0; |
2945 | 0 | state.record = g_malloc0(uat->record_size); |
2946 | 0 | state.linenum = 1; |
2947 | 0 | state.parse_str_pos = 0; |
2948 | |
|
2949 | 0 | if (uat_load_lex_init(&scanner) != 0) { |
2950 | 0 | *err = g_strdup(g_strerror(errno)); |
2951 | 0 | g_free(state.parse_str); |
2952 | 0 | g_free(state.record); |
2953 | 0 | return false; |
2954 | 0 | } |
2955 | | |
2956 | 0 | DUMP(entry); |
2957 | | |
2958 | | /* Associate the state with the scanner */ |
2959 | 0 | uat_load_set_extra(&state, scanner); |
2960 | |
|
2961 | 0 | uat_load_lex(scanner); |
2962 | |
|
2963 | 0 | uat_load_lex_destroy(scanner); |
2964 | 0 | g_free(state.record); |
2965 | 0 | g_free(state.parse_str); |
2966 | |
|
2967 | 0 | uat->changed = true; |
2968 | 0 | uat->loaded = true; |
2969 | 0 | UAT_UPDATE(uat); |
2970 | |
|
2971 | 0 | if (state.error) { |
2972 | 0 | *err = state.error; |
2973 | 0 | return false; |
2974 | 0 | } |
2975 | | |
2976 | 0 | if (uat->post_update_cb) |
2977 | 0 | uat->post_update_cb(); |
2978 | |
|
2979 | 0 | *err = NULL; |
2980 | 0 | return true; |
2981 | 0 | } |
2982 | | |