Coverage Report

Created: 2025-08-04 07:15

/work/build/epan/dtd_preparse.c
Line
Count
Source (jump to first uncovered line)
1
#line 2 "/work/build/epan/dtd_preparse.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/epan/dtd_preparse.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 Dtd_PreParse__create_buffer_ALREADY_DEFINED
33
#else
34
0
#define yy_create_buffer Dtd_PreParse__create_buffer
35
#endif
36
37
#ifdef yy_delete_buffer
38
#define Dtd_PreParse__delete_buffer_ALREADY_DEFINED
39
#else
40
0
#define yy_delete_buffer Dtd_PreParse__delete_buffer
41
#endif
42
43
#ifdef yy_scan_buffer
44
#define Dtd_PreParse__scan_buffer_ALREADY_DEFINED
45
#else
46
0
#define yy_scan_buffer Dtd_PreParse__scan_buffer
47
#endif
48
49
#ifdef yy_scan_string
50
#define Dtd_PreParse__scan_string_ALREADY_DEFINED
51
#else
52
#define yy_scan_string Dtd_PreParse__scan_string
53
#endif
54
55
#ifdef yy_scan_bytes
56
#define Dtd_PreParse__scan_bytes_ALREADY_DEFINED
57
#else
58
0
#define yy_scan_bytes Dtd_PreParse__scan_bytes
59
#endif
60
61
#ifdef yy_init_buffer
62
#define Dtd_PreParse__init_buffer_ALREADY_DEFINED
63
#else
64
0
#define yy_init_buffer Dtd_PreParse__init_buffer
65
#endif
66
67
#ifdef yy_flush_buffer
68
#define Dtd_PreParse__flush_buffer_ALREADY_DEFINED
69
#else
70
0
#define yy_flush_buffer Dtd_PreParse__flush_buffer
71
#endif
72
73
#ifdef yy_load_buffer_state
74
#define Dtd_PreParse__load_buffer_state_ALREADY_DEFINED
75
#else
76
0
#define yy_load_buffer_state Dtd_PreParse__load_buffer_state
77
#endif
78
79
#ifdef yy_switch_to_buffer
80
#define Dtd_PreParse__switch_to_buffer_ALREADY_DEFINED
81
#else
82
0
#define yy_switch_to_buffer Dtd_PreParse__switch_to_buffer
83
#endif
84
85
#ifdef yypush_buffer_state
86
#define Dtd_PreParse_push_buffer_state_ALREADY_DEFINED
87
#else
88
#define yypush_buffer_state Dtd_PreParse_push_buffer_state
89
#endif
90
91
#ifdef yypop_buffer_state
92
#define Dtd_PreParse_pop_buffer_state_ALREADY_DEFINED
93
#else
94
0
#define yypop_buffer_state Dtd_PreParse_pop_buffer_state
95
#endif
96
97
#ifdef yyensure_buffer_stack
98
#define Dtd_PreParse_ensure_buffer_stack_ALREADY_DEFINED
99
#else
100
0
#define yyensure_buffer_stack Dtd_PreParse_ensure_buffer_stack
101
#endif
102
103
#ifdef yylex
104
#define Dtd_PreParse_lex_ALREADY_DEFINED
105
#else
106
#define yylex Dtd_PreParse_lex
107
#endif
108
109
#ifdef yyrestart
110
#define Dtd_PreParse_restart_ALREADY_DEFINED
111
#else
112
0
#define yyrestart Dtd_PreParse_restart
113
#endif
114
115
#ifdef yylex_init
116
#define Dtd_PreParse_lex_init_ALREADY_DEFINED
117
#else
118
#define yylex_init Dtd_PreParse_lex_init
119
#endif
120
121
#ifdef yylex_init_extra
122
#define Dtd_PreParse_lex_init_extra_ALREADY_DEFINED
123
#else
124
#define yylex_init_extra Dtd_PreParse_lex_init_extra
125
#endif
126
127
#ifdef yylex_destroy
128
#define Dtd_PreParse_lex_destroy_ALREADY_DEFINED
129
#else
130
#define yylex_destroy Dtd_PreParse_lex_destroy
131
#endif
132
133
#ifdef yyget_debug
134
#define Dtd_PreParse_get_debug_ALREADY_DEFINED
135
#else
136
#define yyget_debug Dtd_PreParse_get_debug
137
#endif
138
139
#ifdef yyset_debug
140
#define Dtd_PreParse_set_debug_ALREADY_DEFINED
141
#else
142
#define yyset_debug Dtd_PreParse_set_debug
143
#endif
144
145
#ifdef yyget_extra
146
#define Dtd_PreParse_get_extra_ALREADY_DEFINED
147
#else
148
#define yyget_extra Dtd_PreParse_get_extra
149
#endif
150
151
#ifdef yyset_extra
152
#define Dtd_PreParse_set_extra_ALREADY_DEFINED
153
#else
154
0
#define yyset_extra Dtd_PreParse_set_extra
155
#endif
156
157
#ifdef yyget_in
158
#define Dtd_PreParse_get_in_ALREADY_DEFINED
159
#else
160
#define yyget_in Dtd_PreParse_get_in
161
#endif
162
163
#ifdef yyset_in
164
#define Dtd_PreParse_set_in_ALREADY_DEFINED
165
#else
166
#define yyset_in Dtd_PreParse_set_in
167
#endif
168
169
#ifdef yyget_out
170
#define Dtd_PreParse_get_out_ALREADY_DEFINED
171
#else
172
#define yyget_out Dtd_PreParse_get_out
173
#endif
174
175
#ifdef yyset_out
176
#define Dtd_PreParse_set_out_ALREADY_DEFINED
177
#else
178
#define yyset_out Dtd_PreParse_set_out
179
#endif
180
181
#ifdef yyget_leng
182
#define Dtd_PreParse_get_leng_ALREADY_DEFINED
183
#else
184
#define yyget_leng Dtd_PreParse_get_leng
185
#endif
186
187
#ifdef yyget_text
188
#define Dtd_PreParse_get_text_ALREADY_DEFINED
189
#else
190
#define yyget_text Dtd_PreParse_get_text
191
#endif
192
193
#ifdef yyget_lineno
194
#define Dtd_PreParse_get_lineno_ALREADY_DEFINED
195
#else
196
#define yyget_lineno Dtd_PreParse_get_lineno
197
#endif
198
199
#ifdef yyset_lineno
200
#define Dtd_PreParse_set_lineno_ALREADY_DEFINED
201
#else
202
#define yyset_lineno Dtd_PreParse_set_lineno
203
#endif
204
205
#ifdef yyget_column
206
#define Dtd_PreParse_get_column_ALREADY_DEFINED
207
#else
208
#define yyget_column Dtd_PreParse_get_column
209
#endif
210
211
#ifdef yyset_column
212
#define Dtd_PreParse_set_column_ALREADY_DEFINED
213
#else
214
#define yyset_column Dtd_PreParse_set_column
215
#endif
216
217
#ifdef yywrap
218
#define Dtd_PreParse_wrap_ALREADY_DEFINED
219
#else
220
0
#define yywrap Dtd_PreParse_wrap
221
#endif
222
223
/* %endif */
224
225
#ifdef yyalloc
226
#define Dtd_PreParse_alloc_ALREADY_DEFINED
227
#else
228
0
#define yyalloc Dtd_PreParse_alloc
229
#endif
230
231
#ifdef yyrealloc
232
#define Dtd_PreParse_realloc_ALREADY_DEFINED
233
#else
234
0
#define yyrealloc Dtd_PreParse_realloc
235
#endif
236
237
#ifdef yyfree
238
#define Dtd_PreParse_free_ALREADY_DEFINED
239
#else
240
0
#define yyfree Dtd_PreParse_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 Dtd_PreParse_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 21
636
0
#define YY_END_OF_BUFFER 22
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[78] =
645
    {   0,
646
        0,    0,    0,    0,    8,    8,    0,    0,    0,    0,
647
        0,    0,    0,    0,    0,    0,   22,   21,   11,   21,
648
       21,   21,    8,    8,    8,    9,    8,   13,   13,   14,
649
       21,   17,   11,   15,   16,   17,   17,   17,   20,    4,
650
        5,    4,    4,    4,    0,    2,    0,    3,    0,   13,
651
        0,   17,   17,    2,   18,    6,    0,    1,    0,    0,
652
        0,   10,    0,   17,    1,    7,    0,    0,    0,    0,
653
        0,   19,    0,    0,    0,   12,    0
654
    } ;
655
656
static const YY_CHAR yy_ec[256] =
657
    {   0,
658
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
659
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
660
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
661
        1,    2,    4,    5,    1,    1,    6,    7,    1,    1,
662
        1,    1,    1,    1,    8,    9,    1,   10,   10,   10,
663
       10,   10,   10,   10,   10,   10,   10,   11,   12,   13,
664
        1,   14,   15,    1,   16,   16,   17,   17,   18,   17,
665
       17,   17,   19,   17,   16,   16,   20,   21,   17,   17,
666
       17,   17,   22,   23,   17,   17,   17,   17,   24,   17,
667
       25,   26,   27,    1,   10,    1,   16,   16,   17,   17,
668
669
       28,   17,   17,   17,   29,   17,   16,   16,   30,   31,
670
       17,   17,   17,   17,   32,   33,   17,   17,   17,   17,
671
       34,   17,    1,    1,    1,    1,    1,    1,    1,    1,
672
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
673
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
674
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
675
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
676
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
677
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
678
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
679
680
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
681
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
682
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
683
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
684
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
685
        1,    1,    1,    1,    1
686
    } ;
687
688
static const YY_CHAR yy_meta[35] =
689
    {   0,
690
        1,    1,    1,    1,    2,    2,    1,    3,    4,    3,
691
        4,    5,    1,    1,    1,    6,    6,    6,    6,    6,
692
        6,    6,    6,    6,    1,    1,    4,    6,    6,    6,
693
        6,    6,    6,    6
694
    } ;
695
696
static const flex_int16_t yy_base[86] =
697
    {   0,
698
        0,   29,   89,   88,   58,   87,  103,    0,    5,    7,
699
      135,  164,   86,   85,  193,  222,   97,  345,  345,    0,
700
       69,    0,  345,  345,    0,   84,   64,   61,   60,  345,
701
        0,    0,    0,  345,    0,  238,   59,   79,  345,  345,
702
      345,    0,   50,   62,   61,   28,   15,  345,   37,   20,
703
        6,    0,  272,   17,  345,  345,    1,  345,   39,    1,
704
       25,  345,   25,    0,    0,  345,   26,    2,   33,   33,
705
       45,  345,   46,   69,   79,  345,  345,  306,  312,  318,
706
      324,    2,  328,  334,  338
707
    } ;
