2 #line 3 "scripts/kconfig/lex.zconf.c"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 31
12 #if YY_FLEX_SUBMINOR_VERSION > 0
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
24 /* end standard C headers. */
26 /* flex integer type definitions */
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
35 typedef int8_t flex_int8_t;
36 typedef uint8_t flex_uint8_t;
37 typedef int16_t flex_int16_t;
38 typedef uint16_t flex_uint16_t;
39 typedef int32_t flex_int32_t;
40 typedef uint32_t flex_uint32_t;
42 typedef signed char flex_int8_t;
43 typedef short int flex_int16_t;
44 typedef int flex_int32_t;
45 typedef unsigned char flex_uint8_t;
46 typedef unsigned short int flex_uint16_t;
47 typedef unsigned int flex_uint32_t;
50 /* Limits of integral types. */
52 #define INT8_MIN (-128)
55 #define INT16_MIN (-32767-1)
58 #define INT32_MIN (-2147483647-1)
61 #define INT8_MAX (127)
64 #define INT16_MAX (32767)
67 #define INT32_MAX (2147483647)
70 #define UINT8_MAX (255U)
73 #define UINT16_MAX (65535U)
76 #define UINT32_MAX (4294967295U)
79 #endif /* ! FLEXINT_H */
83 /* The "const" storage-class-modifier is valid. */
86 #else /* ! __cplusplus */
93 #endif /* ! __cplusplus */
101 /* Returned upon end-of-file. */
104 /* Promotes a possibly negative, possibly signed char to an unsigned
105 * integer for use as an array index. If the signed char is negative,
106 * we want to instead treat it as an 8-bit unsigned char, hence the
109 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
111 /* Enter a start condition. This macro really ought to take a parameter,
112 * but we do it the disgusting crufty way forced on us by the ()-less
113 * definition of BEGIN.
115 #define BEGIN (yy_start) = 1 + 2 *
117 /* Translate the current start state into a value that can be later handed
118 * to BEGIN to return to the state. The YYSTATE alias is for lex
121 #define YY_START (((yy_start) - 1) / 2)
122 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
127 /* Special action meaning "start processing a new file". */
128 #define YY_NEW_FILE zconfrestart(zconfin )
130 #define YY_END_OF_BUFFER_CHAR 0
132 /* Size of default input buffer. */
134 #define YY_BUF_SIZE 16384
137 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
138 #define YY_TYPEDEF_YY_BUFFER_STATE
139 typedef struct yy_buffer_state *YY_BUFFER_STATE;
142 extern int zconfleng;
144 extern FILE *zconfin, *zconfout;
146 #define EOB_ACT_CONTINUE_SCAN 0
147 #define EOB_ACT_END_OF_FILE 1
148 #define EOB_ACT_LAST_MATCH 2
150 #define YY_LESS_LINENO(n)
152 /* Return all but the first "n" matched characters back to the input stream. */
156 /* Undo effects of setting up zconftext. */ \
157 int yyless_macro_arg = (n); \
158 YY_LESS_LINENO(yyless_macro_arg);\
159 *yy_cp = (yy_hold_char); \
160 YY_RESTORE_YY_MORE_OFFSET \
161 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
162 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
166 #define unput(c) yyunput( c, (yytext_ptr) )
168 /* The following is because we cannot portably get our hands on size_t
169 * (without autoconf's help, which isn't available because we want
170 * flex-generated scanners to compile on their own).
173 #ifndef YY_TYPEDEF_YY_SIZE_T
174 #define YY_TYPEDEF_YY_SIZE_T
175 typedef unsigned int yy_size_t;
178 #ifndef YY_STRUCT_YY_BUFFER_STATE
179 #define YY_STRUCT_YY_BUFFER_STATE
180 struct yy_buffer_state
184 char *yy_ch_buf; /* input buffer */
185 char *yy_buf_pos; /* current position in input buffer */
187 /* Size of input buffer in bytes, not including room for EOB
190 yy_size_t yy_buf_size;
192 /* Number of characters read into yy_ch_buf, not including EOB
197 /* Whether we "own" the buffer - i.e., we know we created it,
198 * and can realloc() it to grow it, and should free() it to
201 int yy_is_our_buffer;
203 /* Whether this is an "interactive" input source; if so, and
204 * if we're using stdio for input, then we want to use getc()
205 * instead of fread(), to make sure we stop fetching input after
208 int yy_is_interactive;
210 /* Whether we're considered to be at the beginning of a line.
211 * If so, '^' rules will be active on the next match, otherwise
216 int yy_bs_lineno; /**< The line count. */
217 int yy_bs_column; /**< The column count. */
219 /* Whether to try to fill the input buffer when we reach the
224 int yy_buffer_status;
226 #define YY_BUFFER_NEW 0
227 #define YY_BUFFER_NORMAL 1
228 /* When an EOF's been seen but there's still some text to process
229 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
230 * shouldn't try reading from the input source any more. We might
231 * still have a bunch of tokens to match, though, because of
232 * possible backing-up.
234 * When we actually see the EOF, we change the status to "new"
235 * (via zconfrestart()), so that the user can continue scanning by
236 * just pointing zconfin at a new input file.
238 #define YY_BUFFER_EOF_PENDING 2
241 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
243 /* Stack of input buffers. */
244 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
248 /* We provide macros for accessing buffer states in case in the
249 * future we want to put the buffer states in a more general
252 * Returns the top of the stack, or NULL.
254 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
255 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
258 /* Same as previous macro, but useful when we know that the buffer stack is not
259 * NULL or when we need an lvalue. For internal use only.
261 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
263 /* yy_hold_char holds the character lost when zconftext is formed. */
264 static char yy_hold_char;
265 static int yy_n_chars; /* number of characters read into yy_ch_buf */
268 /* Points to current character in buffer. */
269 static char *yy_c_buf_p = (char *) 0;
270 static int yy_init = 1; /* whether we need to initialize */
271 static int yy_start = 0; /* start state number */
273 /* Flag which is used to allow zconfwrap()'s to do buffer switches
274 * instead of setting up a fresh zconfin. A bit of a hack ...
276 static int yy_did_buffer_switch_on_eof;
278 void zconfrestart (FILE *input_file );
279 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280 YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
281 void zconf_delete_buffer (YY_BUFFER_STATE b );
282 void zconf_flush_buffer (YY_BUFFER_STATE b );
283 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
284 void zconfpop_buffer_state (void );
286 static void zconfensure_buffer_stack (void );
287 static void zconf_load_buffer_state (void );
288 static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
290 #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
292 YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
293 YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
294 YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
296 void *zconfalloc (yy_size_t );
297 void *zconfrealloc (void *,yy_size_t );
298 void zconffree (void * );
300 #define yy_new_buffer zconf_create_buffer
302 #define yy_set_interactive(is_interactive) \
304 if ( ! YY_CURRENT_BUFFER ){ \
305 zconfensure_buffer_stack (); \
306 YY_CURRENT_BUFFER_LVALUE = \
307 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
309 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 #define yy_set_bol(at_bol) \
314 if ( ! YY_CURRENT_BUFFER ){\
315 zconfensure_buffer_stack (); \
316 YY_CURRENT_BUFFER_LVALUE = \
317 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
319 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324 /* Begin user sect3 */
326 #define zconfwrap() 1
327 #define YY_SKIP_YYWRAP
329 typedef unsigned char YY_CHAR;
331 FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
333 typedef int yy_state_type;
335 extern int zconflineno;
339 extern char *zconftext;
340 #define yytext_ptr zconftext
341 static yyconst flex_int16_t yy_nxt[][17] =
344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
349 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
350 12, 12, 12, 12, 12, 12, 12
354 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
355 12, 12, 12, 12, 12, 12, 12
359 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
360 16, 16, 16, 18, 16, 16, 16
364 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
365 16, 16, 16, 18, 16, 16, 16
370 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
371 19, 19, 19, 19, 19, 19, 19
375 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
376 19, 19, 19, 19, 19, 19, 19
380 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
381 22, 22, 22, 22, 22, 25, 22
385 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
386 22, 22, 22, 22, 22, 25, 22
390 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
391 33, 34, 35, 35, 36, 37, 38
396 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
397 33, 34, 35, 35, 36, 37, 38
401 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
402 -11, -11, -11, -11, -11, -11, -11
406 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
407 -12, -12, -12, -12, -12, -12, -12
411 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
412 -13, -13, -13, -13, -13, -13, -13
416 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
417 -14, -14, -14, -14, -14, -14, -14
422 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
423 42, 42, 42, 42, 42, 42, 42
427 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
428 -16, -16, -16, -16, -16, -16, -16
432 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
433 -17, -17, -17, -17, -17, -17, -17
437 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
438 -18, -18, -18, 44, -18, -18, -18
442 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
443 45, 45, 45, 45, 45, 45, 45
448 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
449 -20, -20, -20, -20, -20, -20, -20
453 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
454 48, 48, 48, 48, 48, 48, 48
458 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
459 49, 49, 49, 49, 49, -22, 49
463 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
464 -23, -23, -23, -23, -23, -23, -23
468 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
469 -24, -24, -24, -24, -24, -24, -24
474 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
475 51, 51, 51, 51, 51, 51, 51
479 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
480 -26, -26, -26, -26, -26, -26, -26
484 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
485 -27, -27, -27, -27, -27, -27, -27
489 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
490 -28, -28, -28, -28, 53, -28, -28
494 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
495 -29, -29, -29, -29, -29, -29, -29
500 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
501 54, 54, 54, 54, 54, 54, 54
505 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
506 -31, -31, -31, -31, -31, -31, -31
510 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
511 -32, -32, -32, -32, -32, -32, -32
515 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
516 -33, -33, -33, -33, -33, -33, -33
520 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
521 -34, 56, 57, 57, -34, -34, -34
526 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
527 -35, 57, 57, 57, -35, -35, -35
531 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
532 -36, -36, -36, -36, -36, -36, -36
536 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
537 -37, -37, -37, -37, -37, -37, -37
541 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
542 -38, -38, -38, -38, -38, -38, 59
546 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
547 -39, -39, -39, -39, -39, -39, -39
552 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
553 -40, -40, -40, -40, -40, -40, -40
557 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
558 42, 42, 42, 42, 42, 42, 42
562 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
563 42, 42, 42, 42, 42, 42, 42
567 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
568 -43, -43, -43, -43, -43, -43, -43
572 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
573 -44, -44, -44, 44, -44, -44, -44
578 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
579 45, 45, 45, 45, 45, 45, 45
583 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
584 -46, -46, -46, -46, -46, -46, -46
588 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
589 48, 48, 48, 48, 48, 48, 48
593 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
594 -48, -48, -48, -48, -48, -48, -48
598 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
599 49, 49, 49, 49, 49, -49, 49
604 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
605 -50, -50, -50, -50, -50, -50, -50
609 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
610 -51, -51, -51, -51, -51, -51, -51
614 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
615 -52, -52, -52, -52, -52, -52, -52
619 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
620 -53, -53, -53, -53, -53, -53, -53
624 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
625 54, 54, 54, 54, 54, 54, 54
630 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
631 -55, -55, -55, -55, -55, -55, -55
635 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
636 -56, 60, 57, 57, -56, -56, -56
640 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
641 -57, 57, 57, 57, -57, -57, -57
645 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
646 -58, -58, -58, -58, -58, -58, -58
650 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
651 -59, -59, -59, -59, -59, -59, -59
656 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
657 -60, 57, 57, 57, -60, -60, -60
662 static yy_state_type yy_get_previous_state (void );
663 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
664 static int yy_get_next_buffer (void );
665 static void yy_fatal_error (yyconst char msg[] );
667 /* Done after the current pattern has been matched and before the
668 * corresponding action - sets up zconftext.
670 #define YY_DO_BEFORE_ACTION \
671 (yytext_ptr) = yy_bp; \
672 zconfleng = (size_t) (yy_cp - yy_bp); \
673 (yy_hold_char) = *yy_cp; \
675 (yy_c_buf_p) = yy_cp;
677 #define YY_NUM_RULES 33
678 #define YY_END_OF_BUFFER 34
679 /* This struct is not used in this scanner,
680 but its presence is necessary. */
683 flex_int32_t yy_verify;
686 static yyconst flex_int16_t yy_accept[61] =
688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
689 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
691 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
692 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
696 static yyconst flex_int32_t yy_ec[256] =
698 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
699 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
700 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
701 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
702 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
703 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
704 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
705 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
706 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
707 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
709 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
710 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
711 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
712 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
713 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
714 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
715 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
716 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
717 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
718 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
720 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
721 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
722 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
723 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
724 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
728 extern int zconf_flex_debug;
729 int zconf_flex_debug = 0;
731 /* The intent behind this definition is that it'll catch
732 * any uses of REJECT which flex missed.
734 #define REJECT reject_used_but_not_detected
735 #define yymore() yymore_used_but_not_detected
736 #define YY_MORE_ADJ 0
737 #define YY_RESTORE_YY_MORE_OFFSET
741 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
742 * Released under the terms of the GNU GPL v2.0.
751 #define LKC_DIRECT_LINK
754 #define START_STRSIZE 16
762 static int text_size, text_asize;
765 struct buffer *parent;
766 YY_BUFFER_STATE state;
769 struct buffer *current_buf;
771 static int last_ts, first_ts;
773 static void zconf_endhelp(void);
774 static void zconf_endfile(void);
776 void new_string(void)
778 text = malloc(START_STRSIZE);
779 text_asize = START_STRSIZE;
784 void append_string(const char *str, int size)
786 int new_size = text_size + size + 1;
787 if (new_size > text_asize) {
788 new_size += START_STRSIZE - 1;
789 new_size &= -START_STRSIZE;
790 text = realloc(text, new_size);
791 text_asize = new_size;
793 memcpy(text + text_size, str, size);
798 void alloc_string(const char *str, int size)
800 text = malloc(size + 1);
801 memcpy(text, str, size);
811 #ifndef YY_NO_UNISTD_H
812 /* Special case for "unistd.h", since it is non-ANSI. We include it way
813 * down here because we want the user's section 1 to have been scanned first.
814 * The user has a chance to override it with an option.
819 #ifndef YY_EXTRA_TYPE
820 #define YY_EXTRA_TYPE void *
823 /* Macros after this point can all be overridden by user definitions in
827 #ifndef YY_SKIP_YYWRAP
829 extern "C" int zconfwrap (void );
831 extern int zconfwrap (void );
835 static void yyunput (int c,char *buf_ptr );
838 static void yy_flex_strncpy (char *,yyconst char *,int );
841 #ifdef YY_NEED_STRLEN
842 static int yy_flex_strlen (yyconst char * );
845 //bbox: suppressing "defined but not used" warning
846 #define YY_NO_INPUT 1
851 static int yyinput (void );
853 static int input (void );
858 /* Amount of stuff to slurp up with each read. */
859 #ifndef YY_READ_BUF_SIZE
860 #define YY_READ_BUF_SIZE 8192
863 /* Copy whatever the last rule matched to the standard output. */
865 /* This used to be an fputs(), but since the string might contain NUL's,
866 * we now use fwrite().
868 #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
871 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
872 * is returned in "result".
875 #define YY_INPUT(buf,result,max_size) \
877 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
879 if( errno != EINTR) \
881 YY_FATAL_ERROR( "input in flex scanner failed" ); \
891 /* No semi-colon after return; correct usage is to write "yyterminate();" -
892 * we don't want an extra ';' after the "return" because that will cause
893 * some compilers to complain about unreachable statements.
896 #define yyterminate() return YY_NULL
899 /* Number of entries by which start-condition stack grows. */
900 #ifndef YY_START_STACK_INCR
901 #define YY_START_STACK_INCR 25
904 /* Report a fatal error. */
905 #ifndef YY_FATAL_ERROR
906 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
909 /* end tables serialization structures and prototypes */
911 /* Default declaration of generated scanner - a define so the user can
912 * easily add parameters.
915 #define YY_DECL_IS_OURS 1
917 extern int zconflex (void);
919 #define YY_DECL int zconflex (void)
920 #endif /* !YY_DECL */
922 /* Code executed at the beginning of each rule, after zconftext and zconfleng
925 #ifndef YY_USER_ACTION
926 #define YY_USER_ACTION
929 /* Code executed at the end of each rule. */
931 #define YY_BREAK break;
934 #define YY_RULE_SETUP \
937 /** The main scanner function which does all the work.
941 register yy_state_type yy_current_state;
942 register char *yy_cp, *yy_bp;
957 (yy_start) = 1; /* first start state */
965 if ( ! YY_CURRENT_BUFFER ) {
966 zconfensure_buffer_stack ();
967 YY_CURRENT_BUFFER_LVALUE =
968 zconf_create_buffer(zconfin,YY_BUF_SIZE );
971 zconf_load_buffer_state( );
974 while ( 1 ) /* loops until end-of-file is reached */
976 yy_cp = (yy_c_buf_p);
978 /* Support of zconftext. */
979 *yy_cp = (yy_hold_char);
981 /* yy_bp points to the position in yy_ch_buf of the start of
986 yy_current_state = (yy_start);
988 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
991 yy_current_state = -yy_current_state;
994 yy_act = yy_accept[yy_current_state];
998 do_action: /* This label is used only to access EOF actions. */
1001 { /* beginning of action switch */
1003 /* rule 1 can match eol */
1005 /* rule 2 can match eol */
1008 current_file->lineno++;
1025 unput(zconftext[0]);
1033 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1035 current_pos.file = current_file;
1036 current_pos.lineno = current_file->lineno;
1037 if (id && id->flags & TF_COMMAND) {
1041 alloc_string(zconftext, zconfleng);
1042 zconflval.string = text;
1051 /* rule 8 can match eol */
1055 current_file->lineno++;
1070 return T_OPEN_PAREN;
1074 return T_CLOSE_PAREN;
1097 /* rule 17 can match eol */
1099 BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1108 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1109 if (id && id->flags & TF_PARAM) {
1113 alloc_string(zconftext, zconfleng);
1114 zconflval.string = text;
1123 /* rule 21 can match eol */
1125 current_file->lineno++;
1131 case YY_STATE_EOF(PARAM):
1138 /* rule 23 can match eol */
1139 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1140 (yy_c_buf_p) = yy_cp -= 1;
1141 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1144 append_string(zconftext, zconfleng);
1145 zconflval.string = text;
1146 return T_WORD_QUOTE;
1152 append_string(zconftext, zconfleng);
1156 /* rule 25 can match eol */
1157 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1158 (yy_c_buf_p) = yy_cp -= 1;
1159 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1162 append_string(zconftext + 1, zconfleng - 1);
1163 zconflval.string = text;
1164 return T_WORD_QUOTE;
1170 append_string(zconftext + 1, zconfleng - 1);
1176 if (str == zconftext[0]) {
1178 zconflval.string = text;
1179 return T_WORD_QUOTE;
1181 append_string(zconftext, 1);
1185 /* rule 28 can match eol */
1188 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1189 current_file->lineno++;
1194 case YY_STATE_EOF(STRING):
1204 for (i = 0; i < zconfleng; i++) {
1205 if (zconftext[i] == '\t')
1212 if (ts < first_ts) {
1218 append_string(" ", 8);
1221 append_string(" ", ts);
1226 /* rule 30 can match eol */
1227 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1228 (yy_c_buf_p) = yy_cp -= 1;
1229 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1232 current_file->lineno++;
1238 /* rule 31 can match eol */
1241 current_file->lineno++;
1242 append_string("\n", 1);
1248 append_string(zconftext, zconfleng);
1253 case YY_STATE_EOF(HELP):
1260 case YY_STATE_EOF(INITIAL):
1261 case YY_STATE_EOF(COMMAND):
1273 YY_FATAL_ERROR( "flex scanner jammed" );
1276 case YY_END_OF_BUFFER:
1278 /* Amount of text matched not including the EOB char. */
1279 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1281 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1282 *yy_cp = (yy_hold_char);
1283 YY_RESTORE_YY_MORE_OFFSET
1285 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1287 /* We're scanning a new file or input source. It's
1288 * possible that this happened because the user
1289 * just pointed zconfin at a new source and called
1290 * zconflex(). If so, then we have to assure
1291 * consistency between YY_CURRENT_BUFFER and our
1292 * globals. Here is the right place to do so, because
1293 * this is the first action (other than possibly a
1294 * back-up) that will match for the new input source.
1296 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1297 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1298 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1301 /* Note that here we test for yy_c_buf_p "<=" to the position
1302 * of the first EOB in the buffer, since yy_c_buf_p will
1303 * already have been incremented past the NUL character
1304 * (since all states make transitions on EOB to the
1305 * end-of-buffer state). Contrast this with the test
1308 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1309 { /* This was really a NUL. */
1310 yy_state_type yy_next_state;
1312 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1314 yy_current_state = yy_get_previous_state( );
1316 /* Okay, we're now positioned to make the NUL
1317 * transition. We couldn't have
1318 * yy_get_previous_state() go ahead and do it
1319 * for us because it doesn't know how to deal
1320 * with the possibility of jamming (and we don't
1321 * want to build jamming into it because then it
1322 * will run more slowly).
1325 yy_next_state = yy_try_NUL_trans( yy_current_state );
1327 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1329 if ( yy_next_state )
1331 /* Consume the NUL. */
1332 yy_cp = ++(yy_c_buf_p);
1333 yy_current_state = yy_next_state;
1339 yy_cp = (yy_c_buf_p);
1340 goto yy_find_action;
1344 else switch ( yy_get_next_buffer( ) )
1346 case EOB_ACT_END_OF_FILE:
1348 (yy_did_buffer_switch_on_eof) = 0;
1352 /* Note: because we've taken care in
1353 * yy_get_next_buffer() to have set up
1354 * zconftext, we can now set up
1355 * yy_c_buf_p so that if some total
1356 * hoser (like flex itself) wants to
1357 * call the scanner after we return the
1358 * YY_NULL, it'll still work - another
1359 * YY_NULL will get returned.
1361 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1363 yy_act = YY_STATE_EOF(YY_START);
1369 if ( ! (yy_did_buffer_switch_on_eof) )
1375 case EOB_ACT_CONTINUE_SCAN:
1377 (yytext_ptr) + yy_amount_of_matched_text;
1379 yy_current_state = yy_get_previous_state( );
1381 yy_cp = (yy_c_buf_p);
1382 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1385 case EOB_ACT_LAST_MATCH:
1387 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1389 yy_current_state = yy_get_previous_state( );
1391 yy_cp = (yy_c_buf_p);
1392 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1393 goto yy_find_action;
1400 "fatal flex scanner internal error--no action found" );
1401 } /* end of action switch */
1402 } /* end of scanning one token */
1403 } /* end of zconflex */
1405 /* yy_get_next_buffer - try to read in a new buffer
1407 * Returns a code representing an action:
1408 * EOB_ACT_LAST_MATCH -
1409 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1410 * EOB_ACT_END_OF_FILE - end of file
1412 static int yy_get_next_buffer (void)
1414 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1415 register char *source = (yytext_ptr);
1416 register int number_to_move, i;
1419 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1421 "fatal flex scanner internal error--end of buffer missed" );
1423 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1424 { /* Don't try to fill the buffer, so this is an EOF. */
1425 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1427 /* We matched a single character, the EOB, so
1428 * treat this as a final EOF.
1430 return EOB_ACT_END_OF_FILE;
1435 /* We matched some text prior to the EOB, first
1438 return EOB_ACT_LAST_MATCH;
1442 /* Try to read more data. */
1444 /* First move last chars to start of buffer. */
1445 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1447 for ( i = 0; i < number_to_move; ++i )
1448 *(dest++) = *(source++);
1450 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1451 /* don't do the read, it's not guaranteed to return an EOF,
1454 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1458 size_t num_to_read =
1459 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1461 while ( num_to_read <= 0 )
1462 { /* Not enough room in the buffer - grow it. */
1464 /* just a shorter name for the current buffer */
1465 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1467 int yy_c_buf_p_offset =
1468 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1470 if ( b->yy_is_our_buffer )
1472 int new_size = b->yy_buf_size * 2;
1474 if ( new_size <= 0 )
1475 b->yy_buf_size += b->yy_buf_size / 8;
1477 b->yy_buf_size *= 2;
1479 b->yy_ch_buf = (char *)
1480 /* Include room in for 2 EOB chars. */
1481 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1484 /* Can't grow it, we don't own it. */
1487 if ( ! b->yy_ch_buf )
1489 "fatal error - scanner input buffer overflow" );
1491 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1493 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1498 if ( num_to_read > YY_READ_BUF_SIZE )
1499 num_to_read = YY_READ_BUF_SIZE;
1501 /* Read in more data. */
1502 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1503 (yy_n_chars), num_to_read );
1505 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1508 if ( (yy_n_chars) == 0 )
1510 if ( number_to_move == YY_MORE_ADJ )
1512 ret_val = EOB_ACT_END_OF_FILE;
1513 zconfrestart(zconfin );
1518 ret_val = EOB_ACT_LAST_MATCH;
1519 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1520 YY_BUFFER_EOF_PENDING;
1525 ret_val = EOB_ACT_CONTINUE_SCAN;
1527 (yy_n_chars) += number_to_move;
1528 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1529 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1531 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1536 /* yy_get_previous_state - get the state just before the EOB char was reached */
1538 static yy_state_type yy_get_previous_state (void)
1540 register yy_state_type yy_current_state;
1541 register char *yy_cp;
1543 yy_current_state = (yy_start);
1545 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1547 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1550 return yy_current_state;
1553 /* yy_try_NUL_trans - try to make a transition on the NUL character
1556 * next_state = yy_try_NUL_trans( current_state );
1558 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1560 register int yy_is_jam;
1562 yy_current_state = yy_nxt[yy_current_state][1];
1563 yy_is_jam = (yy_current_state <= 0);
1565 return yy_is_jam ? 0 : yy_current_state;
1568 static void yyunput (int c, register char * yy_bp )
1570 register char *yy_cp;
1572 yy_cp = (yy_c_buf_p);
1574 /* undo effects of setting up zconftext */
1575 *yy_cp = (yy_hold_char);
1577 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1578 { /* need to shift things up to make room */
1579 /* +2 for EOB chars. */
1580 register int number_to_move = (yy_n_chars) + 2;
1581 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1582 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1583 register char *source =
1584 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1586 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1587 *--dest = *--source;
1589 yy_cp += (int) (dest - source);
1590 yy_bp += (int) (dest - source);
1591 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1592 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1594 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1595 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1598 *--yy_cp = (char) c;
1600 (yytext_ptr) = yy_bp;
1601 (yy_hold_char) = *yy_cp;
1602 (yy_c_buf_p) = yy_cp;
1607 static int yyinput (void)
1609 static int input (void)
1615 *(yy_c_buf_p) = (yy_hold_char);
1617 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1619 /* yy_c_buf_p now points to the character we want to return.
1620 * If this occurs *before* the EOB characters, then it's a
1621 * valid NUL; if not, then we've hit the end of the buffer.
1623 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1624 /* This was really a NUL. */
1625 *(yy_c_buf_p) = '\0';
1628 { /* need more input */
1629 int offset = (yy_c_buf_p) - (yytext_ptr);
1632 switch ( yy_get_next_buffer( ) )
1634 case EOB_ACT_LAST_MATCH:
1635 /* This happens because yy_g_n_b()
1636 * sees that we've accumulated a
1637 * token and flags that we need to
1638 * try matching the token before
1639 * proceeding. But for input(),
1640 * there's no matching to consider.
1641 * So convert the EOB_ACT_LAST_MATCH
1642 * to EOB_ACT_END_OF_FILE.
1645 /* Reset buffer status. */
1646 zconfrestart(zconfin );
1650 case EOB_ACT_END_OF_FILE:
1655 if ( ! (yy_did_buffer_switch_on_eof) )
1664 case EOB_ACT_CONTINUE_SCAN:
1665 (yy_c_buf_p) = (yytext_ptr) + offset;
1671 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1672 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1673 (yy_hold_char) = *++(yy_c_buf_p);
1677 #endif /* ifndef YY_NO_INPUT */
1679 /** Immediately switch to a different input stream.
1680 * @param input_file A readable stream.
1682 * @note This function does not reset the start condition to @c INITIAL .
1684 void zconfrestart (FILE * input_file )
1687 if ( ! YY_CURRENT_BUFFER ){
1688 zconfensure_buffer_stack ();
1689 YY_CURRENT_BUFFER_LVALUE =
1690 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1693 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1694 zconf_load_buffer_state( );
1697 /** Switch to a different input buffer.
1698 * @param new_buffer The new input buffer.
1701 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1704 /* TODO. We should be able to replace this entire function body
1706 * zconfpop_buffer_state();
1707 * zconfpush_buffer_state(new_buffer);
1709 zconfensure_buffer_stack ();
1710 if ( YY_CURRENT_BUFFER == new_buffer )
1713 if ( YY_CURRENT_BUFFER )
1715 /* Flush out information for old buffer. */
1716 *(yy_c_buf_p) = (yy_hold_char);
1717 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1718 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1721 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1722 zconf_load_buffer_state( );
1724 /* We don't actually know whether we did this switch during
1725 * EOF (zconfwrap()) processing, but the only time this flag
1726 * is looked at is after zconfwrap() is called, so it's safe
1727 * to go ahead and always set it.
1729 (yy_did_buffer_switch_on_eof) = 1;
1732 static void zconf_load_buffer_state (void)
1734 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1735 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1736 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1737 (yy_hold_char) = *(yy_c_buf_p);
1740 /** Allocate and initialize an input buffer state.
1741 * @param file A readable stream.
1742 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1744 * @return the allocated buffer state.
1746 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1750 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1752 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1754 b->yy_buf_size = size;
1756 /* yy_ch_buf has to be 2 characters longer than the size given because
1757 * we need to put in 2 end-of-buffer characters.
1759 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1760 if ( ! b->yy_ch_buf )
1761 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1763 b->yy_is_our_buffer = 1;
1765 zconf_init_buffer(b,file );
1770 /** Destroy the buffer.
1771 * @param b a buffer created with zconf_create_buffer()
1774 void zconf_delete_buffer (YY_BUFFER_STATE b )
1780 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1781 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1783 if ( b->yy_is_our_buffer )
1784 zconffree((void *) b->yy_ch_buf );
1786 zconffree((void *) b );
1789 /* Initializes or reinitializes a buffer.
1790 * This function is sometimes called more than once on the same buffer,
1791 * such as during a zconfrestart() or at EOF.
1793 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1798 zconf_flush_buffer(b );
1800 b->yy_input_file = file;
1801 b->yy_fill_buffer = 1;
1803 /* If b is the current buffer, then zconf_init_buffer was _probably_
1804 * called from zconfrestart() or through yy_get_next_buffer.
1805 * In that case, we don't want to reset the lineno or column.
1807 if (b != YY_CURRENT_BUFFER){
1808 b->yy_bs_lineno = 1;
1809 b->yy_bs_column = 0;
1812 b->yy_is_interactive = 0;
1817 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1818 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1821 void zconf_flush_buffer (YY_BUFFER_STATE b )
1828 /* We always need two end-of-buffer characters. The first causes
1829 * a transition to the end-of-buffer state. The second causes
1830 * a jam in that state.
1832 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1833 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1835 b->yy_buf_pos = &b->yy_ch_buf[0];
1838 b->yy_buffer_status = YY_BUFFER_NEW;
1840 if ( b == YY_CURRENT_BUFFER )
1841 zconf_load_buffer_state( );
1844 /** Pushes the new state onto the stack. The new state becomes
1845 * the current state. This function will allocate the stack
1847 * @param new_buffer The new state.
1850 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1852 if (new_buffer == NULL)
1855 zconfensure_buffer_stack();
1857 /* This block is copied from zconf_switch_to_buffer. */
1858 if ( YY_CURRENT_BUFFER )
1860 /* Flush out information for old buffer. */
1861 *(yy_c_buf_p) = (yy_hold_char);
1862 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1863 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1866 /* Only push if top exists. Otherwise, replace top. */
1867 if (YY_CURRENT_BUFFER)
1868 (yy_buffer_stack_top)++;
1869 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1871 /* copied from zconf_switch_to_buffer. */
1872 zconf_load_buffer_state( );
1873 (yy_did_buffer_switch_on_eof) = 1;
1876 /** Removes and deletes the top of the stack, if present.
1877 * The next element becomes the new top.
1880 void zconfpop_buffer_state (void)
1882 if (!YY_CURRENT_BUFFER)
1885 zconf_delete_buffer(YY_CURRENT_BUFFER );
1886 YY_CURRENT_BUFFER_LVALUE = NULL;
1887 if ((yy_buffer_stack_top) > 0)
1888 --(yy_buffer_stack_top);
1890 if (YY_CURRENT_BUFFER) {
1891 zconf_load_buffer_state( );
1892 (yy_did_buffer_switch_on_eof) = 1;
1896 /* Allocates the stack if it does not exist.
1897 * Guarantees space for at least one push.
1899 static void zconfensure_buffer_stack (void)
1903 if (!(yy_buffer_stack)) {
1905 /* First allocation is just for 2 elements, since we don't know if this
1906 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1907 * immediate realloc on the next call.
1910 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1911 (num_to_alloc * sizeof(struct yy_buffer_state*)
1914 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1916 (yy_buffer_stack_max) = num_to_alloc;
1917 (yy_buffer_stack_top) = 0;
1921 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1923 /* Increase the buffer to prepare for a possible push. */
1924 int grow_size = 8 /* arbitrary grow size */;
1926 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1927 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
1929 num_to_alloc * sizeof(struct yy_buffer_state*)
1932 /* zero only the new slots.*/
1933 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1934 (yy_buffer_stack_max) = num_to_alloc;
1938 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1939 * @param base the character buffer
1940 * @param size the size in bytes of the character buffer
1942 * @return the newly allocated buffer state object.
1944 YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1949 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1950 base[size-1] != YY_END_OF_BUFFER_CHAR )
1951 /* They forgot to leave room for the EOB's. */
1954 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1956 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
1958 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1959 b->yy_buf_pos = b->yy_ch_buf = base;
1960 b->yy_is_our_buffer = 0;
1961 b->yy_input_file = 0;
1962 b->yy_n_chars = b->yy_buf_size;
1963 b->yy_is_interactive = 0;
1965 b->yy_fill_buffer = 0;
1966 b->yy_buffer_status = YY_BUFFER_NEW;
1968 zconf_switch_to_buffer(b );
1973 /** Setup the input buffer state to scan a string. The next call to zconflex() will
1974 * scan from a @e copy of @a str.
1975 * @param yy_str a NUL-terminated string to scan
1977 * @return the newly allocated buffer state object.
1978 * @note If you want to scan bytes that may contain NUL values, then use
1979 * zconf_scan_bytes() instead.
1981 YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
1984 return zconf_scan_bytes(yy_str,strlen(yy_str) );
1987 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
1988 * scan from a @e copy of @a bytes.
1989 * @param bytes the byte buffer to scan
1990 * @param len the number of bytes in the buffer pointed to by @a bytes.
1992 * @return the newly allocated buffer state object.
1994 YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
2001 /* Get memory for full buffer, including space for trailing EOB's. */
2003 buf = (char *) zconfalloc(n );
2005 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2007 for ( i = 0; i < len; ++i )
2010 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2012 b = zconf_scan_buffer(buf,n );
2014 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2016 /* It's okay to grow etc. this buffer, and we should throw it
2017 * away when we're done.
2019 b->yy_is_our_buffer = 1;
2024 #ifndef YY_EXIT_FAILURE
2025 #define YY_EXIT_FAILURE 2
2028 static void yy_fatal_error (yyconst char* msg )
2030 (void) fprintf( stderr, "%s\n", msg );
2031 exit( YY_EXIT_FAILURE );
2034 /* Redefine yyless() so it works in section 3 code. */
2040 /* Undo effects of setting up zconftext. */ \
2041 int yyless_macro_arg = (n); \
2042 YY_LESS_LINENO(yyless_macro_arg);\
2043 zconftext[zconfleng] = (yy_hold_char); \
2044 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2045 (yy_hold_char) = *(yy_c_buf_p); \
2046 *(yy_c_buf_p) = '\0'; \
2047 zconfleng = yyless_macro_arg; \
2051 /* Accessor methods (get/set functions) to struct members. */
2053 /** Get the current line number.
2056 int zconfget_lineno (void)
2062 /** Get the input stream.
2065 FILE *zconfget_in (void)
2070 /** Get the output stream.
2073 FILE *zconfget_out (void)
2078 /** Get the length of the current token.
2081 int zconfget_leng (void)
2086 /** Get the current token.
2090 char *zconfget_text (void)
2095 /** Set the current line number.
2096 * @param line_number
2099 void zconfset_lineno (int line_number )
2102 zconflineno = line_number;
2105 /** Set the input stream. This does not discard the current
2107 * @param in_str A readable stream.
2109 * @see zconf_switch_to_buffer
2111 void zconfset_in (FILE * in_str )
2116 void zconfset_out (FILE * out_str )
2118 zconfout = out_str ;
2121 int zconfget_debug (void)
2123 return zconf_flex_debug;
2126 void zconfset_debug (int bdebug )
2128 zconf_flex_debug = bdebug ;
2131 /* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2132 int zconflex_destroy (void)
2135 /* Pop the buffer stack, destroying each element. */
2136 while(YY_CURRENT_BUFFER){
2137 zconf_delete_buffer(YY_CURRENT_BUFFER );
2138 YY_CURRENT_BUFFER_LVALUE = NULL;
2139 zconfpop_buffer_state();
2142 /* Destroy the stack itself. */
2143 zconffree((yy_buffer_stack) );
2144 (yy_buffer_stack) = NULL;
2150 * Internal utility routines.
2154 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2157 for ( i = 0; i < n; ++i )
2162 #ifdef YY_NEED_STRLEN
2163 static int yy_flex_strlen (yyconst char * s )
2166 for ( n = 0; s[n]; ++n )
2173 void *zconfalloc (yy_size_t size )
2175 return (void *) malloc( size );
2178 void *zconfrealloc (void * ptr, yy_size_t size )
2180 /* The cast to (char *) in the following accommodates both
2181 * implementations that use char* generic pointers, and those
2182 * that use void* generic pointers. It works with the latter
2183 * because both ANSI C and C++ allow castless assignment from
2184 * any pointer type to void*, and deal with argument conversions
2185 * as though doing an assignment.
2187 return (void *) realloc( (char *) ptr, size );
2190 void zconffree (void * ptr )
2192 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2195 #define YYTABLES_NAME "yytables"
2198 #undef YY_FLUSH_BUFFER
2200 #undef yy_new_buffer
2201 #undef yy_set_interactive
2203 #undef YY_DO_BEFORE_ACTION
2205 #ifdef YY_DECL_IS_OURS
2206 #undef YY_DECL_IS_OURS
2210 void zconf_starthelp(void)
2213 last_ts = first_ts = 0;
2217 static void zconf_endhelp(void)
2219 zconflval.string = text;
2224 * Try to open specified file with following names:
2227 * The latter is used when srctree is separate from objtree
2228 * when compiling the kernel.
2229 * Return NULL if file is not found.
2231 FILE *zconf_fopen(const char *name)
2233 char *env, fullname[PATH_MAX+1];
2236 f = fopen(name, "r");
2237 if (!f && name[0] != '/') {
2238 env = getenv(SRCTREE);
2240 sprintf(fullname, "%s/%s", env, name);
2241 f = fopen(fullname, "r");
2247 void zconf_initscan(const char *name)
2249 zconfin = zconf_fopen(name);
2251 printf("can't find file %s\n", name);
2255 current_buf = malloc(sizeof(*current_buf));
2256 memset(current_buf, 0, sizeof(*current_buf));
2258 current_file = file_lookup(name);
2259 current_file->lineno = 1;
2260 current_file->flags = FILE_BUSY;
2263 void zconf_nextfile(const char *name)
2265 struct file *file = file_lookup(name);
2266 struct buffer *buf = malloc(sizeof(*buf));
2267 memset(buf, 0, sizeof(*buf));
2269 current_buf->state = YY_CURRENT_BUFFER;
2270 zconfin = zconf_fopen(name);
2272 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
2275 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2276 buf->parent = current_buf;
2279 if (file->flags & FILE_BUSY) {
2280 printf("recursive scan (%s)?\n", name);
2283 if (file->flags & FILE_SCANNED) {
2284 printf("file %s already scanned?\n", name);
2287 file->flags |= FILE_BUSY;
2289 file->parent = current_file;
2290 current_file = file;
2293 static void zconf_endfile(void)
2295 struct buffer *parent;
2297 current_file->flags |= FILE_SCANNED;
2298 current_file->flags &= ~FILE_BUSY;
2299 current_file = current_file->parent;
2301 parent = current_buf->parent;
2304 zconf_delete_buffer(YY_CURRENT_BUFFER);
2305 zconf_switch_to_buffer(parent->state);
2308 current_buf = parent;
2311 int zconf_lineno(void)
2313 return current_pos.lineno;
2316 char *zconf_curname(void)
2318 return current_pos.file ? current_pos.file->name : "<none>";