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;
788 fprintf (stderr, "%s:%d error: Overlong line\n",
789 current_file->name, current_file->lineno);
792 if (new_size > text_asize) {
793 new_size += START_STRSIZE - 1;
794 new_size &= -START_STRSIZE;
795 text = realloc(text, new_size);
796 text_asize = new_size;
798 memcpy(text + text_size, str, size);
803 void alloc_string(const char *str, int size)
805 text = malloc(size + 1);
806 memcpy(text, str, size);
816 #ifndef YY_NO_UNISTD_H
817 /* Special case for "unistd.h", since it is non-ANSI. We include it way
818 * down here because we want the user's section 1 to have been scanned first.
819 * The user has a chance to override it with an option.
824 #ifndef YY_EXTRA_TYPE
825 #define YY_EXTRA_TYPE void *
828 /* Macros after this point can all be overridden by user definitions in
832 #ifndef YY_SKIP_YYWRAP
834 extern "C" int zconfwrap (void );
836 extern int zconfwrap (void );
840 static void yyunput (int c,char *buf_ptr );
843 static void yy_flex_strncpy (char *,yyconst char *,int );
846 #ifdef YY_NEED_STRLEN
847 static int yy_flex_strlen (yyconst char * );
850 //bbox: suppressing "defined but not used" warning
851 #define YY_NO_INPUT 1
856 static int yyinput (void );
858 static int input (void );
863 /* Amount of stuff to slurp up with each read. */
864 #ifndef YY_READ_BUF_SIZE
865 #define YY_READ_BUF_SIZE 8192
868 /* Copy whatever the last rule matched to the standard output. */
870 /* This used to be an fputs(), but since the string might contain NUL's,
871 * we now use fwrite().
873 #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
876 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
877 * is returned in "result".
880 #define YY_INPUT(buf,result,max_size) \
882 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
884 if( errno != EINTR) \
886 YY_FATAL_ERROR( "input in flex scanner failed" ); \
896 /* No semi-colon after return; correct usage is to write "yyterminate();" -
897 * we don't want an extra ';' after the "return" because that will cause
898 * some compilers to complain about unreachable statements.
901 #define yyterminate() return YY_NULL
904 /* Number of entries by which start-condition stack grows. */
905 #ifndef YY_START_STACK_INCR
906 #define YY_START_STACK_INCR 25
909 /* Report a fatal error. */
910 #ifndef YY_FATAL_ERROR
911 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
914 /* end tables serialization structures and prototypes */
916 /* Default declaration of generated scanner - a define so the user can
917 * easily add parameters.
920 #define YY_DECL_IS_OURS 1
922 extern int zconflex (void);
924 #define YY_DECL int zconflex (void)
925 #endif /* !YY_DECL */
927 /* Code executed at the beginning of each rule, after zconftext and zconfleng
930 #ifndef YY_USER_ACTION
931 #define YY_USER_ACTION
934 /* Code executed at the end of each rule. */
936 #define YY_BREAK break;
939 #define YY_RULE_SETUP \
942 /** The main scanner function which does all the work.
946 register yy_state_type yy_current_state;
947 register char *yy_cp, *yy_bp;
962 (yy_start) = 1; /* first start state */
970 if ( ! YY_CURRENT_BUFFER ) {
971 zconfensure_buffer_stack ();
972 YY_CURRENT_BUFFER_LVALUE =
973 zconf_create_buffer(zconfin,YY_BUF_SIZE );
976 zconf_load_buffer_state( );
979 while ( 1 ) /* loops until end-of-file is reached */
981 yy_cp = (yy_c_buf_p);
983 /* Support of zconftext. */
984 *yy_cp = (yy_hold_char);
986 /* yy_bp points to the position in yy_ch_buf of the start of
991 yy_current_state = (yy_start);
993 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
996 yy_current_state = -yy_current_state;
999 yy_act = yy_accept[yy_current_state];
1001 YY_DO_BEFORE_ACTION;
1003 do_action: /* This label is used only to access EOF actions. */
1006 { /* beginning of action switch */
1008 /* rule 1 can match eol */
1010 /* rule 2 can match eol */
1013 current_file->lineno++;
1030 unput(zconftext[0]);
1038 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1040 current_pos.file = current_file;
1041 current_pos.lineno = current_file->lineno;
1042 if (id && id->flags & TF_COMMAND) {
1046 alloc_string(zconftext, zconfleng);
1047 zconflval.string = text;
1056 /* rule 8 can match eol */
1060 current_file->lineno++;
1075 return T_OPEN_PAREN;
1079 return T_CLOSE_PAREN;
1102 /* rule 17 can match eol */
1104 BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1113 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1114 if (id && id->flags & TF_PARAM) {
1118 alloc_string(zconftext, zconfleng);
1119 zconflval.string = text;
1128 /* rule 21 can match eol */
1130 current_file->lineno++;
1136 case YY_STATE_EOF(PARAM):
1143 /* rule 23 can match eol */
1144 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1145 (yy_c_buf_p) = yy_cp -= 1;
1146 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1149 append_string(zconftext, zconfleng);
1150 zconflval.string = text;
1151 return T_WORD_QUOTE;
1157 append_string(zconftext, zconfleng);
1161 /* rule 25 can match eol */
1162 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1163 (yy_c_buf_p) = yy_cp -= 1;
1164 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1167 append_string(zconftext + 1, zconfleng - 1);
1168 zconflval.string = text;
1169 return T_WORD_QUOTE;
1175 append_string(zconftext + 1, zconfleng - 1);
1181 if (str == zconftext[0]) {
1183 zconflval.string = text;
1184 return T_WORD_QUOTE;
1186 append_string(zconftext, 1);
1190 /* rule 28 can match eol */
1193 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1194 current_file->lineno++;
1199 case YY_STATE_EOF(STRING):
1209 for (i = 0; i < zconfleng; i++) {
1210 if (zconftext[i] == '\t')
1217 if (ts < first_ts) {
1223 append_string(" ", 8);
1226 append_string(" ", ts);
1231 /* rule 30 can match eol */
1232 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1233 (yy_c_buf_p) = yy_cp -= 1;
1234 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1237 current_file->lineno++;
1243 /* rule 31 can match eol */
1246 current_file->lineno++;
1247 append_string("\n", 1);
1253 append_string(zconftext, zconfleng);
1258 case YY_STATE_EOF(HELP):
1265 case YY_STATE_EOF(INITIAL):
1266 case YY_STATE_EOF(COMMAND):
1278 YY_FATAL_ERROR( "flex scanner jammed" );
1281 case YY_END_OF_BUFFER:
1283 /* Amount of text matched not including the EOB char. */
1284 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1286 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1287 *yy_cp = (yy_hold_char);
1288 YY_RESTORE_YY_MORE_OFFSET
1290 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1292 /* We're scanning a new file or input source. It's
1293 * possible that this happened because the user
1294 * just pointed zconfin at a new source and called
1295 * zconflex(). If so, then we have to assure
1296 * consistency between YY_CURRENT_BUFFER and our
1297 * globals. Here is the right place to do so, because
1298 * this is the first action (other than possibly a
1299 * back-up) that will match for the new input source.
1301 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1302 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1303 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1306 /* Note that here we test for yy_c_buf_p "<=" to the position
1307 * of the first EOB in the buffer, since yy_c_buf_p will
1308 * already have been incremented past the NUL character
1309 * (since all states make transitions on EOB to the
1310 * end-of-buffer state). Contrast this with the test
1313 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1314 { /* This was really a NUL. */
1315 yy_state_type yy_next_state;
1317 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1319 yy_current_state = yy_get_previous_state( );
1321 /* Okay, we're now positioned to make the NUL
1322 * transition. We couldn't have
1323 * yy_get_previous_state() go ahead and do it
1324 * for us because it doesn't know how to deal
1325 * with the possibility of jamming (and we don't
1326 * want to build jamming into it because then it
1327 * will run more slowly).
1330 yy_next_state = yy_try_NUL_trans( yy_current_state );
1332 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1334 if ( yy_next_state )
1336 /* Consume the NUL. */
1337 yy_cp = ++(yy_c_buf_p);
1338 yy_current_state = yy_next_state;
1344 yy_cp = (yy_c_buf_p);
1345 goto yy_find_action;
1349 else switch ( yy_get_next_buffer( ) )
1351 case EOB_ACT_END_OF_FILE:
1353 (yy_did_buffer_switch_on_eof) = 0;
1357 /* Note: because we've taken care in
1358 * yy_get_next_buffer() to have set up
1359 * zconftext, we can now set up
1360 * yy_c_buf_p so that if some total
1361 * hoser (like flex itself) wants to
1362 * call the scanner after we return the
1363 * YY_NULL, it'll still work - another
1364 * YY_NULL will get returned.
1366 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1368 yy_act = YY_STATE_EOF(YY_START);
1374 if ( ! (yy_did_buffer_switch_on_eof) )
1380 case EOB_ACT_CONTINUE_SCAN:
1382 (yytext_ptr) + yy_amount_of_matched_text;
1384 yy_current_state = yy_get_previous_state( );
1386 yy_cp = (yy_c_buf_p);
1387 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1390 case EOB_ACT_LAST_MATCH:
1392 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1394 yy_current_state = yy_get_previous_state( );
1396 yy_cp = (yy_c_buf_p);
1397 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1398 goto yy_find_action;
1405 "fatal flex scanner internal error--no action found" );
1406 } /* end of action switch */
1407 } /* end of scanning one token */
1408 } /* end of zconflex */
1410 /* yy_get_next_buffer - try to read in a new buffer
1412 * Returns a code representing an action:
1413 * EOB_ACT_LAST_MATCH -
1414 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1415 * EOB_ACT_END_OF_FILE - end of file
1417 static int yy_get_next_buffer (void)
1419 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1420 register char *source = (yytext_ptr);
1421 register int number_to_move, i;
1424 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1426 "fatal flex scanner internal error--end of buffer missed" );
1428 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1429 { /* Don't try to fill the buffer, so this is an EOF. */
1430 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1432 /* We matched a single character, the EOB, so
1433 * treat this as a final EOF.
1435 return EOB_ACT_END_OF_FILE;
1440 /* We matched some text prior to the EOB, first
1443 return EOB_ACT_LAST_MATCH;
1447 /* Try to read more data. */
1449 /* First move last chars to start of buffer. */
1450 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1452 for ( i = 0; i < number_to_move; ++i )
1453 *(dest++) = *(source++);
1455 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1456 /* don't do the read, it's not guaranteed to return an EOF,
1459 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1463 size_t num_to_read =
1464 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1466 while ( num_to_read <= 0 )
1467 { /* Not enough room in the buffer - grow it. */
1469 /* just a shorter name for the current buffer */
1470 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1472 int yy_c_buf_p_offset =
1473 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1475 if ( b->yy_is_our_buffer )
1477 int new_size = b->yy_buf_size * 2;
1479 if ( new_size <= 0 )
1480 b->yy_buf_size += b->yy_buf_size / 8;
1482 b->yy_buf_size *= 2;
1484 b->yy_ch_buf = (char *)
1485 /* Include room in for 2 EOB chars. */
1486 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1489 /* Can't grow it, we don't own it. */
1492 if ( ! b->yy_ch_buf )
1494 "fatal error - scanner input buffer overflow" );
1496 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1498 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1503 if ( num_to_read > YY_READ_BUF_SIZE )
1504 num_to_read = YY_READ_BUF_SIZE;
1506 /* Read in more data. */
1507 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1508 (yy_n_chars), num_to_read );
1510 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1513 if ( (yy_n_chars) == 0 )
1515 if ( number_to_move == YY_MORE_ADJ )
1517 ret_val = EOB_ACT_END_OF_FILE;
1518 zconfrestart(zconfin );
1523 ret_val = EOB_ACT_LAST_MATCH;
1524 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1525 YY_BUFFER_EOF_PENDING;
1530 ret_val = EOB_ACT_CONTINUE_SCAN;
1532 (yy_n_chars) += number_to_move;
1533 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1534 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1536 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1541 /* yy_get_previous_state - get the state just before the EOB char was reached */
1543 static yy_state_type yy_get_previous_state (void)
1545 register yy_state_type yy_current_state;
1546 register char *yy_cp;
1548 yy_current_state = (yy_start);
1550 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1552 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1555 return yy_current_state;
1558 /* yy_try_NUL_trans - try to make a transition on the NUL character
1561 * next_state = yy_try_NUL_trans( current_state );
1563 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1565 register int yy_is_jam;
1567 yy_current_state = yy_nxt[yy_current_state][1];
1568 yy_is_jam = (yy_current_state <= 0);
1570 return yy_is_jam ? 0 : yy_current_state;
1573 static void yyunput (int c, register char * yy_bp )
1575 register char *yy_cp;
1577 yy_cp = (yy_c_buf_p);
1579 /* undo effects of setting up zconftext */
1580 *yy_cp = (yy_hold_char);
1582 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1583 { /* need to shift things up to make room */
1584 /* +2 for EOB chars. */
1585 register int number_to_move = (yy_n_chars) + 2;
1586 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1587 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1588 register char *source =
1589 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1591 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1592 *--dest = *--source;
1594 yy_cp += (int) (dest - source);
1595 yy_bp += (int) (dest - source);
1596 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1597 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1599 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1600 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1603 *--yy_cp = (char) c;
1605 (yytext_ptr) = yy_bp;
1606 (yy_hold_char) = *yy_cp;
1607 (yy_c_buf_p) = yy_cp;
1612 static int yyinput (void)
1614 static int input (void)
1620 *(yy_c_buf_p) = (yy_hold_char);
1622 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1624 /* yy_c_buf_p now points to the character we want to return.
1625 * If this occurs *before* the EOB characters, then it's a
1626 * valid NUL; if not, then we've hit the end of the buffer.
1628 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1629 /* This was really a NUL. */
1630 *(yy_c_buf_p) = '\0';
1633 { /* need more input */
1634 int offset = (yy_c_buf_p) - (yytext_ptr);
1637 switch ( yy_get_next_buffer( ) )
1639 case EOB_ACT_LAST_MATCH:
1640 /* This happens because yy_g_n_b()
1641 * sees that we've accumulated a
1642 * token and flags that we need to
1643 * try matching the token before
1644 * proceeding. But for input(),
1645 * there's no matching to consider.
1646 * So convert the EOB_ACT_LAST_MATCH
1647 * to EOB_ACT_END_OF_FILE.
1650 /* Reset buffer status. */
1651 zconfrestart(zconfin );
1655 case EOB_ACT_END_OF_FILE:
1660 if ( ! (yy_did_buffer_switch_on_eof) )
1669 case EOB_ACT_CONTINUE_SCAN:
1670 (yy_c_buf_p) = (yytext_ptr) + offset;
1676 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1677 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1678 (yy_hold_char) = *++(yy_c_buf_p);
1682 #endif /* ifndef YY_NO_INPUT */
1684 /** Immediately switch to a different input stream.
1685 * @param input_file A readable stream.
1687 * @note This function does not reset the start condition to @c INITIAL .
1689 void zconfrestart (FILE * input_file )
1692 if ( ! YY_CURRENT_BUFFER ){
1693 zconfensure_buffer_stack ();
1694 YY_CURRENT_BUFFER_LVALUE =
1695 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1698 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1699 zconf_load_buffer_state( );
1702 /** Switch to a different input buffer.
1703 * @param new_buffer The new input buffer.
1706 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1709 /* TODO. We should be able to replace this entire function body
1711 * zconfpop_buffer_state();
1712 * zconfpush_buffer_state(new_buffer);
1714 zconfensure_buffer_stack ();
1715 if ( YY_CURRENT_BUFFER == new_buffer )
1718 if ( YY_CURRENT_BUFFER )
1720 /* Flush out information for old buffer. */
1721 *(yy_c_buf_p) = (yy_hold_char);
1722 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1723 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1726 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1727 zconf_load_buffer_state( );
1729 /* We don't actually know whether we did this switch during
1730 * EOF (zconfwrap()) processing, but the only time this flag
1731 * is looked at is after zconfwrap() is called, so it's safe
1732 * to go ahead and always set it.
1734 (yy_did_buffer_switch_on_eof) = 1;
1737 static void zconf_load_buffer_state (void)
1739 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1740 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1741 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1742 (yy_hold_char) = *(yy_c_buf_p);
1745 /** Allocate and initialize an input buffer state.
1746 * @param file A readable stream.
1747 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1749 * @return the allocated buffer state.
1751 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1755 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1757 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1759 b->yy_buf_size = size;
1761 /* yy_ch_buf has to be 2 characters longer than the size given because
1762 * we need to put in 2 end-of-buffer characters.
1764 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1765 if ( ! b->yy_ch_buf )
1766 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1768 b->yy_is_our_buffer = 1;
1770 zconf_init_buffer(b,file );
1775 /** Destroy the buffer.
1776 * @param b a buffer created with zconf_create_buffer()
1779 void zconf_delete_buffer (YY_BUFFER_STATE b )
1785 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1786 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1788 if ( b->yy_is_our_buffer )
1789 zconffree((void *) b->yy_ch_buf );
1791 zconffree((void *) b );
1794 /* Initializes or reinitializes a buffer.
1795 * This function is sometimes called more than once on the same buffer,
1796 * such as during a zconfrestart() or at EOF.
1798 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1803 zconf_flush_buffer(b );
1805 b->yy_input_file = file;
1806 b->yy_fill_buffer = 1;
1808 /* If b is the current buffer, then zconf_init_buffer was _probably_
1809 * called from zconfrestart() or through yy_get_next_buffer.
1810 * In that case, we don't want to reset the lineno or column.
1812 if (b != YY_CURRENT_BUFFER){
1813 b->yy_bs_lineno = 1;
1814 b->yy_bs_column = 0;
1817 b->yy_is_interactive = 0;
1822 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1823 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1826 void zconf_flush_buffer (YY_BUFFER_STATE b )
1833 /* We always need two end-of-buffer characters. The first causes
1834 * a transition to the end-of-buffer state. The second causes
1835 * a jam in that state.
1837 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1838 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1840 b->yy_buf_pos = &b->yy_ch_buf[0];
1843 b->yy_buffer_status = YY_BUFFER_NEW;
1845 if ( b == YY_CURRENT_BUFFER )
1846 zconf_load_buffer_state( );
1849 /** Pushes the new state onto the stack. The new state becomes
1850 * the current state. This function will allocate the stack
1852 * @param new_buffer The new state.
1855 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1857 if (new_buffer == NULL)
1860 zconfensure_buffer_stack();
1862 /* This block is copied from zconf_switch_to_buffer. */
1863 if ( YY_CURRENT_BUFFER )
1865 /* Flush out information for old buffer. */
1866 *(yy_c_buf_p) = (yy_hold_char);
1867 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1868 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1871 /* Only push if top exists. Otherwise, replace top. */
1872 if (YY_CURRENT_BUFFER)
1873 (yy_buffer_stack_top)++;
1874 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1876 /* copied from zconf_switch_to_buffer. */
1877 zconf_load_buffer_state( );
1878 (yy_did_buffer_switch_on_eof) = 1;
1881 /** Removes and deletes the top of the stack, if present.
1882 * The next element becomes the new top.
1885 void zconfpop_buffer_state (void)
1887 if (!YY_CURRENT_BUFFER)
1890 zconf_delete_buffer(YY_CURRENT_BUFFER );
1891 YY_CURRENT_BUFFER_LVALUE = NULL;
1892 if ((yy_buffer_stack_top) > 0)
1893 --(yy_buffer_stack_top);
1895 if (YY_CURRENT_BUFFER) {
1896 zconf_load_buffer_state( );
1897 (yy_did_buffer_switch_on_eof) = 1;
1901 /* Allocates the stack if it does not exist.
1902 * Guarantees space for at least one push.
1904 static void zconfensure_buffer_stack (void)
1908 if (!(yy_buffer_stack)) {
1910 /* First allocation is just for 2 elements, since we don't know if this
1911 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1912 * immediate realloc on the next call.
1915 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1916 (num_to_alloc * sizeof(struct yy_buffer_state*)
1919 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1921 (yy_buffer_stack_max) = num_to_alloc;
1922 (yy_buffer_stack_top) = 0;
1926 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1928 /* Increase the buffer to prepare for a possible push. */
1929 int grow_size = 8 /* arbitrary grow size */;
1931 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1932 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
1934 num_to_alloc * sizeof(struct yy_buffer_state*)
1937 /* zero only the new slots.*/
1938 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1939 (yy_buffer_stack_max) = num_to_alloc;
1943 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1944 * @param base the character buffer
1945 * @param size the size in bytes of the character buffer
1947 * @return the newly allocated buffer state object.
1949 YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1954 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1955 base[size-1] != YY_END_OF_BUFFER_CHAR )
1956 /* They forgot to leave room for the EOB's. */
1959 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1961 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
1963 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1964 b->yy_buf_pos = b->yy_ch_buf = base;
1965 b->yy_is_our_buffer = 0;
1966 b->yy_input_file = 0;
1967 b->yy_n_chars = b->yy_buf_size;
1968 b->yy_is_interactive = 0;
1970 b->yy_fill_buffer = 0;
1971 b->yy_buffer_status = YY_BUFFER_NEW;
1973 zconf_switch_to_buffer(b );
1978 /** Setup the input buffer state to scan a string. The next call to zconflex() will
1979 * scan from a @e copy of @a str.
1980 * @param yy_str a NUL-terminated string to scan
1982 * @return the newly allocated buffer state object.
1983 * @note If you want to scan bytes that may contain NUL values, then use
1984 * zconf_scan_bytes() instead.
1986 YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
1989 return zconf_scan_bytes(yy_str,strlen(yy_str) );
1992 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
1993 * scan from a @e copy of @a bytes.
1994 * @param bytes the byte buffer to scan
1995 * @param len the number of bytes in the buffer pointed to by @a bytes.
1997 * @return the newly allocated buffer state object.
1999 YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
2006 /* Get memory for full buffer, including space for trailing EOB's. */
2008 buf = (char *) zconfalloc(n );
2010 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2012 for ( i = 0; i < len; ++i )
2015 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2017 b = zconf_scan_buffer(buf,n );
2019 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2021 /* It's okay to grow etc. this buffer, and we should throw it
2022 * away when we're done.
2024 b->yy_is_our_buffer = 1;
2029 #ifndef YY_EXIT_FAILURE
2030 #define YY_EXIT_FAILURE 2
2033 static void yy_fatal_error (yyconst char* msg )
2035 (void) fprintf( stderr, "%s\n", msg );
2036 exit( YY_EXIT_FAILURE );
2039 /* Redefine yyless() so it works in section 3 code. */
2045 /* Undo effects of setting up zconftext. */ \
2046 int yyless_macro_arg = (n); \
2047 YY_LESS_LINENO(yyless_macro_arg);\
2048 zconftext[zconfleng] = (yy_hold_char); \
2049 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2050 (yy_hold_char) = *(yy_c_buf_p); \
2051 *(yy_c_buf_p) = '\0'; \
2052 zconfleng = yyless_macro_arg; \
2056 /* Accessor methods (get/set functions) to struct members. */
2058 /** Get the current line number.
2061 int zconfget_lineno (void)
2067 /** Get the input stream.
2070 FILE *zconfget_in (void)
2075 /** Get the output stream.
2078 FILE *zconfget_out (void)
2083 /** Get the length of the current token.
2086 int zconfget_leng (void)
2091 /** Get the current token.
2095 char *zconfget_text (void)
2100 /** Set the current line number.
2101 * @param line_number
2104 void zconfset_lineno (int line_number )
2107 zconflineno = line_number;
2110 /** Set the input stream. This does not discard the current
2112 * @param in_str A readable stream.
2114 * @see zconf_switch_to_buffer
2116 void zconfset_in (FILE * in_str )
2121 void zconfset_out (FILE * out_str )
2123 zconfout = out_str ;
2126 int zconfget_debug (void)
2128 return zconf_flex_debug;
2131 void zconfset_debug (int bdebug )
2133 zconf_flex_debug = bdebug ;
2136 /* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2137 int zconflex_destroy (void)
2140 /* Pop the buffer stack, destroying each element. */
2141 while(YY_CURRENT_BUFFER){
2142 zconf_delete_buffer(YY_CURRENT_BUFFER );
2143 YY_CURRENT_BUFFER_LVALUE = NULL;
2144 zconfpop_buffer_state();
2147 /* Destroy the stack itself. */
2148 zconffree((yy_buffer_stack) );
2149 (yy_buffer_stack) = NULL;
2155 * Internal utility routines.
2159 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2162 for ( i = 0; i < n; ++i )
2167 #ifdef YY_NEED_STRLEN
2168 static int yy_flex_strlen (yyconst char * s )
2171 for ( n = 0; s[n]; ++n )
2178 void *zconfalloc (yy_size_t size )
2180 return (void *) malloc( size );
2183 void *zconfrealloc (void * ptr, yy_size_t size )
2185 /* The cast to (char *) in the following accommodates both
2186 * implementations that use char* generic pointers, and those
2187 * that use void* generic pointers. It works with the latter
2188 * because both ANSI C and C++ allow castless assignment from
2189 * any pointer type to void*, and deal with argument conversions
2190 * as though doing an assignment.
2192 return (void *) realloc( (char *) ptr, size );
2195 void zconffree (void * ptr )
2197 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2200 #define YYTABLES_NAME "yytables"
2203 #undef YY_FLUSH_BUFFER
2205 #undef yy_new_buffer
2206 #undef yy_set_interactive
2208 #undef YY_DO_BEFORE_ACTION
2210 #ifdef YY_DECL_IS_OURS
2211 #undef YY_DECL_IS_OURS
2215 void zconf_starthelp(void)
2218 last_ts = first_ts = 0;
2222 static void zconf_endhelp(void)
2224 zconflval.string = text;
2229 * Try to open specified file with following names:
2232 * The latter is used when srctree is separate from objtree
2233 * when compiling the kernel.
2234 * Return NULL if file is not found.
2236 FILE *zconf_fopen(const char *name)
2241 f = fopen(name, "r");
2242 if (!f && name[0] != '/') {
2243 env = getenv(SRCTREE);
2245 char *fullname = alloca(strlen(env) + strlen(name) + 2);
2246 sprintf(fullname, "%s/%s", env, name);
2247 f = fopen(fullname, "r");
2253 void zconf_initscan(const char *name)
2255 zconfin = zconf_fopen(name);
2257 printf("can't find file %s\n", name);
2261 current_buf = malloc(sizeof(*current_buf));
2262 memset(current_buf, 0, sizeof(*current_buf));
2264 current_file = file_lookup(name);
2265 current_file->lineno = 1;
2266 current_file->flags = FILE_BUSY;
2269 void zconf_nextfile(const char *name)
2271 struct file *file = file_lookup(name);
2272 struct buffer *buf = malloc(sizeof(*buf));
2273 memset(buf, 0, sizeof(*buf));
2275 current_buf->state = YY_CURRENT_BUFFER;
2276 zconfin = zconf_fopen(name);
2278 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
2281 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2282 buf->parent = current_buf;
2285 if (file->flags & FILE_BUSY) {
2286 printf("recursive scan (%s)?\n", name);
2289 if (file->flags & FILE_SCANNED) {
2290 printf("file %s already scanned?\n", name);
2293 file->flags |= FILE_BUSY;
2295 file->parent = current_file;
2296 current_file = file;
2299 static void zconf_endfile(void)
2301 struct buffer *parent;
2303 current_file->flags |= FILE_SCANNED;
2304 current_file->flags &= ~FILE_BUSY;
2305 current_file = current_file->parent;
2307 parent = current_buf->parent;
2310 zconf_delete_buffer(YY_CURRENT_BUFFER);
2311 zconf_switch_to_buffer(parent->state);
2314 current_buf = parent;
2317 int zconf_lineno(void)
2319 return current_pos.lineno;
2322 char *zconf_curname(void)
2324 return current_pos.file ? current_pos.file->name : "<none>";