708
709
static const flex_int16_t yy_def[86] =
710
    {   0,
711
       78,   78,    2,    2,   79,   79,    2,    7,    2,    2,
712
       80,   80,    2,    2,   81,   81,   77,   77,   77,   82,
713
       77,   77,   77,   77,   82,   77,   77,   83,   83,   77,
714
       77,   84,   84,   77,   82,   84,   84,   84,   77,   77,
715
       77,   82,   77,   77,   85,   77,   77,   77,   77,   83,
716
       77,   84,   77,   84,   77,   77,   85,   77,   77,   77,
717
       77,   77,   77,   53,   84,   77,   77,   77,   77,   77,
718
       77,   77,   77,   77,   77,   77,    0,   77,   77,   77,
719
       77,   77,   77,   77,   77
720
    } ;
721
722
static const flex_int16_t yy_nxt[380] =
723
    {   0,
724
       77,   77,   19,   47,   77,   20,   20,   45,   66,   30,
725
       21,   30,   58,   77,   48,   21,   59,   59,   77,   70,
726
       21,   77,   60,   51,   21,   77,   31,   63,   31,   70,
727
       21,   19,   61,   51,   20,   20,   31,   63,   31,   21,
728
       59,   59,   61,   54,   21,   67,   77,   68,   69,   21,
729
       62,   71,   72,   21,   46,   67,   61,   68,   69,   21,
730
       24,   71,   72,   25,   25,   26,   61,   73,   27,   74,
731
       75,   75,   58,   27,   76,   56,   46,   73,   27,   74,
732
       75,   75,   27,   55,   76,   54,   77,   46,   27,   24,
733
       46,   49,   25,   25,   26,   46,   77,   27,   39,   39,
734
735
       22,   22,   27,   77,   77,   77,   77,   27,   77,   77,
736
       77,   27,   77,   77,   77,   77,   77,   27,   28,   29,
737
       29,   29,   29,   28,   29,   29,   29,   77,   77,   77,
738
       29,   29,   29,   28,   29,   29,   29,   33,   77,   34,
739
       35,   36,   77,   77,   77,   37,   77,   77,   77,   77,
740
       37,   77,   77,   77,   77,   37,   77,   77,   77,   37,
741
       38,   77,   77,   77,   77,   37,   33,   77,   34,   35,
742
       36,   77,   77,   77,   37,   77,   77,   77,   77,   37,
743
       77,   77,   77,   77,   37,   77,   77,   77,   37,   38,
744
       77,   77,   77,   77,   37,   41,   77,   77,   42,   42,
745
746
       77,   77,   77,   43,   77,   77,   77,   44,   43,   77,
747
       77,   77,   77,   43,   77,   77,   77,   43,   77,   77,
748
       77,   77,   77,   43,   41,   77,   77,   42,   42,   77,
749
       77,   77,   43,   77,   77,   77,   44,   43,   77,   77,
750
       77,   77,   43,   77,   77,   77,   43,   77,   77,   77,
751
       77,   77,   43,   53,   53,   53,   53,   53,   53,   53,
752
       53,   53,   77,   77,   77,   53,   53,   53,   53,   53,
753
       53,   53,   52,   52,   52,   52,   77,   77,   52,   64,
754
       52,   64,   52,   65,   52,   52,   52,   64,   64,   64,
755
       64,   64,   64,   64,   64,   64,   52,   52,   52,   64,
756
757
       64,   64,   64,   64,   64,   64,   18,   18,   18,   18,
758
       18,   18,   23,   23,   23,   23,   23,   23,   32,   32,
759
       32,   32,   32,   32,   40,   40,   40,   40,   40,   40,
760
       50,   50,   77,   50,   52,   77,   52,   52,   52,   52,
761
       57,   77,   57,   57,   17,   77,   77,   77,   77,   77,
762
       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
763
       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
764
       77,   77,   77,   77,   77,   77,   77,   77,   77
765
    } ;
766
767
static const flex_int16_t yy_chk[380] =
768
    {   0,
769
        0,    0,    1,   22,    0,    1,    1,   82,   60,    9,
770
        1,   10,   57,    0,   22,    1,   47,   47,    0,   68,
771
        1,    0,   47,   31,    1,    0,    9,   51,   10,   68,
772
        1,    2,   47,   31,    2,    2,    9,   51,   10,    2,
773
       59,   59,   47,   54,    2,   61,   50,   63,   67,    2,
774
       49,   69,   70,    2,   46,   61,   59,   63,   67,    2,
775
        5,   69,   70,    5,    5,    5,   59,   71,    5,   73,
776
       74,   74,   45,    5,   74,   44,   43,   71,    5,   73,
777
       75,   75,    5,   38,   75,   37,   29,   28,    5,    6,
778
       27,   26,    6,    6,    6,   21,   17,    6,   14,   13,
779
780
        4,    3,    6,    0,    0,    0,    0,    6,    0,    0,
781
        0,    6,    0,    0,    0,    0,    0,    6,    7,    7,
782
        7,    7,    7,    7,    7,    7,    7,    0,    0,    0,
783
        7,    7,    7,    7,    7,    7,    7,   11,    0,   11,
784
       11,   11,    0,    0,    0,   11,    0,    0,    0,    0,
785
       11,    0,    0,    0,    0,   11,    0,    0,    0,   11,
786
       11,    0,    0,    0,    0,   11,   12,    0,   12,   12,
787
       12,    0,    0,    0,   12,    0,    0,    0,    0,   12,
788
        0,    0,    0,    0,   12,    0,    0,    0,   12,   12,
789
        0,    0,    0,    0,   12,   15,    0,    0,   15,   15,
790
791
        0,    0,    0,   15,    0,    0,    0,   15,   15,    0,
792
        0,    0,    0,   15,    0,    0,    0,   15,    0,    0,
793
        0,    0,    0,   15,   16,    0,    0,   16,   16,    0,
794
        0,    0,   16,    0,    0,    0,   16,   16,    0,    0,
795
        0,    0,   16,    0,    0,    0,   16,    0,    0,    0,
796
        0,    0,   16,   36,   36,   36,   36,   36,   36,   36,
797
       36,   36,    0,    0,    0,   36,   36,   36,   36,   36,
798
       36,   36,   53,   53,   53,   53,    0,    0,   53,   53,
799
       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
800
       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
801
802
       53,   53,   53,   53,   53,   53,   78,   78,   78,   78,
803
       78,   78,   79,   79,   79,   79,   79,   79,   80,   80,
804
       80,   80,   80,   80,   81,   81,   81,   81,   81,   81,
805
       83,   83,    0,   83,   84,    0,   84,   84,   84,   84,
806
       85,    0,   85,   85,   77,   77,   77,   77,   77,   77,
807
       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
808
       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
809
       77,   77,   77,   77,   77,   77,   77,   77,   77
810
    } ;
811
812
static const flex_int16_t yy_rule_linenum[21] =
813
    {   0,
814
      163,  165,  167,  168,  169,  170,  172,  173,  174,  175,
815
      177,  183,  184,  185,  186,  187,  188,  189,  190,  194
816
    } ;
817
818
/* The intent behind this definition is that it'll catch
819
 * any uses of REJECT which flex missed.
820
 */
821
#define REJECT reject_used_but_not_detected
822
#define yymore() yymore_used_but_not_detected
823
0
#define YY_MORE_ADJ 0
824
#define YY_RESTORE_YY_MORE_OFFSET
825
#line 1 "/src/wireshark/epan/dtd_preparse.l"
826
827
/*
828
 * We want a reentrant scanner.
829
 */
830
/*
831
 * We don't use input, so don't generate code for it.
832
 */
833
#define YY_NO_INPUT 1
834
/*
835
 * We don't use unput, so don't generate code for it.
836
 */
837
/*
838
 * We don't read interactively from the terminal.
839
 */
840
/*
841
 * We want to stop processing when we get to the end of the input.
842
 */
843
/*
844
 * The type for the state we keep for a scanner.
845
 */
846
/*
847
 * The language we're scanning is case-insensitive.
848
 */
849
/*
850
 * Prefix scanner routines with "Dtd_PreParse_" rather than "yy", so this
851
 * scanner can coexist with other scanners.
852
 */
853
/*
854
 * We have to override the memory allocators so that we don't get
855
 * "unused argument" warnings from the yyscanner argument (which
856
 * we don't use, as we have a global memory allocator).
857
 *
858
 * We provide, as macros, our own versions of the routines generated by Flex,
859
 * which just call malloc()/realloc()/free() (as the Flex versions do),
860
 * discarding the extra argument.
861
 */
862
#line 62 "/src/wireshark/epan/dtd_preparse.l"
863
  /*
864
   * dtd_preparse.l
865
   *
866
   * an XML dissector for wireshark
867
   *
868
   * DTD Preparser -  import a dtd file into a GString
869
   *        including files, removing comments
870
   *                  and resolving %entities;
871
   *
872
   * Copyright 2004, Luis E. Garcia Ontanon <luis@ontanon.org>
873
   *
874
   * Wireshark - Network traffic analyzer
875
   * By Gerald Combs <gerald@wireshark.org>
876
   * Copyright 1998 Gerald Combs
877
   *
878
   * SPDX-License-Identifier: GPL-2.0-or-later
879
   */
880
881
#include <glib.h>
882
#include <string.h>
883
#include <errno.h>
884
#include <stdio.h>
885
#include "dtd.h"
886
#include <wsutil/file_util.h>
887
888
/*
889
 * Disable diagnostics in the code generated by Flex.
890
 */
891
DIAG_OFF_FLEX()
892
893
0
#define ECHO g_string_append(yyextra->current,yytext);
894
895
struct _dtd_preparse_scanner_state {
896
  char* filename;
897
  unsigned linenum;
898
899
  GString* error;
900
901
  GHashTable* entities;
902
  GString* current;
903
  GString* output;
904
  char* entity_name;
905
};
906
907
static const char* replace_entity(Dtd_PreParse_scanner_state_t* state, char* s);
908
909
0
#define YY_USER_INIT { \
910
0
  BEGIN OUTSIDE; \
911
0
}
912
913
/*
914
 * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
915
 */
916
#ifdef _WIN32
917
#define YY_NO_UNISTD_H
918
#endif
919
920
/*
921
 * Sleazy hack to suppress compiler warnings in yy_fatal_error().
922
 */
923
0
#define YY_EXIT_FAILURE ((void)yyscanner, 2)
924
925
/*
926
 * Macros for the allocators, to discard the extra argument.
927
 */
