Coverage Report

Created: 2025-02-15 06:25

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