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