5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
9 #define yy_create_buffer zconf_create_buffer
10 #define yy_delete_buffer zconf_delete_buffer
11 #define yy_flex_debug zconf_flex_debug
12 #define yy_init_buffer zconf_init_buffer
13 #define yy_flush_buffer zconf_flush_buffer
14 #define yy_load_buffer_state zconf_load_buffer_state
15 #define yy_switch_to_buffer zconf_switch_to_buffer
17 #define yyleng zconfleng
18 #define yylex zconflex
19 #define yylineno zconflineno
20 #define yyout zconfout
21 #define yyrestart zconfrestart
22 #define yytext zconftext
23 #define yywrap zconfwrap
24 #define yyalloc zconfalloc
25 #define yyrealloc zconfrealloc
26 #define yyfree zconffree
29 #define YY_FLEX_MAJOR_VERSION 2
30 #define YY_FLEX_MINOR_VERSION 5
31 #define YY_FLEX_SUBMINOR_VERSION 35
32 #if YY_FLEX_SUBMINOR_VERSION > 0
36 /* First, we deal with platform-specific or compiler-specific issues. */
38 /* begin standard C headers. */
44 /* end standard C headers. */
46 /* flex integer type definitions */
51 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
53 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
55 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56 * if you want the limit (max/min) macros for int types.
58 #ifndef __STDC_LIMIT_MACROS
59 #define __STDC_LIMIT_MACROS 1
63 typedef int8_t flex_int8_t;
64 typedef uint8_t flex_uint8_t;
65 typedef int16_t flex_int16_t;
66 typedef uint16_t flex_uint16_t;
67 typedef int32_t flex_int32_t;
68 typedef uint32_t flex_uint32_t;
70 typedef signed char flex_int8_t;
71 typedef short int flex_int16_t;
72 typedef int flex_int32_t;
73 typedef unsigned char flex_uint8_t;
74 typedef unsigned short int flex_uint16_t;
75 typedef unsigned int flex_uint32_t;
77 /* Limits of integral types. */
79 #define INT8_MIN (-128)
82 #define INT16_MIN (-32767-1)
85 #define INT32_MIN (-2147483647-1)
88 #define INT8_MAX (127)
91 #define INT16_MAX (32767)
94 #define INT32_MAX (2147483647)
97 #define UINT8_MAX (255U)
100 #define UINT16_MAX (65535U)
103 #define UINT32_MAX (4294967295U)
108 #endif /* ! FLEXINT_H */
112 /* The "const" storage-class-modifier is valid. */
115 #else /* ! __cplusplus */
117 /* C99 requires __STDC__ to be defined as 1. */
118 #if defined (__STDC__)
122 #endif /* defined (__STDC__) */
123 #endif /* ! __cplusplus */
126 #define yyconst const
131 /* Returned upon end-of-file. */
134 /* Promotes a possibly negative, possibly signed char to an unsigned
135 * integer for use as an array index. If the signed char is negative,
136 * we want to instead treat it as an 8-bit unsigned char, hence the
139 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
141 /* Enter a start condition. This macro really ought to take a parameter,
142 * but we do it the disgusting crufty way forced on us by the ()-less
143 * definition of BEGIN.
145 #define BEGIN (yy_start) = 1 + 2 *
147 /* Translate the current start state into a value that can be later handed
148 * to BEGIN to return to the state. The YYSTATE alias is for lex
151 #define YY_START (((yy_start) - 1) / 2)
152 #define YYSTATE YY_START
154 /* Action number for EOF rule of a given start state. */
155 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
157 /* Special action meaning "start processing a new file". */
158 #define YY_NEW_FILE zconfrestart(zconfin )
160 #define YY_END_OF_BUFFER_CHAR 0
162 /* Size of default input buffer. */
165 /* On IA-64, the buffer size is 16k, not 8k.
166 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167 * Ditto for the __ia64__ case accordingly.
169 #define YY_BUF_SIZE 32768
171 #define YY_BUF_SIZE 16384
172 #endif /* __ia64__ */
175 /* The state buf must be large enough to hold one state per character in the main buffer.
177 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
179 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
180 #define YY_TYPEDEF_YY_BUFFER_STATE
181 typedef struct yy_buffer_state *YY_BUFFER_STATE;
184 extern int zconfleng;
186 extern FILE *zconfin, *zconfout;
188 #define EOB_ACT_CONTINUE_SCAN 0
189 #define EOB_ACT_END_OF_FILE 1
190 #define EOB_ACT_LAST_MATCH 2
192 #define YY_LESS_LINENO(n)
194 /* Return all but the first "n" matched characters back to the input stream. */
198 /* Undo effects of setting up zconftext. */ \
199 int yyless_macro_arg = (n); \
200 YY_LESS_LINENO(yyless_macro_arg);\
201 *yy_cp = (yy_hold_char); \
202 YY_RESTORE_YY_MORE_OFFSET \
203 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
204 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
208 #define unput(c) yyunput( c, (yytext_ptr) )
210 #ifndef YY_TYPEDEF_YY_SIZE_T
211 #define YY_TYPEDEF_YY_SIZE_T
212 typedef size_t yy_size_t;
215 #ifndef YY_STRUCT_YY_BUFFER_STATE
216 #define YY_STRUCT_YY_BUFFER_STATE
217 struct yy_buffer_state
221 char *yy_ch_buf; /* input buffer */
222 char *yy_buf_pos; /* current position in input buffer */
224 /* Size of input buffer in bytes, not including room for EOB
227 yy_size_t yy_buf_size;
229 /* Number of characters read into yy_ch_buf, not including EOB
234 /* Whether we "own" the buffer - i.e., we know we created it,
235 * and can realloc() it to grow it, and should free() it to
238 int yy_is_our_buffer;
240 /* Whether this is an "interactive" input source; if so, and
241 * if we're using stdio for input, then we want to use getc()
242 * instead of fread(), to make sure we stop fetching input after
245 int yy_is_interactive;
247 /* Whether we're considered to be at the beginning of a line.
248 * If so, '^' rules will be active on the next match, otherwise
253 int yy_bs_lineno; /**< The line count. */
254 int yy_bs_column; /**< The column count. */
256 /* Whether to try to fill the input buffer when we reach the
261 int yy_buffer_status;
263 #define YY_BUFFER_NEW 0
264 #define YY_BUFFER_NORMAL 1
265 /* When an EOF's been seen but there's still some text to process
266 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
267 * shouldn't try reading from the input source any more. We might
268 * still have a bunch of tokens to match, though, because of
269 * possible backing-up.
271 * When we actually see the EOF, we change the status to "new"
272 * (via zconfrestart()), so that the user can continue scanning by
273 * just pointing zconfin at a new input file.
275 #define YY_BUFFER_EOF_PENDING 2
278 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
280 /* Stack of input buffers. */
281 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
282 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
283 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
285 /* We provide macros for accessing buffer states in case in the
286 * future we want to put the buffer states in a more general
289 * Returns the top of the stack, or NULL.
291 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
292 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
295 /* Same as previous macro, but useful when we know that the buffer stack is not
296 * NULL or when we need an lvalue. For internal use only.
298 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
300 /* yy_hold_char holds the character lost when zconftext is formed. */
301 static char yy_hold_char;
302 static int yy_n_chars; /* number of characters read into yy_ch_buf */
305 /* Points to current character in buffer. */
306 static char *yy_c_buf_p = (char *) 0;
307 static int yy_init = 0; /* whether we need to initialize */
308 static int yy_start = 0; /* start state number */
310 /* Flag which is used to allow zconfwrap()'s to do buffer switches
311 * instead of setting up a fresh zconfin. A bit of a hack ...
313 static int yy_did_buffer_switch_on_eof;
315 void zconfrestart (FILE *input_file );
316 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
317 YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
318 void zconf_delete_buffer (YY_BUFFER_STATE b );
319 void zconf_flush_buffer (YY_BUFFER_STATE b );
320 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
321 void zconfpop_buffer_state (void );
323 static void zconfensure_buffer_stack (void );
324 static void zconf_load_buffer_state (void );
325 static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
327 #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
329 YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
330 YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
331 YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
333 void *zconfalloc (yy_size_t );
334 void *zconfrealloc (void *,yy_size_t );
335 void zconffree (void * );
337 #define yy_new_buffer zconf_create_buffer
339 #define yy_set_interactive(is_interactive) \
341 if ( ! YY_CURRENT_BUFFER ){ \
342 zconfensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
346 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
349 #define yy_set_bol(at_bol) \
351 if ( ! YY_CURRENT_BUFFER ){\
352 zconfensure_buffer_stack (); \
353 YY_CURRENT_BUFFER_LVALUE = \
354 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
356 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
359 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
361 /* Begin user sect3 */
363 #define zconfwrap(n) 1
364 #define YY_SKIP_YYWRAP
366 typedef unsigned char YY_CHAR;
368 FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
370 typedef int yy_state_type;
372 extern int zconflineno;
376 extern char *zconftext;
377 #define yytext_ptr zconftext
378 static yyconst flex_int16_t yy_nxt[][17] =
381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
386 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
387 12, 12, 12, 12, 12, 12, 12
391 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
392 12, 12, 12, 12, 12, 12, 12
396 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
397 16, 16, 16, 18, 16, 16, 16
401 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
402 16, 16, 16, 18, 16, 16, 16
407 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
408 19, 19, 19, 19, 19, 19, 19
412 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
413 19, 19, 19, 19, 19, 19, 19
417 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
418 22, 22, 22, 22, 22, 25, 22
422 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
423 22, 22, 22, 22, 22, 25, 22
427 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
428 33, 34, 35, 35, 36, 37, 38
433 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
434 33, 34, 35, 35, 36, 37, 38
438 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
439 -11, -11, -11, -11, -11, -11, -11
443 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
444 -12, -12, -12, -12, -12, -12, -12
448 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
449 -13, -13, -13, -13, -13, -13, -13
453 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
454 -14, -14, -14, -14, -14, -14, -14
459 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
460 42, 42, 42, 42, 42, 42, 42
464 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
465 -16, -16, -16, -16, -16, -16, -16
469 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
470 -17, -17, -17, -17, -17, -17, -17
474 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
475 -18, -18, -18, 44, -18, -18, -18
479 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
480 45, 45, 45, 45, 45, 45, 45
485 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
486 -20, -20, -20, -20, -20, -20, -20
490 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
491 48, 48, 48, 48, 48, 48, 48
495 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
496 49, 49, 49, 49, 49, -22, 49
500 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
501 -23, -23, -23, -23, -23, -23, -23
505 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
506 -24, -24, -24, -24, -24, -24, -24
511 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
512 51, 51, 51, 51, 51, 51, 51
516 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
517 -26, -26, -26, -26, -26, -26, -26
521 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
522 -27, -27, -27, -27, -27, -27, -27
526 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
527 -28, -28, -28, -28, 53, -28, -28
531 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
532 -29, -29, -29, -29, -29, -29, -29
537 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
538 54, 54, 54, 54, 54, 54, 54
542 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
543 -31, -31, -31, -31, -31, -31, -31
547 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
548 -32, -32, -32, -32, -32, -32, -32
552 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
553 -33, -33, -33, -33, -33, -33, -33
557 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
558 -34, 56, 57, 57, -34, -34, -34
563 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
564 -35, 57, 57, 57, -35, -35, -35
568 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
569 -36, -36, -36, -36, -36, -36, -36
573 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
574 -37, -37, -37, -37, -37, -37, -37
578 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
579 -38, -38, -38, -38, -38, -38, 59
583 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
584 -39, -39, -39, -39, -39, -39, -39
589 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
590 -40, -40, -40, -40, -40, -40, -40
594 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
595 42, 42, 42, 42, 42, 42, 42
599 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
600 42, 42, 42, 42, 42, 42, 42
604 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
605 -43, -43, -43, -43, -43, -43, -43
609 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
610 -44, -44, -44, 44, -44, -44, -44
615 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
616 45, 45, 45, 45, 45, 45, 45
620 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
621 -46, -46, -46, -46, -46, -46, -46
625 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
626 48, 48, 48, 48, 48, 48, 48
630 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
631 -48, -48, -48, -48, -48, -48, -48
635 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
636 49, 49, 49, 49, 49, -49, 49
641 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
642 -50, -50, -50, -50, -50, -50, -50
646 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
647 -51, -51, -51, -51, -51, -51, -51
651 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
652 -52, -52, -52, -52, -52, -52, -52
656 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
657 -53, -53, -53, -53, -53, -53, -53
661 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
662 54, 54, 54, 54, 54, 54, 54
667 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
668 -55, -55, -55, -55, -55, -55, -55
672 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
673 -56, 60, 57, 57, -56, -56, -56
677 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
678 -57, 57, 57, 57, -57, -57, -57
682 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
683 -58, -58, -58, -58, -58, -58, -58
687 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
688 -59, -59, -59, -59, -59, -59, -59
693 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
694 -60, 57, 57, 57, -60, -60, -60
699 static yy_state_type yy_get_previous_state (void );
700 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
701 static int yy_get_next_buffer (void );
702 static void yy_fatal_error (yyconst char msg[] );
704 /* Done after the current pattern has been matched and before the
705 * corresponding action - sets up zconftext.
707 #define YY_DO_BEFORE_ACTION \
708 (yytext_ptr) = yy_bp; \
709 zconfleng = (size_t) (yy_cp - yy_bp); \
710 (yy_hold_char) = *yy_cp; \
712 (yy_c_buf_p) = yy_cp;
714 #define YY_NUM_RULES 33
715 #define YY_END_OF_BUFFER 34
716 /* This struct is not used in this scanner,
717 but its presence is necessary. */
720 flex_int32_t yy_verify;
723 static yyconst flex_int16_t yy_accept[61] =
725 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
726 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
727 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
728 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
729 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
730 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
733 static yyconst flex_int32_t yy_ec[256] =
735 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
736 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
737 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
738 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
739 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
740 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
741 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
742 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
743 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
744 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
746 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
747 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
748 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
749 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
750 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
751 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
752 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
754 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
755 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,
765 extern int zconf_flex_debug;
766 int zconf_flex_debug = 0;
768 /* The intent behind this definition is that it'll catch
769 * any uses of REJECT which flex missed.
771 #define REJECT reject_used_but_not_detected
772 #define yymore() yymore_used_but_not_detected
773 #define YY_MORE_ADJ 0
774 #define YY_RESTORE_YY_MORE_OFFSET
777 #define YY_NO_INPUT 1
781 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
782 * Released under the terms of the GNU GPL v2.0.
793 #define START_STRSIZE 16
801 static int text_size, text_asize;
804 struct buffer *parent;
805 YY_BUFFER_STATE state;
808 struct buffer *current_buf;
810 static int last_ts, first_ts;
812 static void zconf_endhelp(void);
813 static void zconf_endfile(void);
815 static void new_string(void)
817 text = xmalloc(START_STRSIZE);
818 text_asize = START_STRSIZE;
823 static void append_string(const char *str, int size)
825 int new_size = text_size + size + 1;
826 if (new_size > text_asize) {
827 new_size += START_STRSIZE - 1;
828 new_size &= -START_STRSIZE;
829 text = realloc(text, new_size);
830 text_asize = new_size;
832 memcpy(text + text_size, str, size);
837 static void alloc_string(const char *str, int size)
839 text = xmalloc(size + 1);
840 memcpy(text, str, size);
843 #line 844 "lex.zconf.c"
851 #ifndef YY_NO_UNISTD_H
852 /* Special case for "unistd.h", since it is non-ANSI. We include it way
853 * down here because we want the user's section 1 to have been scanned first.
854 * The user has a chance to override it with an option.
859 #ifndef YY_EXTRA_TYPE
860 #define YY_EXTRA_TYPE void *
863 static int yy_init_globals (void );
865 /* Accessor methods to globals.
866 These are made visible to non-reentrant scanners for convenience. */
868 int zconflex_destroy (void );
870 int zconfget_debug (void );
872 void zconfset_debug (int debug_flag );
874 YY_EXTRA_TYPE zconfget_extra (void );
876 void zconfset_extra (YY_EXTRA_TYPE user_defined );
878 FILE *zconfget_in (void );
880 void zconfset_in (FILE * in_str );
882 FILE *zconfget_out (void );
884 void zconfset_out (FILE * out_str );
886 int zconfget_leng (void );
888 char *zconfget_text (void );
890 int zconfget_lineno (void );
892 void zconfset_lineno (int line_number );
894 /* Macros after this point can all be overridden by user definitions in
898 #ifndef YY_SKIP_YYWRAP
900 extern "C" int zconfwrap (void );
902 extern int zconfwrap (void );
906 static void yyunput (int c,char *buf_ptr );
909 static void yy_flex_strncpy (char *,yyconst char *,int );
912 #ifdef YY_NEED_STRLEN
913 static int yy_flex_strlen (yyconst char * );
919 static int yyinput (void );
921 static int input (void );
926 /* Amount of stuff to slurp up with each read. */
927 #ifndef YY_READ_BUF_SIZE
929 /* On IA-64, the buffer size is 16k, not 8k */
930 #define YY_READ_BUF_SIZE 16384
932 #define YY_READ_BUF_SIZE 8192
933 #endif /* __ia64__ */
936 /* Copy whatever the last rule matched to the standard output. */
938 /* This used to be an fputs(), but since the string might contain NUL's,
939 * we now use fwrite().
941 #define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0)
944 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
945 * is returned in "result".
948 #define YY_INPUT(buf,result,max_size) \
950 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
952 if( errno != EINTR) \
954 YY_FATAL_ERROR( "input in flex scanner failed" ); \
964 /* No semi-colon after return; correct usage is to write "yyterminate();" -
965 * we don't want an extra ';' after the "return" because that will cause
966 * some compilers to complain about unreachable statements.
969 #define yyterminate() return YY_NULL
972 /* Number of entries by which start-condition stack grows. */
973 #ifndef YY_START_STACK_INCR
974 #define YY_START_STACK_INCR 25
977 /* Report a fatal error. */
978 #ifndef YY_FATAL_ERROR
979 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
982 /* end tables serialization structures and prototypes */
984 /* Default declaration of generated scanner - a define so the user can
985 * easily add parameters.
988 #define YY_DECL_IS_OURS 1
990 extern int zconflex (void);
992 #define YY_DECL int zconflex (void)
993 #endif /* !YY_DECL */
995 /* Code executed at the beginning of each rule, after zconftext and zconfleng
998 #ifndef YY_USER_ACTION
999 #define YY_USER_ACTION
1002 /* Code executed at the end of each rule. */
1004 #define YY_BREAK break;
1007 #define YY_RULE_SETUP \
1010 /** The main scanner function which does all the work.
1014 register yy_state_type yy_current_state;
1015 register char *yy_cp, *yy_bp;
1016 register int yy_act;
1023 #line 1024 "lex.zconf.c"
1034 (yy_start) = 1; /* first start state */
1042 if ( ! YY_CURRENT_BUFFER ) {
1043 zconfensure_buffer_stack ();
1044 YY_CURRENT_BUFFER_LVALUE =
1045 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1048 zconf_load_buffer_state( );
1051 while ( 1 ) /* loops until end-of-file is reached */
1053 yy_cp = (yy_c_buf_p);
1055 /* Support of zconftext. */
1056 *yy_cp = (yy_hold_char);
1058 /* yy_bp points to the position in yy_ch_buf of the start of
1063 yy_current_state = (yy_start);
1065 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
1068 yy_current_state = -yy_current_state;
1071 yy_act = yy_accept[yy_current_state];
1073 YY_DO_BEFORE_ACTION;
1075 do_action: /* This label is used only to access EOF actions. */
1078 { /* beginning of action switch */
1080 /* rule 1 can match eol */
1083 /* rule 2 can match eol */
1087 current_file->lineno++;
1107 unput(zconftext[0]);
1116 const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1118 current_pos.file = current_file;
1119 current_pos.lineno = current_file->lineno;
1120 if (id && id->flags & TF_COMMAND) {
1124 alloc_string(zconftext, zconfleng);
1125 zconflval.string = text;
1135 /* rule 8 can match eol */
1140 current_file->lineno++;
1159 return T_OPEN_PAREN;
1164 return T_CLOSE_PAREN;
1191 /* rule 17 can match eol */
1194 BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1205 const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1206 if (id && id->flags & TF_PARAM) {
1210 alloc_string(zconftext, zconfleng);
1211 zconflval.string = text;
1221 /* rule 21 can match eol */
1224 current_file->lineno++;
1231 case YY_STATE_EOF(PARAM):
1240 /* rule 23 can match eol */
1241 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1242 (yy_c_buf_p) = yy_cp -= 1;
1243 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1247 append_string(zconftext, zconfleng);
1248 zconflval.string = text;
1249 return T_WORD_QUOTE;
1256 append_string(zconftext, zconfleng);
1260 /* rule 25 can match eol */
1261 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1262 (yy_c_buf_p) = yy_cp -= 1;
1263 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1267 append_string(zconftext + 1, zconfleng - 1);
1268 zconflval.string = text;
1269 return T_WORD_QUOTE;
1276 append_string(zconftext + 1, zconfleng - 1);
1283 if (str == zconftext[0]) {
1285 zconflval.string = text;
1286 return T_WORD_QUOTE;
1288 append_string(zconftext, 1);
1292 /* rule 28 can match eol */
1296 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1297 current_file->lineno++;
1302 case YY_STATE_EOF(STRING):
1315 for (i = 0; i < zconfleng; i++) {
1316 if (zconftext[i] == '\t')
1323 if (ts < first_ts) {
1329 append_string(" ", 8);
1332 append_string(" ", ts);
1337 /* rule 30 can match eol */
1338 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1339 (yy_c_buf_p) = yy_cp -= 1;
1340 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1344 current_file->lineno++;
1350 /* rule 31 can match eol */
1354 current_file->lineno++;
1355 append_string("\n", 1);
1363 if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
1367 append_string(zconftext, zconfleng);
1372 case YY_STATE_EOF(HELP):
1380 case YY_STATE_EOF(INITIAL):
1381 case YY_STATE_EOF(COMMAND):
1395 YY_FATAL_ERROR( "flex scanner jammed" );
1397 #line 1398 "lex.zconf.c"
1399 case YY_END_OF_BUFFER:
1401 /* Amount of text matched not including the EOB char. */
1402 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1404 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1405 *yy_cp = (yy_hold_char);
1406 YY_RESTORE_YY_MORE_OFFSET
1408 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1410 /* We're scanning a new file or input source. It's
1411 * possible that this happened because the user
1412 * just pointed zconfin at a new source and called
1413 * zconflex(). If so, then we have to assure
1414 * consistency between YY_CURRENT_BUFFER and our
1415 * globals. Here is the right place to do so, because
1416 * this is the first action (other than possibly a
1417 * back-up) that will match for the new input source.
1419 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1420 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1421 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1424 /* Note that here we test for yy_c_buf_p "<=" to the position
1425 * of the first EOB in the buffer, since yy_c_buf_p will
1426 * already have been incremented past the NUL character
1427 * (since all states make transitions on EOB to the
1428 * end-of-buffer state). Contrast this with the test
1431 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1432 { /* This was really a NUL. */
1433 yy_state_type yy_next_state;
1435 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1437 yy_current_state = yy_get_previous_state( );
1439 /* Okay, we're now positioned to make the NUL
1440 * transition. We couldn't have
1441 * yy_get_previous_state() go ahead and do it
1442 * for us because it doesn't know how to deal
1443 * with the possibility of jamming (and we don't
1444 * want to build jamming into it because then it
1445 * will run more slowly).
1448 yy_next_state = yy_try_NUL_trans( yy_current_state );
1450 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1452 if ( yy_next_state )
1454 /* Consume the NUL. */
1455 yy_cp = ++(yy_c_buf_p);
1456 yy_current_state = yy_next_state;
1462 yy_cp = (yy_c_buf_p);
1463 goto yy_find_action;
1467 else switch ( yy_get_next_buffer( ) )
1469 case EOB_ACT_END_OF_FILE:
1471 (yy_did_buffer_switch_on_eof) = 0;
1475 /* Note: because we've taken care in
1476 * yy_get_next_buffer() to have set up
1477 * zconftext, we can now set up
1478 * yy_c_buf_p so that if some total
1479 * hoser (like flex itself) wants to
1480 * call the scanner after we return the
1481 * YY_NULL, it'll still work - another
1482 * YY_NULL will get returned.
1484 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1486 yy_act = YY_STATE_EOF(YY_START);
1492 if ( ! (yy_did_buffer_switch_on_eof) )
1498 case EOB_ACT_CONTINUE_SCAN:
1500 (yytext_ptr) + yy_amount_of_matched_text;
1502 yy_current_state = yy_get_previous_state( );
1504 yy_cp = (yy_c_buf_p);
1505 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1508 case EOB_ACT_LAST_MATCH:
1510 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1512 yy_current_state = yy_get_previous_state( );
1514 yy_cp = (yy_c_buf_p);
1515 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1516 goto yy_find_action;
1523 "fatal flex scanner internal error--no action found" );
1524 } /* end of action switch */
1525 } /* end of scanning one token */
1526 } /* end of zconflex */
1528 /* yy_get_next_buffer - try to read in a new buffer
1530 * Returns a code representing an action:
1531 * EOB_ACT_LAST_MATCH -
1532 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1533 * EOB_ACT_END_OF_FILE - end of file
1535 static int yy_get_next_buffer (void)
1537 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1538 register char *source = (yytext_ptr);
1539 register int number_to_move, i;
1542 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1544 "fatal flex scanner internal error--end of buffer missed" );
1546 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1547 { /* Don't try to fill the buffer, so this is an EOF. */
1548 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1550 /* We matched a single character, the EOB, so
1551 * treat this as a final EOF.
1553 return EOB_ACT_END_OF_FILE;
1558 /* We matched some text prior to the EOB, first
1561 return EOB_ACT_LAST_MATCH;
1565 /* Try to read more data. */
1567 /* First move last chars to start of buffer. */
1568 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1570 for ( i = 0; i < number_to_move; ++i )
1571 *(dest++) = *(source++);
1573 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1574 /* don't do the read, it's not guaranteed to return an EOF,
1577 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1582 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1584 while ( num_to_read <= 0 )
1585 { /* Not enough room in the buffer - grow it. */
1587 /* just a shorter name for the current buffer */
1588 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1590 int yy_c_buf_p_offset =
1591 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1593 if ( b->yy_is_our_buffer )
1595 int new_size = b->yy_buf_size * 2;
1597 if ( new_size <= 0 )
1598 b->yy_buf_size += b->yy_buf_size / 8;
1600 b->yy_buf_size *= 2;
1602 b->yy_ch_buf = (char *)
1603 /* Include room in for 2 EOB chars. */
1604 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1607 /* Can't grow it, we don't own it. */
1610 if ( ! b->yy_ch_buf )
1612 "fatal error - scanner input buffer overflow" );
1614 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1616 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1621 if ( num_to_read > YY_READ_BUF_SIZE )
1622 num_to_read = YY_READ_BUF_SIZE;
1624 /* Read in more data. */
1625 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1626 (yy_n_chars), (size_t) num_to_read );
1628 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1631 if ( (yy_n_chars) == 0 )
1633 if ( number_to_move == YY_MORE_ADJ )
1635 ret_val = EOB_ACT_END_OF_FILE;
1636 zconfrestart(zconfin );
1641 ret_val = EOB_ACT_LAST_MATCH;
1642 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1643 YY_BUFFER_EOF_PENDING;
1648 ret_val = EOB_ACT_CONTINUE_SCAN;
1650 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1651 /* Extend the array by 50%, plus the number we really need. */
1652 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1653 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1654 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1655 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1658 (yy_n_chars) += number_to_move;
1659 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1660 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1662 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1667 /* yy_get_previous_state - get the state just before the EOB char was reached */
1669 static yy_state_type yy_get_previous_state (void)
1671 register yy_state_type yy_current_state;
1672 register char *yy_cp;
1674 yy_current_state = (yy_start);
1676 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1678 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1681 return yy_current_state;
1684 /* yy_try_NUL_trans - try to make a transition on the NUL character
1687 * next_state = yy_try_NUL_trans( current_state );
1689 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1691 register int yy_is_jam;
1693 yy_current_state = yy_nxt[yy_current_state][1];
1694 yy_is_jam = (yy_current_state <= 0);
1696 return yy_is_jam ? 0 : yy_current_state;
1699 static void yyunput (int c, register char * yy_bp )
1701 register char *yy_cp;
1703 yy_cp = (yy_c_buf_p);
1705 /* undo effects of setting up zconftext */
1706 *yy_cp = (yy_hold_char);
1708 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1709 { /* need to shift things up to make room */
1710 /* +2 for EOB chars. */
1711 register int number_to_move = (yy_n_chars) + 2;
1712 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1713 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1714 register char *source =
1715 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1717 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1718 *--dest = *--source;
1720 yy_cp += (int) (dest - source);
1721 yy_bp += (int) (dest - source);
1722 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1723 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1725 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1726 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1729 *--yy_cp = (char) c;
1731 (yytext_ptr) = yy_bp;
1732 (yy_hold_char) = *yy_cp;
1733 (yy_c_buf_p) = yy_cp;
1738 static int yyinput (void)
1740 static int input (void)
1746 *(yy_c_buf_p) = (yy_hold_char);
1748 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1750 /* yy_c_buf_p now points to the character we want to return.
1751 * If this occurs *before* the EOB characters, then it's a
1752 * valid NUL; if not, then we've hit the end of the buffer.
1754 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1755 /* This was really a NUL. */
1756 *(yy_c_buf_p) = '\0';
1759 { /* need more input */
1760 int offset = (yy_c_buf_p) - (yytext_ptr);
1763 switch ( yy_get_next_buffer( ) )
1765 case EOB_ACT_LAST_MATCH:
1766 /* This happens because yy_g_n_b()
1767 * sees that we've accumulated a
1768 * token and flags that we need to
1769 * try matching the token before
1770 * proceeding. But for input(),
1771 * there's no matching to consider.
1772 * So convert the EOB_ACT_LAST_MATCH
1773 * to EOB_ACT_END_OF_FILE.
1776 /* Reset buffer status. */
1777 zconfrestart(zconfin );
1781 case EOB_ACT_END_OF_FILE:
1786 if ( ! (yy_did_buffer_switch_on_eof) )
1795 case EOB_ACT_CONTINUE_SCAN:
1796 (yy_c_buf_p) = (yytext_ptr) + offset;
1802 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1803 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1804 (yy_hold_char) = *++(yy_c_buf_p);
1808 #endif /* ifndef YY_NO_INPUT */
1810 /** Immediately switch to a different input stream.
1811 * @param input_file A readable stream.
1813 * @note This function does not reset the start condition to @c INITIAL .
1815 void zconfrestart (FILE * input_file )
1818 if ( ! YY_CURRENT_BUFFER ){
1819 zconfensure_buffer_stack ();
1820 YY_CURRENT_BUFFER_LVALUE =
1821 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1824 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1825 zconf_load_buffer_state( );
1828 /** Switch to a different input buffer.
1829 * @param new_buffer The new input buffer.
1832 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1835 /* TODO. We should be able to replace this entire function body
1837 * zconfpop_buffer_state();
1838 * zconfpush_buffer_state(new_buffer);
1840 zconfensure_buffer_stack ();
1841 if ( YY_CURRENT_BUFFER == new_buffer )
1844 if ( YY_CURRENT_BUFFER )
1846 /* Flush out information for old buffer. */
1847 *(yy_c_buf_p) = (yy_hold_char);
1848 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1849 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1852 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1853 zconf_load_buffer_state( );
1855 /* We don't actually know whether we did this switch during
1856 * EOF (zconfwrap()) processing, but the only time this flag
1857 * is looked at is after zconfwrap() is called, so it's safe
1858 * to go ahead and always set it.
1860 (yy_did_buffer_switch_on_eof) = 1;
1863 static void zconf_load_buffer_state (void)
1865 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1866 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1867 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1868 (yy_hold_char) = *(yy_c_buf_p);
1871 /** Allocate and initialize an input buffer state.
1872 * @param file A readable stream.
1873 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1875 * @return the allocated buffer state.
1877 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1881 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1883 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1885 b->yy_buf_size = size;
1887 /* yy_ch_buf has to be 2 characters longer than the size given because
1888 * we need to put in 2 end-of-buffer characters.
1890 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1891 if ( ! b->yy_ch_buf )
1892 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1894 b->yy_is_our_buffer = 1;
1896 zconf_init_buffer(b,file );
1901 /** Destroy the buffer.
1902 * @param b a buffer created with zconf_create_buffer()
1905 void zconf_delete_buffer (YY_BUFFER_STATE b )
1911 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1912 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1914 if ( b->yy_is_our_buffer )
1915 zconffree((void *) b->yy_ch_buf );
1917 zconffree((void *) b );
1920 /* Initializes or reinitializes a buffer.
1921 * This function is sometimes called more than once on the same buffer,
1922 * such as during a zconfrestart() or at EOF.
1924 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1929 zconf_flush_buffer(b );
1931 b->yy_input_file = file;
1932 b->yy_fill_buffer = 1;
1934 /* If b is the current buffer, then zconf_init_buffer was _probably_
1935 * called from zconfrestart() or through yy_get_next_buffer.
1936 * In that case, we don't want to reset the lineno or column.
1938 if (b != YY_CURRENT_BUFFER){
1939 b->yy_bs_lineno = 1;
1940 b->yy_bs_column = 0;
1943 b->yy_is_interactive = 0;
1948 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1949 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1952 void zconf_flush_buffer (YY_BUFFER_STATE b )
1959 /* We always need two end-of-buffer characters. The first causes
1960 * a transition to the end-of-buffer state. The second causes
1961 * a jam in that state.
1963 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1964 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1966 b->yy_buf_pos = &b->yy_ch_buf[0];
1969 b->yy_buffer_status = YY_BUFFER_NEW;
1971 if ( b == YY_CURRENT_BUFFER )
1972 zconf_load_buffer_state( );
1975 /** Pushes the new state onto the stack. The new state becomes
1976 * the current state. This function will allocate the stack
1978 * @param new_buffer The new state.
1981 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1983 if (new_buffer == NULL)
1986 zconfensure_buffer_stack();
1988 /* This block is copied from zconf_switch_to_buffer. */
1989 if ( YY_CURRENT_BUFFER )
1991 /* Flush out information for old buffer. */
1992 *(yy_c_buf_p) = (yy_hold_char);
1993 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1994 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1997 /* Only push if top exists. Otherwise, replace top. */
1998 if (YY_CURRENT_BUFFER)
1999 (yy_buffer_stack_top)++;
2000 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2002 /* copied from zconf_switch_to_buffer. */
2003 zconf_load_buffer_state( );
2004 (yy_did_buffer_switch_on_eof) = 1;
2007 /** Removes and deletes the top of the stack, if present.
2008 * The next element becomes the new top.
2011 void zconfpop_buffer_state (void)
2013 if (!YY_CURRENT_BUFFER)
2016 zconf_delete_buffer(YY_CURRENT_BUFFER );
2017 YY_CURRENT_BUFFER_LVALUE = NULL;
2018 if ((yy_buffer_stack_top) > 0)
2019 --(yy_buffer_stack_top);
2021 if (YY_CURRENT_BUFFER) {
2022 zconf_load_buffer_state( );
2023 (yy_did_buffer_switch_on_eof) = 1;
2027 /* Allocates the stack if it does not exist.
2028 * Guarantees space for at least one push.
2030 static void zconfensure_buffer_stack (void)
2034 if (!(yy_buffer_stack)) {
2036 /* First allocation is just for 2 elements, since we don't know if this
2037 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2038 * immediate realloc on the next call.
2041 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
2042 (num_to_alloc * sizeof(struct yy_buffer_state*)
2044 if ( ! (yy_buffer_stack) )
2045 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
2047 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2049 (yy_buffer_stack_max) = num_to_alloc;
2050 (yy_buffer_stack_top) = 0;
2054 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2056 /* Increase the buffer to prepare for a possible push. */
2057 int grow_size = 8 /* arbitrary grow size */;
2059 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2060 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
2062 num_to_alloc * sizeof(struct yy_buffer_state*)
2064 if ( ! (yy_buffer_stack) )
2065 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
2067 /* zero only the new slots.*/
2068 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2069 (yy_buffer_stack_max) = num_to_alloc;
2073 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2074 * @param base the character buffer
2075 * @param size the size in bytes of the character buffer
2077 * @return the newly allocated buffer state object.
2079 YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
2084 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2085 base[size-1] != YY_END_OF_BUFFER_CHAR )
2086 /* They forgot to leave room for the EOB's. */
2089 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
2091 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
2093 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2094 b->yy_buf_pos = b->yy_ch_buf = base;
2095 b->yy_is_our_buffer = 0;
2096 b->yy_input_file = 0;
2097 b->yy_n_chars = b->yy_buf_size;
2098 b->yy_is_interactive = 0;
2100 b->yy_fill_buffer = 0;
2101 b->yy_buffer_status = YY_BUFFER_NEW;
2103 zconf_switch_to_buffer(b );
2108 /** Setup the input buffer state to scan a string. The next call to zconflex() will
2109 * scan from a @e copy of @a str.
2110 * @param yystr a NUL-terminated string to scan
2112 * @return the newly allocated buffer state object.
2113 * @note If you want to scan bytes that may contain NUL values, then use
2114 * zconf_scan_bytes() instead.
2116 YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
2119 return zconf_scan_bytes(yystr,strlen(yystr) );
2122 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
2123 * scan from a @e copy of @a bytes.
2124 * @param yybytes the byte buffer to scan
2125 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2127 * @return the newly allocated buffer state object.
2129 YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
2136 /* Get memory for full buffer, including space for trailing EOB's. */
2137 n = _yybytes_len + 2;
2138 buf = (char *) zconfalloc(n );
2140 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2142 for ( i = 0; i < _yybytes_len; ++i )
2143 buf[i] = yybytes[i];
2145 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2147 b = zconf_scan_buffer(buf,n );
2149 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2151 /* It's okay to grow etc. this buffer, and we should throw it
2152 * away when we're done.
2154 b->yy_is_our_buffer = 1;
2159 #ifndef YY_EXIT_FAILURE
2160 #define YY_EXIT_FAILURE 2
2163 static void yy_fatal_error (yyconst char* msg )
2165 (void) fprintf( stderr, "%s\n", msg );
2166 exit( YY_EXIT_FAILURE );
2169 /* Redefine yyless() so it works in section 3 code. */
2175 /* Undo effects of setting up zconftext. */ \
2176 int yyless_macro_arg = (n); \
2177 YY_LESS_LINENO(yyless_macro_arg);\
2178 zconftext[zconfleng] = (yy_hold_char); \
2179 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2180 (yy_hold_char) = *(yy_c_buf_p); \
2181 *(yy_c_buf_p) = '\0'; \
2182 zconfleng = yyless_macro_arg; \
2186 /* Accessor methods (get/set functions) to struct members. */
2188 /** Get the current line number.
2191 int zconfget_lineno (void)
2197 /** Get the input stream.
2200 FILE *zconfget_in (void)
2205 /** Get the output stream.
2208 FILE *zconfget_out (void)
2213 /** Get the length of the current token.
2216 int zconfget_leng (void)
2221 /** Get the current token.
2225 char *zconfget_text (void)
2230 /** Set the current line number.
2231 * @param line_number
2234 void zconfset_lineno (int line_number )
2237 zconflineno = line_number;
2240 /** Set the input stream. This does not discard the current
2242 * @param in_str A readable stream.
2244 * @see zconf_switch_to_buffer
2246 void zconfset_in (FILE * in_str )
2251 void zconfset_out (FILE * out_str )
2253 zconfout = out_str ;
2256 int zconfget_debug (void)
2258 return zconf_flex_debug;
2261 void zconfset_debug (int bdebug )
2263 zconf_flex_debug = bdebug ;
2266 static int yy_init_globals (void)
2268 /* Initialization is the same as for the non-reentrant scanner.
2269 * This function is called from zconflex_destroy(), so don't allocate here.
2272 (yy_buffer_stack) = 0;
2273 (yy_buffer_stack_top) = 0;
2274 (yy_buffer_stack_max) = 0;
2275 (yy_c_buf_p) = (char *) 0;
2279 /* Defined in main.c */
2284 zconfin = (FILE *) 0;
2285 zconfout = (FILE *) 0;
2288 /* For future reference: Set errno on error, since we are called by
2294 /* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2295 int zconflex_destroy (void)
2298 /* Pop the buffer stack, destroying each element. */
2299 while(YY_CURRENT_BUFFER){
2300 zconf_delete_buffer(YY_CURRENT_BUFFER );
2301 YY_CURRENT_BUFFER_LVALUE = NULL;
2302 zconfpop_buffer_state();
2305 /* Destroy the stack itself. */
2306 zconffree((yy_buffer_stack) );
2307 (yy_buffer_stack) = NULL;
2309 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2310 * zconflex() is called, initialization will occur. */
2317 * Internal utility routines.
2321 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2324 for ( i = 0; i < n; ++i )
2329 #ifdef YY_NEED_STRLEN
2330 static int yy_flex_strlen (yyconst char * s )
2333 for ( n = 0; s[n]; ++n )
2340 void *zconfalloc (yy_size_t size )
2342 return (void *) malloc( size );
2345 void *zconfrealloc (void * ptr, yy_size_t size )
2347 /* The cast to (char *) in the following accommodates both
2348 * implementations that use char* generic pointers, and those
2349 * that use void* generic pointers. It works with the latter
2350 * because both ANSI C and C++ allow castless assignment from
2351 * any pointer type to void*, and deal with argument conversions
2352 * as though doing an assignment.
2354 return (void *) realloc( (char *) ptr, size );
2357 void zconffree (void * ptr )
2359 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2362 #define YYTABLES_NAME "yytables"
2367 void zconf_starthelp(void)
2370 last_ts = first_ts = 0;
2374 static void zconf_endhelp(void)
2376 zconflval.string = text;
2382 * Try to open specified file with following names:
2385 * The latter is used when srctree is separate from objtree
2386 * when compiling the kernel.
2387 * Return NULL if file is not found.
2389 FILE *zconf_fopen(const char *name)
2391 char *env, fullname[PATH_MAX+1];
2394 f = fopen(name, "r");
2395 if (!f && name != NULL && name[0] != '/') {
2396 env = getenv(SRCTREE);
2398 sprintf(fullname, "%s/%s", env, name);
2399 f = fopen(fullname, "r");
2405 void zconf_initscan(const char *name)
2407 zconfin = zconf_fopen(name);
2409 printf("can't find file %s\n", name);
2413 current_buf = xmalloc(sizeof(*current_buf));
2414 memset(current_buf, 0, sizeof(*current_buf));
2416 current_file = file_lookup(name);
2417 current_file->lineno = 1;
2420 void zconf_nextfile(const char *name)
2423 struct file *file = file_lookup(name);
2424 struct buffer *buf = xmalloc(sizeof(*buf));
2425 memset(buf, 0, sizeof(*buf));
2427 current_buf->state = YY_CURRENT_BUFFER;
2428 zconfin = zconf_fopen(file->name);
2430 printf("%s:%d: can't open file \"%s\"\n",
2431 zconf_curname(), zconf_lineno(), file->name);
2434 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2435 buf->parent = current_buf;
2438 for (iter = current_file->parent; iter; iter = iter->parent ) {
2439 if (!strcmp(current_file->name,iter->name) ) {
2440 printf("%s:%d: recursive inclusion detected. "
2441 "Inclusion path:\n current file : '%s'\n",
2442 zconf_curname(), zconf_lineno(),
2444 iter = current_file->parent;
2446 strcmp(iter->name,current_file->name)) {
2447 printf(" included from: '%s:%d'\n",
2448 iter->name, iter->lineno-1);
2449 iter = iter->parent;
2452 printf(" included from: '%s:%d'\n",
2453 iter->name, iter->lineno+1);
2458 file->parent = current_file;
2459 current_file = file;
2462 static void zconf_endfile(void)
2464 struct buffer *parent;
2466 current_file = current_file->parent;
2468 parent = current_buf->parent;
2471 zconf_delete_buffer(YY_CURRENT_BUFFER);
2472 zconf_switch_to_buffer(parent->state);
2475 current_buf = parent;
2478 int zconf_lineno(void)
2480 return current_pos.lineno;
2483 const char *zconf_curname(void)
2485 return current_pos.file ? current_pos.file->name : "<none>";