/work/build/wiretap/k12text.c
Line | Count | Source (jump to first uncovered line) |
1 | | #line 2 "/work/build/wiretap/k12text.c" |
2 | | /* Include this before everything else, for various large-file definitions */ |
3 | | #include "config.h" |
4 | | #include <wireshark.h> |
5 | | |
6 | | #line 7 "/work/build/wiretap/k12text.c" |
7 | | |
8 | | #define YY_INT_ALIGNED short int |
9 | | |
10 | | /* A lexical scanner generated by flex */ |
11 | | |
12 | | /* %not-for-header */ |
13 | | /* %if-c-only */ |
14 | | /* %if-not-reentrant */ |
15 | | /* %endif */ |
16 | | /* %endif */ |
17 | | /* %ok-for-header */ |
18 | | |
19 | | #define FLEX_SCANNER |
20 | | #define YY_FLEX_MAJOR_VERSION 2 |
21 | | #define YY_FLEX_MINOR_VERSION 6 |
22 | | #define YY_FLEX_SUBMINOR_VERSION 4 |
23 | | #if YY_FLEX_SUBMINOR_VERSION > 0 |
24 | | #define FLEX_BETA |
25 | | #endif |
26 | | |
27 | | /* %if-c++-only */ |
28 | | /* %endif */ |
29 | | |
30 | | /* %if-c-only */ |
31 | | #ifdef yy_create_buffer |
32 | | #define k12text__create_buffer_ALREADY_DEFINED |
33 | | #else |
34 | 0 | #define yy_create_buffer k12text__create_buffer |
35 | | #endif |
36 | | |
37 | | #ifdef yy_delete_buffer |
38 | | #define k12text__delete_buffer_ALREADY_DEFINED |
39 | | #else |
40 | 0 | #define yy_delete_buffer k12text__delete_buffer |
41 | | #endif |
42 | | |
43 | | #ifdef yy_scan_buffer |
44 | | #define k12text__scan_buffer_ALREADY_DEFINED |
45 | | #else |
46 | 0 | #define yy_scan_buffer k12text__scan_buffer |
47 | | #endif |
48 | | |
49 | | #ifdef yy_scan_string |
50 | | #define k12text__scan_string_ALREADY_DEFINED |
51 | | #else |
52 | | #define yy_scan_string k12text__scan_string |
53 | | #endif |
54 | | |
55 | | #ifdef yy_scan_bytes |
56 | | #define k12text__scan_bytes_ALREADY_DEFINED |
57 | | #else |
58 | 0 | #define yy_scan_bytes k12text__scan_bytes |
59 | | #endif |
60 | | |
61 | | #ifdef yy_init_buffer |
62 | | #define k12text__init_buffer_ALREADY_DEFINED |
63 | | #else |
64 | 0 | #define yy_init_buffer k12text__init_buffer |
65 | | #endif |
66 | | |
67 | | #ifdef yy_flush_buffer |
68 | | #define k12text__flush_buffer_ALREADY_DEFINED |
69 | | #else |
70 | 0 | #define yy_flush_buffer k12text__flush_buffer |
71 | | #endif |
72 | | |
73 | | #ifdef yy_load_buffer_state |
74 | | #define k12text__load_buffer_state_ALREADY_DEFINED |
75 | | #else |
76 | 0 | #define yy_load_buffer_state k12text__load_buffer_state |
77 | | #endif |
78 | | |
79 | | #ifdef yy_switch_to_buffer |
80 | | #define k12text__switch_to_buffer_ALREADY_DEFINED |
81 | | #else |
82 | 0 | #define yy_switch_to_buffer k12text__switch_to_buffer |
83 | | #endif |
84 | | |
85 | | #ifdef yypush_buffer_state |
86 | | #define k12text_push_buffer_state_ALREADY_DEFINED |
87 | | #else |
88 | | #define yypush_buffer_state k12text_push_buffer_state |
89 | | #endif |
90 | | |
91 | | #ifdef yypop_buffer_state |
92 | | #define k12text_pop_buffer_state_ALREADY_DEFINED |
93 | | #else |
94 | 0 | #define yypop_buffer_state k12text_pop_buffer_state |
95 | | #endif |
96 | | |
97 | | #ifdef yyensure_buffer_stack |
98 | | #define k12text_ensure_buffer_stack_ALREADY_DEFINED |
99 | | #else |
100 | 0 | #define yyensure_buffer_stack k12text_ensure_buffer_stack |
101 | | #endif |
102 | | |
103 | | #ifdef yylex |
104 | | #define k12text_lex_ALREADY_DEFINED |
105 | | #else |
106 | 0 | #define yylex k12text_lex |
107 | | #endif |
108 | | |
109 | | #ifdef yyrestart |
110 | | #define k12text_restart_ALREADY_DEFINED |
111 | | #else |
112 | 0 | #define yyrestart k12text_restart |
113 | | #endif |
114 | | |
115 | | #ifdef yylex_init |
116 | | #define k12text_lex_init_ALREADY_DEFINED |
117 | | #else |
118 | 0 | #define yylex_init k12text_lex_init |
119 | | #endif |
120 | | |
121 | | #ifdef yylex_init_extra |
122 | | #define k12text_lex_init_extra_ALREADY_DEFINED |
123 | | #else |
124 | | #define yylex_init_extra k12text_lex_init_extra |
125 | | #endif |
126 | | |
127 | | #ifdef yylex_destroy |
128 | | #define k12text_lex_destroy_ALREADY_DEFINED |
129 | | #else |
130 | 0 | #define yylex_destroy k12text_lex_destroy |
131 | | #endif |
132 | | |
133 | | #ifdef yyget_debug |
134 | | #define k12text_get_debug_ALREADY_DEFINED |
135 | | #else |
136 | | #define yyget_debug k12text_get_debug |
137 | | #endif |
138 | | |
139 | | #ifdef yyset_debug |
140 | | #define k12text_set_debug_ALREADY_DEFINED |
141 | | #else |
142 | | #define yyset_debug k12text_set_debug |
143 | | #endif |
144 | | |
145 | | #ifdef yyget_extra |
146 | | #define k12text_get_extra_ALREADY_DEFINED |
147 | | #else |
148 | | #define yyget_extra k12text_get_extra |
149 | | #endif |
150 | | |
151 | | #ifdef yyset_extra |
152 | | #define k12text_set_extra_ALREADY_DEFINED |
153 | | #else |
154 | 0 | #define yyset_extra k12text_set_extra |
155 | | #endif |
156 | | |
157 | | #ifdef yyget_in |
158 | | #define k12text_get_in_ALREADY_DEFINED |
159 | | #else |
160 | | #define yyget_in k12text_get_in |
161 | | #endif |
162 | | |
163 | | #ifdef yyset_in |
164 | | #define k12text_set_in_ALREADY_DEFINED |
165 | | #else |
166 | | #define yyset_in k12text_set_in |
167 | | #endif |
168 | | |
169 | | #ifdef yyget_out |
170 | | #define k12text_get_out_ALREADY_DEFINED |
171 | | #else |
172 | | #define yyget_out k12text_get_out |
173 | | #endif |
174 | | |
175 | | #ifdef yyset_out |
176 | | #define k12text_set_out_ALREADY_DEFINED |
177 | | #else |
178 | | #define yyset_out k12text_set_out |
179 | | #endif |
180 | | |
181 | | #ifdef yyget_leng |
182 | | #define k12text_get_leng_ALREADY_DEFINED |
183 | | #else |
184 | | #define yyget_leng k12text_get_leng |
185 | | #endif |
186 | | |
187 | | #ifdef yyget_text |
188 | | #define k12text_get_text_ALREADY_DEFINED |
189 | | #else |
190 | | #define yyget_text k12text_get_text |
191 | | #endif |
192 | | |
193 | | #ifdef yyget_lineno |
194 | | #define k12text_get_lineno_ALREADY_DEFINED |
195 | | #else |
196 | | #define yyget_lineno k12text_get_lineno |
197 | | #endif |
198 | | |
199 | | #ifdef yyset_lineno |
200 | | #define k12text_set_lineno_ALREADY_DEFINED |
201 | | #else |
202 | | #define yyset_lineno k12text_set_lineno |
203 | | #endif |
204 | | |
205 | | #ifdef yyget_column |
206 | | #define k12text_get_column_ALREADY_DEFINED |
207 | | #else |
208 | | #define yyget_column k12text_get_column |
209 | | #endif |
210 | | |
211 | | #ifdef yyset_column |
212 | | #define k12text_set_column_ALREADY_DEFINED |
213 | | #else |
214 | | #define yyset_column k12text_set_column |
215 | | #endif |
216 | | |
217 | | #ifdef yywrap |
218 | | #define k12text_wrap_ALREADY_DEFINED |
219 | | #else |
220 | 0 | #define yywrap k12text_wrap |
221 | | #endif |
222 | | |
223 | | /* %endif */ |
224 | | |
225 | | #ifdef yyalloc |
226 | | #define k12text_alloc_ALREADY_DEFINED |
227 | | #else |
228 | 0 | #define yyalloc k12text_alloc |
229 | | #endif |
230 | | |
231 | | #ifdef yyrealloc |
232 | | #define k12text_realloc_ALREADY_DEFINED |
233 | | #else |
234 | 0 | #define yyrealloc k12text_realloc |
235 | | #endif |
236 | | |
237 | | #ifdef yyfree |
238 | | #define k12text_free_ALREADY_DEFINED |
239 | | #else |
240 | 0 | #define yyfree k12text_free |
241 | | #endif |
242 | | |
243 | | /* %if-c-only */ |
244 | | |
245 | | /* %endif */ |
246 | | |
247 | | /* First, we deal with platform-specific or compiler-specific issues. */ |
248 | | |
249 | | /* begin standard C headers. */ |
250 | | /* %if-c-only */ |
251 | | #include <stdio.h> |
252 | | #include <string.h> |
253 | | #include <errno.h> |
254 | | #include <stdlib.h> |
255 | | /* %endif */ |
256 | | |
257 | | /* %if-tables-serialization */ |
258 | | /* %endif */ |
259 | | /* end standard C headers. */ |
260 | | |
261 | | /* %if-c-or-c++ */ |
262 | | /* flex integer type definitions */ |
263 | | |
264 | | #ifndef FLEXINT_H |
265 | | #define FLEXINT_H |
266 | | |
267 | | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
268 | | |
269 | | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
270 | | |
271 | | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
272 | | * if you want the limit (max/min) macros for int types. |
273 | | */ |
274 | | #ifndef __STDC_LIMIT_MACROS |
275 | | #define __STDC_LIMIT_MACROS 1 |
276 | | #endif |
277 | | |
278 | | #include <inttypes.h> |
279 | | typedef int8_t flex_int8_t; |
280 | | typedef uint8_t flex_uint8_t; |
281 | | typedef int16_t flex_int16_t; |
282 | | typedef uint16_t flex_uint16_t; |
283 | | typedef int32_t flex_int32_t; |
284 | | typedef uint32_t flex_uint32_t; |
285 | | #else |
286 | | typedef signed char flex_int8_t; |
287 | | typedef short int flex_int16_t; |
288 | | typedef int flex_int32_t; |
289 | | typedef unsigned char flex_uint8_t; |
290 | | typedef unsigned short int flex_uint16_t; |
291 | | typedef unsigned int flex_uint32_t; |
292 | | |
293 | | /* Limits of integral types. */ |
294 | | #ifndef INT8_MIN |
295 | | #define INT8_MIN (-128) |
296 | | #endif |
297 | | #ifndef INT16_MIN |
298 | | #define INT16_MIN (-32767-1) |
299 | | #endif |
300 | | #ifndef INT32_MIN |
301 | | #define INT32_MIN (-2147483647-1) |
302 | | #endif |
303 | | #ifndef INT8_MAX |
304 | | #define INT8_MAX (127) |
305 | | #endif |
306 | | #ifndef INT16_MAX |
307 | | #define INT16_MAX (32767) |
308 | | #endif |
309 | | #ifndef INT32_MAX |
310 | | #define INT32_MAX (2147483647) |
311 | | #endif |
312 | | #ifndef UINT8_MAX |
313 | | #define UINT8_MAX (255U) |
314 | | #endif |
315 | | #ifndef UINT16_MAX |
316 | | #define UINT16_MAX (65535U) |
317 | | #endif |
318 | | #ifndef UINT32_MAX |
319 | | #define UINT32_MAX (4294967295U) |
320 | | #endif |
321 | | |
322 | | #ifndef SIZE_MAX |
323 | | #define SIZE_MAX (~(size_t)0) |
324 | | #endif |
325 | | |
326 | | #endif /* ! C99 */ |
327 | | |
328 | | #endif /* ! FLEXINT_H */ |
329 | | |
330 | | /* %endif */ |
331 | | |
332 | | /* begin standard C++ headers. */ |
333 | | /* %if-c++-only */ |
334 | | /* %endif */ |
335 | | |
336 | | /* TODO: this is always defined, so inline it */ |
337 | | #define yyconst const |
338 | | |
339 | | #if defined(__GNUC__) && __GNUC__ >= 3 |
340 | | #define yynoreturn __attribute__((__noreturn__)) |
341 | | #else |
342 | | #define yynoreturn |
343 | | #endif |
344 | | |
345 | | /* %not-for-header */ |
346 | | /* Returned upon end-of-file. */ |
347 | 0 | #define YY_NULL 0 |
348 | | /* %ok-for-header */ |
349 | | |
350 | | /* %not-for-header */ |
351 | | /* Promotes a possibly negative, possibly signed char to an |
352 | | * integer in range [0..255] for use as an array index. |
353 | | */ |
354 | 0 | #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) |
355 | | /* %ok-for-header */ |
356 | | |
357 | | /* %if-reentrant */ |
358 | | |
359 | | /* An opaque pointer. */ |
360 | | #ifndef YY_TYPEDEF_YY_SCANNER_T |
361 | | #define YY_TYPEDEF_YY_SCANNER_T |
362 | | typedef void* yyscan_t; |
363 | | #endif |
364 | | |
365 | | /* For convenience, these vars (plus the bison vars far below) |
366 | | are macros in the reentrant scanner. */ |
367 | 0 | #define yyin yyg->yyin_r |
368 | 0 | #define yyout yyg->yyout_r |
369 | 0 | #define yyextra yyg->yyextra_r |
370 | 0 | #define yyleng yyg->yyleng_r |
371 | 0 | #define yytext yyg->yytext_r |
372 | 0 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
373 | 0 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
374 | 0 | #define yy_flex_debug yyg->yy_flex_debug_r |
375 | | |
376 | | /* %endif */ |
377 | | |
378 | | /* %if-not-reentrant */ |
379 | | /* %endif */ |
380 | | |
381 | | /* Enter a start condition. This macro really ought to take a parameter, |
382 | | * but we do it the disgusting crufty way forced on us by the ()-less |
383 | | * definition of BEGIN. |
384 | | */ |
385 | 0 | #define BEGIN yyg->yy_start = 1 + 2 * |
386 | | /* Translate the current start state into a value that can be later handed |
387 | | * to BEGIN to return to the state. The YYSTATE alias is for lex |
388 | | * compatibility. |
389 | | */ |
390 | | #define YY_START ((yyg->yy_start - 1) / 2) |
391 | | #define YYSTATE YY_START |
392 | | /* Action number for EOF rule of a given start state. */ |
393 | 0 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
394 | | /* Special action meaning "start processing a new file". */ |
395 | 0 | #define YY_NEW_FILE yyrestart( yyin , yyscanner ) |
396 | 0 | #define YY_END_OF_BUFFER_CHAR 0 |
397 | | |
398 | | /* Size of default input buffer. */ |
399 | | #ifndef YY_BUF_SIZE |
400 | | #ifdef __ia64__ |
401 | | /* On IA-64, the buffer size is 16k, not 8k. |
402 | | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
403 | | * Ditto for the __ia64__ case accordingly. |
404 | | */ |
405 | | #define YY_BUF_SIZE 32768 |
406 | | #else |
407 | 0 | #define YY_BUF_SIZE 16384 |
408 | | #endif /* __ia64__ */ |
409 | | #endif |
410 | | |
411 | | /* The state buf must be large enough to hold one state per character in the main buffer. |
412 | | */ |
413 | | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
414 | | |
415 | | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
416 | | #define YY_TYPEDEF_YY_BUFFER_STATE |
417 | | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
418 | | #endif |
419 | | |
420 | | #ifndef YY_TYPEDEF_YY_SIZE_T |
421 | | #define YY_TYPEDEF_YY_SIZE_T |
422 | | typedef size_t yy_size_t; |
423 | | #endif |
424 | | |
425 | | /* %if-not-reentrant */ |
426 | | /* %endif */ |
427 | | |
428 | | /* %if-c-only */ |
429 | | /* %if-not-reentrant */ |
430 | | /* %endif */ |
431 | | /* %endif */ |
432 | | |
433 | 0 | #define EOB_ACT_CONTINUE_SCAN 0 |
434 | 0 | #define EOB_ACT_END_OF_FILE 1 |
435 | 0 | #define EOB_ACT_LAST_MATCH 2 |
436 | | |
437 | | #define YY_LESS_LINENO(n) |
438 | | #define YY_LINENO_REWIND_TO(ptr) |
439 | | |
440 | | /* Return all but the first "n" matched characters back to the input stream. */ |
441 | | #define yyless(n) \ |
442 | | do \ |
443 | | { \ |
444 | | /* Undo effects of setting up yytext. */ \ |
445 | | int yyless_macro_arg = (n); \ |
446 | | YY_LESS_LINENO(yyless_macro_arg);\ |
447 | | *yy_cp = yyg->yy_hold_char; \ |
448 | | YY_RESTORE_YY_MORE_OFFSET \ |
449 | | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
450 | | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
451 | | } \ |
452 | | while ( 0 ) |
453 | | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) |
454 | | |
455 | | #ifndef YY_STRUCT_YY_BUFFER_STATE |
456 | | #define YY_STRUCT_YY_BUFFER_STATE |
457 | | struct yy_buffer_state |
458 | | { |
459 | | /* %if-c-only */ |
460 | | FILE *yy_input_file; |
461 | | /* %endif */ |
462 | | |
463 | | /* %if-c++-only */ |
464 | | /* %endif */ |
465 | | |
466 | | char *yy_ch_buf; /* input buffer */ |
467 | | char *yy_buf_pos; /* current position in input buffer */ |
468 | | |
469 | | /* Size of input buffer in bytes, not including room for EOB |
470 | | * characters. |
471 | | */ |
472 | | int yy_buf_size; |
473 | | |
474 | | /* Number of characters read into yy_ch_buf, not including EOB |
475 | | * characters. |
476 | | */ |
477 | | int yy_n_chars; |
478 | | |
479 | | /* Whether we "own" the buffer - i.e., we know we created it, |
480 | | * and can realloc() it to grow it, and should free() it to |
481 | | * delete it. |
482 | | */ |
483 | | int yy_is_our_buffer; |
484 | | |
485 | | /* Whether this is an "interactive" input source; if so, and |
486 | | * if we're using stdio for input, then we want to use getc() |
487 | | * instead of fread(), to make sure we stop fetching input after |
488 | | * each newline. |
489 | | */ |
490 | | int yy_is_interactive; |
491 | | |
492 | | /* Whether we're considered to be at the beginning of a line. |
493 | | * If so, '^' rules will be active on the next match, otherwise |
494 | | * not. |
495 | | */ |
496 | | int yy_at_bol; |
497 | | |
498 | | int yy_bs_lineno; /**< The line count. */ |
499 | | int yy_bs_column; /**< The column count. */ |
500 | | |
501 | | /* Whether to try to fill the input buffer when we reach the |
502 | | * end of it. |
503 | | */ |
504 | | int yy_fill_buffer; |
505 | | |
506 | | int yy_buffer_status; |
507 | | |
508 | 0 | #define YY_BUFFER_NEW 0 |
509 | 0 | #define YY_BUFFER_NORMAL 1 |
510 | | /* When an EOF's been seen but there's still some text to process |
511 | | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
512 | | * shouldn't try reading from the input source any more. We might |
513 | | * still have a bunch of tokens to match, though, because of |
514 | | * possible backing-up. |
515 | | * |
516 | | * When we actually see the EOF, we change the status to "new" |
517 | | * (via yyrestart()), so that the user can continue scanning by |
518 | | * just pointing yyin at a new input file. |
519 | | */ |
520 | 0 | #define YY_BUFFER_EOF_PENDING 2 |
521 | | |
522 | | }; |
523 | | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
524 | | |
525 | | /* %if-c-only Standard (non-C++) definition */ |
526 | | /* %not-for-header */ |
527 | | /* %if-not-reentrant */ |
528 | | /* %endif */ |
529 | | /* %ok-for-header */ |
530 | | |
531 | | /* %endif */ |
532 | | |
533 | | /* We provide macros for accessing buffer states in case in the |
534 | | * future we want to put the buffer states in a more general |
535 | | * "scanner state". |
536 | | * |
537 | | * Returns the top of the stack, or NULL. |
538 | | */ |
539 | 0 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ |
540 | 0 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ |
541 | 0 | : NULL) |
542 | | /* Same as previous macro, but useful when we know that the buffer stack is not |
543 | | * NULL or when we need an lvalue. For internal use only. |
544 | | */ |
545 | 0 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
546 | | |
547 | | /* %if-c-only Standard (non-C++) definition */ |
548 | | |
549 | | /* %if-not-reentrant */ |
550 | | /* %not-for-header */ |
551 | | /* %ok-for-header */ |
552 | | |
553 | | /* %endif */ |
554 | | |
555 | | void yyrestart ( FILE *input_file , yyscan_t yyscanner ); |
556 | | void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
557 | | YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); |
558 | | void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
559 | | void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
560 | | void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
561 | | void yypop_buffer_state ( yyscan_t yyscanner ); |
562 | | |
563 | | static void yyensure_buffer_stack ( yyscan_t yyscanner ); |
564 | | static void yy_load_buffer_state ( yyscan_t yyscanner ); |
565 | | static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); |
566 | | #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) |
567 | | |
568 | | YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); |
569 | | YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); |
570 | | YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); |
571 | | |
572 | | /* %endif */ |
573 | | |
574 | | void *yyalloc ( yy_size_t , yyscan_t yyscanner ); |
575 | | void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); |
576 | | void yyfree ( void * , yyscan_t yyscanner ); |
577 | | |
578 | | #define yy_new_buffer yy_create_buffer |
579 | | #define yy_set_interactive(is_interactive) \ |
580 | | { \ |
581 | | if ( ! YY_CURRENT_BUFFER ){ \ |
582 | | yyensure_buffer_stack (yyscanner); \ |
583 | | YY_CURRENT_BUFFER_LVALUE = \ |
584 | | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
585 | | } \ |
586 | | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
587 | | } |
588 | | #define yy_set_bol(at_bol) \ |
589 | | { \ |
590 | | if ( ! YY_CURRENT_BUFFER ){\ |
591 | | yyensure_buffer_stack (yyscanner); \ |
592 | | YY_CURRENT_BUFFER_LVALUE = \ |
593 | | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
594 | | } \ |
595 | | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
596 | | } |
597 | | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
598 | | |
599 | | /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ |
600 | | /* Begin user sect3 */ |
601 | | |
602 | 0 | #define k12text_wrap(yyscanner) (/*CONSTCOND*/1) |
603 | | #define YY_SKIP_YYWRAP |
604 | | |
605 | | #define FLEX_DEBUG |
606 | | typedef flex_uint8_t YY_CHAR; |
607 | | |
608 | | typedef int yy_state_type; |
609 | | |
610 | 0 | #define yytext_ptr yytext_r |
611 | | |
612 | | /* %% [1.5] DFA */ |
613 | | |
614 | | /* %if-c-only Standard (non-C++) definition */ |
615 | | |
616 | | static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); |
617 | | static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); |
618 | | static int yy_get_next_buffer ( yyscan_t yyscanner ); |
619 | | static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); |
620 | | |
621 | | /* %endif */ |
622 | | |
623 | | /* Done after the current pattern has been matched and before the |
624 | | * corresponding action - sets up yytext. |
625 | | */ |
626 | | #define YY_DO_BEFORE_ACTION \ |
627 | 0 | yyg->yytext_ptr = yy_bp; \ |
628 | 0 | /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ |
629 | 0 | yyleng = (int) (yy_cp - yy_bp); \ |
630 | 0 | yyg->yy_hold_char = *yy_cp; \ |
631 | 0 | *yy_cp = '\0'; \ |
632 | 0 | /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ |
633 | 0 | yyg->yy_c_buf_p = yy_cp; |
634 | | /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ |
635 | | #define YY_NUM_RULES 22 |
636 | 0 | #define YY_END_OF_BUFFER 23 |
637 | | /* This struct is not used in this scanner, |
638 | | but its presence is necessary. */ |
639 | | struct yy_trans_info |
640 | | { |
641 | | flex_int32_t yy_verify; |
642 | | flex_int32_t yy_nxt; |
643 | | }; |
644 | | static const flex_int16_t yy_accept[517] = |
645 | | { 0, |
646 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
647 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
648 | | 0, 0, 0, 0, 0, 0, 0, 0, 23, 21, |
649 | | 22, 2, 2, 21, 21, 21, 6, 21, 8, 21, |
650 | | 10, 21, 21, 21, 21, 21, 21, 22, 21, 21, |
651 | | 21, 0, 0, 0, 4, 5, 7, 0, 0, 0, |
652 | | 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, |
653 | | 0, 9, 11, 0, 0, 0, 0, 0, 18, 0, |
654 | | 0, 0, 0, 16, 0, 15, 0, 0, 0, 0, |
655 | | 0, 12, 0, 14, 0, 0, 0, 0, 13, 17, |
656 | | |
657 | | 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
658 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
659 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
660 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
661 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
662 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
663 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
664 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
665 | | 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, |
666 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
667 | | |
668 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
669 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
670 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
671 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
672 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
673 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
674 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
675 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
676 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
677 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
678 | | |
679 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
680 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
681 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
682 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
683 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
684 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
685 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
686 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
687 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
688 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
689 | | |
690 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
691 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
692 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
693 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
694 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
695 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
696 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
697 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
698 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
699 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
700 | | |
701 | | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
702 | | 0, 0, 0, 0, 0, 0 |
703 | | } ; |
704 | | |
705 | | static const YY_CHAR yy_ec[256] = |
706 | | { 0, |
707 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, |
708 | | 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, |
709 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
710 | | 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, |
711 | | 1, 1, 5, 6, 7, 1, 1, 8, 9, 10, |
712 | | 9, 9, 9, 9, 9, 9, 9, 11, 1, 1, |
713 | | 1, 1, 1, 1, 12, 12, 13, 14, 15, 16, |
714 | | 1, 17, 1, 1, 1, 18, 19, 1, 20, 21, |
715 | | 1, 22, 23, 24, 1, 1, 1, 1, 1, 1, |
716 | | 1, 1, 1, 1, 1, 1, 25, 25, 25, 25, |
717 | | |
718 | | 25, 25, 1, 1, 1, 1, 1, 1, 1, 1, |
719 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
720 | | 1, 1, 1, 26, 1, 1, 1, 1, 1, 1, |
721 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
722 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
723 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
724 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
725 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
726 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
727 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
728 | | |
729 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
730 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
731 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
732 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
733 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
734 | | 1, 1, 1, 1, 1 |
735 | | } ; |
736 | | |
737 | | static const YY_CHAR yy_meta[27] = |
738 | | { 0, |
739 | | 1, 1, 1, 2, 1, 1, 1, 3, 3, 3, |
740 | | 4, 5, 5, 5, 5, 5, 1, 1, 1, 1, |
741 | | 1, 1, 1, 1, 6, 1 |
742 | | } ; |
743 | | |
744 | | static const flex_int16_t yy_base[525] = |
745 | | { 0, |
746 | | 930, 929, 0, 1, 2, 6, 10, 19, 28, 37, |
747 | | 11, 12, 46, 55, 29, 38, 64, 73, 47, 56, |
748 | | 82, 91, 100, 0, 7, 8, 125, 0, 930, 933, |
749 | | 933, 933, 922, 921, 916, 7, 933, 16, 933, 33, |
750 | | 933, 42, 902, 911, 900, 900, 914, 57, 919, 0, |
751 | | 0, 913, 912, 907, 933, 933, 933, 59, 68, 900, |
752 | | 898, 894, 901, 909, 933, 910, 68, 885, 0, 903, |
753 | | 902, 933, 933, 893, 894, 899, 69, 901, 933, 0, |
754 | | 897, 896, 880, 933, 883, 933, 879, 895, 0, 891, |
755 | | 890, 933, 886, 933, 869, 868, 886, 885, 933, 933, |
756 | | |
757 | | 933, 884, 883, 882, 881, 880, 879, 880, 879, 876, |
758 | | 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, |
759 | | 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, |
760 | | 855, 854, 853, 852, 851, 850, 849, 848, 847, 81, |
761 | | 89, 846, 90, 845, 98, 844, 99, 843, 102, 842, |
762 | | 103, 841, 106, 839, 107, 835, 111, 831, 115, 827, |
763 | | 124, 824, 125, 823, 131, 806, 132, 142, 135, 141, |
764 | | 136, 118, 139, 117, 140, 114, 147, 91, 148, 80, |
765 | | 151, 152, 155, 156, 159, 933, 160, 163, 933, 164, |
766 | | 167, 168, 171, 172, 175, 176, 179, 180, 183, 184, |
767 | | |
768 | | 187, 188, 191, 192, 195, 196, 199, 200, 203, 204, |
769 | | 207, 208, 211, 212, 215, 216, 219, 220, 223, 224, |
770 | | 227, 228, 231, 232, 235, 236, 239, 240, 243, 244, |
771 | | 247, 248, 251, 252, 255, 256, 259, 260, 263, 264, |
772 | | 267, 268, 271, 272, 275, 276, 279, 280, 283, 284, |
773 | | 287, 288, 291, 292, 295, 296, 299, 300, 303, 304, |
774 | | 307, 308, 311, 312, 315, 316, 319, 320, 323, 324, |
775 | | 327, 328, 331, 332, 335, 336, 339, 340, 343, 344, |
776 | | 347, 348, 351, 352, 355, 356, 359, 360, 363, 364, |
777 | | 367, 368, 371, 372, 375, 376, 379, 380, 383, 384, |
778 | | |
779 | | 387, 388, 391, 392, 395, 396, 399, 400, 403, 404, |
780 | | 407, 408, 411, 412, 415, 416, 419, 420, 423, 424, |
781 | | 427, 428, 431, 432, 435, 436, 439, 440, 443, 444, |
782 | | 447, 448, 451, 452, 455, 456, 459, 460, 463, 464, |
783 | | 467, 468, 471, 472, 475, 476, 479, 480, 483, 484, |
784 | | 487, 488, 491, 492, 495, 496, 499, 500, 503, 504, |
785 | | 507, 508, 511, 512, 515, 516, 519, 520, 523, 524, |
786 | | 527, 528, 531, 532, 535, 536, 539, 540, 543, 544, |
787 | | 547, 548, 551, 552, 555, 556, 559, 560, 563, 564, |
788 | | 567, 568, 571, 572, 575, 576, 579, 580, 583, 584, |
789 | | |
790 | | 587, 588, 591, 592, 595, 596, 599, 600, 603, 604, |
791 | | 607, 608, 611, 612, 615, 616, 619, 620, 623, 624, |
792 | | 627, 628, 631, 632, 635, 636, 639, 640, 643, 644, |
793 | | 647, 648, 651, 652, 655, 656, 659, 660, 663, 664, |
794 | | 667, 668, 671, 672, 675, 676, 679, 680, 683, 684, |
795 | | 687, 688, 691, 692, 695, 696, 699, 700, 703, 704, |
796 | | 707, 708, 711, 712, 715, 716, 719, 720, 723, 724, |
797 | | 727, 728, 731, 732, 735, 736, 739, 740, 743, 744, |
798 | | 75, 747, 74, 748, 751, 752, 755, 756, 759, 760, |
799 | | 763, 764, 767, 768, 771, 772, 775, 776, 779, 780, |
800 | | |
801 | | 783, 784, 787, 788, 791, 792, 795, 796, 799, 800, |
802 | | 803, 804, 807, 56, 27, 933, 814, 820, 824, 826, |
803 | | 830, 834, 838, 842 |
804 | | } ; |
805 | | |
806 | | static const flex_int16_t yy_def[525] = |
807 | | { 0, |
808 | | 517, 517, 518, 518, 517, 517, 517, 517, 517, 517, |
809 | | 517, 517, 517, 517, 517, 517, 517, 517, 517, 517, |
810 | | 517, 517, 517, 23, 517, 517, 517, 27, 516, 516, |
811 | | 516, 516, 516, 516, 519, 516, 516, 516, 516, 516, |
812 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 520, |
813 | | 521, 516, 516, 519, 516, 516, 516, 516, 516, 516, |
814 | | 516, 516, 516, 516, 516, 516, 516, 516, 522, 516, |
815 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 523, |
816 | | 516, 516, 516, 516, 516, 516, 516, 516, 524, 516, |
817 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
818 | | |
819 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
820 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
821 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
822 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
823 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
824 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
825 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
826 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
827 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
828 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
829 | | |
830 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
831 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
832 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
833 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
834 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
835 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
836 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
837 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
838 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
839 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
840 | | |
841 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
842 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
843 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
844 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
845 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
846 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
847 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
848 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
849 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
850 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
851 | | |
852 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
853 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
854 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
855 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
856 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
857 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
858 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
859 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
860 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
861 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
862 | | |
863 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
864 | | 516, 516, 516, 516, 516, 0, 516, 516, 516, 516, |
865 | | 516, 516, 516, 516 |
866 | | } ; |
867 | | |
868 | | static const flex_int16_t yy_nxt[960] = |
869 | | { 0, |
870 | | 516, 31, 31, 31, 33, 33, 34, 31, 31, 31, |
871 | | 34, 31, 31, 31, 56, 56, 56, 35, 35, 35, |
872 | | 31, 37, 37, 57, 57, 57, 35, 35, 35, 31, |
873 | | 31, 189, 47, 47, 39, 36, 36, 36, 31, 31, |
874 | | 58, 58, 58, 39, 36, 36, 36, 31, 31, 59, |
875 | | 59, 59, 41, 38, 38, 38, 31, 31, 65, 66, |
876 | | 186, 41, 38, 38, 38, 31, 72, 72, 72, 65, |
877 | | 66, 40, 40, 40, 31, 73, 73, 73, 144, 142, |
878 | | 40, 40, 40, 31, 86, 142, 184, 143, 87, 42, |
879 | | 42, 42, 31, 144, 142, 145, 147, 182, 42, 42, |
880 | | |
881 | | 42, 31, 144, 142, 149, 151, 144, 142, 153, 155, |
882 | | 144, 142, 157, 159, 43, 144, 44, 161, 45, 142, |
883 | | 180, 163, 46, 178, 176, 47, 48, 49, 144, 142, |
884 | | 165, 167, 50, 50, 50, 144, 142, 169, 171, 144, |
885 | | 142, 173, 175, 144, 142, 177, 179, 174, 172, 50, |
886 | | 51, 144, 142, 181, 183, 144, 186, 185, 187, 142, |
887 | | 189, 188, 190, 144, 186, 191, 192, 142, 189, 193, |
888 | | 194, 144, 186, 195, 196, 142, 189, 197, 198, 144, |
889 | | 186, 199, 200, 142, 189, 201, 202, 144, 186, 203, |
890 | | 204, 142, 189, 205, 206, 144, 186, 207, 208, 142, |
891 | | |
892 | | 189, 209, 210, 144, 186, 211, 212, 142, 189, 213, |
893 | | 214, 144, 186, 215, 216, 142, 189, 217, 218, 144, |
894 | | 186, 219, 220, 142, 189, 221, 222, 144, 186, 223, |
895 | | 224, 142, 189, 225, 226, 144, 186, 227, 228, 142, |
896 | | 189, 229, 230, 144, 186, 231, 232, 142, 189, 233, |
897 | | 234, 144, 186, 235, 236, 142, 189, 237, 238, 144, |
898 | | 186, 239, 240, 142, 189, 241, 242, 144, 186, 243, |
899 | | 244, 142, 189, 245, 246, 144, 186, 247, 248, 142, |
900 | | 189, 249, 250, 144, 186, 251, 252, 142, 189, 253, |
901 | | 254, 144, 186, 255, 256, 142, 189, 257, 258, 144, |
902 | | |
903 | | 186, 259, 260, 142, 189, 261, 262, 144, 186, 263, |
904 | | 264, 142, 189, 265, 266, 144, 186, 267, 268, 142, |
905 | | 189, 269, 270, 144, 186, 271, 272, 142, 189, 273, |
906 | | 274, 144, 186, 275, 276, 142, 189, 277, 278, 144, |
907 | | 186, 279, 280, 142, 189, 281, 282, 144, 186, 283, |
908 | | 284, 142, 189, 285, 286, 144, 186, 287, 288, 142, |
909 | | 189, 289, 290, 144, 186, 291, 292, 142, 189, 293, |
910 | | 294, 144, 186, 295, 296, 142, 189, 297, 298, 144, |
911 | | 186, 299, 300, 142, 189, 301, 302, 144, 186, 303, |
912 | | 304, 142, 189, 305, 306, 144, 186, 307, 308, 142, |
913 | | |
914 | | 189, 309, 310, 144, 186, 311, 312, 142, 189, 313, |
915 | | 314, 144, 186, 315, 316, 142, 189, 317, 318, 144, |
916 | | 186, 319, 320, 142, 189, 321, 322, 144, 186, 323, |
917 | | 324, 142, 189, 325, 326, 144, 186, 327, 328, 142, |
918 | | 189, 329, 330, 144, 186, 331, 332, 142, 189, 333, |
919 | | 334, 144, 186, 335, 336, 142, 189, 337, 338, 144, |
920 | | 186, 339, 340, 142, 189, 341, 342, 144, 186, 343, |
921 | | 344, 142, 189, 345, 346, 144, 186, 347, 348, 142, |
922 | | 189, 349, 350, 144, 186, 351, 352, 142, 189, 353, |
923 | | 354, 144, 186, 355, 356, 142, 189, 357, 358, 144, |
924 | | |
925 | | 186, 359, 360, 142, 189, 361, 362, 144, 186, 363, |
926 | | 364, 142, 189, 365, 366, 144, 186, 367, 368, 142, |
927 | | 189, 369, 370, 144, 186, 371, 372, 142, 189, 373, |
928 | | 374, 144, 186, 375, 376, 142, 189, 377, 378, 144, |
929 | | 186, 379, 380, 142, 189, 381, 382, 144, 186, 383, |
930 | | 384, 142, 189, 385, 386, 144, 186, 387, 388, 142, |
931 | | 189, 389, 390, 144, 186, 391, 392, 142, 189, 393, |
932 | | 394, 144, 186, 395, 396, 142, 189, 397, 398, 144, |
933 | | 186, 399, 400, 142, 189, 401, 402, 144, 186, 403, |
934 | | 404, 142, 189, 405, 406, 144, 186, 407, 408, 142, |
935 | | |
936 | | 189, 409, 410, 144, 186, 411, 412, 142, 189, 413, |
937 | | 414, 144, 186, 415, 416, 142, 189, 417, 418, 144, |
938 | | 186, 419, 420, 142, 189, 421, 422, 144, 186, 423, |
939 | | 424, 142, 189, 425, 426, 144, 186, 427, 428, 142, |
940 | | 189, 429, 430, 144, 186, 431, 432, 142, 189, 433, |
941 | | 434, 144, 186, 435, 436, 142, 189, 437, 438, 144, |
942 | | 186, 439, 440, 142, 189, 441, 442, 144, 186, 443, |
943 | | 444, 142, 189, 445, 446, 144, 186, 447, 448, 142, |
944 | | 189, 449, 450, 144, 186, 451, 452, 142, 189, 453, |
945 | | 454, 144, 186, 455, 456, 142, 189, 457, 458, 144, |
946 | | |
947 | | 186, 459, 460, 142, 189, 461, 462, 144, 186, 463, |
948 | | 464, 142, 189, 465, 466, 144, 186, 467, 468, 142, |
949 | | 189, 469, 470, 144, 186, 471, 472, 142, 189, 473, |
950 | | 474, 144, 186, 475, 476, 142, 189, 477, 478, 144, |
951 | | 186, 479, 480, 142, 189, 481, 482, 144, 186, 483, |
952 | | 484, 189, 186, 485, 486, 189, 186, 487, 488, 189, |
953 | | 186, 489, 490, 189, 186, 491, 492, 189, 186, 493, |
954 | | 494, 189, 186, 495, 496, 189, 186, 497, 498, 189, |
955 | | 186, 499, 500, 189, 186, 501, 502, 189, 186, 503, |
956 | | 504, 189, 186, 505, 506, 189, 186, 507, 508, 189, |
957 | | |
958 | | 186, 509, 510, 189, 186, 511, 512, 189, 186, 513, |
959 | | 514, 189, 170, 515, 30, 30, 30, 30, 30, 30, |
960 | | 32, 32, 32, 32, 32, 32, 54, 54, 68, 168, |
961 | | 166, 68, 69, 164, 69, 80, 80, 162, 80, 89, |
962 | | 89, 160, 89, 96, 96, 158, 96, 156, 154, 152, |
963 | | 150, 148, 146, 141, 140, 139, 138, 137, 136, 135, |
964 | | 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, |
965 | | 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, |
966 | | 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, |
967 | | 104, 103, 102, 101, 100, 99, 98, 97, 95, 94, |
968 | | |
969 | | 93, 92, 91, 90, 88, 85, 84, 83, 82, 81, |
970 | | 79, 65, 78, 77, 76, 75, 74, 55, 71, 70, |
971 | | 67, 64, 63, 62, 61, 60, 55, 53, 52, 516, |
972 | | 31, 31, 29, 516, 516, 516, 516, 516, 516, 516, |
973 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
974 | | 516, 516, 516, 516, 516, 516, 516, 516, 516 |
975 | | } ; |
976 | | |
977 | | static const flex_int16_t yy_chk[960] = |
978 | | { 0, |
979 | | 0, 3, 4, 5, 3, 4, 5, 6, 25, 26, |
980 | | 6, 7, 11, 12, 36, 36, 36, 7, 7, 7, |
981 | | 8, 11, 12, 38, 38, 38, 8, 8, 8, 9, |
982 | | 15, 515, 25, 26, 15, 9, 9, 9, 10, 16, |
983 | | 40, 40, 40, 16, 10, 10, 10, 13, 19, 42, |
984 | | 42, 42, 19, 13, 13, 13, 14, 20, 48, 48, |
985 | | 514, 20, 14, 14, 14, 17, 58, 58, 58, 67, |
986 | | 67, 17, 17, 17, 18, 59, 59, 59, 483, 481, |
987 | | 18, 18, 18, 21, 77, 140, 180, 140, 77, 21, |
988 | | 21, 21, 22, 141, 143, 141, 143, 178, 22, 22, |
989 | | |
990 | | 22, 23, 145, 147, 145, 147, 149, 151, 149, 151, |
991 | | 153, 155, 153, 155, 23, 157, 23, 157, 23, 159, |
992 | | 176, 159, 23, 174, 172, 23, 27, 27, 161, 163, |
993 | | 161, 163, 27, 27, 27, 165, 167, 165, 167, 169, |
994 | | 171, 169, 171, 173, 175, 173, 175, 170, 168, 27, |
995 | | 27, 177, 179, 177, 179, 181, 182, 181, 182, 183, |
996 | | 184, 183, 184, 185, 187, 185, 187, 188, 190, 188, |
997 | | 190, 191, 192, 191, 192, 193, 194, 193, 194, 195, |
998 | | 196, 195, 196, 197, 198, 197, 198, 199, 200, 199, |
999 | | 200, 201, 202, 201, 202, 203, 204, 203, 204, 205, |
1000 | | |
1001 | | 206, 205, 206, 207, 208, 207, 208, 209, 210, 209, |
1002 | | 210, 211, 212, 211, 212, 213, 214, 213, 214, 215, |
1003 | | 216, 215, 216, 217, 218, 217, 218, 219, 220, 219, |
1004 | | 220, 221, 222, 221, 222, 223, 224, 223, 224, 225, |
1005 | | 226, 225, 226, 227, 228, 227, 228, 229, 230, 229, |
1006 | | 230, 231, 232, 231, 232, 233, 234, 233, 234, 235, |
1007 | | 236, 235, 236, 237, 238, 237, 238, 239, 240, 239, |
1008 | | 240, 241, 242, 241, 242, 243, 244, 243, 244, 245, |
1009 | | 246, 245, 246, 247, 248, 247, 248, 249, 250, 249, |
1010 | | 250, 251, 252, 251, 252, 253, 254, 253, 254, 255, |
1011 | | |
1012 | | 256, 255, 256, 257, 258, 257, 258, 259, 260, 259, |
1013 | | 260, 261, 262, 261, 262, 263, 264, 263, 264, 265, |
1014 | | 266, 265, 266, 267, 268, 267, 268, 269, 270, 269, |
1015 | | 270, 271, 272, 271, 272, 273, 274, 273, 274, 275, |
1016 | | 276, 275, 276, 277, 278, 277, 278, 279, 280, 279, |
1017 | | 280, 281, 282, 281, 282, 283, 284, 283, 284, 285, |
1018 | | 286, 285, 286, 287, 288, 287, 288, 289, 290, 289, |
1019 | | 290, 291, 292, 291, 292, 293, 294, 293, 294, 295, |
1020 | | 296, 295, 296, 297, 298, 297, 298, 299, 300, 299, |
1021 | | 300, 301, 302, 301, 302, 303, 304, 303, 304, 305, |
1022 | | |
1023 | | 306, 305, 306, 307, 308, 307, 308, 309, 310, 309, |
1024 | | 310, 311, 312, 311, 312, 313, 314, 313, 314, 315, |
1025 | | 316, 315, 316, 317, 318, 317, 318, 319, 320, 319, |
1026 | | 320, 321, 322, 321, 322, 323, 324, 323, 324, 325, |
1027 | | 326, 325, 326, 327, 328, 327, 328, 329, 330, 329, |
1028 | | 330, 331, 332, 331, 332, 333, 334, 333, 334, 335, |
1029 | | 336, 335, 336, 337, 338, 337, 338, 339, 340, 339, |
1030 | | 340, 341, 342, 341, 342, 343, 344, 343, 344, 345, |
1031 | | 346, 345, 346, 347, 348, 347, 348, 349, 350, 349, |
1032 | | 350, 351, 352, 351, 352, 353, 354, 353, 354, 355, |
1033 | | |
1034 | | 356, 355, 356, 357, 358, 357, 358, 359, 360, 359, |
1035 | | 360, 361, 362, 361, 362, 363, 364, 363, 364, 365, |
1036 | | 366, 365, 366, 367, 368, 367, 368, 369, 370, 369, |
1037 | | 370, 371, 372, 371, 372, 373, 374, 373, 374, 375, |
1038 | | 376, 375, 376, 377, 378, 377, 378, 379, 380, 379, |
1039 | | 380, 381, 382, 381, 382, 383, 384, 383, 384, 385, |
1040 | | 386, 385, 386, 387, 388, 387, 388, 389, 390, 389, |
1041 | | 390, 391, 392, 391, 392, 393, 394, 393, 394, 395, |
1042 | | 396, 395, 396, 397, 398, 397, 398, 399, 400, 399, |
1043 | | 400, 401, 402, 401, 402, 403, 404, 403, 404, 405, |
1044 | | |
1045 | | 406, 405, 406, 407, 408, 407, 408, 409, 410, 409, |
1046 | | 410, 411, 412, 411, 412, 413, 414, 413, 414, 415, |
1047 | | 416, 415, 416, 417, 418, 417, 418, 419, 420, 419, |
1048 | | 420, 421, 422, 421, 422, 423, 424, 423, 424, 425, |
1049 | | 426, 425, 426, 427, 428, 427, 428, 429, 430, 429, |
1050 | | 430, 431, 432, 431, 432, 433, 434, 433, 434, 435, |
1051 | | 436, 435, 436, 437, 438, 437, 438, 439, 440, 439, |
1052 | | 440, 441, 442, 441, 442, 443, 444, 443, 444, 445, |
1053 | | 446, 445, 446, 447, 448, 447, 448, 449, 450, 449, |
1054 | | 450, 451, 452, 451, 452, 453, 454, 453, 454, 455, |
1055 | | |
1056 | | 456, 455, 456, 457, 458, 457, 458, 459, 460, 459, |
1057 | | 460, 461, 462, 461, 462, 463, 464, 463, 464, 465, |
1058 | | 466, 465, 466, 467, 468, 467, 468, 469, 470, 469, |
1059 | | 470, 471, 472, 471, 472, 473, 474, 473, 474, 475, |
1060 | | 476, 475, 476, 477, 478, 477, 478, 479, 480, 479, |
1061 | | 480, 482, 484, 482, 484, 485, 486, 485, 486, 487, |
1062 | | 488, 487, 488, 489, 490, 489, 490, 491, 492, 491, |
1063 | | 492, 493, 494, 493, 494, 495, 496, 495, 496, 497, |
1064 | | 498, 497, 498, 499, 500, 499, 500, 501, 502, 501, |
1065 | | 502, 503, 504, 503, 504, 505, 506, 505, 506, 507, |
1066 | | |
1067 | | 508, 507, 508, 509, 510, 509, 510, 511, 512, 511, |
1068 | | 512, 513, 166, 513, 517, 517, 517, 517, 517, 517, |
1069 | | 518, 518, 518, 518, 518, 518, 519, 519, 520, 164, |
1070 | | 162, 520, 521, 160, 521, 522, 522, 158, 522, 523, |
1071 | | 523, 156, 523, 524, 524, 154, 524, 152, 150, 148, |
1072 | | 146, 144, 142, 139, 138, 137, 136, 135, 134, 133, |
1073 | | 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, |
1074 | | 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, |
1075 | | 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, |
1076 | | 102, 98, 97, 96, 95, 93, 91, 90, 88, 87, |
1077 | | |
1078 | | 85, 83, 82, 81, 78, 76, 75, 74, 71, 70, |
1079 | | 68, 66, 64, 63, 62, 61, 60, 54, 53, 52, |
1080 | | 49, 47, 46, 45, 44, 43, 35, 34, 33, 29, |
1081 | | 2, 1, 516, 516, 516, 516, 516, 516, 516, 516, |
1082 | | 516, 516, 516, 516, 516, 516, 516, 516, 516, 516, |
1083 | | 516, 516, 516, 516, 516, 516, 516, 516, 516 |
1084 | | } ; |
1085 | | |
1086 | | static const flex_int16_t yy_rule_linenum[22] = |
1087 | | { 0, |
1088 | | 215, 217, 219, 220, 221, 222, 223, 224, 225, 226, |
1089 | | 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, |
1090 | | 238 |
1091 | | } ; |
1092 | | |
1093 | | /* The intent behind this definition is that it'll catch |
1094 | | * any uses of REJECT which flex missed. |
1095 | | */ |
1096 | | #define REJECT reject_used_but_not_detected |
1097 | | #define yymore() yymore_used_but_not_detected |
1098 | 0 | #define YY_MORE_ADJ 0 |
1099 | | #define YY_RESTORE_YY_MORE_OFFSET |
1100 | | #line 1 "/src/wireshark/wiretap/k12text.l" |
1101 | | |
1102 | | /* |
1103 | | * We want a reentrant scanner. |
1104 | | */ |
1105 | | /* |
1106 | | * We don't use input, so don't generate code for it. |
1107 | | */ |
1108 | | #define YY_NO_INPUT 1 |
1109 | | /* |
1110 | | * We don't use unput, so don't generate code for it. |
1111 | | */ |
1112 | | /* |
1113 | | * We don't read interactively from the terminal. |
1114 | | */ |
1115 | | /* |
1116 | | * We want to stop processing when we get to the end of the input. |
1117 | | */ |
1118 | | /* |
1119 | | * The type for the state we keep for a scanner. |
1120 | | */ |
1121 | | /* |
1122 | | * Prefix scanner routines with "k12text_" rather than "yy", so this scanner |
1123 | | * can coexist with other scanners. |
1124 | | */ |
1125 | | /* Options useful for debugging */ |
1126 | | /* noline: Prevent generation of #line directives */ |
1127 | | /* Seems to be required when using the */ |
1128 | | /* Windows VS debugger so as to be able */ |
1129 | | /* to properly step through the code and */ |
1130 | | /* set breakpoints & etc using the */ |
1131 | | /* k12text.c file rather than the */ |
1132 | | /* k12text.l file */ |
1133 | | /* XXX: %option noline gives an error message: */ |
1134 | | /* "unrecognized %option: line" */ |
1135 | | /* with flex 2.5.35; the --noline */ |
1136 | | /* command-line option works OK. */ |
1137 | | /* */ |
1138 | | /* debug: Do output of "rule acceptance" info */ |
1139 | | /* during parse */ |
1140 | | /* */ |
1141 | | /* %option noline */ |
1142 | | /* %option debug */ |
1143 | | /* |
1144 | | * We have to override the memory allocators so that we don't get |
1145 | | * "unused argument" warnings from the yyscanner argument (which |
1146 | | * we don't use, as we have a global memory allocator). |
1147 | | * |
1148 | | * We provide, as macros, our own versions of the routines generated by Flex, |
1149 | | * which just call malloc()/realloc()/free() (as the Flex versions do), |
1150 | | * discarding the extra argument. |
1151 | | */ |
1152 | | #line 76 "/src/wireshark/wiretap/k12text.l" |
1153 | | /* k12text.l |
1154 | | * |
1155 | | * Wiretap Library |
1156 | | * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> |
1157 | | * |
1158 | | * SPDX-License-Identifier: GPL-2.0-or-later |
1159 | | */ |
1160 | | |
1161 | | /* |
1162 | | * TODO: |
1163 | | * - fix timestamps after midnight |
1164 | | * - verify encapsulations |
1165 | | */ |
1166 | | |
1167 | | #include <stdlib.h> |
1168 | | #include <string.h> |
1169 | | #include <errno.h> |
1170 | | #include <time.h> |
1171 | | #include "wtap-int.h" |
1172 | | #include "wtap.h" |
1173 | | #include "file_wrappers.h" |
1174 | | #include <wsutil/buffer.h> |
1175 | | #include "k12.h" |
1176 | | |
1177 | | #ifndef HAVE_UNISTD_H |
1178 | | #define YY_NO_UNISTD_H |
1179 | | #endif |
1180 | | |
1181 | | /* |
1182 | | * Disable diagnostics in the code generated by Flex. |
1183 | | */ |
1184 | | DIAG_OFF_FLEX() |
1185 | | |
1186 | | /* |
1187 | | * State kept by the scanner. |
1188 | | */ |
1189 | | typedef struct { |
1190 | | FILE_T fh; |
1191 | | int err; |
1192 | | char *err_info; |
1193 | | int start_state; |
1194 | | |
1195 | | unsigned g_h; |
1196 | | unsigned g_m; |
1197 | | unsigned g_s; |
1198 | | unsigned g_ms; |
1199 | | unsigned g_ns; |
1200 | | int g_encap; |
1201 | | uint8_t *bb; |
1202 | | unsigned ii; |
1203 | | bool is_k12text; |
1204 | | bool at_eof; |
1205 | | unsigned junk_chars; |
1206 | | char* error_str; |
1207 | | uint64_t file_bytes_read; |
1208 | | bool ok_frame; |
1209 | | } k12text_state_t; |
1210 | | |
1211 | 0 | #define KERROR(text) do { yyextra->error_str = g_strdup(text); yyterminate(); } while(0) |
1212 | 0 | #define SET_HOURS(text) yyextra->g_h = (unsigned) strtoul(text,NULL,10) |
1213 | 0 | #define SET_MINUTES(text) yyextra->g_m = (unsigned) strtoul(text,NULL,10) |
1214 | 0 | #define SET_SECONDS(text) yyextra->g_s = (unsigned) strtoul(text,NULL,10) |
1215 | 0 | #define SET_MS(text) yyextra->g_ms = (unsigned) strtoul(text,NULL,10) |
1216 | 0 | #define SET_NS(text) yyextra->g_ns = (unsigned) strtoul(text,NULL,10) |
1217 | 0 | #define ADD_BYTE(text) do {if (yyextra->ii >= WTAP_MAX_PACKET_SIZE_STANDARD) {KERROR("frame too large");} yyextra->bb[yyextra->ii++] = (uint8_t)strtoul(text,NULL,16); } while(0) |
1218 | 0 | #define FINALIZE_FRAME() do { yyextra->ok_frame = true; } while (0) |
1219 | | /*~ #define ECHO*/ |
1220 | 0 | #define YY_USER_ACTION yyextra->file_bytes_read += yyleng; |
1221 | 0 | #define YY_USER_INIT { \ |
1222 | 0 | k12text_state_t *scanner_state = k12text_get_extra(yyscanner); \ |
1223 | 0 | BEGIN(scanner_state->start_state); \ |
1224 | 0 | } |
1225 | 0 | #define YY_INPUT(buf,result,max_size) { \ |
1226 | 0 | k12text_state_t *scanner_state = k12text_get_extra(yyscanner); \ |
1227 | 0 | int c = file_getc(scanner_state->fh); \ |
1228 | 0 | if (c == EOF) { \ |
1229 | 0 | scanner_state->err = file_error(scanner_state->fh, \ |
1230 | 0 | &scanner_state->err_info); \ |
1231 | 0 | if (scanner_state->err == 0) \ |
1232 | 0 | scanner_state->err = WTAP_ERR_SHORT_READ; \ |
1233 | 0 | result = YY_NULL; \ |
1234 | 0 | } else { \ |
1235 | 0 | buf[0] = c; \ |
1236 | 0 | result = 1; \ |
1237 | 0 | } \ |
1238 | 0 | } |
1239 | 0 | #define MAX_JUNK 400000 |
1240 | | #define ECHO |
1241 | | |
1242 | | /* |
1243 | | * Private per-file data. |
1244 | | */ |
1245 | | typedef struct { |
1246 | | /* |
1247 | | * The file position after the end of the previous frame processed by |
1248 | | * k12text_read. |
1249 | | * |
1250 | | * We need to keep this around, and seek to it at the beginning of |
1251 | | * each call to k12text_read(), since the lexer undoubtedly did some |
1252 | | * amount of look-ahead when processing the previous frame. |
1253 | | */ |
1254 | | int64_t next_frame_offset; |
1255 | | } k12text_t; |
1256 | | |
1257 | | /* |
1258 | | * Sleazy hack to suppress compiler warnings in yy_fatal_error(). |
1259 | | */ |
1260 | 0 | #define YY_EXIT_FAILURE ((void)yyscanner, 2) |
1261 | | |
1262 | | /* |
1263 | | * Macros for the allocators, to discard the extra argument. |
1264 | | */ |
1265 | 0 | #define k12text_alloc(size, yyscanner) (void *)malloc(size) |
1266 | 0 | #define k12text_realloc(ptr, size, yyscanner) (void *)realloc((char *)(ptr), (size)) |
1267 | 0 | #define k12text_free(ptr, yyscanner) free((char *)ptr) |
1268 | | |
1269 | | static int k12text_file_type_subtype = -1; |
1270 | | |
1271 | | void register_k12text(void); |
1272 | | |
1273 | | #line 1274 "/work/build/wiretap/k12text.c" |
1274 | | |
1275 | | #line 1276 "/work/build/wiretap/k12text.c" |
1276 | | |
1277 | | #define INITIAL 0 |
1278 | 0 | #define MAGIC 1 |
1279 | 0 | #define NEXT_FRAME 2 |
1280 | 0 | #define HOURS 3 |
1281 | 0 | #define MINUTES 4 |
1282 | 0 | #define M2S 5 |
1283 | 0 | #define SECONDS 6 |
1284 | 0 | #define S2M 7 |
1285 | 0 | #define MS 8 |
1286 | 0 | #define M2N 9 |
1287 | 0 | #define NS 10 |
1288 | 0 | #define ENCAP 11 |
1289 | 0 | #define STARTBYTES 12 |
1290 | 0 | #define BYTE 13 |
1291 | | |
1292 | | #ifndef YY_NO_UNISTD_H |
1293 | | /* Special case for "unistd.h", since it is non-ANSI. We include it way |
1294 | | * down here because we want the user's section 1 to have been scanned first. |
1295 | | * The user has a chance to override it with an option. |
1296 | | */ |
1297 | | /* %if-c-only */ |
1298 | | #include <unistd.h> |
1299 | | /* %endif */ |
1300 | | /* %if-c++-only */ |
1301 | | /* %endif */ |
1302 | | #endif |
1303 | | |
1304 | | #define YY_EXTRA_TYPE k12text_state_t * |
1305 | | |
1306 | | /* %if-c-only Reentrant structure and macros (non-C++). */ |
1307 | | /* %if-reentrant */ |
1308 | | |
1309 | | /* Holds the entire state of the reentrant scanner. */ |
1310 | | struct yyguts_t |
1311 | | { |
1312 | | |
1313 | | /* User-defined. Not touched by flex. */ |
1314 | | YY_EXTRA_TYPE yyextra_r; |
1315 | | |
1316 | | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
1317 | | FILE *yyin_r, *yyout_r; |
1318 | | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
1319 | | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
1320 | | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ |
1321 | | char yy_hold_char; |
1322 | | int yy_n_chars; |
1323 | | int yyleng_r; |
1324 | | char *yy_c_buf_p; |
1325 | | int yy_init; |
1326 | | int yy_start; |
1327 | | int yy_did_buffer_switch_on_eof; |
1328 | | int yy_start_stack_ptr; |
1329 | | int yy_start_stack_depth; |
1330 | | int *yy_start_stack; |
1331 | | yy_state_type yy_last_accepting_state; |
1332 | | char* yy_last_accepting_cpos; |
1333 | | |
1334 | | int yylineno_r; |
1335 | | int yy_flex_debug_r; |
1336 | | |
1337 | | char *yytext_r; |
1338 | | int yy_more_flag; |
1339 | | int yy_more_len; |
1340 | | |
1341 | | }; /* end struct yyguts_t */ |
1342 | | |
1343 | | /* %if-c-only */ |
1344 | | |
1345 | | static int yy_init_globals ( yyscan_t yyscanner ); |
1346 | | |
1347 | | /* %endif */ |
1348 | | |
1349 | | /* %if-reentrant */ |
1350 | | |
1351 | | int yylex_init (yyscan_t* scanner); |
1352 | | |
1353 | | int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); |
1354 | | |
1355 | | /* %endif */ |
1356 | | |
1357 | | /* %endif End reentrant structures and macros. */ |
1358 | | |
1359 | | /* Accessor methods to globals. |
1360 | | These are made visible to non-reentrant scanners for convenience. */ |
1361 | | |
1362 | | int yylex_destroy ( yyscan_t yyscanner ); |
1363 | | |
1364 | | int yyget_debug ( yyscan_t yyscanner ); |
1365 | | |
1366 | | void yyset_debug ( int debug_flag , yyscan_t yyscanner ); |
1367 | | |
1368 | | YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); |
1369 | | |
1370 | | void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); |
1371 | | |
1372 | | FILE *yyget_in ( yyscan_t yyscanner ); |
1373 | | |
1374 | | void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); |
1375 | | |
1376 | | FILE *yyget_out ( yyscan_t yyscanner ); |
1377 | | |
1378 | | void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); |
1379 | | |
1380 | | int yyget_leng ( yyscan_t yyscanner ); |
1381 | | |
1382 | | char *yyget_text ( yyscan_t yyscanner ); |
1383 | | |
1384 | | int yyget_lineno ( yyscan_t yyscanner ); |
1385 | | |
1386 | | void yyset_lineno ( int _line_number , yyscan_t yyscanner ); |
1387 | | |
1388 | | int yyget_column ( yyscan_t yyscanner ); |
1389 | | |
1390 | | void yyset_column ( int _column_no , yyscan_t yyscanner ); |
1391 | | |
1392 | | /* %if-bison-bridge */ |
1393 | | /* %endif */ |
1394 | | |
1395 | | /* Macros after this point can all be overridden by user definitions in |
1396 | | * section 1. |
1397 | | */ |
1398 | | |
1399 | | #ifndef YY_SKIP_YYWRAP |
1400 | | #ifdef __cplusplus |
1401 | | extern "C" int yywrap ( yyscan_t yyscanner ); |
1402 | | #else |
1403 | | extern int yywrap ( yyscan_t yyscanner ); |
1404 | | #endif |
1405 | | #endif |
1406 | | |
1407 | | /* %not-for-header */ |
1408 | | #ifndef YY_NO_UNPUT |
1409 | | |
1410 | | #endif |
1411 | | /* %ok-for-header */ |
1412 | | |
1413 | | /* %endif */ |
1414 | | |
1415 | | #ifndef yytext_ptr |
1416 | | static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); |
1417 | | #endif |
1418 | | |
1419 | | #ifdef YY_NEED_STRLEN |
1420 | | static int yy_flex_strlen ( const char * , yyscan_t yyscanner); |
1421 | | #endif |
1422 | | |
1423 | | #ifndef YY_NO_INPUT |
1424 | | /* %if-c-only Standard (non-C++) definition */ |
1425 | | /* %not-for-header */ |
1426 | | #ifdef __cplusplus |
1427 | | static int yyinput ( yyscan_t yyscanner ); |
1428 | | #else |
1429 | | static int input ( yyscan_t yyscanner ); |
1430 | | #endif |
1431 | | /* %ok-for-header */ |
1432 | | |
1433 | | /* %endif */ |
1434 | | #endif |
1435 | | |
1436 | | /* %if-c-only */ |
1437 | | |
1438 | | /* %endif */ |
1439 | | |
1440 | | /* Amount of stuff to slurp up with each read. */ |
1441 | | #ifndef YY_READ_BUF_SIZE |
1442 | | #ifdef __ia64__ |
1443 | | /* On IA-64, the buffer size is 16k, not 8k */ |
1444 | | #define YY_READ_BUF_SIZE 16384 |
1445 | | #else |
1446 | 0 | #define YY_READ_BUF_SIZE 8192 |
1447 | | #endif /* __ia64__ */ |
1448 | | #endif |
1449 | | |
1450 | | /* Copy whatever the last rule matched to the standard output. */ |
1451 | | #ifndef ECHO |
1452 | | /* %if-c-only Standard (non-C++) definition */ |
1453 | | /* This used to be an fputs(), but since the string might contain NUL's, |
1454 | | * we now use fwrite(). |
1455 | | */ |
1456 | | #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) |
1457 | | /* %endif */ |
1458 | | /* %if-c++-only C++ definition */ |
1459 | | /* %endif */ |
1460 | | #endif |
1461 | | |
1462 | | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
1463 | | * is returned in "result". |
1464 | | */ |
1465 | | #ifndef YY_INPUT |
1466 | | #define YY_INPUT(buf,result,max_size) \ |
1467 | | /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ |
1468 | | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
1469 | | { \ |
1470 | | int c = '*'; \ |
1471 | | int n; \ |
1472 | | for ( n = 0; n < max_size && \ |
1473 | | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
1474 | | buf[n] = (char) c; \ |
1475 | | if ( c == '\n' ) \ |
1476 | | buf[n++] = (char) c; \ |
1477 | | if ( c == EOF && ferror( yyin ) ) \ |
1478 | | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1479 | | result = n; \ |
1480 | | } \ |
1481 | | else \ |
1482 | | { \ |
1483 | | errno=0; \ |
1484 | | while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ |
1485 | | { \ |
1486 | | if( errno != EINTR) \ |
1487 | | { \ |
1488 | | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1489 | | break; \ |
1490 | | } \ |
1491 | | errno=0; \ |
1492 | | clearerr(yyin); \ |
1493 | | } \ |
1494 | | }\ |
1495 | | \ |
1496 | | /* %if-c++-only C++ definition \ */\ |
1497 | | /* %endif */ |
1498 | | |
1499 | | #endif |
1500 | | |
1501 | | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
1502 | | * we don't want an extra ';' after the "return" because that will cause |
1503 | | * some compilers to complain about unreachable statements. |
1504 | | */ |
1505 | | #ifndef yyterminate |
1506 | 0 | #define yyterminate() return YY_NULL |
1507 | | #endif |
1508 | | |
1509 | | /* Number of entries by which start-condition stack grows. */ |
1510 | | #ifndef YY_START_STACK_INCR |
1511 | | #define YY_START_STACK_INCR 25 |
1512 | | #endif |
1513 | | |
1514 | | /* Report a fatal error. */ |
1515 | | #ifndef YY_FATAL_ERROR |
1516 | | /* %if-c-only */ |
1517 | 0 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) |
1518 | | /* %endif */ |
1519 | | /* %if-c++-only */ |
1520 | | /* %endif */ |
1521 | | #endif |
1522 | | |
1523 | | /* %if-tables-serialization structures and prototypes */ |
1524 | | /* %not-for-header */ |
1525 | | /* %ok-for-header */ |
1526 | | |
1527 | | /* %not-for-header */ |
1528 | | /* %tables-yydmap generated elements */ |
1529 | | /* %endif */ |
1530 | | /* end tables serialization structures and prototypes */ |
1531 | | |
1532 | | /* %ok-for-header */ |
1533 | | |
1534 | | /* Default declaration of generated scanner - a define so the user can |
1535 | | * easily add parameters. |
1536 | | */ |
1537 | | #ifndef YY_DECL |
1538 | | #define YY_DECL_IS_OURS 1 |
1539 | | /* %if-c-only Standard (non-C++) definition */ |
1540 | | |
1541 | | extern int yylex (yyscan_t yyscanner); |
1542 | | |
1543 | | #define YY_DECL int yylex (yyscan_t yyscanner) |
1544 | | /* %endif */ |
1545 | | /* %if-c++-only C++ definition */ |
1546 | | /* %endif */ |
1547 | | #endif /* !YY_DECL */ |
1548 | | |
1549 | | /* Code executed at the beginning of each rule, after yytext and yyleng |
1550 | | * have been set up. |
1551 | | */ |
1552 | | #ifndef YY_USER_ACTION |
1553 | | #define YY_USER_ACTION |
1554 | | #endif |
1555 | | |
1556 | | /* Code executed at the end of each rule. */ |
1557 | | #ifndef YY_BREAK |
1558 | 0 | #define YY_BREAK /*LINTED*/break; |
1559 | | #endif |
1560 | | |
1561 | | /* %% [6.0] YY_RULE_SETUP definition goes here */ |
1562 | | #define YY_RULE_SETUP \ |
1563 | 0 | YY_USER_ACTION |
1564 | | |
1565 | | /* %not-for-header */ |
1566 | | /** The main scanner function which does all the work. |
1567 | | */ |
1568 | | YY_DECL |
1569 | 0 | { |
1570 | 0 | yy_state_type yy_current_state; |
1571 | 0 | char *yy_cp, *yy_bp; |
1572 | 0 | int yy_act; |
1573 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1574 | |
|
1575 | 0 | if ( !yyg->yy_init ) |
1576 | 0 | { |
1577 | 0 | yyg->yy_init = 1; |
1578 | |
|
1579 | 0 | #ifdef YY_USER_INIT |
1580 | 0 | YY_USER_INIT; |
1581 | 0 | #endif |
1582 | |
|
1583 | 0 | if ( ! yyg->yy_start ) |
1584 | 0 | yyg->yy_start = 1; /* first start state */ |
1585 | |
|
1586 | 0 | if ( ! yyin ) |
1587 | | /* %if-c-only */ |
1588 | 0 | yyin = stdin; |
1589 | | /* %endif */ |
1590 | | /* %if-c++-only */ |
1591 | | /* %endif */ |
1592 | |
|
1593 | 0 | if ( ! yyout ) |
1594 | | /* %if-c-only */ |
1595 | 0 | yyout = stdout; |
1596 | | /* %endif */ |
1597 | | /* %if-c++-only */ |
1598 | | /* %endif */ |
1599 | |
|
1600 | 0 | if ( ! YY_CURRENT_BUFFER ) { |
1601 | 0 | yyensure_buffer_stack (yyscanner); |
1602 | 0 | YY_CURRENT_BUFFER_LVALUE = |
1603 | 0 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
1604 | 0 | } |
1605 | |
|
1606 | 0 | yy_load_buffer_state( yyscanner ); |
1607 | 0 | } |
1608 | |
|
1609 | 0 | { |
1610 | | /* %% [7.0] user's declarations go here */ |
1611 | 0 | #line 214 "/src/wireshark/wiretap/k12text.l" |
1612 | |
|
1613 | 0 | #line 1614 "/work/build/wiretap/k12text.c" |
1614 | |
|
1615 | 0 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
1616 | 0 | { |
1617 | | /* %% [8.0] yymore()-related code goes here */ |
1618 | 0 | yy_cp = yyg->yy_c_buf_p; |
1619 | | |
1620 | | /* Support of yytext. */ |
1621 | 0 | *yy_cp = yyg->yy_hold_char; |
1622 | | |
1623 | | /* yy_bp points to the position in yy_ch_buf of the start of |
1624 | | * the current run. |
1625 | | */ |
1626 | 0 | yy_bp = yy_cp; |
1627 | | |
1628 | | /* %% [9.0] code to set up and find next match goes here */ |
1629 | 0 | yy_current_state = yyg->yy_start; |
1630 | 0 | yy_match: |
1631 | 0 | do |
1632 | 0 | { |
1633 | 0 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
1634 | 0 | if ( yy_accept[yy_current_state] ) |
1635 | 0 | { |
1636 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
1637 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
1638 | 0 | } |
1639 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1640 | 0 | { |
1641 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
1642 | 0 | if ( yy_current_state >= 517 ) |
1643 | 0 | yy_c = yy_meta[yy_c]; |
1644 | 0 | } |
1645 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1646 | 0 | ++yy_cp; |
1647 | 0 | } |
1648 | 0 | while ( yy_current_state != 516 ); |
1649 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1650 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1651 | |
|
1652 | 0 | yy_find_action: |
1653 | | /* %% [10.0] code to find the action number goes here */ |
1654 | 0 | yy_act = yy_accept[yy_current_state]; |
1655 | |
|
1656 | 0 | YY_DO_BEFORE_ACTION; |
1657 | | |
1658 | | /* %% [11.0] code for yylineno update goes here */ |
1659 | |
|
1660 | 0 | do_action: /* This label is used only to access EOF actions. */ |
1661 | | |
1662 | | /* %% [12.0] debug code goes here */ |
1663 | 0 | if ( yy_flex_debug ) |
1664 | 0 | { |
1665 | 0 | if ( yy_act == 0 ) |
1666 | 0 | fprintf( stderr, "--scanner backing up\n" ); |
1667 | 0 | else if ( yy_act < 22 ) |
1668 | 0 | fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", |
1669 | 0 | (long)yy_rule_linenum[yy_act], yytext ); |
1670 | 0 | else if ( yy_act == 22 ) |
1671 | 0 | fprintf( stderr, "--accepting default rule (\"%s\")\n", |
1672 | 0 | yytext ); |
1673 | 0 | else if ( yy_act == 23 ) |
1674 | 0 | fprintf( stderr, "--(end of buffer or a NUL)\n" ); |
1675 | 0 | else |
1676 | 0 | fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); |
1677 | 0 | } |
1678 | |
|
1679 | 0 | switch ( yy_act ) |
1680 | 0 | { /* beginning of action switch */ |
1681 | | /* %% [13.0] actions go here */ |
1682 | 0 | case 0: /* must back up */ |
1683 | | /* undo the effects of YY_DO_BEFORE_ACTION */ |
1684 | 0 | *yy_cp = yyg->yy_hold_char; |
1685 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1686 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1687 | 0 | goto yy_find_action; |
1688 | | |
1689 | 0 | case 1: |
1690 | 0 | YY_RULE_SETUP |
1691 | 0 | #line 215 "/src/wireshark/wiretap/k12text.l" |
1692 | 0 | { yyextra->is_k12text = true; yyterminate(); } |
1693 | 0 | YY_BREAK |
1694 | 0 | case 2: |
1695 | 0 | YY_RULE_SETUP |
1696 | 0 | #line 217 "/src/wireshark/wiretap/k12text.l" |
1697 | 0 | { if (++ yyextra->junk_chars > MAX_JUNK) { yyextra->is_k12text = false; yyterminate(); } } |
1698 | 0 | YY_BREAK |
1699 | 0 | case 3: |
1700 | 0 | YY_RULE_SETUP |
1701 | 0 | #line 219 "/src/wireshark/wiretap/k12text.l" |
1702 | 0 | {BEGIN(HOURS); } |
1703 | 0 | YY_BREAK |
1704 | 0 | case 4: |
1705 | 0 | YY_RULE_SETUP |
1706 | 0 | #line 220 "/src/wireshark/wiretap/k12text.l" |
1707 | 0 | { SET_HOURS(yytext); BEGIN(MINUTES); } |
1708 | 0 | YY_BREAK |
1709 | 0 | case 5: |
1710 | 0 | YY_RULE_SETUP |
1711 | 0 | #line 221 "/src/wireshark/wiretap/k12text.l" |
1712 | 0 | { SET_MINUTES(yytext); BEGIN(M2S);} |
1713 | 0 | YY_BREAK |
1714 | 0 | case 6: |
1715 | 0 | YY_RULE_SETUP |
1716 | 0 | #line 222 "/src/wireshark/wiretap/k12text.l" |
1717 | 0 | { BEGIN(SECONDS);} |
1718 | 0 | YY_BREAK |
1719 | 0 | case 7: |
1720 | 0 | YY_RULE_SETUP |
1721 | 0 | #line 223 "/src/wireshark/wiretap/k12text.l" |
1722 | 0 | { SET_SECONDS(yytext); BEGIN(S2M); } |
1723 | 0 | YY_BREAK |
1724 | 0 | case 8: |
1725 | 0 | YY_RULE_SETUP |
1726 | 0 | #line 224 "/src/wireshark/wiretap/k12text.l" |
1727 | 0 | { BEGIN(MS); } |
1728 | 0 | YY_BREAK |
1729 | 0 | case 9: |
1730 | 0 | YY_RULE_SETUP |
1731 | 0 | #line 225 "/src/wireshark/wiretap/k12text.l" |
1732 | 0 | { SET_MS(yytext); BEGIN(M2N); } |
1733 | 0 | YY_BREAK |
1734 | 0 | case 10: |
1735 | 0 | YY_RULE_SETUP |
1736 | 0 | #line 226 "/src/wireshark/wiretap/k12text.l" |
1737 | 0 | { BEGIN(NS); } |
1738 | 0 | YY_BREAK |
1739 | 0 | case 11: |
1740 | 0 | YY_RULE_SETUP |
1741 | 0 | #line 227 "/src/wireshark/wiretap/k12text.l" |
1742 | 0 | { SET_NS(yytext); BEGIN(ENCAP);} |
1743 | 0 | YY_BREAK |
1744 | 0 | case 12: |
1745 | 0 | YY_RULE_SETUP |
1746 | 0 | #line 228 "/src/wireshark/wiretap/k12text.l" |
1747 | 0 | {yyextra->g_encap = WTAP_ENCAP_ETHERNET; BEGIN(STARTBYTES); } |
1748 | 0 | YY_BREAK |
1749 | 0 | case 13: |
1750 | 0 | YY_RULE_SETUP |
1751 | 0 | #line 229 "/src/wireshark/wiretap/k12text.l" |
1752 | 0 | {yyextra->g_encap = WTAP_ENCAP_MTP2; BEGIN(STARTBYTES); } |
1753 | 0 | YY_BREAK |
1754 | 0 | case 14: |
1755 | 0 | YY_RULE_SETUP |
1756 | 0 | #line 230 "/src/wireshark/wiretap/k12text.l" |
1757 | 0 | {yyextra->g_encap = WTAP_ENCAP_ATM_PDUS; BEGIN(STARTBYTES); } |
1758 | 0 | YY_BREAK |
1759 | 0 | case 15: |
1760 | 0 | YY_RULE_SETUP |
1761 | 0 | #line 231 "/src/wireshark/wiretap/k12text.l" |
1762 | 0 | {yyextra->g_encap = WTAP_ENCAP_MTP3; BEGIN(STARTBYTES); } |
1763 | 0 | YY_BREAK |
1764 | 0 | case 16: |
1765 | 0 | YY_RULE_SETUP |
1766 | 0 | #line 232 "/src/wireshark/wiretap/k12text.l" |
1767 | 0 | {yyextra->g_encap = WTAP_ENCAP_CHDLC; BEGIN(STARTBYTES); } |
1768 | 0 | YY_BREAK |
1769 | 0 | case 17: |
1770 | 0 | YY_RULE_SETUP |
1771 | 0 | #line 233 "/src/wireshark/wiretap/k12text.l" |
1772 | 0 | { BEGIN(BYTE); } |
1773 | 0 | YY_BREAK |
1774 | 0 | case 18: |
1775 | 0 | YY_RULE_SETUP |
1776 | 0 | #line 234 "/src/wireshark/wiretap/k12text.l" |
1777 | 0 | { ADD_BYTE(yytext); } |
1778 | 0 | YY_BREAK |
1779 | 0 | case 19: |
1780 | 0 | YY_RULE_SETUP |
1781 | 0 | #line 235 "/src/wireshark/wiretap/k12text.l" |
1782 | 0 | ; |
1783 | 0 | YY_BREAK |
1784 | 0 | case 20: |
1785 | | /* rule 20 can match eol */ |
1786 | 0 | YY_RULE_SETUP |
1787 | 0 | #line 236 "/src/wireshark/wiretap/k12text.l" |
1788 | 0 | { FINALIZE_FRAME(); yyterminate(); } |
1789 | 0 | YY_BREAK |
1790 | 0 | case 21: |
1791 | 0 | YY_RULE_SETUP |
1792 | 0 | #line 238 "/src/wireshark/wiretap/k12text.l" |
1793 | 0 | { if (++yyextra->junk_chars > MAX_JUNK) { KERROR("too much junk"); } } |
1794 | 0 | YY_BREAK |
1795 | 0 | case YY_STATE_EOF(INITIAL): |
1796 | 0 | case YY_STATE_EOF(MAGIC): |
1797 | 0 | case YY_STATE_EOF(NEXT_FRAME): |
1798 | 0 | case YY_STATE_EOF(HOURS): |
1799 | 0 | case YY_STATE_EOF(MINUTES): |
1800 | 0 | case YY_STATE_EOF(M2S): |
1801 | 0 | case YY_STATE_EOF(SECONDS): |
1802 | 0 | case YY_STATE_EOF(S2M): |
1803 | 0 | case YY_STATE_EOF(MS): |
1804 | 0 | case YY_STATE_EOF(M2N): |
1805 | 0 | case YY_STATE_EOF(NS): |
1806 | 0 | case YY_STATE_EOF(ENCAP): |
1807 | 0 | case YY_STATE_EOF(STARTBYTES): |
1808 | 0 | case YY_STATE_EOF(BYTE): |
1809 | 0 | #line 239 "/src/wireshark/wiretap/k12text.l" |
1810 | 0 | { yyextra->at_eof = true; yyterminate(); } |
1811 | 0 | YY_BREAK |
1812 | 0 | case 22: |
1813 | 0 | YY_RULE_SETUP |
1814 | 0 | #line 241 "/src/wireshark/wiretap/k12text.l" |
1815 | 0 | ECHO; |
1816 | 0 | YY_BREAK |
1817 | 0 | #line 1818 "/work/build/wiretap/k12text.c" |
1818 | | |
1819 | 0 | case YY_END_OF_BUFFER: |
1820 | 0 | { |
1821 | | /* Amount of text matched not including the EOB char. */ |
1822 | 0 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; |
1823 | | |
1824 | | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
1825 | 0 | *yy_cp = yyg->yy_hold_char; |
1826 | 0 | YY_RESTORE_YY_MORE_OFFSET |
1827 | |
|
1828 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
1829 | 0 | { |
1830 | | /* We're scanning a new file or input source. It's |
1831 | | * possible that this happened because the user |
1832 | | * just pointed yyin at a new source and called |
1833 | | * yylex(). If so, then we have to assure |
1834 | | * consistency between YY_CURRENT_BUFFER and our |
1835 | | * globals. Here is the right place to do so, because |
1836 | | * this is the first action (other than possibly a |
1837 | | * back-up) that will match for the new input source. |
1838 | | */ |
1839 | 0 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1840 | | /* %if-c-only */ |
1841 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
1842 | | /* %endif */ |
1843 | | /* %if-c++-only */ |
1844 | | /* %endif */ |
1845 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
1846 | 0 | } |
1847 | | |
1848 | | /* Note that here we test for yy_c_buf_p "<=" to the position |
1849 | | * of the first EOB in the buffer, since yy_c_buf_p will |
1850 | | * already have been incremented past the NUL character |
1851 | | * (since all states make transitions on EOB to the |
1852 | | * end-of-buffer state). Contrast this with the test |
1853 | | * in input(). |
1854 | | */ |
1855 | 0 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
1856 | 0 | { /* This was really a NUL. */ |
1857 | 0 | yy_state_type yy_next_state; |
1858 | |
|
1859 | 0 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
1860 | |
|
1861 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1862 | | |
1863 | | /* Okay, we're now positioned to make the NUL |
1864 | | * transition. We couldn't have |
1865 | | * yy_get_previous_state() go ahead and do it |
1866 | | * for us because it doesn't know how to deal |
1867 | | * with the possibility of jamming (and we don't |
1868 | | * want to build jamming into it because then it |
1869 | | * will run more slowly). |
1870 | | */ |
1871 | |
|
1872 | 0 | yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); |
1873 | |
|
1874 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1875 | |
|
1876 | 0 | if ( yy_next_state ) |
1877 | 0 | { |
1878 | | /* Consume the NUL. */ |
1879 | 0 | yy_cp = ++yyg->yy_c_buf_p; |
1880 | 0 | yy_current_state = yy_next_state; |
1881 | 0 | goto yy_match; |
1882 | 0 | } |
1883 | | |
1884 | 0 | else |
1885 | 0 | { |
1886 | | /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ |
1887 | 0 | yy_cp = yyg->yy_last_accepting_cpos; |
1888 | 0 | yy_current_state = yyg->yy_last_accepting_state; |
1889 | 0 | goto yy_find_action; |
1890 | 0 | } |
1891 | 0 | } |
1892 | | |
1893 | 0 | else switch ( yy_get_next_buffer( yyscanner ) ) |
1894 | 0 | { |
1895 | 0 | case EOB_ACT_END_OF_FILE: |
1896 | 0 | { |
1897 | 0 | yyg->yy_did_buffer_switch_on_eof = 0; |
1898 | |
|
1899 | 0 | if ( yywrap( yyscanner ) ) |
1900 | 0 | { |
1901 | | /* Note: because we've taken care in |
1902 | | * yy_get_next_buffer() to have set up |
1903 | | * yytext, we can now set up |
1904 | | * yy_c_buf_p so that if some total |
1905 | | * hoser (like flex itself) wants to |
1906 | | * call the scanner after we return the |
1907 | | * YY_NULL, it'll still work - another |
1908 | | * YY_NULL will get returned. |
1909 | | */ |
1910 | 0 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
1911 | |
|
1912 | 0 | yy_act = YY_STATE_EOF(YY_START); |
1913 | 0 | goto do_action; |
1914 | 0 | } |
1915 | | |
1916 | 0 | else |
1917 | 0 | { |
1918 | 0 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
1919 | 0 | YY_NEW_FILE; |
1920 | 0 | } |
1921 | 0 | break; |
1922 | 0 | } |
1923 | | |
1924 | 0 | case EOB_ACT_CONTINUE_SCAN: |
1925 | 0 | yyg->yy_c_buf_p = |
1926 | 0 | yyg->yytext_ptr + yy_amount_of_matched_text; |
1927 | |
|
1928 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1929 | |
|
1930 | 0 | yy_cp = yyg->yy_c_buf_p; |
1931 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1932 | 0 | goto yy_match; |
1933 | | |
1934 | 0 | case EOB_ACT_LAST_MATCH: |
1935 | 0 | yyg->yy_c_buf_p = |
1936 | 0 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
1937 | |
|
1938 | 0 | yy_current_state = yy_get_previous_state( yyscanner ); |
1939 | |
|
1940 | 0 | yy_cp = yyg->yy_c_buf_p; |
1941 | 0 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
1942 | 0 | goto yy_find_action; |
1943 | 0 | } |
1944 | 0 | break; |
1945 | 0 | } |
1946 | | |
1947 | 0 | default: |
1948 | 0 | YY_FATAL_ERROR( |
1949 | 0 | "fatal flex scanner internal error--no action found" ); |
1950 | 0 | } /* end of action switch */ |
1951 | 0 | } /* end of scanning one token */ |
1952 | 0 | } /* end of user's declarations */ |
1953 | 0 | } /* end of yylex */ |
1954 | | /* %ok-for-header */ |
1955 | | |
1956 | | /* %if-c++-only */ |
1957 | | /* %not-for-header */ |
1958 | | /* %ok-for-header */ |
1959 | | |
1960 | | /* %endif */ |
1961 | | |
1962 | | /* yy_get_next_buffer - try to read in a new buffer |
1963 | | * |
1964 | | * Returns a code representing an action: |
1965 | | * EOB_ACT_LAST_MATCH - |
1966 | | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1967 | | * EOB_ACT_END_OF_FILE - end of file |
1968 | | */ |
1969 | | /* %if-c-only */ |
1970 | | static int yy_get_next_buffer (yyscan_t yyscanner) |
1971 | | /* %endif */ |
1972 | | /* %if-c++-only */ |
1973 | | /* %endif */ |
1974 | 0 | { |
1975 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1976 | 0 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
1977 | 0 | char *source = yyg->yytext_ptr; |
1978 | 0 | int number_to_move, i; |
1979 | 0 | int ret_val; |
1980 | |
|
1981 | 0 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
1982 | 0 | YY_FATAL_ERROR( |
1983 | 0 | "fatal flex scanner internal error--end of buffer missed" ); |
1984 | | |
1985 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
1986 | 0 | { /* Don't try to fill the buffer, so this is an EOF. */ |
1987 | 0 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
1988 | 0 | { |
1989 | | /* We matched a single character, the EOB, so |
1990 | | * treat this as a final EOF. |
1991 | | */ |
1992 | 0 | return EOB_ACT_END_OF_FILE; |
1993 | 0 | } |
1994 | | |
1995 | 0 | else |
1996 | 0 | { |
1997 | | /* We matched some text prior to the EOB, first |
1998 | | * process it. |
1999 | | */ |
2000 | 0 | return EOB_ACT_LAST_MATCH; |
2001 | 0 | } |
2002 | 0 | } |
2003 | | |
2004 | | /* Try to read more data. */ |
2005 | | |
2006 | | /* First move last chars to start of buffer. */ |
2007 | 0 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); |
2008 | |
|
2009 | 0 | for ( i = 0; i < number_to_move; ++i ) |
2010 | 0 | *(dest++) = *(source++); |
2011 | |
|
2012 | 0 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
2013 | | /* don't do the read, it's not guaranteed to return an EOF, |
2014 | | * just force an EOF |
2015 | | */ |
2016 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
2017 | | |
2018 | 0 | else |
2019 | 0 | { |
2020 | 0 | int num_to_read = |
2021 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
2022 | |
|
2023 | 0 | while ( num_to_read <= 0 ) |
2024 | 0 | { /* Not enough room in the buffer - grow it. */ |
2025 | | |
2026 | | /* just a shorter name for the current buffer */ |
2027 | 0 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
2028 | |
|
2029 | 0 | int yy_c_buf_p_offset = |
2030 | 0 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
2031 | |
|
2032 | 0 | if ( b->yy_is_our_buffer ) |
2033 | 0 | { |
2034 | 0 | int new_size = b->yy_buf_size * 2; |
2035 | |
|
2036 | 0 | if ( new_size <= 0 ) |
2037 | 0 | b->yy_buf_size += b->yy_buf_size / 8; |
2038 | 0 | else |
2039 | 0 | b->yy_buf_size *= 2; |
2040 | |
|
2041 | 0 | b->yy_ch_buf = (char *) |
2042 | | /* Include room in for 2 EOB chars. */ |
2043 | 0 | yyrealloc( (void *) b->yy_ch_buf, |
2044 | 0 | (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
2045 | 0 | } |
2046 | 0 | else |
2047 | | /* Can't grow it, we don't own it. */ |
2048 | 0 | b->yy_ch_buf = NULL; |
2049 | |
|
2050 | 0 | if ( ! b->yy_ch_buf ) |
2051 | 0 | YY_FATAL_ERROR( |
2052 | 0 | "fatal error - scanner input buffer overflow" ); |
2053 | | |
2054 | 0 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
2055 | |
|
2056 | 0 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
2057 | 0 | number_to_move - 1; |
2058 | |
|
2059 | 0 | } |
2060 | | |
2061 | 0 | if ( num_to_read > YY_READ_BUF_SIZE ) |
2062 | 0 | num_to_read = YY_READ_BUF_SIZE; |
2063 | | |
2064 | | /* Read in more data. */ |
2065 | 0 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
2066 | 0 | yyg->yy_n_chars, num_to_read ); |
2067 | |
|
2068 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2069 | 0 | } |
2070 | | |
2071 | 0 | if ( yyg->yy_n_chars == 0 ) |
2072 | 0 | { |
2073 | 0 | if ( number_to_move == YY_MORE_ADJ ) |
2074 | 0 | { |
2075 | 0 | ret_val = EOB_ACT_END_OF_FILE; |
2076 | 0 | yyrestart( yyin , yyscanner); |
2077 | 0 | } |
2078 | | |
2079 | 0 | else |
2080 | 0 | { |
2081 | 0 | ret_val = EOB_ACT_LAST_MATCH; |
2082 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
2083 | 0 | YY_BUFFER_EOF_PENDING; |
2084 | 0 | } |
2085 | 0 | } |
2086 | | |
2087 | 0 | else |
2088 | 0 | ret_val = EOB_ACT_CONTINUE_SCAN; |
2089 | |
|
2090 | 0 | if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
2091 | | /* Extend the array by 50%, plus the number we really need. */ |
2092 | 0 | int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
2093 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( |
2094 | 0 | (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); |
2095 | 0 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
2096 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
2097 | | /* "- 2" to take care of EOB's */ |
2098 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); |
2099 | 0 | } |
2100 | | |
2101 | 0 | yyg->yy_n_chars += number_to_move; |
2102 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
2103 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
2104 | |
|
2105 | 0 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
2106 | |
|
2107 | 0 | return ret_val; |
2108 | 0 | } |
2109 | | |
2110 | | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
2111 | | |
2112 | | /* %if-c-only */ |
2113 | | /* %not-for-header */ |
2114 | | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) |
2115 | | /* %endif */ |
2116 | | /* %if-c++-only */ |
2117 | | /* %endif */ |
2118 | 0 | { |
2119 | 0 | yy_state_type yy_current_state; |
2120 | 0 | char *yy_cp; |
2121 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2122 | | |
2123 | | /* %% [15.0] code to get the start state into yy_current_state goes here */ |
2124 | 0 | yy_current_state = yyg->yy_start; |
2125 | |
|
2126 | 0 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) |
2127 | 0 | { |
2128 | | /* %% [16.0] code to find the next state goes here */ |
2129 | 0 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
2130 | 0 | if ( yy_accept[yy_current_state] ) |
2131 | 0 | { |
2132 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
2133 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
2134 | 0 | } |
2135 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2136 | 0 | { |
2137 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
2138 | 0 | if ( yy_current_state >= 517 ) |
2139 | 0 | yy_c = yy_meta[yy_c]; |
2140 | 0 | } |
2141 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2142 | 0 | } |
2143 | |
|
2144 | 0 | return yy_current_state; |
2145 | 0 | } |
2146 | | |
2147 | | /* yy_try_NUL_trans - try to make a transition on the NUL character |
2148 | | * |
2149 | | * synopsis |
2150 | | * next_state = yy_try_NUL_trans( current_state ); |
2151 | | */ |
2152 | | /* %if-c-only */ |
2153 | | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) |
2154 | | /* %endif */ |
2155 | | /* %if-c++-only */ |
2156 | | /* %endif */ |
2157 | 0 | { |
2158 | 0 | int yy_is_jam; |
2159 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ |
2160 | | /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ |
2161 | 0 | char *yy_cp = yyg->yy_c_buf_p; |
2162 | |
|
2163 | 0 | YY_CHAR yy_c = 1; |
2164 | 0 | if ( yy_accept[yy_current_state] ) |
2165 | 0 | { |
2166 | 0 | yyg->yy_last_accepting_state = yy_current_state; |
2167 | 0 | yyg->yy_last_accepting_cpos = yy_cp; |
2168 | 0 | } |
2169 | 0 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2170 | 0 | { |
2171 | 0 | yy_current_state = (int) yy_def[yy_current_state]; |
2172 | 0 | if ( yy_current_state >= 517 ) |
2173 | 0 | yy_c = yy_meta[yy_c]; |
2174 | 0 | } |
2175 | 0 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2176 | 0 | yy_is_jam = (yy_current_state == 516); |
2177 | |
|
2178 | 0 | (void)yyg; |
2179 | 0 | return yy_is_jam ? 0 : yy_current_state; |
2180 | 0 | } |
2181 | | |
2182 | | #ifndef YY_NO_UNPUT |
2183 | | /* %if-c-only */ |
2184 | | |
2185 | | /* %endif */ |
2186 | | #endif |
2187 | | |
2188 | | /* %if-c-only */ |
2189 | | #ifndef YY_NO_INPUT |
2190 | | #ifdef __cplusplus |
2191 | | static int yyinput (yyscan_t yyscanner) |
2192 | | #else |
2193 | | static int input (yyscan_t yyscanner) |
2194 | | #endif |
2195 | | |
2196 | | /* %endif */ |
2197 | | /* %if-c++-only */ |
2198 | | /* %endif */ |
2199 | | { |
2200 | | int c; |
2201 | | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2202 | | |
2203 | | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
2204 | | |
2205 | | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
2206 | | { |
2207 | | /* yy_c_buf_p now points to the character we want to return. |
2208 | | * If this occurs *before* the EOB characters, then it's a |
2209 | | * valid NUL; if not, then we've hit the end of the buffer. |
2210 | | */ |
2211 | | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
2212 | | /* This was really a NUL. */ |
2213 | | *yyg->yy_c_buf_p = '\0'; |
2214 | | |
2215 | | else |
2216 | | { /* need more input */ |
2217 | | int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); |
2218 | | ++yyg->yy_c_buf_p; |
2219 | | |
2220 | | switch ( yy_get_next_buffer( yyscanner ) ) |
2221 | | { |
2222 | | case EOB_ACT_LAST_MATCH: |
2223 | | /* This happens because yy_g_n_b() |
2224 | | * sees that we've accumulated a |
2225 | | * token and flags that we need to |
2226 | | * try matching the token before |
2227 | | * proceeding. But for input(), |
2228 | | * there's no matching to consider. |
2229 | | * So convert the EOB_ACT_LAST_MATCH |
2230 | | * to EOB_ACT_END_OF_FILE. |
2231 | | */ |
2232 | | |
2233 | | /* Reset buffer status. */ |
2234 | | yyrestart( yyin , yyscanner); |
2235 | | |
2236 | | /*FALLTHROUGH*/ |
2237 | | |
2238 | | case EOB_ACT_END_OF_FILE: |
2239 | | { |
2240 | | if ( yywrap( yyscanner ) ) |
2241 | | return 0; |
2242 | | |
2243 | | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
2244 | | YY_NEW_FILE; |
2245 | | #ifdef __cplusplus |
2246 | | return yyinput(yyscanner); |
2247 | | #else |
2248 | | return input(yyscanner); |
2249 | | #endif |
2250 | | } |
2251 | | |
2252 | | case EOB_ACT_CONTINUE_SCAN: |
2253 | | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
2254 | | break; |
2255 | | } |
2256 | | } |
2257 | | } |
2258 | | |
2259 | | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
2260 | | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
2261 | | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
2262 | | |
2263 | | /* %% [19.0] update BOL and yylineno */ |
2264 | | |
2265 | | return c; |
2266 | | } |
2267 | | /* %if-c-only */ |
2268 | | #endif /* ifndef YY_NO_INPUT */ |
2269 | | /* %endif */ |
2270 | | |
2271 | | /** Immediately switch to a different input stream. |
2272 | | * @param input_file A readable stream. |
2273 | | * @param yyscanner The scanner object. |
2274 | | * @note This function does not reset the start condition to @c INITIAL . |
2275 | | */ |
2276 | | /* %if-c-only */ |
2277 | | void yyrestart (FILE * input_file , yyscan_t yyscanner) |
2278 | | /* %endif */ |
2279 | | /* %if-c++-only */ |
2280 | | /* %endif */ |
2281 | 0 | { |
2282 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2283 | |
|
2284 | 0 | if ( ! YY_CURRENT_BUFFER ){ |
2285 | 0 | yyensure_buffer_stack (yyscanner); |
2286 | 0 | YY_CURRENT_BUFFER_LVALUE = |
2287 | 0 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
2288 | 0 | } |
2289 | |
|
2290 | 0 | yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); |
2291 | 0 | yy_load_buffer_state( yyscanner ); |
2292 | 0 | } |
2293 | | |
2294 | | /* %if-c++-only */ |
2295 | | /* %endif */ |
2296 | | |
2297 | | /** Switch to a different input buffer. |
2298 | | * @param new_buffer The new input buffer. |
2299 | | * @param yyscanner The scanner object. |
2300 | | */ |
2301 | | /* %if-c-only */ |
2302 | | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
2303 | | /* %endif */ |
2304 | | /* %if-c++-only */ |
2305 | | /* %endif */ |
2306 | 0 | { |
2307 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2308 | | |
2309 | | /* TODO. We should be able to replace this entire function body |
2310 | | * with |
2311 | | * yypop_buffer_state(); |
2312 | | * yypush_buffer_state(new_buffer); |
2313 | | */ |
2314 | 0 | yyensure_buffer_stack (yyscanner); |
2315 | 0 | if ( YY_CURRENT_BUFFER == new_buffer ) |
2316 | 0 | return; |
2317 | | |
2318 | 0 | if ( YY_CURRENT_BUFFER ) |
2319 | 0 | { |
2320 | | /* Flush out information for old buffer. */ |
2321 | 0 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
2322 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
2323 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2324 | 0 | } |
2325 | |
|
2326 | 0 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2327 | 0 | yy_load_buffer_state( yyscanner ); |
2328 | | |
2329 | | /* We don't actually know whether we did this switch during |
2330 | | * EOF (yywrap()) processing, but the only time this flag |
2331 | | * is looked at is after yywrap() is called, so it's safe |
2332 | | * to go ahead and always set it. |
2333 | | */ |
2334 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2335 | 0 | } |
2336 | | |
2337 | | /* %if-c-only */ |
2338 | | static void yy_load_buffer_state (yyscan_t yyscanner) |
2339 | | /* %endif */ |
2340 | | /* %if-c++-only */ |
2341 | | /* %endif */ |
2342 | 0 | { |
2343 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2344 | 0 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
2345 | 0 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
2346 | | /* %if-c-only */ |
2347 | 0 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
2348 | | /* %endif */ |
2349 | | /* %if-c++-only */ |
2350 | | /* %endif */ |
2351 | 0 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
2352 | 0 | } |
2353 | | |
2354 | | /** Allocate and initialize an input buffer state. |
2355 | | * @param file A readable stream. |
2356 | | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
2357 | | * @param yyscanner The scanner object. |
2358 | | * @return the allocated buffer state. |
2359 | | */ |
2360 | | /* %if-c-only */ |
2361 | | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
2362 | | /* %endif */ |
2363 | | /* %if-c++-only */ |
2364 | | /* %endif */ |
2365 | 0 | { |
2366 | 0 | YY_BUFFER_STATE b; |
2367 | | |
2368 | 0 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
2369 | 0 | if ( ! b ) |
2370 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
2371 | | |
2372 | 0 | b->yy_buf_size = size; |
2373 | | |
2374 | | /* yy_ch_buf has to be 2 characters longer than the size given because |
2375 | | * we need to put in 2 end-of-buffer characters. |
2376 | | */ |
2377 | 0 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
2378 | 0 | if ( ! b->yy_ch_buf ) |
2379 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
2380 | | |
2381 | 0 | b->yy_is_our_buffer = 1; |
2382 | |
|
2383 | 0 | yy_init_buffer( b, file , yyscanner); |
2384 | |
|
2385 | 0 | return b; |
2386 | 0 | } |
2387 | | |
2388 | | /* %if-c++-only */ |
2389 | | /* %endif */ |
2390 | | |
2391 | | /** Destroy the buffer. |
2392 | | * @param b a buffer created with yy_create_buffer() |
2393 | | * @param yyscanner The scanner object. |
2394 | | */ |
2395 | | /* %if-c-only */ |
2396 | | void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
2397 | | /* %endif */ |
2398 | | /* %if-c++-only */ |
2399 | | /* %endif */ |
2400 | 0 | { |
2401 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2402 | |
|
2403 | 0 | if ( ! b ) |
2404 | 0 | return; |
2405 | | |
2406 | 0 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
2407 | 0 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
2408 | |
|
2409 | 0 | if ( b->yy_is_our_buffer ) |
2410 | 0 | yyfree( (void *) b->yy_ch_buf , yyscanner ); |
2411 | |
|
2412 | 0 | yyfree( (void *) b , yyscanner ); |
2413 | 0 | } |
2414 | | |
2415 | | /* Initializes or reinitializes a buffer. |
2416 | | * This function is sometimes called more than once on the same buffer, |
2417 | | * such as during a yyrestart() or at EOF. |
2418 | | */ |
2419 | | /* %if-c-only */ |
2420 | | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) |
2421 | | /* %endif */ |
2422 | | /* %if-c++-only */ |
2423 | | /* %endif */ |
2424 | | |
2425 | 0 | { |
2426 | 0 | int oerrno = errno; |
2427 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2428 | |
|
2429 | 0 | yy_flush_buffer( b , yyscanner); |
2430 | | |
2431 | | /* %if-c-only */ |
2432 | 0 | b->yy_input_file = file; |
2433 | | /* %endif */ |
2434 | | /* %if-c++-only */ |
2435 | | /* %endif */ |
2436 | 0 | b->yy_fill_buffer = 1; |
2437 | | |
2438 | | /* If b is the current buffer, then yy_init_buffer was _probably_ |
2439 | | * called from yyrestart() or through yy_get_next_buffer. |
2440 | | * In that case, we don't want to reset the lineno or column. |
2441 | | */ |
2442 | 0 | if (b != YY_CURRENT_BUFFER){ |
2443 | 0 | b->yy_bs_lineno = 1; |
2444 | 0 | b->yy_bs_column = 0; |
2445 | 0 | } |
2446 | | |
2447 | | /* %if-c-only */ |
2448 | |
|
2449 | 0 | b->yy_is_interactive = 0; |
2450 | | |
2451 | | /* %endif */ |
2452 | | /* %if-c++-only */ |
2453 | | /* %endif */ |
2454 | 0 | errno = oerrno; |
2455 | 0 | } |
2456 | | |
2457 | | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
2458 | | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
2459 | | * @param yyscanner The scanner object. |
2460 | | */ |
2461 | | /* %if-c-only */ |
2462 | | void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
2463 | | /* %endif */ |
2464 | | /* %if-c++-only */ |
2465 | | /* %endif */ |
2466 | 0 | { |
2467 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2468 | 0 | if ( ! b ) |
2469 | 0 | return; |
2470 | | |
2471 | 0 | b->yy_n_chars = 0; |
2472 | | |
2473 | | /* We always need two end-of-buffer characters. The first causes |
2474 | | * a transition to the end-of-buffer state. The second causes |
2475 | | * a jam in that state. |
2476 | | */ |
2477 | 0 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
2478 | 0 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
2479 | |
|
2480 | 0 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
2481 | |
|
2482 | 0 | b->yy_at_bol = 1; |
2483 | 0 | b->yy_buffer_status = YY_BUFFER_NEW; |
2484 | |
|
2485 | 0 | if ( b == YY_CURRENT_BUFFER ) |
2486 | 0 | yy_load_buffer_state( yyscanner ); |
2487 | 0 | } |
2488 | | |
2489 | | /* %if-c-or-c++ */ |
2490 | | /** Pushes the new state onto the stack. The new state becomes |
2491 | | * the current state. This function will allocate the stack |
2492 | | * if necessary. |
2493 | | * @param new_buffer The new state. |
2494 | | * @param yyscanner The scanner object. |
2495 | | */ |
2496 | | /* %if-c-only */ |
2497 | | void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
2498 | | /* %endif */ |
2499 | | /* %if-c++-only */ |
2500 | | /* %endif */ |
2501 | 0 | { |
2502 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2503 | 0 | if (new_buffer == NULL) |
2504 | 0 | return; |
2505 | | |
2506 | 0 | yyensure_buffer_stack(yyscanner); |
2507 | | |
2508 | | /* This block is copied from yy_switch_to_buffer. */ |
2509 | 0 | if ( YY_CURRENT_BUFFER ) |
2510 | 0 | { |
2511 | | /* Flush out information for old buffer. */ |
2512 | 0 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
2513 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
2514 | 0 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2515 | 0 | } |
2516 | | |
2517 | | /* Only push if top exists. Otherwise, replace top. */ |
2518 | 0 | if (YY_CURRENT_BUFFER) |
2519 | 0 | yyg->yy_buffer_stack_top++; |
2520 | 0 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2521 | | |
2522 | | /* copied from yy_switch_to_buffer. */ |
2523 | 0 | yy_load_buffer_state( yyscanner ); |
2524 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2525 | 0 | } |
2526 | | /* %endif */ |
2527 | | |
2528 | | /* %if-c-or-c++ */ |
2529 | | /** Removes and deletes the top of the stack, if present. |
2530 | | * The next element becomes the new top. |
2531 | | * @param yyscanner The scanner object. |
2532 | | */ |
2533 | | /* %if-c-only */ |
2534 | | void yypop_buffer_state (yyscan_t yyscanner) |
2535 | | /* %endif */ |
2536 | | /* %if-c++-only */ |
2537 | | /* %endif */ |
2538 | 0 | { |
2539 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2540 | 0 | if (!YY_CURRENT_BUFFER) |
2541 | 0 | return; |
2542 | | |
2543 | 0 | yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); |
2544 | 0 | YY_CURRENT_BUFFER_LVALUE = NULL; |
2545 | 0 | if (yyg->yy_buffer_stack_top > 0) |
2546 | 0 | --yyg->yy_buffer_stack_top; |
2547 | |
|
2548 | 0 | if (YY_CURRENT_BUFFER) { |
2549 | 0 | yy_load_buffer_state( yyscanner ); |
2550 | 0 | yyg->yy_did_buffer_switch_on_eof = 1; |
2551 | 0 | } |
2552 | 0 | } |
2553 | | /* %endif */ |
2554 | | |
2555 | | /* %if-c-or-c++ */ |
2556 | | /* Allocates the stack if it does not exist. |
2557 | | * Guarantees space for at least one push. |
2558 | | */ |
2559 | | /* %if-c-only */ |
2560 | | static void yyensure_buffer_stack (yyscan_t yyscanner) |
2561 | | /* %endif */ |
2562 | | /* %if-c++-only */ |
2563 | | /* %endif */ |
2564 | 0 | { |
2565 | 0 | yy_size_t num_to_alloc; |
2566 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2567 | |
|
2568 | 0 | if (!yyg->yy_buffer_stack) { |
2569 | | |
2570 | | /* First allocation is just for 2 elements, since we don't know if this |
2571 | | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
2572 | | * immediate realloc on the next call. |
2573 | | */ |
2574 | 0 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
2575 | 0 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc |
2576 | 0 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
2577 | 0 | , yyscanner); |
2578 | 0 | if ( ! yyg->yy_buffer_stack ) |
2579 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2580 | | |
2581 | 0 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
2582 | |
|
2583 | 0 | yyg->yy_buffer_stack_max = num_to_alloc; |
2584 | 0 | yyg->yy_buffer_stack_top = 0; |
2585 | 0 | return; |
2586 | 0 | } |
2587 | | |
2588 | 0 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ |
2589 | | |
2590 | | /* Increase the buffer to prepare for a possible push. */ |
2591 | 0 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
2592 | |
|
2593 | 0 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
2594 | 0 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc |
2595 | 0 | (yyg->yy_buffer_stack, |
2596 | 0 | num_to_alloc * sizeof(struct yy_buffer_state*) |
2597 | 0 | , yyscanner); |
2598 | 0 | if ( ! yyg->yy_buffer_stack ) |
2599 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2600 | | |
2601 | | /* zero only the new slots.*/ |
2602 | 0 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); |
2603 | 0 | yyg->yy_buffer_stack_max = num_to_alloc; |
2604 | 0 | } |
2605 | 0 | } |
2606 | | /* %endif */ |
2607 | | |
2608 | | /* %if-c-only */ |
2609 | | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
2610 | | * @param base the character buffer |
2611 | | * @param size the size in bytes of the character buffer |
2612 | | * @param yyscanner The scanner object. |
2613 | | * @return the newly allocated buffer state object. |
2614 | | */ |
2615 | | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
2616 | 0 | { |
2617 | 0 | YY_BUFFER_STATE b; |
2618 | | |
2619 | 0 | if ( size < 2 || |
2620 | 0 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
2621 | 0 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
2622 | | /* They forgot to leave room for the EOB's. */ |
2623 | 0 | return NULL; |
2624 | | |
2625 | 0 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
2626 | 0 | if ( ! b ) |
2627 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
2628 | | |
2629 | 0 | b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
2630 | 0 | b->yy_buf_pos = b->yy_ch_buf = base; |
2631 | 0 | b->yy_is_our_buffer = 0; |
2632 | 0 | b->yy_input_file = NULL; |
2633 | 0 | b->yy_n_chars = b->yy_buf_size; |
2634 | 0 | b->yy_is_interactive = 0; |
2635 | 0 | b->yy_at_bol = 1; |
2636 | 0 | b->yy_fill_buffer = 0; |
2637 | 0 | b->yy_buffer_status = YY_BUFFER_NEW; |
2638 | |
|
2639 | 0 | yy_switch_to_buffer( b , yyscanner ); |
2640 | |
|
2641 | 0 | return b; |
2642 | 0 | } |
2643 | | /* %endif */ |
2644 | | |
2645 | | /* %if-c-only */ |
2646 | | /** Setup the input buffer state to scan a string. The next call to yylex() will |
2647 | | * scan from a @e copy of @a str. |
2648 | | * @param yystr a NUL-terminated string to scan |
2649 | | * @param yyscanner The scanner object. |
2650 | | * @return the newly allocated buffer state object. |
2651 | | * @note If you want to scan bytes that may contain NUL values, then use |
2652 | | * yy_scan_bytes() instead. |
2653 | | */ |
2654 | | YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) |
2655 | 0 | { |
2656 | | |
2657 | 0 | return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); |
2658 | 0 | } |
2659 | | /* %endif */ |
2660 | | |
2661 | | /* %if-c-only */ |
2662 | | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
2663 | | * scan from a @e copy of @a bytes. |
2664 | | * @param yybytes the byte buffer to scan |
2665 | | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2666 | | * @param yyscanner The scanner object. |
2667 | | * @return the newly allocated buffer state object. |
2668 | | */ |
2669 | | YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) |
2670 | 0 | { |
2671 | 0 | YY_BUFFER_STATE b; |
2672 | 0 | char *buf; |
2673 | 0 | yy_size_t n; |
2674 | 0 | int i; |
2675 | | |
2676 | | /* Get memory for full buffer, including space for trailing EOB's. */ |
2677 | 0 | n = (yy_size_t) (_yybytes_len + 2); |
2678 | 0 | buf = (char *) yyalloc( n , yyscanner ); |
2679 | 0 | if ( ! buf ) |
2680 | 0 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
2681 | | |
2682 | 0 | for ( i = 0; i < _yybytes_len; ++i ) |
2683 | 0 | buf[i] = yybytes[i]; |
2684 | |
|
2685 | 0 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
2686 | |
|
2687 | 0 | b = yy_scan_buffer( buf, n , yyscanner); |
2688 | 0 | if ( ! b ) |
2689 | 0 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
2690 | | |
2691 | | /* It's okay to grow etc. this buffer, and we should throw it |
2692 | | * away when we're done. |
2693 | | */ |
2694 | 0 | b->yy_is_our_buffer = 1; |
2695 | |
|
2696 | 0 | return b; |
2697 | 0 | } |
2698 | | /* %endif */ |
2699 | | |
2700 | | #ifndef YY_EXIT_FAILURE |
2701 | | #define YY_EXIT_FAILURE 2 |
2702 | | #endif |
2703 | | |
2704 | | /* %if-c-only */ |
2705 | | static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) |
2706 | 0 | { |
2707 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2708 | 0 | (void)yyg; |
2709 | 0 | fprintf( stderr, "%s\n", msg ); |
2710 | 0 | exit( YY_EXIT_FAILURE ); |
2711 | 0 | } |
2712 | | /* %endif */ |
2713 | | /* %if-c++-only */ |
2714 | | /* %endif */ |
2715 | | |
2716 | | /* Redefine yyless() so it works in section 3 code. */ |
2717 | | |
2718 | | #undef yyless |
2719 | | #define yyless(n) \ |
2720 | | do \ |
2721 | | { \ |
2722 | | /* Undo effects of setting up yytext. */ \ |
2723 | | int yyless_macro_arg = (n); \ |
2724 | | YY_LESS_LINENO(yyless_macro_arg);\ |
2725 | | yytext[yyleng] = yyg->yy_hold_char; \ |
2726 | | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
2727 | | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
2728 | | *yyg->yy_c_buf_p = '\0'; \ |
2729 | | yyleng = yyless_macro_arg; \ |
2730 | | } \ |
2731 | | while ( 0 ) |
2732 | | |
2733 | | /* Accessor methods (get/set functions) to struct members. */ |
2734 | | |
2735 | | /* %if-c-only */ |
2736 | | /* %if-reentrant */ |
2737 | | |
2738 | | /** Get the user-defined data for this scanner. |
2739 | | * @param yyscanner The scanner object. |
2740 | | */ |
2741 | | YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) |
2742 | 0 | { |
2743 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2744 | 0 | return yyextra; |
2745 | 0 | } |
2746 | | |
2747 | | /* %endif */ |
2748 | | |
2749 | | /** Get the current line number. |
2750 | | * @param yyscanner The scanner object. |
2751 | | */ |
2752 | | int yyget_lineno (yyscan_t yyscanner) |
2753 | 0 | { |
2754 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2755 | |
|
2756 | 0 | if (! YY_CURRENT_BUFFER) |
2757 | 0 | return 0; |
2758 | | |
2759 | 0 | return yylineno; |
2760 | 0 | } |
2761 | | |
2762 | | /** Get the current column number. |
2763 | | * @param yyscanner The scanner object. |
2764 | | */ |
2765 | | int yyget_column (yyscan_t yyscanner) |
2766 | 0 | { |
2767 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2768 | |
|
2769 | 0 | if (! YY_CURRENT_BUFFER) |
2770 | 0 | return 0; |
2771 | | |
2772 | 0 | return yycolumn; |
2773 | 0 | } |
2774 | | |
2775 | | /** Get the input stream. |
2776 | | * @param yyscanner The scanner object. |
2777 | | */ |
2778 | | FILE *yyget_in (yyscan_t yyscanner) |
2779 | 0 | { |
2780 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2781 | 0 | return yyin; |
2782 | 0 | } |
2783 | | |
2784 | | /** Get the output stream. |
2785 | | * @param yyscanner The scanner object. |
2786 | | */ |
2787 | | FILE *yyget_out (yyscan_t yyscanner) |
2788 | 0 | { |
2789 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2790 | 0 | return yyout; |
2791 | 0 | } |
2792 | | |
2793 | | /** Get the length of the current token. |
2794 | | * @param yyscanner The scanner object. |
2795 | | */ |
2796 | | int yyget_leng (yyscan_t yyscanner) |
2797 | 0 | { |
2798 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2799 | 0 | return yyleng; |
2800 | 0 | } |
2801 | | |
2802 | | /** Get the current token. |
2803 | | * @param yyscanner The scanner object. |
2804 | | */ |
2805 | | |
2806 | | char *yyget_text (yyscan_t yyscanner) |
2807 | 0 | { |
2808 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2809 | 0 | return yytext; |
2810 | 0 | } |
2811 | | |
2812 | | /* %if-reentrant */ |
2813 | | |
2814 | | /** Set the user-defined data. This data is never touched by the scanner. |
2815 | | * @param user_defined The data to be associated with this scanner. |
2816 | | * @param yyscanner The scanner object. |
2817 | | */ |
2818 | | void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) |
2819 | 0 | { |
2820 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2821 | 0 | yyextra = user_defined ; |
2822 | 0 | } |
2823 | | |
2824 | | /* %endif */ |
2825 | | |
2826 | | /** Set the current line number. |
2827 | | * @param _line_number line number |
2828 | | * @param yyscanner The scanner object. |
2829 | | */ |
2830 | | void yyset_lineno (int _line_number , yyscan_t yyscanner) |
2831 | 0 | { |
2832 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2833 | | |
2834 | | /* lineno is only valid if an input buffer exists. */ |
2835 | 0 | if (! YY_CURRENT_BUFFER ) |
2836 | 0 | YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); |
2837 | | |
2838 | 0 | yylineno = _line_number; |
2839 | 0 | } |
2840 | | |
2841 | | /** Set the current column. |
2842 | | * @param _column_no column number |
2843 | | * @param yyscanner The scanner object. |
2844 | | */ |
2845 | | void yyset_column (int _column_no , yyscan_t yyscanner) |
2846 | 0 | { |
2847 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2848 | | |
2849 | | /* column is only valid if an input buffer exists. */ |
2850 | 0 | if (! YY_CURRENT_BUFFER ) |
2851 | 0 | YY_FATAL_ERROR( "yyset_column called with no buffer" ); |
2852 | | |
2853 | 0 | yycolumn = _column_no; |
2854 | 0 | } |
2855 | | |
2856 | | /** Set the input stream. This does not discard the current |
2857 | | * input buffer. |
2858 | | * @param _in_str A readable stream. |
2859 | | * @param yyscanner The scanner object. |
2860 | | * @see yy_switch_to_buffer |
2861 | | */ |
2862 | | void yyset_in (FILE * _in_str , yyscan_t yyscanner) |
2863 | 0 | { |
2864 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2865 | 0 | yyin = _in_str ; |
2866 | 0 | } |
2867 | | |
2868 | | void yyset_out (FILE * _out_str , yyscan_t yyscanner) |
2869 | 0 | { |
2870 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2871 | 0 | yyout = _out_str ; |
2872 | 0 | } |
2873 | | |
2874 | | int yyget_debug (yyscan_t yyscanner) |
2875 | 0 | { |
2876 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2877 | 0 | return yy_flex_debug; |
2878 | 0 | } |
2879 | | |
2880 | | void yyset_debug (int _bdebug , yyscan_t yyscanner) |
2881 | 0 | { |
2882 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2883 | 0 | yy_flex_debug = _bdebug ; |
2884 | 0 | } |
2885 | | |
2886 | | /* %endif */ |
2887 | | |
2888 | | /* %if-reentrant */ |
2889 | | /* Accessor methods for yylval and yylloc */ |
2890 | | |
2891 | | /* %if-bison-bridge */ |
2892 | | /* %endif */ |
2893 | | |
2894 | | /* User-visible API */ |
2895 | | |
2896 | | /* yylex_init is special because it creates the scanner itself, so it is |
2897 | | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
2898 | | * That's why we explicitly handle the declaration, instead of using our macros. |
2899 | | */ |
2900 | | int yylex_init(yyscan_t* ptr_yy_globals) |
2901 | 0 | { |
2902 | 0 | if (ptr_yy_globals == NULL){ |
2903 | 0 | errno = EINVAL; |
2904 | 0 | return 1; |
2905 | 0 | } |
2906 | | |
2907 | 0 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); |
2908 | |
|
2909 | 0 | if (*ptr_yy_globals == NULL){ |
2910 | 0 | errno = ENOMEM; |
2911 | 0 | return 1; |
2912 | 0 | } |
2913 | | |
2914 | | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
2915 | 0 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
2916 | |
|
2917 | 0 | return yy_init_globals ( *ptr_yy_globals ); |
2918 | 0 | } |
2919 | | |
2920 | | /* yylex_init_extra has the same functionality as yylex_init, but follows the |
2921 | | * convention of taking the scanner as the last argument. Note however, that |
2922 | | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
2923 | | * is the reason, too, why this function also must handle its own declaration). |
2924 | | * The user defined value in the first argument will be available to yyalloc in |
2925 | | * the yyextra field. |
2926 | | */ |
2927 | | int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) |
2928 | 0 | { |
2929 | 0 | struct yyguts_t dummy_yyguts; |
2930 | |
|
2931 | 0 | yyset_extra (yy_user_defined, &dummy_yyguts); |
2932 | |
|
2933 | 0 | if (ptr_yy_globals == NULL){ |
2934 | 0 | errno = EINVAL; |
2935 | 0 | return 1; |
2936 | 0 | } |
2937 | | |
2938 | 0 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); |
2939 | |
|
2940 | 0 | if (*ptr_yy_globals == NULL){ |
2941 | 0 | errno = ENOMEM; |
2942 | 0 | return 1; |
2943 | 0 | } |
2944 | | |
2945 | | /* By setting to 0xAA, we expose bugs in |
2946 | | yy_init_globals. Leave at 0x00 for releases. */ |
2947 | 0 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); |
2948 | |
|
2949 | 0 | yyset_extra (yy_user_defined, *ptr_yy_globals); |
2950 | |
|
2951 | 0 | return yy_init_globals ( *ptr_yy_globals ); |
2952 | 0 | } |
2953 | | |
2954 | | /* %endif if-c-only */ |
2955 | | |
2956 | | /* %if-c-only */ |
2957 | | static int yy_init_globals (yyscan_t yyscanner) |
2958 | 0 | { |
2959 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2960 | | /* Initialization is the same as for the non-reentrant scanner. |
2961 | | * This function is called from yylex_destroy(), so don't allocate here. |
2962 | | */ |
2963 | |
|
2964 | 0 | yyg->yy_buffer_stack = NULL; |
2965 | 0 | yyg->yy_buffer_stack_top = 0; |
2966 | 0 | yyg->yy_buffer_stack_max = 0; |
2967 | 0 | yyg->yy_c_buf_p = NULL; |
2968 | 0 | yyg->yy_init = 0; |
2969 | 0 | yyg->yy_start = 0; |
2970 | |
|
2971 | 0 | yyg->yy_start_stack_ptr = 0; |
2972 | 0 | yyg->yy_start_stack_depth = 0; |
2973 | 0 | yyg->yy_start_stack = NULL; |
2974 | | |
2975 | | /* Defined in main.c */ |
2976 | | #ifdef YY_STDINIT |
2977 | | yyin = stdin; |
2978 | | yyout = stdout; |
2979 | | #else |
2980 | 0 | yyin = NULL; |
2981 | 0 | yyout = NULL; |
2982 | 0 | #endif |
2983 | | |
2984 | | /* For future reference: Set errno on error, since we are called by |
2985 | | * yylex_init() |
2986 | | */ |
2987 | 0 | return 0; |
2988 | 0 | } |
2989 | | /* %endif */ |
2990 | | |
2991 | | /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ |
2992 | | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2993 | | int yylex_destroy (yyscan_t yyscanner) |
2994 | 0 | { |
2995 | 0 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2996 | | |
2997 | | /* Pop the buffer stack, destroying each element. */ |
2998 | 0 | while(YY_CURRENT_BUFFER){ |
2999 | 0 | yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); |
3000 | 0 | YY_CURRENT_BUFFER_LVALUE = NULL; |
3001 | 0 | yypop_buffer_state(yyscanner); |
3002 | 0 | } |
3003 | | |
3004 | | /* Destroy the stack itself. */ |
3005 | 0 | yyfree(yyg->yy_buffer_stack , yyscanner); |
3006 | 0 | yyg->yy_buffer_stack = NULL; |
3007 | | |
3008 | | /* Destroy the start condition stack. */ |
3009 | 0 | yyfree( yyg->yy_start_stack , yyscanner ); |
3010 | 0 | yyg->yy_start_stack = NULL; |
3011 | | |
3012 | | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
3013 | | * yylex() is called, initialization will occur. */ |
3014 | 0 | yy_init_globals( yyscanner); |
3015 | | |
3016 | | /* %if-reentrant */ |
3017 | | /* Destroy the main struct (reentrant only). */ |
3018 | 0 | yyfree ( yyscanner , yyscanner ); |
3019 | 0 | yyscanner = NULL; |
3020 | | /* %endif */ |
3021 | 0 | return 0; |
3022 | 0 | } |
3023 | | /* %endif */ |
3024 | | |
3025 | | /* |
3026 | | * Internal utility routines. |
3027 | | */ |
3028 | | |
3029 | | #ifndef yytext_ptr |
3030 | | static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) |
3031 | | { |
3032 | | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3033 | | (void)yyg; |
3034 | | |
3035 | | int i; |
3036 | | for ( i = 0; i < n; ++i ) |
3037 | | s1[i] = s2[i]; |
3038 | | } |
3039 | | #endif |
3040 | | |
3041 | | #ifdef YY_NEED_STRLEN |
3042 | | static int yy_flex_strlen (const char * s , yyscan_t yyscanner) |
3043 | | { |
3044 | | int n; |
3045 | | for ( n = 0; s[n]; ++n ) |
3046 | | ; |
3047 | | |
3048 | | return n; |
3049 | | } |
3050 | | #endif |
3051 | | |
3052 | | /* %if-tables-serialization definitions */ |
3053 | | /* %define-yytables The name for this specific scanner's tables. */ |
3054 | | #define YYTABLES_NAME "yytables" |
3055 | | /* %endif */ |
3056 | | |
3057 | | /* %ok-for-header */ |
3058 | | |
3059 | | #line 241 "/src/wireshark/wiretap/k12text.l" |
3060 | | |
3061 | | |
3062 | | /* |
3063 | | * Turn diagnostics back on, so we check the code that we've written. |
3064 | | */ |
3065 | | DIAG_ON_FLEX() |
3066 | | |
3067 | | /* Fill in pkthdr */ |
3068 | | |
3069 | | static bool |
3070 | | k12text_set_headers(wtap_rec *rec, k12text_state_t *state, |
3071 | | int *err, char **err_info) |
3072 | 0 | { |
3073 | 0 | rec->rec_type = REC_TYPE_PACKET; |
3074 | 0 | rec->block = wtap_block_create(WTAP_BLOCK_PACKET); |
3075 | 0 | rec->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; |
3076 | |
|
3077 | 0 | rec->ts.secs = 946681200 + (3600*state->g_h) + (60*state->g_m) + state->g_s; |
3078 | 0 | rec->ts.nsecs = 1000000*state->g_ms + 1000*state->g_ns; |
3079 | |
|
3080 | 0 | rec->rec_header.packet_header.caplen = rec->rec_header.packet_header.len = state->ii; |
3081 | |
|
3082 | 0 | rec->rec_header.packet_header.pkt_encap = state->g_encap; |
3083 | | |
3084 | | /* The file-encap is WTAP_ENCAP_PER_PACKET */ |
3085 | 0 | switch(state->g_encap) { |
3086 | 0 | case WTAP_ENCAP_ETHERNET: |
3087 | 0 | rec->rec_header.packet_header.pseudo_header.eth.fcs_len = 0; |
3088 | 0 | break; |
3089 | 0 | case WTAP_ENCAP_MTP3: |
3090 | 0 | case WTAP_ENCAP_CHDLC: |
3091 | | /* no pseudo_header to fill in for these types */ |
3092 | 0 | break; |
3093 | 0 | case WTAP_ENCAP_MTP2: /* not (yet) supported */ |
3094 | | /* XXX: I don't know how to fill in the */ |
3095 | | /* pseudo_header for these types. */ |
3096 | 0 | *err = WTAP_ERR_UNSUPPORTED; |
3097 | 0 | *err_info = g_strdup("k12text: MTP2 packets not yet supported"); |
3098 | 0 | return false; |
3099 | 0 | case WTAP_ENCAP_ATM_PDUS: /* not (yet) supported */ |
3100 | | /* XXX: I don't know how to fill in the */ |
3101 | | /* pseudo_header for these types. */ |
3102 | 0 | *err = WTAP_ERR_UNSUPPORTED; |
3103 | 0 | *err_info = g_strdup("k12text: SSCOP packets not yet supported"); |
3104 | 0 | return false; |
3105 | 0 | default: |
3106 | 0 | *err = WTAP_ERR_UNSUPPORTED; |
3107 | 0 | *err_info = g_strdup("k12text: unknown encapsulation type"); |
3108 | 0 | return false; |
3109 | 0 | } |
3110 | 0 | return true; |
3111 | 0 | } |
3112 | | |
3113 | | /* Note: k12text_reset is called each time data is to be processed from */ |
3114 | | /* a file. This ensures that no "state" from a previous read is */ |
3115 | | /* used (such as the lexer look-ahead buffer, file_handle, file */ |
3116 | | /* position and so on. This allows a single lexer buffer to be */ |
3117 | | /* used even when multiple files are open simultaneously (as for */ |
3118 | | /* a file merge). */ |
3119 | | |
3120 | | static bool |
3121 | | k12text_run_scanner(k12text_state_t *state, FILE_T fh, int start_state, |
3122 | | int *err, char **err_info) |
3123 | 0 | { |
3124 | 0 | yyscan_t scanner = NULL; |
3125 | |
|
3126 | 0 | if (yylex_init(&scanner) != 0) { |
3127 | | /* errno is set if this fails */ |
3128 | 0 | *err = errno; |
3129 | 0 | *err_info = NULL; |
3130 | 0 | return false; |
3131 | 0 | } |
3132 | 0 | state->fh = fh; |
3133 | 0 | state->err = 0; |
3134 | 0 | state->err_info = NULL; |
3135 | 0 | state->start_state = start_state; |
3136 | |
|
3137 | 0 | state->g_encap = WTAP_ENCAP_UNKNOWN; |
3138 | 0 | state->ok_frame = false; |
3139 | 0 | state->is_k12text = false; |
3140 | 0 | state->at_eof = false; |
3141 | 0 | state->junk_chars = 0; |
3142 | 0 | state->error_str = NULL; |
3143 | 0 | state->file_bytes_read=0; |
3144 | 0 | state->g_h=0; |
3145 | 0 | state->g_m=0; |
3146 | 0 | state->g_s=0; |
3147 | 0 | state->g_ns=0; |
3148 | 0 | state->g_ms=0; |
3149 | 0 | state->ii=0; |
3150 | | |
3151 | | /* Associate the state with the scanner */ |
3152 | 0 | k12text_set_extra(state, scanner); |
3153 | |
|
3154 | 0 | yylex(scanner); |
3155 | 0 | yylex_destroy(scanner); |
3156 | 0 | if (state->err != 0 && state->err != WTAP_ERR_SHORT_READ) { |
3157 | | /* I/O error. */ |
3158 | 0 | *err = state->err; |
3159 | 0 | *err_info = state->err_info; |
3160 | 0 | return false; |
3161 | 0 | } |
3162 | 0 | return true; |
3163 | 0 | } |
3164 | | |
3165 | | static bool |
3166 | | k12text_read(wtap *wth, wtap_rec *rec, int *err, char ** err_info, int64_t *data_offset) |
3167 | 0 | { |
3168 | 0 | k12text_t *k12text = (k12text_t *)wth->priv; |
3169 | 0 | k12text_state_t state; |
3170 | | |
3171 | | /* |
3172 | | * We seek to the file position after the end of the previous frame |
3173 | | * processed by k12text_read(), since the lexer undoubtedly did some |
3174 | | * amount of look-ahead when processing the previous frame. |
3175 | | * |
3176 | | * We also clear out any lexer state (eg: look-ahead buffer) and |
3177 | | * init vars set by lexer. |
3178 | | */ |
3179 | |
|
3180 | 0 | if ( file_seek(wth->fh, k12text->next_frame_offset, SEEK_SET, err) == -1) { |
3181 | 0 | return false; |
3182 | 0 | } |
3183 | 0 | state.bb = (uint8_t*)g_malloc(WTAP_MAX_PACKET_SIZE_STANDARD); |
3184 | |
|
3185 | 0 | if (!k12text_run_scanner(&state, wth->fh, NEXT_FRAME, err, err_info)) { |
3186 | 0 | g_free(state.bb); |
3187 | 0 | return false; |
3188 | 0 | } |
3189 | | |
3190 | 0 | if (state.ok_frame == false) { |
3191 | 0 | if (state.at_eof) { |
3192 | 0 | *err = 0; |
3193 | 0 | *err_info = NULL; |
3194 | 0 | } else { |
3195 | 0 | *err = WTAP_ERR_BAD_FILE; |
3196 | 0 | *err_info = state.error_str; |
3197 | 0 | } |
3198 | 0 | g_free(state.bb); |
3199 | 0 | return false; |
3200 | 0 | } |
3201 | | |
3202 | 0 | *data_offset = k12text->next_frame_offset; /* file position for beginning of this frame */ |
3203 | 0 | k12text->next_frame_offset += state.file_bytes_read; /* file position after end of this frame */ |
3204 | |
|
3205 | 0 | if (!k12text_set_headers(rec, &state, err, err_info)) { |
3206 | 0 | g_free(state.bb); |
3207 | 0 | return false; |
3208 | 0 | } |
3209 | 0 | ws_buffer_append(&rec->data, state.bb, rec->rec_header.packet_header.caplen); |
3210 | |
|
3211 | 0 | g_free(state.bb); |
3212 | 0 | return true; |
3213 | 0 | } |
3214 | | |
3215 | | static bool |
3216 | | k12text_seek_read(wtap *wth, int64_t seek_off, wtap_rec *rec, int *err, char **err_info) |
3217 | 0 | { |
3218 | 0 | k12text_state_t state; |
3219 | |
|
3220 | 0 | if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) { |
3221 | 0 | return false; |
3222 | 0 | } |
3223 | 0 | state.bb = (uint8_t*)g_malloc(WTAP_MAX_PACKET_SIZE_STANDARD); |
3224 | |
|
3225 | 0 | if (!k12text_run_scanner(&state, wth->random_fh, NEXT_FRAME, err, err_info)) { |
3226 | 0 | g_free(state.bb); |
3227 | 0 | return false; |
3228 | 0 | } |
3229 | | |
3230 | 0 | if (state.ok_frame == false) { |
3231 | 0 | *err = WTAP_ERR_BAD_FILE; |
3232 | 0 | if (state.at_eof) { |
3233 | | /* What happened ? The desired frame was previously read without a problem */ |
3234 | 0 | *err_info = g_strdup("Unexpected EOF (program error ?)"); |
3235 | 0 | } else { |
3236 | 0 | *err_info = state.error_str; |
3237 | 0 | } |
3238 | 0 | g_free(state.bb); |
3239 | 0 | return false; |
3240 | 0 | } |
3241 | | |
3242 | 0 | if (!k12text_set_headers(rec, &state, err, err_info)) { |
3243 | 0 | g_free(state.bb); |
3244 | 0 | return false; |
3245 | 0 | } |
3246 | 0 | ws_buffer_append(&rec->data, state.bb, rec->rec_header.packet_header.caplen); |
3247 | |
|
3248 | 0 | g_free(state.bb); |
3249 | 0 | return true; |
3250 | 0 | } |
3251 | | |
3252 | | wtap_open_return_val |
3253 | | k12text_open(wtap *wth, int *err, char **err_info) |
3254 | 0 | { |
3255 | 0 | k12text_t *k12text; |
3256 | 0 | k12text_state_t state; |
3257 | |
|
3258 | 0 | state.bb = (uint8_t*)g_malloc(WTAP_MAX_PACKET_SIZE_STANDARD); |
3259 | 0 | if (!k12text_run_scanner(&state, wth->fh, MAGIC, err, err_info)) { |
3260 | 0 | g_free(state.bb); |
3261 | 0 | return WTAP_OPEN_ERROR; |
3262 | 0 | } |
3263 | | |
3264 | 0 | if (!state.is_k12text) { |
3265 | | /* *err might have been set to WTAP_ERR_SHORT_READ */ |
3266 | 0 | *err = 0; |
3267 | 0 | g_free(state.bb); |
3268 | 0 | return WTAP_OPEN_NOT_MINE; |
3269 | 0 | } |
3270 | | |
3271 | 0 | if ( file_seek(wth->fh, 0, SEEK_SET, err) == -1) { |
3272 | 0 | g_free(state.bb); |
3273 | 0 | return WTAP_OPEN_ERROR; |
3274 | 0 | } |
3275 | | |
3276 | 0 | k12text = g_new(k12text_t, 1); |
3277 | 0 | wth->priv = (void *)k12text; |
3278 | 0 | k12text->next_frame_offset = 0; |
3279 | 0 | wth->file_type_subtype = k12text_file_type_subtype; |
3280 | 0 | wth->file_encap = WTAP_ENCAP_PER_PACKET; |
3281 | 0 | wth->snapshot_length = 0; |
3282 | 0 | wth->subtype_read = k12text_read; |
3283 | 0 | wth->subtype_seek_read = k12text_seek_read; |
3284 | 0 | wth->file_tsprec = WTAP_TSPREC_NSEC; |
3285 | |
|
3286 | 0 | g_free(state.bb); |
3287 | 0 | return WTAP_OPEN_MINE; |
3288 | 0 | } |
3289 | | |
3290 | | |
3291 | | static const struct { int e; const char* s; } encaps[] = { |
3292 | | { WTAP_ENCAP_ETHERNET, "ETHER" }, |
3293 | | { WTAP_ENCAP_MTP2, "MTP-L2" }, |
3294 | | { WTAP_ENCAP_ATM_PDUS, "SSCOP" }, |
3295 | | { WTAP_ENCAP_MTP3, "SSCF" }, |
3296 | | { WTAP_ENCAP_CHDLC, "HDLC" }, |
3297 | | /* ... */ |
3298 | | { 0, NULL } |
3299 | | }; |
3300 | | |
3301 | | static bool |
3302 | | k12text_dump(wtap_dumper *wdh, const wtap_rec *rec, |
3303 | 0 | const uint8_t *pd, int *err, char **err_info _U_) { |
3304 | 0 | #define K12BUF_SIZE 196808 |
3305 | 0 | char *buf; |
3306 | 0 | size_t left = K12BUF_SIZE; |
3307 | 0 | size_t wl; |
3308 | 0 | char *p; |
3309 | 0 | const char* str_enc; |
3310 | 0 | unsigned i; |
3311 | 0 | unsigned ns; |
3312 | 0 | unsigned ms; |
3313 | 0 | bool ret; |
3314 | 0 | struct tm *tmp; |
3315 | | |
3316 | | /* Don't write anything bigger than we're willing to read. */ |
3317 | 0 | if (rec->rec_header.packet_header.caplen > WTAP_MAX_PACKET_SIZE_STANDARD) { |
3318 | 0 | *err = WTAP_ERR_PACKET_TOO_LARGE; |
3319 | 0 | return false; |
3320 | 0 | } |
3321 | | |
3322 | 0 | str_enc = NULL; |
3323 | 0 | for(i=0; encaps[i].s; i++) { |
3324 | 0 | if (rec->rec_header.packet_header.pkt_encap == encaps[i].e) { |
3325 | 0 | str_enc = encaps[i].s; |
3326 | 0 | break; |
3327 | 0 | } |
3328 | 0 | } |
3329 | 0 | if (str_enc == NULL) { |
3330 | | /* |
3331 | | * That encapsulation type is not supported. Fail. |
3332 | | */ |
3333 | 0 | *err = WTAP_ERR_UNWRITABLE_ENCAP; |
3334 | 0 | return false; |
3335 | 0 | } |
3336 | | |
3337 | 0 | buf = (char *)g_malloc(K12BUF_SIZE); |
3338 | 0 | p = buf; |
3339 | |
|
3340 | 0 | ms = rec->ts.nsecs / 1000000; |
3341 | 0 | ns = (rec->ts.nsecs - (1000000*ms))/1000; |
3342 | |
|
3343 | 0 | tmp = gmtime(&rec->ts.secs); |
3344 | 0 | if (tmp == NULL) |
3345 | 0 | snprintf(p, 90, "+---------+---------------+----------+\r\nXX:XX:XX,"); |
3346 | 0 | else |
3347 | 0 | strftime(p, 90, "+---------+---------------+----------+\r\n%H:%M:%S,", tmp); |
3348 | 0 | wl = strlen(p); |
3349 | 0 | p += wl; |
3350 | 0 | left -= wl; |
3351 | |
|
3352 | 0 | wl = snprintf(p, left, "%.3d,%.3d %s\r\n|0 |", ms, ns, str_enc); |
3353 | 0 | p += wl; |
3354 | 0 | left -= wl; |
3355 | |
|
3356 | 0 | for(i = 0; i < rec->rec_header.packet_header.caplen && left > 2; i++) { |
3357 | 0 | wl = snprintf(p, left, "%.2x|", pd[i]); |
3358 | 0 | p += wl; |
3359 | 0 | left -= wl; |
3360 | 0 | } |
3361 | |
|
3362 | 0 | wl = snprintf(p, left, "\r\n\r\n"); |
3363 | 0 | left -= wl; |
3364 | |
|
3365 | 0 | ret = wtap_dump_file_write(wdh, buf, K12BUF_SIZE - left, err); |
3366 | |
|
3367 | 0 | g_free(buf); |
3368 | 0 | return ret; |
3369 | 0 | } |
3370 | | |
3371 | | |
3372 | | static bool |
3373 | | k12text_dump_open(wtap_dumper *wdh, int *err _U_, char **err_info _U_) |
3374 | 0 | { |
3375 | 0 | wdh->subtype_write = k12text_dump; |
3376 | |
|
3377 | 0 | return true; |
3378 | 0 | } |
3379 | | |
3380 | | static int |
3381 | | k12text_dump_can_write_encap(int encap) |
3382 | 0 | { |
3383 | 0 | switch (encap) { |
3384 | 0 | case WTAP_ENCAP_PER_PACKET: |
3385 | 0 | case WTAP_ENCAP_ETHERNET: |
3386 | 0 | case WTAP_ENCAP_MTP3: |
3387 | 0 | case WTAP_ENCAP_CHDLC: |
3388 | 0 | return 0; |
3389 | 0 | case WTAP_ENCAP_MTP2: |
3390 | 0 | case WTAP_ENCAP_ATM_PDUS: |
3391 | 0 | default: |
3392 | 0 | return WTAP_ERR_UNWRITABLE_ENCAP; |
3393 | 0 | } |
3394 | 0 | } |
3395 | | |
3396 | | static const struct supported_block_type k12text_blocks_supported[] = { |
3397 | | /* |
3398 | | * We support packet blocks, with no comments or other options. |
3399 | | */ |
3400 | | { WTAP_BLOCK_PACKET, MULTIPLE_BLOCKS_SUPPORTED, NO_OPTIONS_SUPPORTED } |
3401 | | }; |
3402 | | |
3403 | | static const struct file_type_subtype_info k12text_info = { |
3404 | | "K12 text file", "k12text", "txt", NULL, |
3405 | | false, BLOCKS_SUPPORTED(k12text_blocks_supported), |
3406 | | k12text_dump_can_write_encap, k12text_dump_open, NULL |
3407 | | }; |
3408 | | |
3409 | | void register_k12text(void) |
3410 | 14 | { |
3411 | 14 | k12text_file_type_subtype = wtap_register_file_type_subtype(&k12text_info); |
3412 | | |
3413 | | /* |
3414 | | * Register name for backwards compatibility with the |
3415 | | * wtap_filetypes table in Lua. |
3416 | | */ |
3417 | 14 | wtap_register_backwards_compatibility_lua_name("K12TEXT", |
3418 | 14 | k12text_file_type_subtype); |
3419 | 14 | } |
3420 | | |