2 #line 3 "scripts/kconfig/lex.zconf.c"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
8 #define yy_create_buffer zconf_create_buffer
9 #define yy_delete_buffer zconf_delete_buffer
10 #define yy_flex_debug zconf_flex_debug
11 #define yy_init_buffer zconf_init_buffer
12 #define yy_flush_buffer zconf_flush_buffer
13 #define yy_load_buffer_state zconf_load_buffer_state
14 #define yy_switch_to_buffer zconf_switch_to_buffer
16 #define yyleng zconfleng
17 #define yylex zconflex
18 #define yylineno zconflineno
19 #define yyout zconfout
20 #define yyrestart zconfrestart
21 #define yytext zconftext
22 #define yywrap zconfwrap
23 #define yyalloc zconfalloc
24 #define yyrealloc zconfrealloc
25 #define yyfree zconffree
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 33
31 #if YY_FLEX_SUBMINOR_VERSION > 0
35 /* First, we deal with platform-specific or compiler-specific issues. */
37 /* begin standard C headers. */
43 /* end standard C headers. */
45 /* flex integer type definitions */
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52 #if __STDC_VERSION__ >= 199901L
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
77 /* Limits of integral types. */
79 #define INT8_MIN (-128)
82 #define INT16_MIN (-32767-1)
85 #define INT32_MIN (-2147483647-1)
88 #define INT8_MAX (127)
91 #define INT16_MAX (32767)
94 #define INT32_MAX (2147483647)
97 #define UINT8_MAX (255U)
100 #define UINT16_MAX (65535U)
103 #define UINT32_MAX (4294967295U)
106 #endif /* ! FLEXINT_H */
110 /* The "const" storage-class-modifier is valid. */
113 #else /* ! __cplusplus */
119 #endif /* __STDC__ */
120 #endif /* ! __cplusplus */
123 #define yyconst const
128 /* Returned upon end-of-file. */
131 /* Promotes a possibly negative, possibly signed char to an unsigned
132 * integer for use as an array index. If the signed char is negative,
133 * we want to instead treat it as an 8-bit unsigned char, hence the
136 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
138 /* Enter a start condition. This macro really ought to take a parameter,
139 * but we do it the disgusting crufty way forced on us by the ()-less
140 * definition of BEGIN.
142 #define BEGIN (yy_start) = 1 + 2 *
144 /* Translate the current start state into a value that can be later handed
145 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 #define YY_START (((yy_start) - 1) / 2)
149 #define YYSTATE YY_START
151 /* Action number for EOF rule of a given start state. */
152 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154 /* Special action meaning "start processing a new file". */
155 #define YY_NEW_FILE zconfrestart(zconfin )
157 #define YY_END_OF_BUFFER_CHAR 0
159 /* Size of default input buffer. */
161 #define YY_BUF_SIZE 16384
164 /* The state buf must be large enough to hold one state per character in the main buffer.
166 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
168 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
169 #define YY_TYPEDEF_YY_BUFFER_STATE
170 typedef struct yy_buffer_state *YY_BUFFER_STATE;
173 extern int zconfleng;
175 extern FILE *zconfin, *zconfout;
177 #define EOB_ACT_CONTINUE_SCAN 0
178 #define EOB_ACT_END_OF_FILE 1
179 #define EOB_ACT_LAST_MATCH 2
181 #define YY_LESS_LINENO(n)
183 /* Return all but the first "n" matched characters back to the input stream. */
187 /* Undo effects of setting up zconftext. */ \
188 int yyless_macro_arg = (n); \
189 YY_LESS_LINENO(yyless_macro_arg);\
190 *yy_cp = (yy_hold_char); \
191 YY_RESTORE_YY_MORE_OFFSET \
192 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
193 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
197 #define unput(c) yyunput( c, (yytext_ptr) )
199 /* The following is because we cannot portably get our hands on size_t
200 * (without autoconf's help, which isn't available because we want
201 * flex-generated scanners to compile on their own).
204 #ifndef YY_TYPEDEF_YY_SIZE_T
205 #define YY_TYPEDEF_YY_SIZE_T
206 typedef unsigned int yy_size_t;
209 #ifndef YY_STRUCT_YY_BUFFER_STATE
210 #define YY_STRUCT_YY_BUFFER_STATE
211 struct yy_buffer_state
215 char *yy_ch_buf; /* input buffer */
216 char *yy_buf_pos; /* current position in input buffer */
218 /* Size of input buffer in bytes, not including room for EOB
221 yy_size_t yy_buf_size;
223 /* Number of characters read into yy_ch_buf, not including EOB
228 /* Whether we "own" the buffer - i.e., we know we created it,
229 * and can realloc() it to grow it, and should free() it to
232 int yy_is_our_buffer;
234 /* Whether this is an "interactive" input source; if so, and
235 * if we're using stdio for input, then we want to use getc()
236 * instead of fread(), to make sure we stop fetching input after
239 int yy_is_interactive;
241 /* Whether we're considered to be at the beginning of a line.
242 * If so, '^' rules will be active on the next match, otherwise
247 int yy_bs_lineno; /**< The line count. */
248 int yy_bs_column; /**< The column count. */
250 /* Whether to try to fill the input buffer when we reach the
255 int yy_buffer_status;
257 #define YY_BUFFER_NEW 0
258 #define YY_BUFFER_NORMAL 1
259 /* When an EOF's been seen but there's still some text to process
260 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
261 * shouldn't try reading from the input source any more. We might
262 * still have a bunch of tokens to match, though, because of
263 * possible backing-up.
265 * When we actually see the EOF, we change the status to "new"
266 * (via zconfrestart()), so that the user can continue scanning by
267 * just pointing zconfin at a new input file.
269 #define YY_BUFFER_EOF_PENDING 2
272 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
274 /* Stack of input buffers. */
275 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
276 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
277 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
279 /* We provide macros for accessing buffer states in case in the
280 * future we want to put the buffer states in a more general
283 * Returns the top of the stack, or NULL.
285 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
286 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
289 /* Same as previous macro, but useful when we know that the buffer stack is not
290 * NULL or when we need an lvalue. For internal use only.
292 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
294 /* yy_hold_char holds the character lost when zconftext is formed. */
295 static char yy_hold_char;
296 static int yy_n_chars; /* number of characters read into yy_ch_buf */
299 /* Points to current character in buffer. */
300 static char *yy_c_buf_p = (char *) 0;
301 static int yy_init = 0; /* whether we need to initialize */
302 static int yy_start = 0; /* start state number */
304 /* Flag which is used to allow zconfwrap()'s to do buffer switches
305 * instead of setting up a fresh zconfin. A bit of a hack ...
307 static int yy_did_buffer_switch_on_eof;
309 void zconfrestart (FILE *input_file );
310 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
311 YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
312 void zconf_delete_buffer (YY_BUFFER_STATE b );
313 void zconf_flush_buffer (YY_BUFFER_STATE b );
314 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
315 void zconfpop_buffer_state (void );
317 static void zconfensure_buffer_stack (void );
318 static void zconf_load_buffer_state (void );
319 static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
321 #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
323 YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
324 YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
325 YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
327 void *zconfalloc (yy_size_t );
328 void *zconfrealloc (void *,yy_size_t );
329 void zconffree (void * );
331 #define yy_new_buffer zconf_create_buffer
333 #define yy_set_interactive(is_interactive) \
335 if ( ! YY_CURRENT_BUFFER ){ \
336 zconfensure_buffer_stack (); \
337 YY_CURRENT_BUFFER_LVALUE = \
338 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
340 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
343 #define yy_set_bol(at_bol) \
345 if ( ! YY_CURRENT_BUFFER ){\
346 zconfensure_buffer_stack (); \
347 YY_CURRENT_BUFFER_LVALUE = \
348 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
350 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
353 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
355 /* Begin user sect3 */
357 #define zconfwrap(n) 1
358 #define YY_SKIP_YYWRAP
360 typedef unsigned char YY_CHAR;
362 FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
364 typedef int yy_state_type;
366 extern int zconflineno;
370 extern char *zconftext;
371 #define yytext_ptr zconftext
372 static yyconst flex_int16_t yy_nxt[][17] =
375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
380 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
381 12, 12, 12, 12, 12, 12, 12
385 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
386 12, 12, 12, 12, 12, 12, 12
390 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
391 16, 16, 16, 18, 16, 16, 16
395 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
396 16, 16, 16, 18, 16, 16, 16
401 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
402 19, 19, 19, 19, 19, 19, 19
406 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
407 19, 19, 19, 19, 19, 19, 19
411 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
412 22, 22, 22, 22, 22, 25, 22
416 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
417 22, 22, 22, 22, 22, 25, 22
421 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
422 33, 34, 35, 35, 36, 37, 38
427 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
428 33, 34, 35, 35, 36, 37, 38
432 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
433 -11, -11, -11, -11, -11, -11, -11
437 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
438 -12, -12, -12, -12, -12, -12, -12
442 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
443 -13, -13, -13, -13, -13, -13, -13
447 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
448 -14, -14, -14, -14, -14, -14, -14
453 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
454 42, 42, 42, 42, 42, 42, 42
458 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
459 -16, -16, -16, -16, -16, -16, -16
463 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
464 -17, -17, -17, -17, -17, -17, -17
468 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
469 -18, -18, -18, 44, -18, -18, -18
473 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
474 45, 45, 45, 45, 45, 45, 45
479 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
480 -20, -20, -20, -20, -20, -20, -20
484 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
485 48, 48, 48, 48, 48, 48, 48
489 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
490 49, 49, 49, 49, 49, -22, 49
494 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
495 -23, -23, -23, -23, -23, -23, -23
499 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
500 -24, -24, -24, -24, -24, -24, -24
505 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
506 51, 51, 51, 51, 51, 51, 51
510 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
511 -26, -26, -26, -26, -26, -26, -26
515 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
516 -27, -27, -27, -27, -27, -27, -27
520 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
521 -28, -28, -28, -28, 53, -28, -28
525 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
526 -29, -29, -29, -29, -29, -29, -29
531 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
532 54, 54, 54, 54, 54, 54, 54
536 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
537 -31, -31, -31, -31, -31, -31, -31
541 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
542 -32, -32, -32, -32, -32, -32, -32
546 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
547 -33, -33, -33, -33, -33, -33, -33
551 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
552 -34, 56, 57, 57, -34, -34, -34
557 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
558 -35, 57, 57, 57, -35, -35, -35
562 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
563 -36, -36, -36, -36, -36, -36, -36
567 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
568 -37, -37, -37, -37, -37, -37, -37
572 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
573 -38, -38, -38, -38, -38, -38, 59
577 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
578 -39, -39, -39, -39, -39, -39, -39
583 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
584 -40, -40, -40, -40, -40, -40, -40
588 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
589 42, 42, 42, 42, 42, 42, 42
593 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
594 42, 42, 42, 42, 42, 42, 42
598 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
599 -43, -43, -43, -43, -43, -43, -43
603 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
604 -44, -44, -44, 44, -44, -44, -44
609 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
610 45, 45, 45, 45, 45, 45, 45
614 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
615 -46, -46, -46, -46, -46, -46, -46
619 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
620 48, 48, 48, 48, 48, 48, 48
624 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
625 -48, -48, -48, -48, -48, -48, -48
629 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
630 49, 49, 49, 49, 49, -49, 49
635 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
636 -50, -50, -50, -50, -50, -50, -50
640 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
641 -51, -51, -51, -51, -51, -51, -51
645 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
646 -52, -52, -52, -52, -52, -52, -52
650 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
651 -53, -53, -53, -53, -53, -53, -53
655 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
656 54, 54, 54, 54, 54, 54, 54
661 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
662 -55, -55, -55, -55, -55, -55, -55
666 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
667 -56, 60, 57, 57, -56, -56, -56
671 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
672 -57, 57, 57, 57, -57, -57, -57
676 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
677 -58, -58, -58, -58, -58, -58, -58
681 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
682 -59, -59, -59, -59, -59, -59, -59
687 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
688 -60, 57, 57, 57, -60, -60, -60
693 static yy_state_type yy_get_previous_state (void );
694 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
695 static int yy_get_next_buffer (void );
696 static void yy_fatal_error (yyconst char msg[] );
698 /* Done after the current pattern has been matched and before the
699 * corresponding action - sets up zconftext.
701 #define YY_DO_BEFORE_ACTION \
702 (yytext_ptr) = yy_bp; \
703 zconfleng = (size_t) (yy_cp - yy_bp); \
704 (yy_hold_char) = *yy_cp; \
706 (yy_c_buf_p) = yy_cp;
708 #define YY_NUM_RULES 33
709 #define YY_END_OF_BUFFER 34
710 /* This struct is not used in this scanner,
711 but its presence is necessary. */
714 flex_int32_t yy_verify;
717 static yyconst flex_int16_t yy_accept[61] =
719 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
720 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
721 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
722 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
723 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
724 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
727 static yyconst flex_int32_t yy_ec[256] =
729 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
730 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
731 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
732 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
733 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
734 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
735 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
736 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
737 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
738 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
740 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
741 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
742 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
743 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
744 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
745 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
746 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
747 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
748 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
749 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
751 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
752 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
754 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
759 extern int zconf_flex_debug;
760 int zconf_flex_debug = 0;
762 /* The intent behind this definition is that it'll catch
763 * any uses of REJECT which flex missed.
765 #define REJECT reject_used_but_not_detected
766 #define yymore() yymore_used_but_not_detected
767 #define YY_MORE_ADJ 0
768 #define YY_RESTORE_YY_MORE_OFFSET
772 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
773 * Released under the terms of the GNU GPL v2.0.
782 #define LKC_DIRECT_LINK
785 #define START_STRSIZE 16
793 static int text_size, text_asize;
796 struct buffer *parent;
797 YY_BUFFER_STATE state;
800 struct buffer *current_buf;
802 static int last_ts, first_ts;
804 static void zconf_endhelp(void);
805 static void zconf_endfile(void);
807 void new_string(void)
809 text = malloc(START_STRSIZE);
810 text_asize = START_STRSIZE;
815 void append_string(const char *str, int size)
817 int new_size = text_size + size + 1;
818 if (new_size > text_asize) {
819 new_size += START_STRSIZE - 1;
820 new_size &= -START_STRSIZE;
821 text = realloc(text, new_size);
822 text_asize = new_size;
824 memcpy(text + text_size, str, size);
829 void alloc_string(const char *str, int size)
831 text = malloc(size + 1);
832 memcpy(text, str, size);
842 #ifndef YY_NO_UNISTD_H
843 /* Special case for "unistd.h", since it is non-ANSI. We include it way
844 * down here because we want the user's section 1 to have been scanned first.
845 * The user has a chance to override it with an option.
850 #ifndef YY_EXTRA_TYPE
851 #define YY_EXTRA_TYPE void *
854 static int yy_init_globals (void );
856 /* Macros after this point can all be overridden by user definitions in
860 #ifndef YY_SKIP_YYWRAP
862 extern "C" int zconfwrap (void );
864 extern int zconfwrap (void );
868 static void yyunput (int c,char *buf_ptr );
871 static void yy_flex_strncpy (char *,yyconst char *,int );
874 #ifdef YY_NEED_STRLEN
875 static int yy_flex_strlen (yyconst char * );
881 static int yyinput (void );
883 static int input (void );
888 /* Amount of stuff to slurp up with each read. */
889 #ifndef YY_READ_BUF_SIZE
890 #define YY_READ_BUF_SIZE 8192
893 /* Copy whatever the last rule matched to the standard output. */
895 /* This used to be an fputs(), but since the string might contain NUL's,
896 * we now use fwrite().
898 #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
901 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
902 * is returned in "result".
905 #define YY_INPUT(buf,result,max_size) \
907 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
909 if( errno != EINTR) \
911 YY_FATAL_ERROR( "input in flex scanner failed" ); \
921 /* No semi-colon after return; correct usage is to write "yyterminate();" -
922 * we don't want an extra ';' after the "return" because that will cause
923 * some compilers to complain about unreachable statements.
926 #define yyterminate() return YY_NULL
929 /* Number of entries by which start-condition stack grows. */
930 #ifndef YY_START_STACK_INCR
931 #define YY_START_STACK_INCR 25
934 /* Report a fatal error. */
935 #ifndef YY_FATAL_ERROR
936 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
939 /* end tables serialization structures and prototypes */
941 /* Default declaration of generated scanner - a define so the user can
942 * easily add parameters.
945 #define YY_DECL_IS_OURS 1
947 extern int zconflex (void);
949 #define YY_DECL int zconflex (void)
950 #endif /* !YY_DECL */
952 /* Code executed at the beginning of each rule, after zconftext and zconfleng
955 #ifndef YY_USER_ACTION
956 #define YY_USER_ACTION
959 /* Code executed at the end of each rule. */
961 #define YY_BREAK break;
964 #define YY_RULE_SETUP \
967 /** The main scanner function which does all the work.
971 register yy_state_type yy_current_state;
972 register char *yy_cp, *yy_bp;
987 (yy_start) = 1; /* first start state */
995 if ( ! YY_CURRENT_BUFFER ) {
996 zconfensure_buffer_stack ();
997 YY_CURRENT_BUFFER_LVALUE =
998 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1001 zconf_load_buffer_state( );
1004 while ( 1 ) /* loops until end-of-file is reached */
1006 yy_cp = (yy_c_buf_p);
1008 /* Support of zconftext. */
1009 *yy_cp = (yy_hold_char);
1011 /* yy_bp points to the position in yy_ch_buf of the start of
1016 yy_current_state = (yy_start);
1018 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
1021 yy_current_state = -yy_current_state;
1024 yy_act = yy_accept[yy_current_state];
1026 YY_DO_BEFORE_ACTION;
1028 do_action: /* This label is used only to access EOF actions. */
1031 { /* beginning of action switch */
1033 /* rule 1 can match eol */
1035 /* rule 2 can match eol */
1038 current_file->lineno++;
1055 unput(zconftext[0]);
1063 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1065 current_pos.file = current_file;
1066 current_pos.lineno = current_file->lineno;
1067 if (id && id->flags & TF_COMMAND) {
1071 alloc_string(zconftext, zconfleng);
1072 zconflval.string = text;
1081 /* rule 8 can match eol */
1085 current_file->lineno++;
1100 return T_OPEN_PAREN;
1104 return T_CLOSE_PAREN;
1127 /* rule 17 can match eol */
1129 BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1138 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1139 if (id && id->flags & TF_PARAM) {
1143 alloc_string(zconftext, zconfleng);
1144 zconflval.string = text;
1153 /* rule 21 can match eol */
1155 current_file->lineno++;
1161 case YY_STATE_EOF(PARAM):
1168 /* rule 23 can match eol */
1169 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1170 (yy_c_buf_p) = yy_cp -= 1;
1171 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1174 append_string(zconftext, zconfleng);
1175 zconflval.string = text;
1176 return T_WORD_QUOTE;
1182 append_string(zconftext, zconfleng);
1186 /* rule 25 can match eol */
1187 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1188 (yy_c_buf_p) = yy_cp -= 1;
1189 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1192 append_string(zconftext + 1, zconfleng - 1);
1193 zconflval.string = text;
1194 return T_WORD_QUOTE;
1200 append_string(zconftext + 1, zconfleng - 1);
1206 if (str == zconftext[0]) {
1208 zconflval.string = text;
1209 return T_WORD_QUOTE;
1211 append_string(zconftext, 1);
1215 /* rule 28 can match eol */
1218 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1219 current_file->lineno++;
1224 case YY_STATE_EOF(STRING):
1234 for (i = 0; i < zconfleng; i++) {
1235 if (zconftext[i] == '\t')
1242 if (ts < first_ts) {
1248 append_string(" ", 8);
1251 append_string(" ", ts);
1256 /* rule 30 can match eol */
1257 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1258 (yy_c_buf_p) = yy_cp -= 1;
1259 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1262 current_file->lineno++;
1268 /* rule 31 can match eol */
1271 current_file->lineno++;
1272 append_string("\n", 1);
1279 if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
1283 append_string(zconftext, zconfleng);
1288 case YY_STATE_EOF(HELP):
1295 case YY_STATE_EOF(INITIAL):
1296 case YY_STATE_EOF(COMMAND):
1308 YY_FATAL_ERROR( "flex scanner jammed" );
1311 case YY_END_OF_BUFFER:
1313 /* Amount of text matched not including the EOB char. */
1314 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1316 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1317 *yy_cp = (yy_hold_char);
1318 YY_RESTORE_YY_MORE_OFFSET
1320 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1322 /* We're scanning a new file or input source. It's
1323 * possible that this happened because the user
1324 * just pointed zconfin at a new source and called
1325 * zconflex(). If so, then we have to assure
1326 * consistency between YY_CURRENT_BUFFER and our
1327 * globals. Here is the right place to do so, because
1328 * this is the first action (other than possibly a
1329 * back-up) that will match for the new input source.
1331 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1332 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1333 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1336 /* Note that here we test for yy_c_buf_p "<=" to the position
1337 * of the first EOB in the buffer, since yy_c_buf_p will
1338 * already have been incremented past the NUL character
1339 * (since all states make transitions on EOB to the
1340 * end-of-buffer state). Contrast this with the test
1343 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1344 { /* This was really a NUL. */
1345 yy_state_type yy_next_state;
1347 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1349 yy_current_state = yy_get_previous_state( );
1351 /* Okay, we're now positioned to make the NUL
1352 * transition. We couldn't have
1353 * yy_get_previous_state() go ahead and do it
1354 * for us because it doesn't know how to deal
1355 * with the possibility of jamming (and we don't
1356 * want to build jamming into it because then it
1357 * will run more slowly).
1360 yy_next_state = yy_try_NUL_trans( yy_current_state );
1362 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1364 if ( yy_next_state )
1366 /* Consume the NUL. */
1367 yy_cp = ++(yy_c_buf_p);
1368 yy_current_state = yy_next_state;
1374 yy_cp = (yy_c_buf_p);
1375 goto yy_find_action;
1379 else switch ( yy_get_next_buffer( ) )
1381 case EOB_ACT_END_OF_FILE:
1383 (yy_did_buffer_switch_on_eof) = 0;
1387 /* Note: because we've taken care in
1388 * yy_get_next_buffer() to have set up
1389 * zconftext, we can now set up
1390 * yy_c_buf_p so that if some total
1391 * hoser (like flex itself) wants to
1392 * call the scanner after we return the
1393 * YY_NULL, it'll still work - another
1394 * YY_NULL will get returned.
1396 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1398 yy_act = YY_STATE_EOF(YY_START);
1404 if ( ! (yy_did_buffer_switch_on_eof) )
1410 case EOB_ACT_CONTINUE_SCAN:
1412 (yytext_ptr) + yy_amount_of_matched_text;
1414 yy_current_state = yy_get_previous_state( );
1416 yy_cp = (yy_c_buf_p);
1417 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1420 case EOB_ACT_LAST_MATCH:
1422 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1424 yy_current_state = yy_get_previous_state( );
1426 yy_cp = (yy_c_buf_p);
1427 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1428 goto yy_find_action;
1435 "fatal flex scanner internal error--no action found" );
1436 } /* end of action switch */
1437 } /* end of scanning one token */
1438 } /* end of zconflex */
1440 /* yy_get_next_buffer - try to read in a new buffer
1442 * Returns a code representing an action:
1443 * EOB_ACT_LAST_MATCH -
1444 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1445 * EOB_ACT_END_OF_FILE - end of file
1447 static int yy_get_next_buffer (void)
1449 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1450 register char *source = (yytext_ptr);
1451 register int number_to_move, i;
1454 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1456 "fatal flex scanner internal error--end of buffer missed" );
1458 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1459 { /* Don't try to fill the buffer, so this is an EOF. */
1460 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1462 /* We matched a single character, the EOB, so
1463 * treat this as a final EOF.
1465 return EOB_ACT_END_OF_FILE;
1470 /* We matched some text prior to the EOB, first
1473 return EOB_ACT_LAST_MATCH;
1477 /* Try to read more data. */
1479 /* First move last chars to start of buffer. */
1480 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1482 for ( i = 0; i < number_to_move; ++i )
1483 *(dest++) = *(source++);
1485 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1486 /* don't do the read, it's not guaranteed to return an EOF,
1489 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1494 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1496 while ( num_to_read <= 0 )
1497 { /* Not enough room in the buffer - grow it. */
1499 /* just a shorter name for the current buffer */
1500 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1502 int yy_c_buf_p_offset =
1503 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1505 if ( b->yy_is_our_buffer )
1507 int new_size = b->yy_buf_size * 2;
1509 if ( new_size <= 0 )
1510 b->yy_buf_size += b->yy_buf_size / 8;
1512 b->yy_buf_size *= 2;
1514 b->yy_ch_buf = (char *)
1515 /* Include room in for 2 EOB chars. */
1516 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1519 /* Can't grow it, we don't own it. */
1522 if ( ! b->yy_ch_buf )
1524 "fatal error - scanner input buffer overflow" );
1526 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1528 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1533 if ( num_to_read > YY_READ_BUF_SIZE )
1534 num_to_read = YY_READ_BUF_SIZE;
1536 /* Read in more data. */
1537 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1538 (yy_n_chars), num_to_read );
1540 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1543 if ( (yy_n_chars) == 0 )
1545 if ( number_to_move == YY_MORE_ADJ )
1547 ret_val = EOB_ACT_END_OF_FILE;
1548 zconfrestart(zconfin );
1553 ret_val = EOB_ACT_LAST_MATCH;
1554 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1555 YY_BUFFER_EOF_PENDING;
1560 ret_val = EOB_ACT_CONTINUE_SCAN;
1562 (yy_n_chars) += number_to_move;
1563 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1564 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1566 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1571 /* yy_get_previous_state - get the state just before the EOB char was reached */
1573 static yy_state_type yy_get_previous_state (void)
1575 register yy_state_type yy_current_state;
1576 register char *yy_cp;
1578 yy_current_state = (yy_start);
1580 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1582 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1585 return yy_current_state;
1588 /* yy_try_NUL_trans - try to make a transition on the NUL character
1591 * next_state = yy_try_NUL_trans( current_state );
1593 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1595 register int yy_is_jam;
1597 yy_current_state = yy_nxt[yy_current_state][1];
1598 yy_is_jam = (yy_current_state <= 0);
1600 return yy_is_jam ? 0 : yy_current_state;
1603 static void yyunput (int c, register char * yy_bp )
1605 register char *yy_cp;
1607 yy_cp = (yy_c_buf_p);
1609 /* undo effects of setting up zconftext */
1610 *yy_cp = (yy_hold_char);
1612 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1613 { /* need to shift things up to make room */
1614 /* +2 for EOB chars. */
1615 register int number_to_move = (yy_n_chars) + 2;
1616 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1617 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1618 register char *source =
1619 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1621 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1622 *--dest = *--source;
1624 yy_cp += (int) (dest - source);
1625 yy_bp += (int) (dest - source);
1626 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1627 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1629 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1630 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1633 *--yy_cp = (char) c;
1635 (yytext_ptr) = yy_bp;
1636 (yy_hold_char) = *yy_cp;
1637 (yy_c_buf_p) = yy_cp;
1642 static int yyinput (void)
1644 static int input (void)
1650 *(yy_c_buf_p) = (yy_hold_char);
1652 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1654 /* yy_c_buf_p now points to the character we want to return.
1655 * If this occurs *before* the EOB characters, then it's a
1656 * valid NUL; if not, then we've hit the end of the buffer.
1658 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1659 /* This was really a NUL. */
1660 *(yy_c_buf_p) = '\0';
1663 { /* need more input */
1664 int offset = (yy_c_buf_p) - (yytext_ptr);
1667 switch ( yy_get_next_buffer( ) )
1669 case EOB_ACT_LAST_MATCH:
1670 /* This happens because yy_g_n_b()
1671 * sees that we've accumulated a
1672 * token and flags that we need to
1673 * try matching the token before
1674 * proceeding. But for input(),
1675 * there's no matching to consider.
1676 * So convert the EOB_ACT_LAST_MATCH
1677 * to EOB_ACT_END_OF_FILE.
1680 /* Reset buffer status. */
1681 zconfrestart(zconfin );
1685 case EOB_ACT_END_OF_FILE:
1690 if ( ! (yy_did_buffer_switch_on_eof) )
1699 case EOB_ACT_CONTINUE_SCAN:
1700 (yy_c_buf_p) = (yytext_ptr) + offset;
1706 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1707 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1708 (yy_hold_char) = *++(yy_c_buf_p);
1712 #endif /* ifndef YY_NO_INPUT */
1714 /** Immediately switch to a different input stream.
1715 * @param input_file A readable stream.
1717 * @note This function does not reset the start condition to @c INITIAL .
1719 void zconfrestart (FILE * input_file )
1722 if ( ! YY_CURRENT_BUFFER ){
1723 zconfensure_buffer_stack ();
1724 YY_CURRENT_BUFFER_LVALUE =
1725 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1728 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1729 zconf_load_buffer_state( );
1732 /** Switch to a different input buffer.
1733 * @param new_buffer The new input buffer.
1736 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1739 /* TODO. We should be able to replace this entire function body
1741 * zconfpop_buffer_state();
1742 * zconfpush_buffer_state(new_buffer);
1744 zconfensure_buffer_stack ();
1745 if ( YY_CURRENT_BUFFER == new_buffer )
1748 if ( YY_CURRENT_BUFFER )
1750 /* Flush out information for old buffer. */
1751 *(yy_c_buf_p) = (yy_hold_char);
1752 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1753 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1756 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1757 zconf_load_buffer_state( );
1759 /* We don't actually know whether we did this switch during
1760 * EOF (zconfwrap()) processing, but the only time this flag
1761 * is looked at is after zconfwrap() is called, so it's safe
1762 * to go ahead and always set it.
1764 (yy_did_buffer_switch_on_eof) = 1;
1767 static void zconf_load_buffer_state (void)
1769 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1770 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1771 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1772 (yy_hold_char) = *(yy_c_buf_p);
1775 /** Allocate and initialize an input buffer state.
1776 * @param file A readable stream.
1777 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1779 * @return the allocated buffer state.
1781 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1785 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1787 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1789 b->yy_buf_size = size;
1791 /* yy_ch_buf has to be 2 characters longer than the size given because
1792 * we need to put in 2 end-of-buffer characters.
1794 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1795 if ( ! b->yy_ch_buf )
1796 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1798 b->yy_is_our_buffer = 1;
1800 zconf_init_buffer(b,file );
1805 /** Destroy the buffer.
1806 * @param b a buffer created with zconf_create_buffer()
1809 void zconf_delete_buffer (YY_BUFFER_STATE b )
1815 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1816 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1818 if ( b->yy_is_our_buffer )
1819 zconffree((void *) b->yy_ch_buf );
1821 zconffree((void *) b );
1824 /* Initializes or reinitializes a buffer.
1825 * This function is sometimes called more than once on the same buffer,
1826 * such as during a zconfrestart() or at EOF.
1828 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1833 zconf_flush_buffer(b );
1835 b->yy_input_file = file;
1836 b->yy_fill_buffer = 1;
1838 /* If b is the current buffer, then zconf_init_buffer was _probably_
1839 * called from zconfrestart() or through yy_get_next_buffer.
1840 * In that case, we don't want to reset the lineno or column.
1842 if (b != YY_CURRENT_BUFFER){
1843 b->yy_bs_lineno = 1;
1844 b->yy_bs_column = 0;
1847 b->yy_is_interactive = 0;
1852 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1853 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1856 void zconf_flush_buffer (YY_BUFFER_STATE b )
1863 /* We always need two end-of-buffer characters. The first causes
1864 * a transition to the end-of-buffer state. The second causes
1865 * a jam in that state.
1867 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1868 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1870 b->yy_buf_pos = &b->yy_ch_buf[0];
1873 b->yy_buffer_status = YY_BUFFER_NEW;
1875 if ( b == YY_CURRENT_BUFFER )
1876 zconf_load_buffer_state( );
1879 /** Pushes the new state onto the stack. The new state becomes
1880 * the current state. This function will allocate the stack
1882 * @param new_buffer The new state.
1885 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1887 if (new_buffer == NULL)
1890 zconfensure_buffer_stack();
1892 /* This block is copied from zconf_switch_to_buffer. */
1893 if ( YY_CURRENT_BUFFER )
1895 /* Flush out information for old buffer. */
1896 *(yy_c_buf_p) = (yy_hold_char);
1897 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1898 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1901 /* Only push if top exists. Otherwise, replace top. */
1902 if (YY_CURRENT_BUFFER)
1903 (yy_buffer_stack_top)++;
1904 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1906 /* copied from zconf_switch_to_buffer. */
1907 zconf_load_buffer_state( );
1908 (yy_did_buffer_switch_on_eof) = 1;
1911 /** Removes and deletes the top of the stack, if present.
1912 * The next element becomes the new top.
1915 void zconfpop_buffer_state (void)
1917 if (!YY_CURRENT_BUFFER)
1920 zconf_delete_buffer(YY_CURRENT_BUFFER );
1921 YY_CURRENT_BUFFER_LVALUE = NULL;
1922 if ((yy_buffer_stack_top) > 0)
1923 --(yy_buffer_stack_top);
1925 if (YY_CURRENT_BUFFER) {
1926 zconf_load_buffer_state( );
1927 (yy_did_buffer_switch_on_eof) = 1;
1931 /* Allocates the stack if it does not exist.
1932 * Guarantees space for at least one push.
1934 static void zconfensure_buffer_stack (void)
1938 if (!(yy_buffer_stack)) {
1940 /* First allocation is just for 2 elements, since we don't know if this
1941 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1942 * immediate realloc on the next call.
1945 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1946 (num_to_alloc * sizeof(struct yy_buffer_state*)
1949 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1951 (yy_buffer_stack_max) = num_to_alloc;
1952 (yy_buffer_stack_top) = 0;
1956 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1958 /* Increase the buffer to prepare for a possible push. */
1959 int grow_size = 8 /* arbitrary grow size */;
1961 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1962 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
1964 num_to_alloc * sizeof(struct yy_buffer_state*)
1967 /* zero only the new slots.*/
1968 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1969 (yy_buffer_stack_max) = num_to_alloc;
1973 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1974 * @param base the character buffer
1975 * @param size the size in bytes of the character buffer
1977 * @return the newly allocated buffer state object.
1979 YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1984 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1985 base[size-1] != YY_END_OF_BUFFER_CHAR )
1986 /* They forgot to leave room for the EOB's. */
1989 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1991 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
1993 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1994 b->yy_buf_pos = b->yy_ch_buf = base;
1995 b->yy_is_our_buffer = 0;
1996 b->yy_input_file = 0;
1997 b->yy_n_chars = b->yy_buf_size;
1998 b->yy_is_interactive = 0;
2000 b->yy_fill_buffer = 0;
2001 b->yy_buffer_status = YY_BUFFER_NEW;
2003 zconf_switch_to_buffer(b );
2008 /** Setup the input buffer state to scan a string. The next call to zconflex() will
2009 * scan from a @e copy of @a str.
2010 * @param str a NUL-terminated string to scan
2012 * @return the newly allocated buffer state object.
2013 * @note If you want to scan bytes that may contain NUL values, then use
2014 * zconf_scan_bytes() instead.
2016 YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
2019 return zconf_scan_bytes(yystr,strlen(yystr) );
2022 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
2023 * scan from a @e copy of @a bytes.
2024 * @param bytes the byte buffer to scan
2025 * @param len the number of bytes in the buffer pointed to by @a bytes.
2027 * @return the newly allocated buffer state object.
2029 YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
2036 /* Get memory for full buffer, including space for trailing EOB's. */
2037 n = _yybytes_len + 2;
2038 buf = (char *) zconfalloc(n );
2040 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2042 for ( i = 0; i < _yybytes_len; ++i )
2043 buf[i] = yybytes[i];
2045 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2047 b = zconf_scan_buffer(buf,n );
2049 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2051 /* It's okay to grow etc. this buffer, and we should throw it
2052 * away when we're done.
2054 b->yy_is_our_buffer = 1;
2059 #ifndef YY_EXIT_FAILURE
2060 #define YY_EXIT_FAILURE 2
2063 static void yy_fatal_error (yyconst char* msg )
2065 (void) fprintf( stderr, "%s\n", msg );
2066 exit( YY_EXIT_FAILURE );
2069 /* Redefine yyless() so it works in section 3 code. */
2075 /* Undo effects of setting up zconftext. */ \
2076 int yyless_macro_arg = (n); \
2077 YY_LESS_LINENO(yyless_macro_arg);\
2078 zconftext[zconfleng] = (yy_hold_char); \
2079 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2080 (yy_hold_char) = *(yy_c_buf_p); \
2081 *(yy_c_buf_p) = '\0'; \
2082 zconfleng = yyless_macro_arg; \
2086 /* Accessor methods (get/set functions) to struct members. */
2088 /** Get the current line number.
2091 int zconfget_lineno (void)
2097 /** Get the input stream.
2100 FILE *zconfget_in (void)
2105 /** Get the output stream.
2108 FILE *zconfget_out (void)
2113 /** Get the length of the current token.
2116 int zconfget_leng (void)
2121 /** Get the current token.
2125 char *zconfget_text (void)
2130 /** Set the current line number.
2131 * @param line_number
2134 void zconfset_lineno (int line_number )
2137 zconflineno = line_number;
2140 /** Set the input stream. This does not discard the current
2142 * @param in_str A readable stream.
2144 * @see zconf_switch_to_buffer
2146 void zconfset_in (FILE * in_str )
2151 void zconfset_out (FILE * out_str )
2153 zconfout = out_str ;
2156 int zconfget_debug (void)
2158 return zconf_flex_debug;
2161 void zconfset_debug (int bdebug )
2163 zconf_flex_debug = bdebug ;
2166 static int yy_init_globals (void)
2168 /* Initialization is the same as for the non-reentrant scanner.
2169 * This function is called from zconflex_destroy(), so don't allocate here.
2172 (yy_buffer_stack) = 0;
2173 (yy_buffer_stack_top) = 0;
2174 (yy_buffer_stack_max) = 0;
2175 (yy_c_buf_p) = (char *) 0;
2179 /* Defined in main.c */
2184 zconfin = (FILE *) 0;
2185 zconfout = (FILE *) 0;
2188 /* For future reference: Set errno on error, since we are called by
2194 /* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2195 int zconflex_destroy (void)
2198 /* Pop the buffer stack, destroying each element. */
2199 while(YY_CURRENT_BUFFER){
2200 zconf_delete_buffer(YY_CURRENT_BUFFER );
2201 YY_CURRENT_BUFFER_LVALUE = NULL;
2202 zconfpop_buffer_state();
2205 /* Destroy the stack itself. */
2206 zconffree((yy_buffer_stack) );
2207 (yy_buffer_stack) = NULL;
2209 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2210 * zconflex() is called, initialization will occur. */
2217 * Internal utility routines.
2221 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2224 for ( i = 0; i < n; ++i )
2229 #ifdef YY_NEED_STRLEN
2230 static int yy_flex_strlen (yyconst char * s )
2233 for ( n = 0; s[n]; ++n )
2240 void *zconfalloc (yy_size_t size )
2242 return (void *) malloc( size );
2245 void *zconfrealloc (void * ptr, yy_size_t size )
2247 /* The cast to (char *) in the following accommodates both
2248 * implementations that use char* generic pointers, and those
2249 * that use void* generic pointers. It works with the latter
2250 * because both ANSI C and C++ allow castless assignment from
2251 * any pointer type to void*, and deal with argument conversions
2252 * as though doing an assignment.
2254 return (void *) realloc( (char *) ptr, size );
2257 void zconffree (void * ptr )
2259 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2262 #define YYTABLES_NAME "yytables"
2264 void zconf_starthelp(void)
2267 last_ts = first_ts = 0;
2271 static void zconf_endhelp(void)
2273 zconflval.string = text;
2278 * Try to open specified file with following names:
2281 * The latter is used when srctree is separate from objtree
2282 * when compiling the kernel.
2283 * Return NULL if file is not found.
2285 FILE *zconf_fopen(const char *name)
2287 char *env, fullname[PATH_MAX+1];
2290 f = fopen(name, "r");
2291 if (!f && name != NULL && name[0] != '/') {
2292 env = getenv(SRCTREE);
2294 sprintf(fullname, "%s/%s", env, name);
2295 f = fopen(fullname, "r");
2301 void zconf_initscan(const char *name)
2303 zconfin = zconf_fopen(name);
2305 printf("can't find file %s\n", name);
2309 current_buf = malloc(sizeof(*current_buf));
2310 memset(current_buf, 0, sizeof(*current_buf));
2312 current_file = file_lookup(name);
2313 current_file->lineno = 1;
2314 current_file->flags = FILE_BUSY;
2317 void zconf_nextfile(const char *name)
2319 struct file *file = file_lookup(name);
2320 struct buffer *buf = malloc(sizeof(*buf));
2321 memset(buf, 0, sizeof(*buf));
2323 current_buf->state = YY_CURRENT_BUFFER;
2324 zconfin = zconf_fopen(name);
2326 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
2329 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2330 buf->parent = current_buf;
2333 if (file->flags & FILE_BUSY) {
2334 printf("recursive scan (%s)?\n", name);
2337 if (file->flags & FILE_SCANNED) {
2338 printf("file %s already scanned?\n", name);
2341 file->flags |= FILE_BUSY;
2343 file->parent = current_file;
2344 current_file = file;
2347 static void zconf_endfile(void)
2349 struct buffer *parent;
2351 current_file->flags |= FILE_SCANNED;
2352 current_file->flags &= ~FILE_BUSY;
2353 current_file = current_file->parent;
2355 parent = current_buf->parent;
2358 zconf_delete_buffer(YY_CURRENT_BUFFER);
2359 zconf_switch_to_buffer(parent->state);
2362 current_buf = parent;
2365 int zconf_lineno(void)
2367 return current_pos.lineno;
2370 char *zconf_curname(void)
2372 return current_pos.file ? current_pos.file->name : "<none>";