928
0
#define Dtd_PreParse_alloc(size, yyscanner)   (void *)malloc(size)
929
0
#define Dtd_PreParse_realloc(ptr, size, yyscanner)  (void *)realloc((char *)(ptr), (size))
930
0
#define Dtd_PreParse_free(ptr, yyscanner)   free((char *)ptr)
931
932
#line 933 "/work/build/epan/dtd_preparse.c"
933
934
#line 935 "/work/build/epan/dtd_preparse.c"
935
936
#define INITIAL 0
937
0
#define OUTSIDE 1
938
0
#define IN_COMMENT 2
939
0
#define IN_ENTITY 3
940
0
#define NAMED_ENTITY 4
941
0
#define IN_QUOTE 5
942
0
#define ENTITY_DONE 6
943
0
#define XMLPI 7
944
945
#ifndef YY_NO_UNISTD_H
946
/* Special case for "unistd.h", since it is non-ANSI. We include it way
947
 * down here because we want the user's section 1 to have been scanned first.
948
 * The user has a chance to override it with an option.
949
 */
950
/* %if-c-only */
951
#include <unistd.h>
952
/* %endif */
953
/* %if-c++-only */
954
/* %endif */
955
#endif
956
957
#define YY_EXTRA_TYPE Dtd_PreParse_scanner_state_t *
958
959
/* %if-c-only Reentrant structure and macros (non-C++). */
960
/* %if-reentrant */
961
962
/* Holds the entire state of the reentrant scanner. */
963
struct yyguts_t
964
    {
965
966
    /* User-defined. Not touched by flex. */
967
    YY_EXTRA_TYPE yyextra_r;
968
969
    /* The rest are the same as the globals declared in the non-reentrant scanner. */
970
    FILE *yyin_r, *yyout_r;
971
    size_t yy_buffer_stack_top; /**< index of top of stack. */
972
    size_t yy_buffer_stack_max; /**< capacity of stack. */
973
    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
974
    char yy_hold_char;
975
    int yy_n_chars;
976
    int yyleng_r;
977
    char *yy_c_buf_p;
978
    int yy_init;
979
    int yy_start;
980
    int yy_did_buffer_switch_on_eof;
981
    int yy_start_stack_ptr;
982
    int yy_start_stack_depth;
983
    int *yy_start_stack;
984
    yy_state_type yy_last_accepting_state;
985
    char* yy_last_accepting_cpos;
986
987
    int yylineno_r;
988
    int yy_flex_debug_r;
989
990
    char *yytext_r;
991
    int yy_more_flag;
992
    int yy_more_len;
993
994
    }; /* end struct yyguts_t */
995
996
/* %if-c-only */
997
998
static int yy_init_globals ( yyscan_t yyscanner );
999
1000
/* %endif */
1001
1002
/* %if-reentrant */
1003
1004
int yylex_init (yyscan_t* scanner);
1005
1006
int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
1007
1008
/* %endif */
1009
1010
/* %endif End reentrant structures and macros. */
1011
1012
/* Accessor methods to globals.
1013
   These are made visible to non-reentrant scanners for convenience. */
1014
1015
int yylex_destroy ( yyscan_t yyscanner );
1016
1017
int yyget_debug ( yyscan_t yyscanner );
1018
1019
void yyset_debug ( int debug_flag , yyscan_t yyscanner );
1020
1021
YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
1022
1023
void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
1024
1025
FILE *yyget_in ( yyscan_t yyscanner );
1026
1027
void yyset_in  ( FILE * _in_str , yyscan_t yyscanner );
1028
1029
FILE *yyget_out ( yyscan_t yyscanner );
1030
1031
void yyset_out  ( FILE * _out_str , yyscan_t yyscanner );
1032
1033
      int yyget_leng ( yyscan_t yyscanner );
1034
1035
char *yyget_text ( yyscan_t yyscanner );
1036
1037
int yyget_lineno ( yyscan_t yyscanner );
1038
1039
void yyset_lineno ( int _line_number , yyscan_t yyscanner );
1040
1041
int yyget_column  ( yyscan_t yyscanner );
1042
1043
void yyset_column ( int _column_no , yyscan_t yyscanner );
1044
1045
/* %if-bison-bridge */
1046
/* %endif */
1047
1048
/* Macros after this point can all be overridden by user definitions in
1049
 * section 1.
1050
 */
1051
1052
#ifndef YY_SKIP_YYWRAP
1053
#ifdef __cplusplus
1054
extern "C" int yywrap ( yyscan_t yyscanner );
1055
#else
1056
extern int yywrap ( yyscan_t yyscanner );
1057
#endif
1058
#endif
1059
1060
/* %not-for-header */
1061
#ifndef YY_NO_UNPUT
1062
    
1063
#endif
1064
/* %ok-for-header */
1065
1066
/* %endif */
1067
1068
#ifndef yytext_ptr
1069
static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
1070
#endif
1071
1072
#ifdef YY_NEED_STRLEN
1073
static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
1074
#endif
1075
1076
#ifndef YY_NO_INPUT
1077
/* %if-c-only Standard (non-C++) definition */
1078
/* %not-for-header */
1079
#ifdef __cplusplus
1080
static int yyinput ( yyscan_t yyscanner );
1081
#else
1082
static int input ( yyscan_t yyscanner );
1083
#endif
1084
/* %ok-for-header */
1085
1086
/* %endif */
1087
#endif
1088
1089
/* %if-c-only */
1090
1091
/* %endif */
1092
1093
/* Amount of stuff to slurp up with each read. */
1094
#ifndef YY_READ_BUF_SIZE
1095
#ifdef __ia64__
1096
/* On IA-64, the buffer size is 16k, not 8k */
1097
#define YY_READ_BUF_SIZE 16384
1098
#else
1099
0
#define YY_READ_BUF_SIZE 8192
1100
#endif /* __ia64__ */
1101
#endif
1102
1103
/* Copy whatever the last rule matched to the standard output. */
1104
#ifndef ECHO
1105
/* %if-c-only Standard (non-C++) definition */
1106
/* This used to be an fputs(), but since the string might contain NUL's,
1107
 * we now use fwrite().
1108
 */
1109
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1110
/* %endif */
1111
/* %if-c++-only C++ definition */
1112
/* %endif */
1113
#endif
1114
1115
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1116
 * is returned in "result".
1117
 */
1118
#ifndef YY_INPUT
1119
#define YY_INPUT(buf,result,max_size) \
1120
/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
1121
0
  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1122
