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