0
    { \
1123
0
    int c = '*'; \
1124
0
    int n; \
1125
0
    for ( n = 0; n < max_size && \
1126
0
           (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1127
0
      buf[n] = (char) c; \
1128
0
    if ( c == '\n' ) \
1129
0
      buf[n++] = (char) c; \
1130
0
    if ( c == EOF && ferror( yyin ) ) \
1131
0
      YY_FATAL_ERROR( "input in flex scanner failed" ); \
1132
0
    result = n; \
1133
0
    } \
1134
0
  else \
1135
0
    { \
1136
0
    errno=0; \
1137
0
    while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
1138
0
      { \
1139
0
      if( errno != EINTR) \
1140
0
        { \
1141
0
        YY_FATAL_ERROR( "input in flex scanner failed" ); \
1142
0
        break; \
1143
0
        } \
1144
0
      errno=0; \
1145
0
      clearerr(yyin); \
1146
0
      } \
1147
0
    }\
1148
\
1149
/* %if-c++-only C++ definition \ */\
1150
/* %endif */
1151
1152
#endif
1153
1154
/* No semi-colon after return; correct usage is to write "yyterminate();" -
1155
 * we don't want an extra ';' after the "return" because that will cause
1156
 * some compilers to complain about unreachable statements.
1157
 */
1158
#ifndef yyterminate
1159
0
#define yyterminate() return YY_NULL
1160
#endif
1161
1162
/* Number of entries by which start-condition stack grows. */
1163
#ifndef YY_START_STACK_INCR
1164
#define YY_START_STACK_INCR 25
1165
#endif
1166
1167
/* Report a fatal error. */
1168
#ifndef YY_FATAL_ERROR
1169
/* %if-c-only */
1170
0
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1171
/* %endif */
1172
/* %if-c++-only */
1173
/* %endif */
1174
#endif
1175
1176
/* %if-tables-serialization structures and prototypes */
1177
/* %not-for-header */
1178
/* %ok-for-header */
1179
1180
/* %not-for-header */
1181
/* %tables-yydmap generated elements */
1182
/* %endif */
1183
/* end tables serialization structures and prototypes */
1184
1185
/* %ok-for-header */
1186
1187
/* Default declaration of generated scanner - a define so the user can
1188
 * easily add parameters.
1189
 */
1190
#ifndef YY_DECL
1191
#define YY_DECL_IS_OURS 1
1192
/* %if-c-only Standard (non-C++) definition */
1193
1194
extern int yylex (yyscan_t yyscanner);
1195
1196
#define YY_DECL int yylex (yyscan_t yyscanner)
1197
/* %endif */
1198
/* %if-c++-only C++ definition */
1199
/* %endif */
1200
#endif /* !YY_DECL */
1201
1202
/* Code executed at the beginning of each rule, after yytext and yyleng
1203
 * have been set up.
1204
 */
1205
#ifndef YY_USER_ACTION
1206
#define YY_USER_ACTION
1207
#endif
1208
1209
/* Code executed at the end of each rule. */
1210
#ifndef YY_BREAK
1211
0
#define YY_BREAK /*LINTED*/break;
1212
#endif
1213
1214
/* %% [6.0] YY_RULE_SETUP definition goes here */
1215
#define YY_RULE_SETUP \
1216
  YY_USER_ACTION
1217
1218
/* %not-for-header */
1219
/** The main scanner function which does all the work.
1220
 */
1221
YY_DECL
1222
0
{
1223
0
  yy_state_type yy_current_state;
1224
0
  char *yy_cp, *yy_bp;
1225
0
  int yy_act;
1226
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1227
1228
0
  if ( !yyg->yy_init )
1229
0
    {
1230
0
    yyg->yy_init = 1;
1231
1232
0
#ifdef YY_USER_INIT
1233
0
    YY_USER_INIT;
1234
0
#endif
1235
1236
0
    if ( ! yyg->yy_start )
1237
0
      yyg->yy_start = 1; /* first start state */
1238
1239
0
    if ( ! yyin )
1240
/* %if-c-only */
1241
0
      yyin = stdin;
1242
/* %endif */
1243
/* %if-c++-only */
1244
/* %endif */
1245
1246
0
    if ( ! yyout )
1247
/* %if-c-only */
1248
0
      yyout = stdout;
1249
/* %endif */
1250
/* %if-c++-only */
1251
/* %endif */
1252
1253
0
    if ( ! YY_CURRENT_BUFFER ) {
1254
0
      yyensure_buffer_stack (yyscanner);
1255
0
      YY_CURRENT_BUFFER_LVALUE =
1256
0
        yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
1257
0
    }
1258
1259
0
    yy_load_buffer_state( yyscanner );
1260
0
    }
1261
1262
0
  {
1263
/* %% [7.0] user's declarations go here */
1264
0
#line 160 "/src/wireshark/epan/dtd_preparse.l"
1265
1266
1267
1268
0
#line 1269 "/work/build/epan/dtd_preparse.c"
1269
1270
0
  while ( /*CONSTCOND*/1 )    /* loops until end-of-file is reached */
1271
0
    {
1272
/* %% [8.0] yymore()-related code goes here */
1273
0
    yy_cp = yyg->yy_c_buf_p;
1274
1275
    /* Support of yytext. */
1276
0
    *yy_cp = yyg->yy_hold_char;
1277
1278
    /* yy_bp points to the position in yy_ch_buf of the start of
1279
     * the current run.
1280
     */
1281
0
    yy_bp = yy_cp;
1282
1283
/* %% [9.0] code to set up and find next match goes here */
1284
0
    yy_current_state = yyg->yy_start;
1285
0
yy_match:
1286
0
    do
1287
0
      {
1288
0
      YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1289
0
      if ( yy_accept[yy_current_state] )
1290
0
        {
1291
0
        yyg->yy_last_accepting_state = yy_current_state;
1292
0
        yyg->yy_last_accepting_cpos = yy_cp;
1293
0
        }
1294
0
      while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1295
0
        {
1296
0
        yy_current_state = (int) yy_def[yy_current_state];
1297
0
        if ( yy_current_state >= 78 )
1298
0
          yy_c = yy_meta[yy_c];
1299
0
        }
1300
0
      yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1301
0
      ++yy_cp;
1302
0
      }
1303
0
    while ( yy_current_state != 77 );
1304
0
    yy_cp = yyg->yy_last_accepting_cpos;
1305
0
    yy_current_state = yyg->yy_last_accepting_state;
1306
1307
0
yy_find_action:
1308
/* %% [10.0] code to find the action number goes here */
1309
0
    yy_act = yy_accept[yy_current_state];
1310
1311
0
    YY_DO_BEFORE_ACTION;
1312
1313
/* %% [11.0] code for yylineno update goes here */
1314
1315
0
do_action:  /* This label is used only to access EOF actions. */
1316
1317
/* %% [12.0] debug code goes here */
1318
0
    if ( yy_flex_debug )
1319
0
      {
1320
0
      if ( yy_act == 0 )
1321
0
        fprintf( stderr, "--scanner backing up\n" );
1322
0
      else if ( yy_act < 21 )
1323
0
        fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
1324
0
                 (long)yy_rule_linenum[yy_act], yytext );
1325
0
      else if ( yy_act == 21 )
1326
0
        fprintf( stderr, "--accepting default rule (\"%s\")\n",
1327
0
                 yytext );
1328
0
      else if ( yy_act == 22 )
1329
0
        fprintf( stderr, "--(end of buffer or a NUL)\n" );
1330
0
      else
1331
0
        fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1332
0
      }
1333
1334
0
    switch ( yy_act )
1335
0
  { /* beginning of action switch */
1336
/* %% [13.0] actions go here */
1337
0
      case 0: /* must back up */
1338
      /* undo the effects of YY_DO_BEFORE_ACTION */
1339
0
      *yy_cp = yyg->yy_hold_char;
1340
0
      yy_cp = yyg->yy_last_accepting_cpos;
1341
0
      yy_current_state = yyg->yy_last_accepting_state;
1342
0
      goto yy_find_action;
1343
1344
0
case 1:
1345
0
YY_RULE_SETUP
1346
0
#line 163 "/src/wireshark/epan/dtd_preparse.l"
1347
0
if (yyextra->current) g_string_append_printf(yyextra->current,"%s\n%s\n",replace_entity(yyextra, yytext),dtd_location(yyextra));
1348
0
  YY_BREAK
1349
0
case 2:
1350
0
YY_RULE_SETUP
1351
0
#line 165 "/src/wireshark/epan/dtd_preparse.l"
1352
0
if (yyextra->current) g_string_append(yyextra->current," ");
1353
0
  YY_BREAK
1354
0
case 3:
1355
0
YY_RULE_SETUP
1356
0
#line 167 "/src/wireshark/epan/dtd_preparse.l"
1357
0
{ g_string_append(yyextra->current,yytext); BEGIN XMLPI; }
1358
0
  YY_BREAK
1359
0
case 4:
1360
0
YY_RULE_SETUP
1361
0
#line 168 "/src/wireshark/epan/dtd_preparse.l"
1362
0
{ g_string_append(yyextra->current,yytext); }
1363
0
  YY_BREAK
1364
0
case 5:
1365
/* rule 5 can match eol */
1366
0
YY_RULE_SETUP
1367
0
#line 169 "/src/wireshark/epan/dtd_preparse.l"
1368
0
{ g_string_append(yyextra->current,yytext); }
1369
0
  YY_BREAK
1370
0
case 6:
1371
0
YY_RULE_SETUP
1372
0
#line 170 "/src/wireshark/epan/dtd_preparse.l"
1373
0
{ g_string_append(yyextra->current,yytext); BEGIN OUTSIDE; }
1374
0
  YY_BREAK
1375
0
case 7:
1376
0
YY_RULE_SETUP
1377
0
#line 172 "/src/wireshark/epan/dtd_preparse.l"
1378
0
{ yyextra->current = NULL; BEGIN IN_COMMENT; }
1379
0
  YY_BREAK
1380
0
case 8:
1381
/* rule 8 can match eol */
1382
0
#line 174 "/src/wireshark/epan/dtd_preparse.l"
1383
0
case 9:
1384
/* rule 9 can match eol */
1385
0
YY_RULE_SETUP
1386
0
#line 174 "/src/wireshark/epan/dtd_preparse.l"
1387
0
;
1388
0
  YY_BREAK
1389
0
case 10:
1390
0
YY_RULE_SETUP
1391
0
#line 175 "/src/wireshark/epan/dtd_preparse.l"
1392
0
{ yyextra->current = yyextra->output; BEGIN OUTSIDE; }
1393
0
  YY_BREAK
1394
0
case 11:
1395
/* rule 11 can match eol */
1396
0
YY_RULE_SETUP
1397
0
#line 177 "/src/wireshark/epan/dtd_preparse.l"
1398
0
{
1399
0
  yyextra->linenum++;
1400
0
  if (yyextra->current) g_string_append_printf(yyextra->current,"%s\n",dtd_location(yyextra));
1401
0
}
1402
0
  YY_BREAK
1403
0
case 12:
1404
/* rule 12 can match eol */
1405
0
YY_RULE_SETUP
1406
0
#line 183 "/src/wireshark/epan/dtd_preparse.l"
1407
0
{ BEGIN IN_ENTITY; }
1408
0
  YY_BREAK
1409
0
case 13:
1410
0
YY_RULE_SETUP
1411
0
#line 184 "/src/wireshark/epan/dtd_preparse.l"
1412
0
{ yyextra->entity_name = ws_strdup_printf("%%%s;",yytext); BEGIN NAMED_ENTITY; }
1413
0
  YY_BREAK
1414
0
case 14:
1415
0
YY_RULE_SETUP
1416
0
#line 185 "/src/wireshark/epan/dtd_preparse.l"
1417
0
{ yyextra->current = g_string_new(dtd_location(yyextra)); BEGIN IN_QUOTE; }
1418
0
  YY_BREAK
1419
0
case 15:
1420
0
YY_RULE_SETUP
1421
0
#line 186 "/src/wireshark/epan/dtd_preparse.l"
1422
0
{ g_hash_table_insert(yyextra->entities,yyextra->entity_name,yyextra->current);  BEGIN ENTITY_DONE; }
1423
0
  YY_BREAK
1424
0
case 16:
1425
0
#line 188 "/src/wireshark/epan/dtd_preparse.l"
1426
0
case 17:
1427
/* rule 17 can match eol */
1428
0
#line 189 "/src/wireshark/epan/dtd_preparse.l"
1429
0
case 18:
1430
/* rule 18 can match eol */
1431
0
YY_RULE_SETUP
1432
0
#line 189 "/src/wireshark/epan/dtd_preparse.l"
1433
0
g_string_append(yyextra->current,yytext);
1434
0
  YY_BREAK
1435
0
case 19:
1436
0
YY_RULE_SETUP
1437
0
#line 190 "/src/wireshark/epan/dtd_preparse.l"
1438
0
{
1439
0
  g_string_append_printf(yyextra->error,"at %s:%u: file inclusion is not supported!", yyextra->filename, yyextra->linenum);
1440
0
  yyterminate();
1441
0
}
1442
0
  YY_BREAK
1443
0
case 20:
1444
0
YY_RULE_SETUP
1445
0
#line 194 "/src/wireshark/epan/dtd_preparse.l"
1446
0
{ yyextra->current = yyextra->output; g_string_append(yyextra->current,"\n"); BEGIN OUTSIDE; }
1447
0
  YY_BREAK
1448
0
case 21:
1449
0
YY_RULE_SETUP
1450
0
#line 196 "/src/wireshark/epan/dtd_preparse.l"
1451
0
ECHO;
1452
0
  YY_BREAK
1453
0
#line 1454 "/work/build/epan/dtd_preparse.c"
1454
0
case YY_STATE_EOF(INITIAL):
1455
0
case YY_STATE_EOF(OUTSIDE):
1456
0
case YY_STATE_EOF(IN_COMMENT):
1457
0
case YY_STATE_EOF(IN_ENTITY):
1458
0
case YY_STATE_EOF(NAMED_ENTITY):
1459
0
case YY_STATE_EOF(IN_QUOTE):
1460
0
case YY_STATE_EOF(ENTITY_DONE):
1461
0
case YY_STATE_EOF(XMLPI):
1462
0
  yyterminate();
1463
1464
0
  case YY_END_OF_BUFFER:
1465
0
    {
1466
    /* Amount of text matched not including the EOB char. */
1467
0
    int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1468
1469
    /* Undo the effects of YY_DO_BEFORE_ACTION. */
1470
0
    *yy_cp = yyg->yy_hold_char;
1471
0
    YY_RESTORE_YY_MORE_OFFSET
1472
1473
0
    if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1474
0
      {
1475
      /* We're scanning a new file or input source.  It's
1476
       * possible that this happened because the user
1477
       * just pointed yyin at a new source and called
1478
       * yylex().  If so, then we have to assure
1479
       * consistency between YY_CURRENT_BUFFER and our
1480
       * globals.  Here is the right place to do so, because
1481
       * this is the first action (other than possibly a
1482
       * back-up) that will match for the new input source.
1483
       */
1484
0
      yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1485
/* %if-c-only */
1486
0
      YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1487
/* %endif */
1488
/* %if-c++-only */
1489
/* %endif */
1490
0
      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1491
0
      }
1492
1493
    /* Note that here we test for yy_c_buf_p "<=" to the position
1494
     * of the first EOB in the buffer, since yy_c_buf_p will
1495
     * already have been incremented past the NUL character
1496
     * (since all states make transitions on EOB to the
1497
     * end-of-buffer state).  Contrast this with the test
1498
     * in input().
1499
     */
1500
0
    if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1501
0
      { /* This was really a NUL. */
1502
0
      yy_state_type yy_next_state;
1503
1504
0
      yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1505
1506
0
      yy_current_state = yy_get_previous_state( yyscanner );
1507
1508
      /* Okay, we're now positioned to make the NUL
1509
       * transition.  We couldn't have
1510
       * yy_get_previous_state() go ahead and do it
1511
       * for us because it doesn't know how to deal
1512
       * with the possibility of jamming (and we don't
1513
       * want to build jamming into it because then it
1514
       * will run more slowly).
1515
       */
1516
1517
0
      yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1518
1519
0
      yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1520
1521
0
      if ( yy_next_state )
1522
0
        {
1523
        /* Consume the NUL. */
1524
0
        yy_cp = ++yyg->yy_c_buf_p;
1525
0
        yy_current_state = yy_next_state;
1526
0
        goto yy_match;
1527
0
        }
1528
1529
0
      else
1530
0
        {
1531
/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
1532
0
        yy_cp = yyg->yy_last_accepting_cpos;
1533
0
        yy_current_state = yyg->yy_last_accepting_state;
1534
0
        goto yy_find_action;
1535
0
        }
1536
0
      }
1537
1538
0
    else switch ( yy_get_next_buffer( yyscanner ) )
1539
0
      {
1540
0
      case EOB_ACT_END_OF_FILE:
1541
0
        {
1542
0
        yyg->yy_did_buffer_switch_on_eof = 0;
1543
1544
0
        if ( yywrap( yyscanner ) )
1545
0
          {
1546
          /* Note: because we've taken care in
1547
           * yy_get_next_buffer() to have set up
1548
           * yytext, we can now set up
1549
           * yy_c_buf_p so that if some total
1550
           * hoser (like flex itself) wants to
1551
           * call the scanner after we return the
1552
           * YY_NULL, it'll still work - another
1553
           * YY_NULL will get returned.
1554
           */
1555
0
          yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1556
1557
0
          yy_act = YY_STATE_EOF(YY_START);
1558
0
          goto do_action;
1559
0
          }
1560
1561
0
        else
1562
0
          {
1563
0
          if ( ! yyg->yy_did_buffer_switch_on_eof )
1564
0
            YY_NEW_FILE;
1565
0
          }
1566
0
        break;
1567
0
        }
1568
1569
0
      case EOB_ACT_CONTINUE_SCAN:
1570
0
        yyg->yy_c_buf_p =
1571
0
          yyg->yytext_ptr + yy_amount_of_matched_text;
1572
1573
0
        yy_current_state = yy_get_previous_state( yyscanner );
1574
1575
0
        yy_cp = yyg->yy_c_buf_p;
1576
0
        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1577
0
        goto yy_match;
1578
1579
0
      case EOB_ACT_LAST_MATCH:
1580
0
        yyg->yy_c_buf_p =
1581
0
        &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1582
1583
0
        yy_current_state = yy_get_previous_state( yyscanner );
1584
1585
0
        yy_cp = yyg->yy_c_buf_p;
1586
0
        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1587
0
        goto yy_find_action;
1588
0
      }
1589
0
    break;
1590
0
    }
1591
1592
0
  default:
1593
0
    YY_FATAL_ERROR(
1594
0
      "fatal flex scanner internal error--no action found" );
1595
0
  } /* end of action switch */
1596
0
    } /* end of scanning one token */
1597
0
  } /* end of user's declarations */
1598
0
} /* end of yylex */
1599
/* %ok-for-header */
1600
1601
/* %if-c++-only */
1602
/* %not-for-header */
1603
/* %ok-for-header */
1604
1605
/* %endif */
1606
1607
/* yy_get_next_buffer - try to read in a new buffer
1608
 *
1609
 * Returns a code representing an action:
1610
 *  EOB_ACT_LAST_MATCH -
1611
 *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1612
 *  EOB_ACT_END_OF_FILE - end of file
1613
 */
1614
/* %if-c-only */
1615
static int yy_get_next_buffer (yyscan_t yyscanner)
1616
/* %endif */
1617
/* %if-c++-only */
1618
/* %endif */
1619
0
{
1620
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1621
0
  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1622
0
  char *source = yyg->yytext_ptr;
1623
0
  int number_to_move, i;
1624
0
  int ret_val;
1625
1626
0
  if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1627
0
    YY_FATAL_ERROR(
1628
0
    "fatal flex scanner internal error--end of buffer missed" );
1629
1630
0
  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1631
0
    { /* Don't try to fill the buffer, so this is an EOF. */
1632
0
    if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1633
0
      {
1634
      /* We matched a single character, the EOB, so
1635
       * treat this as a final EOF.
1636
       */
1637
0
      return EOB_ACT_END_OF_FILE;
1638
0
      }
1639
1640
0
    else
1641
0
      {
1642
      /* We matched some text prior to the EOB, first
1643
       * process it.
1644
       */
1645
0
      return EOB_ACT_LAST_MATCH;
1646
0
      }
1647
0
    }
1648
1649
  /* Try to read more data. */
1650
1651
  /* First move last chars to start of buffer. */
1652
0
  number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1653
1654
0
  for ( i = 0; i < number_to_move; ++i )
1655
0
    *(dest++) = *(source++);
1656
1657
0
  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1658
    /* don't do the read, it's not guaranteed to return an EOF,
1659
     * just force an EOF
1660
     */
1661
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1662
1663
0
  else
1664
0
    {
1665
0
      int num_to_read =
1666
0
      YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1667
1668
0
    while ( num_to_read <= 0 )
1669
0
      { /* Not enough room in the buffer - grow it. */
1670
1671
      /* just a shorter name for the current buffer */
1672
0
      YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1673
1674
0
      int yy_c_buf_p_offset =
1675
0
        (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1676
1677
0
      if ( b->yy_is_our_buffer )
1678
0
        {
1679
0
        int new_size = b->yy_buf_size * 2;
1680
1681
0
        if ( new_size <= 0 )
1682
0
          b->yy_buf_size += b->yy_buf_size / 8;
1683
0
        else
1684
0
          b->yy_buf_size *= 2;
1685
1686
0
        b->yy_ch_buf = (char *)
1687
          /* Include room in for 2 EOB chars. */
1688
0
          yyrealloc( (void *) b->yy_ch_buf,
1689
0
               (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
1690
0
        }
1691
0
      else
1692
        /* Can't grow it, we don't own it. */
1693
0
        b->yy_ch_buf = NULL;
1694
1695
0
      if ( ! b->yy_ch_buf )
1696
0
        YY_FATAL_ERROR(
1697
0
        "fatal error - scanner input buffer overflow" );
1698
1699
0
      yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1700
1701
0
      num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1702
0
            number_to_move - 1;
1703
1704
0
      }
1705
1706
0
    if ( num_to_read > YY_READ_BUF_SIZE )
1707
0
      num_to_read = YY_READ_BUF_SIZE;
1708
1709
    /* Read in more data. */
1710
0
    YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1711
0
      yyg->yy_n_chars, num_to_read );
1712
1713
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1714
0
    }
1715
1716
0
  if ( yyg->yy_n_chars == 0 )
1717
0
    {
1718
0
    if ( number_to_move == YY_MORE_ADJ )
1719
0
      {
1720
0
      ret_val = EOB_ACT_END_OF_FILE;
1721
0
      yyrestart( yyin  , yyscanner);
1722
0
      }
1723
1724
0
    else
1725
0
      {
1726
0
      ret_val = EOB_ACT_LAST_MATCH;
1727
0
      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1728
0
        YY_BUFFER_EOF_PENDING;
1729
0
      }
1730
0
    }
1731
1732
0
  else
1733
0
    ret_val = EOB_ACT_CONTINUE_SCAN;
1734
1735
0
  if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1736
    /* Extend the array by 50%, plus the number we really need. */
1737
0
    int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1738
0
    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1739
0
      (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
1740
0
    if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1741
0
      YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1742
    /* "- 2" to take care of EOB's */
1743
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1744
0
  }
1745
1746
0
  yyg->yy_n_chars += number_to_move;
1747
0
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1748
0
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1749
1750
0
  yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1751
1752
0
  return ret_val;
1753
0
}
1754
1755
/* yy_get_previous_state - get the state just before the EOB char was reached */
1756
1757
/* %if-c-only */
1758
/* %not-for-header */
1759
    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1760
/* %endif */
1761
/* %if-c++-only */
1762
/* %endif */
1763
0
{
1764
0
  yy_state_type yy_current_state;
1765
0
  char *yy_cp;
1766
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1767
1768
/* %% [15.0] code to get the start state into yy_current_state goes here */
1769
0
  yy_current_state = yyg->yy_start;
1770
1771
0
  for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1772
0
    {
1773
/* %% [16.0] code to find the next state goes here */
1774
0
    YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1775
0
    if ( yy_accept[yy_current_state] )
1776
0
      {
1777
0
      yyg->yy_last_accepting_state = yy_current_state;
1778
0
      yyg->yy_last_accepting_cpos = yy_cp;
1779
0
      }
1780
0
    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1781
0
      {
1782
0
      yy_current_state = (int) yy_def[yy_current_state];
1783
0
      if ( yy_current_state >= 78 )
1784
0
        yy_c = yy_meta[yy_c];
1785
0
      }
1786
0
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1787
0
    }
1788
1789
0
  return yy_current_state;
1790
0
}
1791
1792
/* yy_try_NUL_trans - try to make a transition on the NUL character
1793
 *
1794
 * synopsis
1795
 *  next_state = yy_try_NUL_trans( current_state );
1796
 */
1797
/* %if-c-only */
1798
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
1799
/* %endif */
1800
/* %if-c++-only */
1801
/* %endif */
1802
0
{
1803
0
  int yy_is_jam;
1804
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1805
/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
1806
0
  char *yy_cp = yyg->yy_c_buf_p;
1807
1808
0
  YY_CHAR yy_c = 1;
1809
0
  if ( yy_accept[yy_current_state] )
1810
0
    {
1811
0
    yyg->yy_last_accepting_state = yy_current_state;
1812
0
    yyg->yy_last_accepting_cpos = yy_cp;
1813
0
    }
1814
0
  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1815
0
    {
1816
0
    yy_current_state = (int) yy_def[yy_current_state];
1817
0
    if ( yy_current_state >= 78 )
1818
0
      yy_c = yy_meta[yy_c];
1819
0
    }
1820
0
  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1821
0
  yy_is_jam = (yy_current_state == 77);
1822
1823
0
  (void)yyg;
1824
0
  return yy_is_jam ? 0 : yy_current_state;
1825
0
}
1826
1827
#ifndef YY_NO_UNPUT
1828
/* %if-c-only */
1829
1830
/* %endif */
1831
#endif
1832
1833
/* %if-c-only */
1834
#ifndef YY_NO_INPUT
1835
#ifdef __cplusplus
1836
    static int yyinput (yyscan_t yyscanner)
1837
#else
1838
    static int input  (yyscan_t yyscanner)
1839
#endif
1840
1841
/* %endif */
1842
/* %if-c++-only */
1843
/* %endif */
1844
{
1845
  int c;
1846
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1847
1848
  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1849
1850
  if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1851
    {
1852
    /* yy_c_buf_p now points to the character we want to return.
1853
     * If this occurs *before* the EOB characters, then it's a
1854
     * valid NUL; if not, then we've hit the end of the buffer.
1855
     */
1856
    if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1857
      /* This was really a NUL. */
1858
      *yyg->yy_c_buf_p = '\0';
1859
1860
    else
1861
      { /* need more input */
1862
      int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
1863
      ++yyg->yy_c_buf_p;
1864
1865
      switch ( yy_get_next_buffer( yyscanner ) )
1866
        {
1867
        case EOB_ACT_LAST_MATCH:
1868
          /* This happens because yy_g_n_b()
1869
           * sees that we've accumulated a
1870
           * token and flags that we need to
1871
           * try matching the token before
1872
           * proceeding.  But for input(),
1873
           * there's no matching to consider.
1874
           * So convert the EOB_ACT_LAST_MATCH
1875
           * to EOB_ACT_END_OF_FILE.
1876
           */
1877
1878
          /* Reset buffer status. */
1879
          yyrestart( yyin , yyscanner);
1880
1881
          /*FALLTHROUGH*/
1882
1883
        case EOB_ACT_END_OF_FILE:
1884
          {
1885
          if ( yywrap( yyscanner ) )
1886
            return 0;
1887
1888
          if ( ! yyg->yy_did_buffer_switch_on_eof )
1889
            YY_NEW_FILE;
1890
#ifdef __cplusplus
1891
          return yyinput(yyscanner);
1892
#else
1893
          return input(yyscanner);
1894
#endif
1895
          }
1896
1897
        case EOB_ACT_CONTINUE_SCAN:
1898
          yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1899
          break;
1900
        }
1901
      }
1902
    }
1903
1904
  c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1905
  *yyg->yy_c_buf_p = '\0';  /* preserve yytext */
1906
  yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1907
1908
/* %% [19.0] update BOL and yylineno */
1909
1910
  return c;
1911
}
1912
/* %if-c-only */
1913
#endif  /* ifndef YY_NO_INPUT */
1914
/* %endif */
1915
1916
/** Immediately switch to a different input stream.
1917
 * @param input_file A readable stream.
1918
 * @param yyscanner The scanner object.
1919
 * @note This function does not reset the start condition to @c INITIAL .
1920
 */
1921
/* %if-c-only */
1922
    void yyrestart  (FILE * input_file , yyscan_t yyscanner)
1923
/* %endif */
1924
/* %if-c++-only */
1925
/* %endif */
1926
0
{
1927
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1928
1929
0
  if ( ! YY_CURRENT_BUFFER ){
1930
0
        yyensure_buffer_stack (yyscanner);
1931
0
    YY_CURRENT_BUFFER_LVALUE =
1932
0
            yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
1933
0
  }
1934
1935
0
  yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
1936
0
  yy_load_buffer_state( yyscanner );
1937
0
}
1938
1939
/* %if-c++-only */
1940
/* %endif */
1941
1942
/** Switch to a different input buffer.
1943
 * @param new_buffer The new input buffer.
1944
 * @param yyscanner The scanner object.
1945
 */
1946
/* %if-c-only */
1947
    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
1948
/* %endif */
1949
/* %if-c++-only */
1950
/* %endif */
1951
0
{
1952
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1953
1954
  /* TODO. We should be able to replace this entire function body
1955
   * with
1956
   *    yypop_buffer_state();
1957
   *    yypush_buffer_state(new_buffer);
1958
     */
1959
0
  yyensure_buffer_stack (yyscanner);
1960
0
  if ( YY_CURRENT_BUFFER == new_buffer )
1961
0
    return;
1962
1963
0
  if ( YY_CURRENT_BUFFER )
1964
0
    {
1965
    /* Flush out information for old buffer. */
1966
0
    *yyg->yy_c_buf_p = yyg->yy_hold_char;
1967
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1968
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1969
0
    }
1970
1971
0
  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1972
0
  yy_load_buffer_state( yyscanner );
1973
1974
  /* We don't actually know whether we did this switch during
1975
   * EOF (yywrap()) processing, but the only time this flag
1976
   * is looked at is after yywrap() is called, so it's safe
1977
   * to go ahead and always set it.
1978
   */
1979
0
  yyg->yy_did_buffer_switch_on_eof = 1;
1980
0
}
1981
1982
/* %if-c-only */
1983
static void yy_load_buffer_state  (yyscan_t yyscanner)
1984
/* %endif */
1985
/* %if-c++-only */
1986
/* %endif */
1987
0
{
1988
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1989
0
  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1990
0
  yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1991
/* %if-c-only */
1992
0
  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1993
/* %endif */
1994
/* %if-c++-only */
1995
/* %endif */
1996
0
  yyg->yy_hold_char = *yyg->yy_c_buf_p;
1997
0
}
1998
1999
/** Allocate and initialize an input buffer state.
2000
 * @param file A readable stream.
2001
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2002
 * @param yyscanner The scanner object.
2003
 * @return the allocated buffer state.
2004
 */
2005
/* %if-c-only */
2006
    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
2007
/* %endif */
2008
/* %if-c++-only */
2009
/* %endif */
2010
0
{
2011
0
  YY_BUFFER_STATE b;
2012
    
2013
0
  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
2014
0
  if ( ! b )
2015
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2016
2017
0
  b->yy_buf_size = size;
2018
2019
  /* yy_ch_buf has to be 2 characters longer than the size given because
2020
   * we need to put in 2 end-of-buffer characters.
2021
   */
2022
0
  b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
2023
0
  if ( ! b->yy_ch_buf )
2024
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2025
2026
0
  b->yy_is_our_buffer = 1;
2027
2028
0
  yy_init_buffer( b, file , yyscanner);
2029
2030
0
  return b;
2031
0
}
2032
2033
/* %if-c++-only */
2034
/* %endif */
2035
2036
/** Destroy the buffer.
2037
 * @param b a buffer created with yy_create_buffer()
2038
 * @param yyscanner The scanner object.
2039
 */
2040
/* %if-c-only */
2041
    void yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
2042
/* %endif */
2043
/* %if-c++-only */
2044
/* %endif */
2045
0
{
2046
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2047
2048
0
  if ( ! b )
2049
0
    return;
2050
2051
0
  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2052
0
    YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2053
2054
0
  if ( b->yy_is_our_buffer )
2055
0
    yyfree( (void *) b->yy_ch_buf , yyscanner );
2056
2057
0
  yyfree( (void *) b , yyscanner );
2058
0
}
2059
2060
/* Initializes or reinitializes a buffer.
2061
 * This function is sometimes called more than once on the same buffer,
2062
 * such as during a yyrestart() or at EOF.
2063
 */
2064
/* %if-c-only */
2065
    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
2066
/* %endif */
2067
/* %if-c++-only */
2068
/* %endif */
2069
2070
0
{
2071
0
  int oerrno = errno;
2072
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2073
2074
0
  yy_flush_buffer( b , yyscanner);
2075
2076
/* %if-c-only */
2077
0
  b->yy_input_file = file;
2078
/* %endif */
2079
/* %if-c++-only */
2080
/* %endif */
2081
0
  b->yy_fill_buffer = 1;
2082
2083
    /* If b is the current buffer, then yy_init_buffer was _probably_
2084
     * called from yyrestart() or through yy_get_next_buffer.
2085
     * In that case, we don't want to reset the lineno or column.
2086
     */
2087
0
    if (b != YY_CURRENT_BUFFER){
2088
0
        b->yy_bs_lineno = 1;
2089
0
        b->yy_bs_column = 0;
2090
0
    }
2091
2092
/* %if-c-only */
2093
2094
0
        b->yy_is_interactive = 0;
2095
    
2096
/* %endif */
2097
/* %if-c++-only */
2098
/* %endif */
2099
0
  errno = oerrno;
2100
0
}
2101
2102
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2103
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2104
 * @param yyscanner The scanner object.
2105
 */
2106
/* %if-c-only */
2107
    void yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
2108
/* %endif */
2109
/* %if-c++-only */
2110
/* %endif */
2111
0
{
2112
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2113
0
  if ( ! b )
2114
0
    return;
2115
2116
0
  b->yy_n_chars = 0;
2117
2118
  /* We always need two end-of-buffer characters.  The first causes
2119
   * a transition to the end-of-buffer state.  The second causes
2120
   * a jam in that state.
2121
   */
2122
0
  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2123
0
  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2124
2125
0
  b->yy_buf_pos = &b->yy_ch_buf[0];
2126
2127
0
  b->yy_at_bol = 1;
2128
0
  b->yy_buffer_status = YY_BUFFER_NEW;
2129
2130
0
  if ( b == YY_CURRENT_BUFFER )
2131
0
    yy_load_buffer_state( yyscanner );
2132
0
}
2133
2134
/* %if-c-or-c++ */
2135
/** Pushes the new state onto the stack. The new state becomes
2136
 *  the current state. This function will allocate the stack
2137
 *  if necessary.
2138
 *  @param new_buffer The new state.
2139
 *  @param yyscanner The scanner object.
2140
 */
2141
/* %if-c-only */
2142
void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2143
/* %endif */
2144
/* %if-c++-only */
2145
/* %endif */
2146
0
{
2147
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2148
0
  if (new_buffer == NULL)
2149
0
    return;
2150
2151
0
  yyensure_buffer_stack(yyscanner);
2152
2153
  /* This block is copied from yy_switch_to_buffer. */
2154
0
  if ( YY_CURRENT_BUFFER )
2155
0
    {
2156
    /* Flush out information for old buffer. */
2157
0
    *yyg->yy_c_buf_p = yyg->yy_hold_char;
2158
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2159
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2160
0
    }
2161
2162
  /* Only push if top exists. Otherwise, replace top. */
2163
0
  if (YY_CURRENT_BUFFER)
2164
0
    yyg->yy_buffer_stack_top++;
2165
0
  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2166
2167
  /* copied from yy_switch_to_buffer. */
2168
0
  yy_load_buffer_state( yyscanner );
2169
0
  yyg->yy_did_buffer_switch_on_eof = 1;
2170
0
}
2171
/* %endif */
2172
2173
/* %if-c-or-c++ */
2174
/** Removes and deletes the top of the stack, if present.
2175
 *  The next element becomes the new top.
2176
 *  @param yyscanner The scanner object.
2177
 */
2178
/* %if-c-only */
2179
void yypop_buffer_state (yyscan_t yyscanner)
2180
/* %endif */
2181
/* %if-c++-only */
2182
/* %endif */
2183
0
{
2184
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2185
0
  if (!YY_CURRENT_BUFFER)
2186
0
    return;
2187
2188
0
  yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
2189
0
  YY_CURRENT_BUFFER_LVALUE = NULL;
2190
0
  if (yyg->yy_buffer_stack_top > 0)
2191
0
    --yyg->yy_buffer_stack_top;
2192
2193
0
  if (YY_CURRENT_BUFFER) {
2194
0
    yy_load_buffer_state( yyscanner );
2195
0
    yyg->yy_did_buffer_switch_on_eof = 1;
2196
0
  }
2197
0
}
2198
/* %endif */
2199
2200
/* %if-c-or-c++ */
2201
/* Allocates the stack if it does not exist.
2202
 *  Guarantees space for at least one push.
2203
 */
2204
/* %if-c-only */
2205
static void yyensure_buffer_stack (yyscan_t yyscanner)
2206
/* %endif */
2207
/* %if-c++-only */
2208
/* %endif */
2209
0
{
2210
0
  yy_size_t num_to_alloc;
2211
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2212
2213
0
  if (!yyg->yy_buffer_stack) {
2214
2215
    /* First allocation is just for 2 elements, since we don't know if this
2216
     * scanner will even need a stack. We use 2 instead of 1 to avoid an
2217
     * immediate realloc on the next call.
2218
         */
2219
0
      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2220
0
    yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
2221
0
                (num_to_alloc * sizeof(struct yy_buffer_state*)
2222
0
                , yyscanner);
2223
0
    if ( ! yyg->yy_buffer_stack )
2224
0
      YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2225
2226
0
    memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2227
2228
0
    yyg->yy_buffer_stack_max = num_to_alloc;
2229
0
    yyg->yy_buffer_stack_top = 0;
2230
0
    return;
2231
0
  }
2232
2233
0
  if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2234
2235
    /* Increase the buffer to prepare for a possible push. */
2236
0
    yy_size_t grow_size = 8 /* arbitrary grow size */;
2237
2238
0
    num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2239
0
    yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
2240
0
                (yyg->yy_buffer_stack,
2241
0
                num_to_alloc * sizeof(struct yy_buffer_state*)
2242
0
                , yyscanner);
2243
0
    if ( ! yyg->yy_buffer_stack )
2244
0
      YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2245
2246
    /* zero only the new slots.*/
2247
0
    memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2248
0
    yyg->yy_buffer_stack_max = num_to_alloc;
2249
0
  }
2250
0
}
2251
/* %endif */
2252
2253
/* %if-c-only */
2254
/** Setup the input buffer state to scan directly from a user-specified character buffer.
2255
 * @param base the character buffer
2256
 * @param size the size in bytes of the character buffer
2257
 * @param yyscanner The scanner object.
2258
 * @return the newly allocated buffer state object.
2259
 */
2260
YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
2261
0
{
2262
0
  YY_BUFFER_STATE b;
2263
    
2264
0
  if ( size < 2 ||
2265
0
       base[size-2] != YY_END_OF_BUFFER_CHAR ||
2266
0
       base[size-1] != YY_END_OF_BUFFER_CHAR )
2267
    /* They forgot to leave room for the EOB's. */
2268
0
    return NULL;
2269
2270
0
  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
2271
0
  if ( ! b )
2272
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2273
2274
0
  b->yy_buf_size = (int) (size - 2);  /* "- 2" to take care of EOB's */
2275
0
  b->yy_buf_pos = b->yy_ch_buf = base;
2276
0
  b->yy_is_our_buffer = 0;
2277
0
  b->yy_input_file = NULL;
2278
0
  b->yy_n_chars = b->yy_buf_size;
2279
0
  b->yy_is_interactive = 0;
2280
0
  b->yy_at_bol = 1;
2281
0
  b->yy_fill_buffer = 0;
2282
0
  b->yy_buffer_status = YY_BUFFER_NEW;
2283
2284
0
  yy_switch_to_buffer( b , yyscanner );
2285
2286
0
  return b;
2287
0
}
2288
/* %endif */
2289
2290
/* %if-c-only */
2291
/** Setup the input buffer state to scan a string. The next call to yylex() will
2292
 * scan from a @e copy of @a str.
2293
 * @param yystr a NUL-terminated string to scan
2294
 * @param yyscanner The scanner object.
2295
 * @return the newly allocated buffer state object.
2296
 * @note If you want to scan bytes that may contain NUL values, then use
2297
 *       yy_scan_bytes() instead.
2298
 */
2299
YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
2300
0
{
2301
    
2302
0
  return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
2303
0
}
2304
/* %endif */
2305
2306
/* %if-c-only */
2307
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2308
 * scan from a @e copy of @a bytes.
2309
 * @param yybytes the byte buffer to scan
2310
 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2311
 * @param yyscanner The scanner object.
2312
 * @return the newly allocated buffer state object.
2313
 */
2314
YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
2315
0
{
2316
0
  YY_BUFFER_STATE b;
2317
0
  char *buf;
2318
0
  yy_size_t n;
2319
0
  int i;
2320
    
2321
  /* Get memory for full buffer, including space for trailing EOB's. */
2322
0
  n = (yy_size_t) (_yybytes_len + 2);
2323
0
  buf = (char *) yyalloc( n , yyscanner );
2324
0
  if ( ! buf )
2325
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2326
2327
0
  for ( i = 0; i < _yybytes_len; ++i )
2328
0
    buf[i] = yybytes[i];
2329
2330
0
  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2331
2332
0
  b = yy_scan_buffer( buf, n , yyscanner);
2333
0
  if ( ! b )
2334
0
    YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2335
2336
  /* It's okay to grow etc. this buffer, and we should throw it
2337
   * away when we're done.
2338
   */
2339
0
  b->yy_is_our_buffer = 1;
2340
2341
0
  return b;
2342
0
}
2343
/* %endif */
2344
2345
#ifndef YY_EXIT_FAILURE
2346
#define YY_EXIT_FAILURE 2
2347
#endif
2348
2349
/* %if-c-only */
2350
static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
2351
0
{
2352
0
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2353
0
  (void)yyg;
2354
0
  fprintf( stderr, "%s\n", msg );
2355
0
  exit( YY_EXIT_FAILURE );
2356
0
}
2357
/* %endif */
2358
/* %if-c++-only */
2359
/* %endif */
2360
2361
/* Redefine yyless() so it works in section 3 code. */
2362
2363
#undef yyless
2364
#define yyless(n) \
2365
  do \
2366
    { \
2367
    /* Undo effects of setting up yytext. */ \
2368
        int yyless_macro_arg = (n); \
2369
        YY_LESS_LINENO(yyless_macro_arg);\
2370
    yytext[yyleng] = yyg->yy_hold_char; \
2371
    yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2372
    yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2373
    *yyg->yy_c_buf_p = '\0'; \
2374
    yyleng = yyless_macro_arg; \
2375
    } \
2376
  while ( 0 )
2377
2378
/* Accessor  methods (get/set functions) to struct members. */
2379
2380
/* %if-c-only */
2381
/* %if-reentrant */
2382
2383
/** Get the user-defined data for this scanner.
2384
 * @param yyscanner The scanner object.
2385
 */
2386
YY_EXTRA_TYPE yyget_extra  (yyscan_t yyscanner)
2387
0
{
2388
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2389
0
    return yyextra;
2390
0
}
2391
2392
/* %endif */
2393
2394
/** Get the current line number.
2395
 * @param yyscanner The scanner object.
2396
 */
2397
int yyget_lineno  (yyscan_t yyscanner)
2398
0
{
2399
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2400
2401
0
        if (! YY_CURRENT_BUFFER)
2402
0
            return 0;
2403
    
2404
0
    return yylineno;
2405
0
}
2406
2407
/** Get the current column number.
2408
 * @param yyscanner The scanner object.
2409
 */
2410
int yyget_column  (yyscan_t yyscanner)
2411
0
{
2412
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2413
2414
0
        if (! YY_CURRENT_BUFFER)
2415
0
            return 0;
2416
    
2417
0
    return yycolumn;
2418
0
}
2419
2420
/** Get the input stream.
2421
 * @param yyscanner The scanner object.
2422
 */
2423
FILE *yyget_in  (yyscan_t yyscanner)
2424
0
{
2425
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2426
0
    return yyin;
2427
0
}
2428
2429
/** Get the output stream.
2430
 * @param yyscanner The scanner object.
2431
 */
2432
FILE *yyget_out  (yyscan_t yyscanner)
2433
0
{
2434
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2435
0
    return yyout;
2436
0
}
2437
2438
/** Get the length of the current token.
2439
 * @param yyscanner The scanner object.
2440
 */
2441
int yyget_leng  (yyscan_t yyscanner)
2442
0
{
2443
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2444
0
    return yyleng;
2445
0
}
2446
2447
/** Get the current token.
2448
 * @param yyscanner The scanner object.
2449
 */
2450
2451
char *yyget_text  (yyscan_t yyscanner)
2452
0
{
2453
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2454
0
    return yytext;
2455
0
}
2456
2457
/* %if-reentrant */
2458
2459
/** Set the user-defined data. This data is never touched by the scanner.
2460
 * @param user_defined The data to be associated with this scanner.
2461
 * @param yyscanner The scanner object.
2462
 */
2463
void yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
2464
0
{
2465
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2466
0
    yyextra = user_defined ;
2467
0
}
2468
2469
/* %endif */
2470
2471
/** Set the current line number.
2472
 * @param _line_number line number
2473
 * @param yyscanner The scanner object.
2474
 */
2475
void yyset_lineno (int  _line_number , yyscan_t yyscanner)
2476
0
{
2477
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2478
2479
        /* lineno is only valid if an input buffer exists. */
2480
0
        if (! YY_CURRENT_BUFFER )
2481
0
           YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2482
    
2483
0
    yylineno = _line_number;
2484
0
}
2485
2486
/** Set the current column.
2487
 * @param _column_no column number
2488
 * @param yyscanner The scanner object.
2489
 */
2490
void yyset_column (int  _column_no , yyscan_t yyscanner)
2491
0
{
2492
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2493
2494
        /* column is only valid if an input buffer exists. */
2495
0
        if (! YY_CURRENT_BUFFER )
2496
0
           YY_FATAL_ERROR( "yyset_column called with no buffer" );
2497
    
2498
0
    yycolumn = _column_no;
2499
0
}
2500
2501
/** Set the input stream. This does not discard the current
2502
 * input buffer.
2503
 * @param _in_str A readable stream.
2504
 * @param yyscanner The scanner object.
2505
 * @see yy_switch_to_buffer
2506
 */
2507
void yyset_in (FILE *  _in_str , yyscan_t yyscanner)
2508
0
{
2509
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2510
0
    yyin = _in_str ;
2511
0
}
2512
2513
void yyset_out (FILE *  _out_str , yyscan_t yyscanner)
2514
0
{
2515
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2516
0
    yyout = _out_str ;
2517
0
}
2518
2519
int yyget_debug  (yyscan_t yyscanner)
2520
0
{
2521
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2522
0
    return yy_flex_debug;
2523
0
}
2524
2525
void yyset_debug (int  _bdebug , yyscan_t yyscanner)
2526
0
{
2527
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2528
0
    yy_flex_debug = _bdebug ;
2529
0
}
2530
2531
/* %endif */
2532
2533
/* %if-reentrant */
2534
/* Accessor methods for yylval and yylloc */
2535
2536
/* %if-bison-bridge */
2537
/* %endif */
2538
2539
/* User-visible API */
2540
2541
/* yylex_init is special because it creates the scanner itself, so it is
2542
 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2543
 * That's why we explicitly handle the declaration, instead of using our macros.
2544
 */
2545
int yylex_init(yyscan_t* ptr_yy_globals)
2546
0
{
2547
0
    if (ptr_yy_globals == NULL){
2548
0
        errno = EINVAL;
2549
0
        return 1;
2550
0
    }
2551
2552
0
    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2553
2554
0
    if (*ptr_yy_globals == NULL){
2555
0
        errno = ENOMEM;
2556
0
        return 1;
2557
0
    }
2558
2559
    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2560
0
    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2561
2562
0
    return yy_init_globals ( *ptr_yy_globals );
2563
0
}
2564
2565
/* yylex_init_extra has the same functionality as yylex_init, but follows the
2566
 * convention of taking the scanner as the last argument. Note however, that
2567
 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2568
 * is the reason, too, why this function also must handle its own declaration).
2569
 * The user defined value in the first argument will be available to yyalloc in
2570
 * the yyextra field.
2571
 */
2572
int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2573
0
{
2574
0
    struct yyguts_t dummy_yyguts;
2575
2576
0
    yyset_extra (yy_user_defined, &dummy_yyguts);
2577
2578
0
    if (ptr_yy_globals == NULL){
2579
0
        errno = EINVAL;
2580
0
        return 1;
2581
0
    }
2582
2583
0
    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2584
2585
0
    if (*ptr_yy_globals == NULL){
2586
0
        errno = ENOMEM;
2587
0
        return 1;
2588
0
    }
2589
2590
    /* By setting to 0xAA, we expose bugs in
2591
    yy_init_globals. Leave at 0x00 for releases. */
2592
0
    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2593
2594
0
    yyset_extra (yy_user_defined, *ptr_yy_globals);
2595
2596
0
    return yy_init_globals ( *ptr_yy_globals );
2597
0
}
2598
2599
/* %endif if-c-only */
2600
2601
/* %if-c-only */
2602
static int yy_init_globals (yyscan_t yyscanner)
2603
0
{
2604
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2605
    /* Initialization is the same as for the non-reentrant scanner.
2606
     * This function is called from yylex_destroy(), so don't allocate here.
2607
     */
2608
2609
0
    yyg->yy_buffer_stack = NULL;
2610
0
    yyg->yy_buffer_stack_top = 0;
2611
0
    yyg->yy_buffer_stack_max = 0;
2612
0
    yyg->yy_c_buf_p = NULL;
2613
0
    yyg->yy_init = 0;
2614
0
    yyg->yy_start = 0;
2615
2616
0
    yyg->yy_start_stack_ptr = 0;
2617
0
    yyg->yy_start_stack_depth = 0;
2618
0
    yyg->yy_start_stack =  NULL;
2619
2620
/* Defined in main.c */
2621
#ifdef YY_STDINIT
2622
    yyin = stdin;
2623
    yyout = stdout;
2624
#else
2625
0
    yyin = NULL;
2626
0
    yyout = NULL;
2627
0
#endif
2628
2629
    /* For future reference: Set errno on error, since we are called by
2630
     * yylex_init()
2631
     */
2632
0
    return 0;
2633
0
}
2634
/* %endif */
2635
2636
/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2637
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2638
int yylex_destroy  (yyscan_t yyscanner)
2639
0
{
2640
0
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2641
2642
    /* Pop the buffer stack, destroying each element. */
2643
0
  while(YY_CURRENT_BUFFER){
2644
0
    yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
2645
0
    YY_CURRENT_BUFFER_LVALUE = NULL;
2646
0
    yypop_buffer_state(yyscanner);
2647
0
  }
2648
2649
  /* Destroy the stack itself. */
2650
0
  yyfree(yyg->yy_buffer_stack , yyscanner);
2651
0
  yyg->yy_buffer_stack = NULL;
2652
2653
    /* Destroy the start condition stack. */
2654
0
        yyfree( yyg->yy_start_stack , yyscanner );
2655
0
        yyg->yy_start_stack = NULL;
2656
2657
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2658
     * yylex() is called, initialization will occur. */
2659
0
    yy_init_globals( yyscanner);
2660
2661
/* %if-reentrant */
2662
    /* Destroy the main struct (reentrant only). */
2663
0
    yyfree ( yyscanner , yyscanner );
2664
0
    yyscanner = NULL;
2665
/* %endif */
2666
0
    return 0;
2667
0
}
2668
/* %endif */
2669
2670
/*
2671
 * Internal utility routines.
2672
 */
2673
2674
#ifndef yytext_ptr
2675
static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
2676
{
2677
  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2678
  (void)yyg;
2679
2680
  int i;
2681
  for ( i = 0; i < n; ++i )
2682
    s1[i] = s2[i];
2683
}
2684
#endif
2685
2686
#ifdef YY_NEED_STRLEN
2687
static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
2688
{
2689
  int n;
2690
  for ( n = 0; s[n]; ++n )
2691
    ;
2692
2693
  return n;
2694
}
2695
#endif
2696
2697
/* %if-tables-serialization definitions */
2698
/* %define-yytables   The name for this specific scanner's tables. */
2699
#define YYTABLES_NAME "yytables"
2700
/* %endif */
2701
2702
/* %ok-for-header */
2703
2704
#line 196 "/src/wireshark/epan/dtd_preparse.l"
2705
2706
2707
/*
2708
 * Turn diagnostics back on, so we check the code that we've written.
2709
 */
2710
DIAG_ON_FLEX()
2711
2712
0
static const char* replace_entity(Dtd_PreParse_scanner_state_t* state, char* entity) {
2713
0
  GString* replacement;
2714
2715
0
  *entity = '%';
2716
2717
0
  replacement = (GString*)g_hash_table_lookup(state->entities,entity);
2718
2719
0
  if (replacement) {
2720
0
    return replacement->str;
2721
0
  } else {
2722
0
    g_string_append_printf(state->error,"dtd_preparse: in file '%s': entity %s does not exists\n", state->filename, entity);
2723
0
    return "";
2724
0
  }
2725
2726
0
}
2727
2728
0
const char* dtd_location(Dtd_PreParse_scanner_state_t* state) {
2729
0
  static char* loc = NULL;
2730
2731
0
  g_free(loc);
2732
2733
0
  if (!state) return NULL;
2734
2735
0
  loc = ws_strdup_printf("<?wireshark-location %s:%u ?>", state->filename, state->linenum);
2736
2737
0
  return loc;
2738
0
}
2739
2740
0
static gboolean free_gstring_hash_items(void *k,void *v,void *p _U_) {
2741
0
  g_free(k);
2742
0
  g_string_free((GString*)v,true);
2743
0
  return true;
2744
0
}
2745
2746
0
extern GString* dtd_preparse(const char* fullname, GString* err) {
2747
0
  FILE *in;
2748
0
  yyscan_t scanner;
2749
0
  Dtd_PreParse_scanner_state_t state;
2750
2751
0
  in = ws_fopen(fullname,"r");
2752
2753
0
  if (!in) {
2754
0
    if (err)
2755
0
      g_string_append_printf(err, "Could not open file: '%s', error: %s",fullname,g_strerror(errno));
2756
0
    return NULL;
2757
0
  }
2758
2759
0
  if (Dtd_PreParse_lex_init(&scanner) != 0) {
2760
0
    if (err)
2761
0
      g_string_append_printf(err, "Can't initialize scanner: %s",
2762
0
          strerror(errno));
2763
0
    fclose(in);
2764
0
    return NULL;
2765
0
  }
2766
2767
0
  Dtd_PreParse_set_in(in, scanner);
2768
2769
0
  state.filename = g_path_get_basename(fullname);
2770
0
  state.linenum = 1;
2771
2772
0
  state.error = err;
2773
2774
0
  state.entities = g_hash_table_new(g_str_hash,g_str_equal);
2775
0
  state.current = state.output = g_string_new(dtd_location(&state));
2776
0
  state.entity_name = NULL;
2777
2778
  /* Associate the state with the scanner */
2779
0
  Dtd_PreParse_set_extra(&state, scanner);
2780
2781
0
  Dtd_PreParse_lex(scanner);
2782
2783
0
  Dtd_PreParse_lex_destroy(scanner);
2784
0
  fclose(in);
2785
2786
0
  g_hash_table_foreach_remove(state.entities,free_gstring_hash_items,NULL);
2787
0
  g_hash_table_destroy(state.entities);
2788
2789
0
  g_free(state.filename);
2790
2791
0
  return state.output;
2792
0
}
2793