blob: 24e3c8cbb7ac379fe853c24600ad0f839e1516ce [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
Roman Zippel7a884882005-11-08 21:34:51 -08002#line 3 "scripts/kconfig/lex.zconf.c"
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
4#define YY_INT_ALIGNED short int
5
6/* A lexical scanner generated by flex */
7
8#define FLEX_SCANNER
9#define YY_FLEX_MAJOR_VERSION 2
10#define YY_FLEX_MINOR_VERSION 5
11#define YY_FLEX_SUBMINOR_VERSION 31
12#if YY_FLEX_SUBMINOR_VERSION > 0
13#define FLEX_BETA
14#endif
15
16/* First, we deal with platform-specific or compiler-specific issues. */
17
18/* begin standard C headers. */
19#include <stdio.h>
20#include <string.h>
21#include <errno.h>
22#include <stdlib.h>
23
24/* end standard C headers. */
25
26/* flex integer type definitions */
27
28#ifndef FLEXINT_H
29#define FLEXINT_H
30
31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
34#include <inttypes.h>
35typedef int8_t flex_int8_t;
36typedef uint8_t flex_uint8_t;
37typedef int16_t flex_int16_t;
38typedef uint16_t flex_uint16_t;
39typedef int32_t flex_int32_t;
40typedef uint32_t flex_uint32_t;
41#else
42typedef signed char flex_int8_t;
43typedef short int flex_int16_t;
44typedef int flex_int32_t;
45typedef unsigned char flex_uint8_t;
46typedef unsigned short int flex_uint16_t;
47typedef unsigned int flex_uint32_t;
48#endif /* ! C99 */
49
50/* Limits of integral types. */
51#ifndef INT8_MIN
52#define INT8_MIN (-128)
53#endif
54#ifndef INT16_MIN
55#define INT16_MIN (-32767-1)
56#endif
57#ifndef INT32_MIN
58#define INT32_MIN (-2147483647-1)
59#endif
60#ifndef INT8_MAX
61#define INT8_MAX (127)
62#endif
63#ifndef INT16_MAX
64#define INT16_MAX (32767)
65#endif
66#ifndef INT32_MAX
67#define INT32_MAX (2147483647)
68#endif
69#ifndef UINT8_MAX
70#define UINT8_MAX (255U)
71#endif
72#ifndef UINT16_MAX
73#define UINT16_MAX (65535U)
74#endif
75#ifndef UINT32_MAX
76#define UINT32_MAX (4294967295U)
77#endif
78
79#endif /* ! FLEXINT_H */
80
81#ifdef __cplusplus
82
83/* The "const" storage-class-modifier is valid. */
84#define YY_USE_CONST
85
86#else /* ! __cplusplus */
87
88#if __STDC__
89
90#define YY_USE_CONST
91
92#endif /* __STDC__ */
93#endif /* ! __cplusplus */
94
95#ifdef YY_USE_CONST
96#define yyconst const
97#else
98#define yyconst
99#endif
100
101/* Returned upon end-of-file. */
102#define YY_NULL 0
103
104/* Promotes a possibly negative, possibly signed char to an unsigned
105 * integer for use as an array index. If the signed char is negative,
106 * we want to instead treat it as an 8-bit unsigned char, hence the
107 * double cast.
108 */
109#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
110
111/* Enter a start condition. This macro really ought to take a parameter,
112 * but we do it the disgusting crufty way forced on us by the ()-less
113 * definition of BEGIN.
114 */
115#define BEGIN (yy_start) = 1 + 2 *
116
117/* Translate the current start state into a value that can be later handed
118 * to BEGIN to return to the state. The YYSTATE alias is for lex
119 * compatibility.
120 */
121#define YY_START (((yy_start) - 1) / 2)
122#define YYSTATE YY_START
123
124/* Action number for EOF rule of a given start state. */
125#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126
127/* Special action meaning "start processing a new file". */
128#define YY_NEW_FILE zconfrestart(zconfin )
129
130#define YY_END_OF_BUFFER_CHAR 0
131
132/* Size of default input buffer. */
133#ifndef YY_BUF_SIZE
134#define YY_BUF_SIZE 16384
135#endif
136
137#ifndef YY_TYPEDEF_YY_BUFFER_STATE
138#define YY_TYPEDEF_YY_BUFFER_STATE
139typedef struct yy_buffer_state *YY_BUFFER_STATE;
140#endif
141
142extern int zconfleng;
143
144extern FILE *zconfin, *zconfout;
145
146#define EOB_ACT_CONTINUE_SCAN 0
147#define EOB_ACT_END_OF_FILE 1
148#define EOB_ACT_LAST_MATCH 2
149
150 #define YY_LESS_LINENO(n)
151
152/* Return all but the first "n" matched characters back to the input stream. */
153#define yyless(n) \
154 do \
155 { \
156 /* Undo effects of setting up zconftext. */ \
157 int yyless_macro_arg = (n); \
158 YY_LESS_LINENO(yyless_macro_arg);\
159 *yy_cp = (yy_hold_char); \
160 YY_RESTORE_YY_MORE_OFFSET \
161 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
162 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
163 } \
164 while ( 0 )
165
166#define unput(c) yyunput( c, (yytext_ptr) )
167
168/* The following is because we cannot portably get our hands on size_t
169 * (without autoconf's help, which isn't available because we want
170 * flex-generated scanners to compile on their own).
171 */
172
173#ifndef YY_TYPEDEF_YY_SIZE_T
174#define YY_TYPEDEF_YY_SIZE_T
175typedef unsigned int yy_size_t;
176#endif
177
178#ifndef YY_STRUCT_YY_BUFFER_STATE
179#define YY_STRUCT_YY_BUFFER_STATE
180struct yy_buffer_state
181 {
182 FILE *yy_input_file;
183
184 char *yy_ch_buf; /* input buffer */
185 char *yy_buf_pos; /* current position in input buffer */
186
187 /* Size of input buffer in bytes, not including room for EOB
188 * characters.
189 */
190 yy_size_t yy_buf_size;
191
192 /* Number of characters read into yy_ch_buf, not including EOB
193 * characters.
194 */
195 int yy_n_chars;
196
197 /* Whether we "own" the buffer - i.e., we know we created it,
198 * and can realloc() it to grow it, and should free() it to
199 * delete it.
200 */
201 int yy_is_our_buffer;
202
203 /* Whether this is an "interactive" input source; if so, and
204 * if we're using stdio for input, then we want to use getc()
205 * instead of fread(), to make sure we stop fetching input after
206 * each newline.
207 */
208 int yy_is_interactive;
209
210 /* Whether we're considered to be at the beginning of a line.
211 * If so, '^' rules will be active on the next match, otherwise
212 * not.
213 */
214 int yy_at_bol;
215
216 int yy_bs_lineno; /**< The line count. */
217 int yy_bs_column; /**< The column count. */
218
219 /* Whether to try to fill the input buffer when we reach the
220 * end of it.
221 */
222 int yy_fill_buffer;
223
224 int yy_buffer_status;
225
226#define YY_BUFFER_NEW 0
227#define YY_BUFFER_NORMAL 1
228 /* When an EOF's been seen but there's still some text to process
229 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
230 * shouldn't try reading from the input source any more. We might
231 * still have a bunch of tokens to match, though, because of
232 * possible backing-up.
233 *
234 * When we actually see the EOF, we change the status to "new"
235 * (via zconfrestart()), so that the user can continue scanning by
236 * just pointing zconfin at a new input file.
237 */
238#define YY_BUFFER_EOF_PENDING 2
239
240 };
241#endif /* !YY_STRUCT_YY_BUFFER_STATE */
242
243/* Stack of input buffers. */
244static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
247
248/* We provide macros for accessing buffer states in case in the
249 * future we want to put the buffer states in a more general
250 * "scanner state".
251 *
252 * Returns the top of the stack, or NULL.
253 */
254#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
255 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
256 : NULL)
257
258/* Same as previous macro, but useful when we know that the buffer stack is not
259 * NULL or when we need an lvalue. For internal use only.
260 */
261#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
262
263/* yy_hold_char holds the character lost when zconftext is formed. */
264static char yy_hold_char;
265static int yy_n_chars; /* number of characters read into yy_ch_buf */
266int zconfleng;
267
268/* Points to current character in buffer. */
269static char *yy_c_buf_p = (char *) 0;
270static int yy_init = 1; /* whether we need to initialize */
271static int yy_start = 0; /* start state number */
272
273/* Flag which is used to allow zconfwrap()'s to do buffer switches
274 * instead of setting up a fresh zconfin. A bit of a hack ...
275 */
276static int yy_did_buffer_switch_on_eof;
277
278void zconfrestart (FILE *input_file );
279void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
281void zconf_delete_buffer (YY_BUFFER_STATE b );
282void zconf_flush_buffer (YY_BUFFER_STATE b );
283void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
284void zconfpop_buffer_state (void );
285
286static void zconfensure_buffer_stack (void );
287static void zconf_load_buffer_state (void );
288static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
289
290#define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
291
292YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
293YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
294YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
295
296void *zconfalloc (yy_size_t );
297void *zconfrealloc (void *,yy_size_t );
298void zconffree (void * );
299
300#define yy_new_buffer zconf_create_buffer
301
302#define yy_set_interactive(is_interactive) \
303 { \
304 if ( ! YY_CURRENT_BUFFER ){ \
305 zconfensure_buffer_stack (); \
306 YY_CURRENT_BUFFER_LVALUE = \
307 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
308 } \
309 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
310 }
311
312#define yy_set_bol(at_bol) \
313 { \
314 if ( ! YY_CURRENT_BUFFER ){\
315 zconfensure_buffer_stack (); \
316 YY_CURRENT_BUFFER_LVALUE = \
317 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
318 } \
319 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
320 }
321
322#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
323
324/* Begin user sect3 */
325
Roman Zippela02f0572005-11-08 21:34:53 -0800326#define zconfwrap() 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327#define YY_SKIP_YYWRAP
328
329typedef unsigned char YY_CHAR;
330
331FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
332
333typedef int yy_state_type;
334
335extern int zconflineno;
336
337int zconflineno = 1;
338
339extern char *zconftext;
340#define yytext_ptr zconftext
Roman Zippel7a884882005-11-08 21:34:51 -0800341static yyconst flex_int16_t yy_nxt[][17] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 {
343 {
344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Roman Zippel7a884882005-11-08 21:34:51 -0800345 0, 0, 0, 0, 0, 0, 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 },
347
348 {
349 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
Roman Zippel7a884882005-11-08 21:34:51 -0800350 12, 12, 12, 12, 12, 12, 12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 },
352
353 {
354 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
Roman Zippel7a884882005-11-08 21:34:51 -0800355 12, 12, 12, 12, 12, 12, 12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 },
357
358 {
359 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
Roman Zippel7a884882005-11-08 21:34:51 -0800360 16, 16, 16, 18, 16, 16, 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 },
362
363 {
364 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
Roman Zippel7a884882005-11-08 21:34:51 -0800365 16, 16, 16, 18, 16, 16, 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366
367 },
368
369 {
Roman Zippel7a884882005-11-08 21:34:51 -0800370 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
371 19, 19, 19, 19, 19, 19, 19
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 },
373
374 {
Roman Zippel7a884882005-11-08 21:34:51 -0800375 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
376 19, 19, 19, 19, 19, 19, 19
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 },
378
379 {
Roman Zippel7a884882005-11-08 21:34:51 -0800380 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
381 22, 22, 22, 22, 22, 25, 22
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 },
383
384 {
Roman Zippel7a884882005-11-08 21:34:51 -0800385 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
386 22, 22, 22, 22, 22, 25, 22
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 },
388
389 {
Roman Zippel7a884882005-11-08 21:34:51 -0800390 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
391 33, 34, 35, 35, 36, 37, 38
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392
393 },
394
395 {
Roman Zippel7a884882005-11-08 21:34:51 -0800396 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
397 33, 34, 35, 35, 36, 37, 38
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398 },
399
400 {
401 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
Roman Zippel7a884882005-11-08 21:34:51 -0800402 -11, -11, -11, -11, -11, -11, -11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 },
404
405 {
406 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
Roman Zippel7a884882005-11-08 21:34:51 -0800407 -12, -12, -12, -12, -12, -12, -12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 },
409
410 {
Roman Zippel7a884882005-11-08 21:34:51 -0800411 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
412 -13, -13, -13, -13, -13, -13, -13
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 },
414
415 {
416 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
Roman Zippel7a884882005-11-08 21:34:51 -0800417 -14, -14, -14, -14, -14, -14, -14
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418
419 },
420
421 {
Roman Zippel7a884882005-11-08 21:34:51 -0800422 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
423 42, 42, 42, 42, 42, 42, 42
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 },
425
426 {
427 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
Roman Zippel7a884882005-11-08 21:34:51 -0800428 -16, -16, -16, -16, -16, -16, -16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 },
430
431 {
432 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
Roman Zippel7a884882005-11-08 21:34:51 -0800433 -17, -17, -17, -17, -17, -17, -17
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 },
435
436 {
437 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
Roman Zippel7a884882005-11-08 21:34:51 -0800438 -18, -18, -18, 44, -18, -18, -18
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 },
440
441 {
Roman Zippel7a884882005-11-08 21:34:51 -0800442 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
443 45, 45, 45, 45, 45, 45, 45
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444
445 },
446
447 {
Roman Zippel7a884882005-11-08 21:34:51 -0800448 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
449 -20, -20, -20, -20, -20, -20, -20
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450 },
451
452 {
Roman Zippel7a884882005-11-08 21:34:51 -0800453 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
454 48, 48, 48, 48, 48, 48, 48
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 },
456
457 {
Roman Zippel7a884882005-11-08 21:34:51 -0800458 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
459 49, 49, 49, 49, 49, -22, 49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 },
461
462 {
463 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
Roman Zippel7a884882005-11-08 21:34:51 -0800464 -23, -23, -23, -23, -23, -23, -23
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 },
466
467 {
468 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
Roman Zippel7a884882005-11-08 21:34:51 -0800469 -24, -24, -24, -24, -24, -24, -24
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470
471 },
472
473 {
Roman Zippel7a884882005-11-08 21:34:51 -0800474 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
475 51, 51, 51, 51, 51, 51, 51
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 },
477
478 {
479 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
Roman Zippel7a884882005-11-08 21:34:51 -0800480 -26, -26, -26, -26, -26, -26, -26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 },
482
483 {
484 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
Roman Zippel7a884882005-11-08 21:34:51 -0800485 -27, -27, -27, -27, -27, -27, -27
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 },
487
488 {
489 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
Roman Zippel7a884882005-11-08 21:34:51 -0800490 -28, -28, -28, -28, 53, -28, -28
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 },
492
493 {
494 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
Roman Zippel7a884882005-11-08 21:34:51 -0800495 -29, -29, -29, -29, -29, -29, -29
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496
497 },
498
499 {
Roman Zippel7a884882005-11-08 21:34:51 -0800500 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
501 54, 54, 54, 54, 54, 54, 54
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 },
503
504 {
Roman Zippel7a884882005-11-08 21:34:51 -0800505 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
506 -31, -31, -31, -31, -31, -31, -31
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 },
508
509 {
Roman Zippel7a884882005-11-08 21:34:51 -0800510 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
511 -32, -32, -32, -32, -32, -32, -32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 },
513
514 {
Roman Zippel7a884882005-11-08 21:34:51 -0800515 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
516 -33, -33, -33, -33, -33, -33, -33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 },
518
519 {
Roman Zippel7a884882005-11-08 21:34:51 -0800520 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
521 -34, 56, 57, 57, -34, -34, -34
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522
523 },
524
525 {
526 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
Roman Zippel7a884882005-11-08 21:34:51 -0800527 -35, 57, 57, 57, -35, -35, -35
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 },
529
530 {
531 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
Roman Zippel7a884882005-11-08 21:34:51 -0800532 -36, -36, -36, -36, -36, -36, -36
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533 },
534
535 {
Roman Zippel7a884882005-11-08 21:34:51 -0800536 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
537 -37, -37, -37, -37, -37, -37, -37
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 },
539
540 {
541 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
Roman Zippel7a884882005-11-08 21:34:51 -0800542 -38, -38, -38, -38, -38, -38, 59
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 },
544
545 {
Roman Zippel7a884882005-11-08 21:34:51 -0800546 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
547 -39, -39, -39, -39, -39, -39, -39
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548
549 },
550
551 {
552 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
Roman Zippel7a884882005-11-08 21:34:51 -0800553 -40, -40, -40, -40, -40, -40, -40
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 },
555
556 {
Roman Zippel7a884882005-11-08 21:34:51 -0800557 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
558 42, 42, 42, 42, 42, 42, 42
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 },
560
561 {
Roman Zippel7a884882005-11-08 21:34:51 -0800562 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
563 42, 42, 42, 42, 42, 42, 42
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 },
565
566 {
Roman Zippel7a884882005-11-08 21:34:51 -0800567 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
568 -43, -43, -43, -43, -43, -43, -43
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 },
570
571 {
572 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
Roman Zippel7a884882005-11-08 21:34:51 -0800573 -44, -44, -44, 44, -44, -44, -44
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574
575 },
576
577 {
Roman Zippel7a884882005-11-08 21:34:51 -0800578 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
579 45, 45, 45, 45, 45, 45, 45
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580 },
581
582 {
Roman Zippel7a884882005-11-08 21:34:51 -0800583 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
584 -46, -46, -46, -46, -46, -46, -46
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 },
586
587 {
Roman Zippel7a884882005-11-08 21:34:51 -0800588 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
589 48, 48, 48, 48, 48, 48, 48
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 },
591
592 {
593 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
Roman Zippel7a884882005-11-08 21:34:51 -0800594 -48, -48, -48, -48, -48, -48, -48
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 },
596
597 {
Roman Zippel7a884882005-11-08 21:34:51 -0800598 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
599 49, 49, 49, 49, 49, -49, 49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600
601 },
602
603 {
604 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
Roman Zippel7a884882005-11-08 21:34:51 -0800605 -50, -50, -50, -50, -50, -50, -50
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 },
607
608 {
Roman Zippel7a884882005-11-08 21:34:51 -0800609 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
610 -51, -51, -51, -51, -51, -51, -51
Linus Torvalds1da177e2005-04-16 15:20:36 -0700611 },
612
613 {
614 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
Roman Zippel7a884882005-11-08 21:34:51 -0800615 -52, -52, -52, -52, -52, -52, -52
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 },
617
618 {
Roman Zippel7a884882005-11-08 21:34:51 -0800619 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
620 -53, -53, -53, -53, -53, -53, -53
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 },
622
623 {
Roman Zippel7a884882005-11-08 21:34:51 -0800624 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
625 54, 54, 54, 54, 54, 54, 54
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626
627 },
628
629 {
Roman Zippel7a884882005-11-08 21:34:51 -0800630 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
631 -55, -55, -55, -55, -55, -55, -55
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632 },
633
634 {
Roman Zippel7a884882005-11-08 21:34:51 -0800635 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
636 -56, 60, 57, 57, -56, -56, -56
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 },
638
639 {
640 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
Roman Zippel7a884882005-11-08 21:34:51 -0800641 -57, 57, 57, 57, -57, -57, -57
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 },
643
644 {
645 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
Roman Zippel7a884882005-11-08 21:34:51 -0800646 -58, -58, -58, -58, -58, -58, -58
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 },
648
649 {
650 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
Roman Zippel7a884882005-11-08 21:34:51 -0800651 -59, -59, -59, -59, -59, -59, -59
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652
653 },
654
655 {
656 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
Roman Zippel7a884882005-11-08 21:34:51 -0800657 -60, 57, 57, 57, -60, -60, -60
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 },
659
660 } ;
661
662static yy_state_type yy_get_previous_state (void );
663static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
664static int yy_get_next_buffer (void );
665static void yy_fatal_error (yyconst char msg[] );
666
667/* Done after the current pattern has been matched and before the
668 * corresponding action - sets up zconftext.
669 */
670#define YY_DO_BEFORE_ACTION \
671 (yytext_ptr) = yy_bp; \
672 zconfleng = (size_t) (yy_cp - yy_bp); \
673 (yy_hold_char) = *yy_cp; \
674 *yy_cp = '\0'; \
675 (yy_c_buf_p) = yy_cp;
676
Roman Zippel7a884882005-11-08 21:34:51 -0800677#define YY_NUM_RULES 33
678#define YY_END_OF_BUFFER 34
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679/* This struct is not used in this scanner,
680 but its presence is necessary. */
681struct yy_trans_info
682 {
683 flex_int32_t yy_verify;
684 flex_int32_t yy_nxt;
685 };
Roman Zippel7a884882005-11-08 21:34:51 -0800686static yyconst flex_int16_t yy_accept[61] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 { 0,
688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Roman Zippela02f0572005-11-08 21:34:53 -0800689 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
Roman Zippel7a884882005-11-08 21:34:51 -0800690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
Roman Zippela02f0572005-11-08 21:34:53 -0800691 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
692 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
Roman Zippel7a884882005-11-08 21:34:51 -0800693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 } ;
695
696static yyconst flex_int32_t yy_ec[256] =
697 { 0,
698 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
699 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
700 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
701 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
702 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
703 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
704 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
705 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
706 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
Roman Zippel7a884882005-11-08 21:34:51 -0800707 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708
Roman Zippel7a884882005-11-08 21:34:51 -0800709 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
710 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
711 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
713 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
714 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
715 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
716 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
717 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
718 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
719
720 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
721 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
722 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
723 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
724 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
725 1, 1, 1, 1, 1
726 } ;
727
728extern int zconf_flex_debug;
729int zconf_flex_debug = 0;
730
731/* The intent behind this definition is that it'll catch
732 * any uses of REJECT which flex missed.
733 */
734#define REJECT reject_used_but_not_detected
735#define yymore() yymore_used_but_not_detected
736#define YY_MORE_ADJ 0
737#define YY_RESTORE_YY_MORE_OFFSET
738char *zconftext;
739
740/*
741 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
742 * Released under the terms of the GNU GPL v2.0.
743 */
744
745#include <limits.h>
746#include <stdio.h>
747#include <stdlib.h>
748#include <string.h>
749#include <unistd.h>
750
751#define LKC_DIRECT_LINK
752#include "lkc.h"
753
754#define START_STRSIZE 16
755
Roman Zippela02f0572005-11-08 21:34:53 -0800756static struct {
757 struct file *file;
758 int lineno;
759} current_pos;
760
Roman Zippel7a884882005-11-08 21:34:51 -0800761static char *text;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762static int text_size, text_asize;
763
764struct buffer {
765 struct buffer *parent;
766 YY_BUFFER_STATE state;
767};
768
769struct buffer *current_buf;
770
771static int last_ts, first_ts;
772
773static void zconf_endhelp(void);
Roman Zippela02f0572005-11-08 21:34:53 -0800774static void zconf_endfile(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775
776void new_string(void)
777{
778 text = malloc(START_STRSIZE);
779 text_asize = START_STRSIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780 text_size = 0;
Roman Zippel7a884882005-11-08 21:34:51 -0800781 *text = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782}
783
784void append_string(const char *str, int size)
785{
786 int new_size = text_size + size + 1;
787 if (new_size > text_asize) {
Roman Zippel7a884882005-11-08 21:34:51 -0800788 new_size += START_STRSIZE - 1;
789 new_size &= -START_STRSIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700790 text = realloc(text, new_size);
791 text_asize = new_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792 }
Roman Zippel7a884882005-11-08 21:34:51 -0800793 memcpy(text + text_size, str, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794 text_size += size;
Roman Zippel7a884882005-11-08 21:34:51 -0800795 text[text_size] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796}
797
798void alloc_string(const char *str, int size)
799{
800 text = malloc(size + 1);
801 memcpy(text, str, size);
802 text[size] = 0;
803}
804
805#define INITIAL 0
806#define COMMAND 1
807#define HELP 2
808#define STRING 3
809#define PARAM 4
810
Roman Zippel7a884882005-11-08 21:34:51 -0800811#ifndef YY_NO_UNISTD_H
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812/* Special case for "unistd.h", since it is non-ANSI. We include it way
813 * down here because we want the user's section 1 to have been scanned first.
814 * The user has a chance to override it with an option.
815 */
816#include <unistd.h>
Roman Zippel7a884882005-11-08 21:34:51 -0800817#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818
819#ifndef YY_EXTRA_TYPE
820#define YY_EXTRA_TYPE void *
821#endif
822
823/* Macros after this point can all be overridden by user definitions in
824 * section 1.
825 */
826
827#ifndef YY_SKIP_YYWRAP
828#ifdef __cplusplus
829extern "C" int zconfwrap (void );
830#else
831extern int zconfwrap (void );
832#endif
833#endif
834
835 static void yyunput (int c,char *buf_ptr );
836
837#ifndef yytext_ptr
838static void yy_flex_strncpy (char *,yyconst char *,int );
839#endif
840
841#ifdef YY_NEED_STRLEN
842static int yy_flex_strlen (yyconst char * );
843#endif
844
845#ifndef YY_NO_INPUT
846
847#ifdef __cplusplus
848static int yyinput (void );
849#else
850static int input (void );
851#endif
852
853#endif
854
855/* Amount of stuff to slurp up with each read. */
856#ifndef YY_READ_BUF_SIZE
857#define YY_READ_BUF_SIZE 8192
858#endif
859
860/* Copy whatever the last rule matched to the standard output. */
861#ifndef ECHO
862/* This used to be an fputs(), but since the string might contain NUL's,
863 * we now use fwrite().
864 */
865#define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
866#endif
867
868/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
869 * is returned in "result".
870 */
871#ifndef YY_INPUT
872#define YY_INPUT(buf,result,max_size) \
873 errno=0; \
874 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
875 { \
876 if( errno != EINTR) \
877 { \
878 YY_FATAL_ERROR( "input in flex scanner failed" ); \
879 break; \
880 } \
881 errno=0; \
882 clearerr(zconfin); \
883 }\
884\
885
886#endif
887
888/* No semi-colon after return; correct usage is to write "yyterminate();" -
889 * we don't want an extra ';' after the "return" because that will cause
890 * some compilers to complain about unreachable statements.
891 */
892#ifndef yyterminate
893#define yyterminate() return YY_NULL
894#endif
895
896/* Number of entries by which start-condition stack grows. */
897#ifndef YY_START_STACK_INCR
898#define YY_START_STACK_INCR 25
899#endif
900
901/* Report a fatal error. */
902#ifndef YY_FATAL_ERROR
903#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
904#endif
905
906/* end tables serialization structures and prototypes */
907
908/* Default declaration of generated scanner - a define so the user can
909 * easily add parameters.
910 */
911#ifndef YY_DECL
912#define YY_DECL_IS_OURS 1
913
914extern int zconflex (void);
915
916#define YY_DECL int zconflex (void)
917#endif /* !YY_DECL */
918
919/* Code executed at the beginning of each rule, after zconftext and zconfleng
920 * have been set up.
921 */
922#ifndef YY_USER_ACTION
923#define YY_USER_ACTION
924#endif
925
926/* Code executed at the end of each rule. */
927#ifndef YY_BREAK
928#define YY_BREAK break;
929#endif
930
931#define YY_RULE_SETUP \
932 YY_USER_ACTION
933
934/** The main scanner function which does all the work.
935 */
936YY_DECL
937{
938 register yy_state_type yy_current_state;
939 register char *yy_cp, *yy_bp;
940 register int yy_act;
941
942 int str = 0;
943 int ts, i;
944
945 if ( (yy_init) )
946 {
947 (yy_init) = 0;
948
949#ifdef YY_USER_INIT
950 YY_USER_INIT;
951#endif
952
953 if ( ! (yy_start) )
954 (yy_start) = 1; /* first start state */
955
956 if ( ! zconfin )
957 zconfin = stdin;
958
959 if ( ! zconfout )
960 zconfout = stdout;
961
962 if ( ! YY_CURRENT_BUFFER ) {
963 zconfensure_buffer_stack ();
964 YY_CURRENT_BUFFER_LVALUE =
965 zconf_create_buffer(zconfin,YY_BUF_SIZE );
966 }
967
968 zconf_load_buffer_state( );
969 }
970
971 while ( 1 ) /* loops until end-of-file is reached */
972 {
973 yy_cp = (yy_c_buf_p);
974
975 /* Support of zconftext. */
976 *yy_cp = (yy_hold_char);
977
978 /* yy_bp points to the position in yy_ch_buf of the start of
979 * the current run.
980 */
981 yy_bp = yy_cp;
982
983 yy_current_state = (yy_start);
984yy_match:
985 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
986 ++yy_cp;
987
988 yy_current_state = -yy_current_state;
989
990yy_find_action:
991 yy_act = yy_accept[yy_current_state];
992
993 YY_DO_BEFORE_ACTION;
994
995do_action: /* This label is used only to access EOF actions. */
996
997 switch ( yy_act )
998 { /* beginning of action switch */
999case 1:
1000/* rule 1 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001001case 2:
Roman Zippela02f0572005-11-08 21:34:53 -08001002/* rule 2 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001003YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001004{
1005 current_file->lineno++;
1006 return T_EOL;
1007}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001008 YY_BREAK
1009case 3:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001010YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001011
Linus Torvalds1da177e2005-04-16 15:20:36 -07001012 YY_BREAK
1013case 4:
1014YY_RULE_SETUP
1015{
1016 BEGIN(COMMAND);
1017}
1018 YY_BREAK
1019case 5:
1020YY_RULE_SETUP
1021{
1022 unput(zconftext[0]);
1023 BEGIN(COMMAND);
1024}
1025 YY_BREAK
1026
1027case 6:
1028YY_RULE_SETUP
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029{
Roman Zippel7a884882005-11-08 21:34:51 -08001030 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
Roman Zippela02f0572005-11-08 21:34:53 -08001031 BEGIN(PARAM);
1032 current_pos.file = current_file;
1033 current_pos.lineno = current_file->lineno;
Roman Zippel7a884882005-11-08 21:34:51 -08001034 if (id && id->flags & TF_COMMAND) {
Roman Zippel3370f9f2005-11-08 21:34:52 -08001035 zconflval.id = id;
Roman Zippel7a884882005-11-08 21:34:51 -08001036 return id->token;
1037 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001038 alloc_string(zconftext, zconfleng);
1039 zconflval.string = text;
1040 return T_WORD;
1041 }
1042 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001043case 7:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044YY_RULE_SETUP
1045
1046 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001047case 8:
1048/* rule 8 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001049YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001050{
1051 BEGIN(INITIAL);
1052 current_file->lineno++;
1053 return T_EOL;
1054 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 YY_BREAK
1056
Roman Zippel7a884882005-11-08 21:34:51 -08001057case 9:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001058YY_RULE_SETUP
1059return T_AND;
1060 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001061case 10:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001062YY_RULE_SETUP
1063return T_OR;
1064 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001065case 11:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001066YY_RULE_SETUP
1067return T_OPEN_PAREN;
1068 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001069case 12:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070YY_RULE_SETUP
1071return T_CLOSE_PAREN;
1072 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001073case 13:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001074YY_RULE_SETUP
1075return T_NOT;
1076 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001077case 14:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001078YY_RULE_SETUP
1079return T_EQUAL;
1080 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001081case 15:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001082YY_RULE_SETUP
1083return T_UNEQUAL;
1084 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001085case 16:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001086YY_RULE_SETUP
1087{
1088 str = zconftext[0];
1089 new_string();
1090 BEGIN(STRING);
1091 }
1092 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001093case 17:
1094/* rule 17 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001095YY_RULE_SETUP
1096BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1097 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001098case 18:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099YY_RULE_SETUP
1100/* ignore */
1101 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001102case 19:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103YY_RULE_SETUP
1104{
Roman Zippel7a884882005-11-08 21:34:51 -08001105 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
Roman Zippel3370f9f2005-11-08 21:34:52 -08001106 if (id && id->flags & TF_PARAM) {
1107 zconflval.id = id;
Roman Zippel7a884882005-11-08 21:34:51 -08001108 return id->token;
Roman Zippel3370f9f2005-11-08 21:34:52 -08001109 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110 alloc_string(zconftext, zconfleng);
1111 zconflval.string = text;
1112 return T_WORD;
1113 }
1114 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001115case 20:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116YY_RULE_SETUP
1117/* comment */
1118 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001119case 21:
1120/* rule 21 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121YY_RULE_SETUP
1122current_file->lineno++;
1123 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001124case 22:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001125YY_RULE_SETUP
1126
1127 YY_BREAK
1128case YY_STATE_EOF(PARAM):
1129{
1130 BEGIN(INITIAL);
1131 }
1132 YY_BREAK
1133
Roman Zippel7a884882005-11-08 21:34:51 -08001134case 23:
1135/* rule 23 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001136*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1137(yy_c_buf_p) = yy_cp -= 1;
1138YY_DO_BEFORE_ACTION; /* set up zconftext again */
1139YY_RULE_SETUP
1140{
1141 append_string(zconftext, zconfleng);
1142 zconflval.string = text;
1143 return T_WORD_QUOTE;
1144 }
1145 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001146case 24:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147YY_RULE_SETUP
1148{
1149 append_string(zconftext, zconfleng);
1150 }
1151 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001152case 25:
1153/* rule 25 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001154*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1155(yy_c_buf_p) = yy_cp -= 1;
1156YY_DO_BEFORE_ACTION; /* set up zconftext again */
1157YY_RULE_SETUP
1158{
1159 append_string(zconftext + 1, zconfleng - 1);
1160 zconflval.string = text;
1161 return T_WORD_QUOTE;
1162 }
1163 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001164case 26:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165YY_RULE_SETUP
1166{
1167 append_string(zconftext + 1, zconfleng - 1);
1168 }
1169 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001170case 27:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001171YY_RULE_SETUP
1172{
1173 if (str == zconftext[0]) {
1174 BEGIN(PARAM);
1175 zconflval.string = text;
1176 return T_WORD_QUOTE;
1177 } else
1178 append_string(zconftext, 1);
1179 }
1180 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001181case 28:
1182/* rule 28 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001183YY_RULE_SETUP
1184{
1185 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1186 current_file->lineno++;
1187 BEGIN(INITIAL);
1188 return T_EOL;
1189 }
1190 YY_BREAK
1191case YY_STATE_EOF(STRING):
1192{
1193 BEGIN(INITIAL);
1194 }
1195 YY_BREAK
1196
Roman Zippel7a884882005-11-08 21:34:51 -08001197case 29:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001198YY_RULE_SETUP
1199{
1200 ts = 0;
1201 for (i = 0; i < zconfleng; i++) {
1202 if (zconftext[i] == '\t')
1203 ts = (ts & ~7) + 8;
1204 else
1205 ts++;
1206 }
1207 last_ts = ts;
1208 if (first_ts) {
1209 if (ts < first_ts) {
1210 zconf_endhelp();
1211 return T_HELPTEXT;
1212 }
1213 ts -= first_ts;
1214 while (ts > 8) {
1215 append_string(" ", 8);
1216 ts -= 8;
1217 }
1218 append_string(" ", ts);
1219 }
1220 }
1221 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001222case 30:
1223/* rule 30 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001224*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1225(yy_c_buf_p) = yy_cp -= 1;
1226YY_DO_BEFORE_ACTION; /* set up zconftext again */
1227YY_RULE_SETUP
1228{
1229 current_file->lineno++;
1230 zconf_endhelp();
1231 return T_HELPTEXT;
1232 }
1233 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001234case 31:
1235/* rule 31 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001236YY_RULE_SETUP
1237{
1238 current_file->lineno++;
1239 append_string("\n", 1);
1240 }
1241 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001242case 32:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001243YY_RULE_SETUP
1244{
1245 append_string(zconftext, zconfleng);
1246 if (!first_ts)
1247 first_ts = last_ts;
1248 }
1249 YY_BREAK
1250case YY_STATE_EOF(HELP):
1251{
1252 zconf_endhelp();
1253 return T_HELPTEXT;
1254 }
1255 YY_BREAK
1256
1257case YY_STATE_EOF(INITIAL):
1258case YY_STATE_EOF(COMMAND):
1259{
Roman Zippela02f0572005-11-08 21:34:53 -08001260 if (current_file) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001261 zconf_endfile();
Roman Zippela02f0572005-11-08 21:34:53 -08001262 return T_EOL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001263 }
1264 fclose(zconfin);
1265 yyterminate();
1266}
1267 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001268case 33:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001269YY_RULE_SETUP
1270YY_FATAL_ERROR( "flex scanner jammed" );
1271 YY_BREAK
1272
1273 case YY_END_OF_BUFFER:
1274 {
1275 /* Amount of text matched not including the EOB char. */
1276 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1277
1278 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1279 *yy_cp = (yy_hold_char);
1280 YY_RESTORE_YY_MORE_OFFSET
1281
1282 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1283 {
1284 /* We're scanning a new file or input source. It's
1285 * possible that this happened because the user
1286 * just pointed zconfin at a new source and called
1287 * zconflex(). If so, then we have to assure
1288 * consistency between YY_CURRENT_BUFFER and our
1289 * globals. Here is the right place to do so, because
1290 * this is the first action (other than possibly a
1291 * back-up) that will match for the new input source.
1292 */
1293 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1294 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1295 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1296 }
1297
1298 /* Note that here we test for yy_c_buf_p "<=" to the position
1299 * of the first EOB in the buffer, since yy_c_buf_p will
1300 * already have been incremented past the NUL character
1301 * (since all states make transitions on EOB to the
1302 * end-of-buffer state). Contrast this with the test
1303 * in input().
1304 */
1305 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1306 { /* This was really a NUL. */
1307 yy_state_type yy_next_state;
1308
1309 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1310
1311 yy_current_state = yy_get_previous_state( );
1312
1313 /* Okay, we're now positioned to make the NUL
1314 * transition. We couldn't have
1315 * yy_get_previous_state() go ahead and do it
1316 * for us because it doesn't know how to deal
1317 * with the possibility of jamming (and we don't
1318 * want to build jamming into it because then it
1319 * will run more slowly).
1320 */
1321
1322 yy_next_state = yy_try_NUL_trans( yy_current_state );
1323
1324 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1325
1326 if ( yy_next_state )
1327 {
1328 /* Consume the NUL. */
1329 yy_cp = ++(yy_c_buf_p);
1330 yy_current_state = yy_next_state;
1331 goto yy_match;
1332 }
1333
1334 else
1335 {
1336 yy_cp = (yy_c_buf_p);
1337 goto yy_find_action;
1338 }
1339 }
1340
1341 else switch ( yy_get_next_buffer( ) )
1342 {
1343 case EOB_ACT_END_OF_FILE:
1344 {
1345 (yy_did_buffer_switch_on_eof) = 0;
1346
1347 if ( zconfwrap( ) )
1348 {
1349 /* Note: because we've taken care in
1350 * yy_get_next_buffer() to have set up
1351 * zconftext, we can now set up
1352 * yy_c_buf_p so that if some total
1353 * hoser (like flex itself) wants to
1354 * call the scanner after we return the
1355 * YY_NULL, it'll still work - another
1356 * YY_NULL will get returned.
1357 */
1358 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1359
1360 yy_act = YY_STATE_EOF(YY_START);
1361 goto do_action;
1362 }
1363
1364 else
1365 {
1366 if ( ! (yy_did_buffer_switch_on_eof) )
1367 YY_NEW_FILE;
1368 }
1369 break;
1370 }
1371
1372 case EOB_ACT_CONTINUE_SCAN:
1373 (yy_c_buf_p) =
1374 (yytext_ptr) + yy_amount_of_matched_text;
1375
1376 yy_current_state = yy_get_previous_state( );
1377
1378 yy_cp = (yy_c_buf_p);
1379 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1380 goto yy_match;
1381
1382 case EOB_ACT_LAST_MATCH:
1383 (yy_c_buf_p) =
1384 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1385
1386 yy_current_state = yy_get_previous_state( );
1387
1388 yy_cp = (yy_c_buf_p);
1389 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1390 goto yy_find_action;
1391 }
1392 break;
1393 }
1394
1395 default:
1396 YY_FATAL_ERROR(
1397 "fatal flex scanner internal error--no action found" );
1398 } /* end of action switch */
1399 } /* end of scanning one token */
1400} /* end of zconflex */
1401
1402/* yy_get_next_buffer - try to read in a new buffer
1403 *
1404 * Returns a code representing an action:
1405 * EOB_ACT_LAST_MATCH -
1406 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1407 * EOB_ACT_END_OF_FILE - end of file
1408 */
1409static int yy_get_next_buffer (void)
1410{
1411 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1412 register char *source = (yytext_ptr);
1413 register int number_to_move, i;
1414 int ret_val;
1415
1416 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1417 YY_FATAL_ERROR(
1418 "fatal flex scanner internal error--end of buffer missed" );
1419
1420 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1421 { /* Don't try to fill the buffer, so this is an EOF. */
1422 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1423 {
1424 /* We matched a single character, the EOB, so
1425 * treat this as a final EOF.
1426 */
1427 return EOB_ACT_END_OF_FILE;
1428 }
1429
1430 else
1431 {
1432 /* We matched some text prior to the EOB, first
1433 * process it.
1434 */
1435 return EOB_ACT_LAST_MATCH;
1436 }
1437 }
1438
1439 /* Try to read more data. */
1440
1441 /* First move last chars to start of buffer. */
1442 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1443
1444 for ( i = 0; i < number_to_move; ++i )
1445 *(dest++) = *(source++);
1446
1447 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1448 /* don't do the read, it's not guaranteed to return an EOF,
1449 * just force an EOF
1450 */
1451 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1452
1453 else
1454 {
1455 size_t num_to_read =
1456 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1457
1458 while ( num_to_read <= 0 )
1459 { /* Not enough room in the buffer - grow it. */
1460
1461 /* just a shorter name for the current buffer */
1462 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1463
1464 int yy_c_buf_p_offset =
1465 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1466
1467 if ( b->yy_is_our_buffer )
1468 {
1469 int new_size = b->yy_buf_size * 2;
1470
1471 if ( new_size <= 0 )
1472 b->yy_buf_size += b->yy_buf_size / 8;
1473 else
1474 b->yy_buf_size *= 2;
1475
1476 b->yy_ch_buf = (char *)
1477 /* Include room in for 2 EOB chars. */
1478 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1479 }
1480 else
1481 /* Can't grow it, we don't own it. */
1482 b->yy_ch_buf = 0;
1483
1484 if ( ! b->yy_ch_buf )
1485 YY_FATAL_ERROR(
1486 "fatal error - scanner input buffer overflow" );
1487
1488 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1489
1490 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1491 number_to_move - 1;
1492
1493 }
1494
1495 if ( num_to_read > YY_READ_BUF_SIZE )
1496 num_to_read = YY_READ_BUF_SIZE;
1497
1498 /* Read in more data. */
1499 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1500 (yy_n_chars), num_to_read );
1501
1502 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1503 }
1504
1505 if ( (yy_n_chars) == 0 )
1506 {
1507 if ( number_to_move == YY_MORE_ADJ )
1508 {
1509 ret_val = EOB_ACT_END_OF_FILE;
1510 zconfrestart(zconfin );
1511 }
1512
1513 else
1514 {
1515 ret_val = EOB_ACT_LAST_MATCH;
1516 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1517 YY_BUFFER_EOF_PENDING;
1518 }
1519 }
1520
1521 else
1522 ret_val = EOB_ACT_CONTINUE_SCAN;
1523
1524 (yy_n_chars) += number_to_move;
1525 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1526 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1527
1528 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1529
1530 return ret_val;
1531}
1532
1533/* yy_get_previous_state - get the state just before the EOB char was reached */
1534
1535 static yy_state_type yy_get_previous_state (void)
1536{
1537 register yy_state_type yy_current_state;
1538 register char *yy_cp;
1539
1540 yy_current_state = (yy_start);
1541
1542 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1543 {
1544 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1545 }
1546
1547 return yy_current_state;
1548}
1549
1550/* yy_try_NUL_trans - try to make a transition on the NUL character
1551 *
1552 * synopsis
1553 * next_state = yy_try_NUL_trans( current_state );
1554 */
1555 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1556{
1557 register int yy_is_jam;
1558
1559 yy_current_state = yy_nxt[yy_current_state][1];
1560 yy_is_jam = (yy_current_state <= 0);
1561
1562 return yy_is_jam ? 0 : yy_current_state;
1563}
1564
1565 static void yyunput (int c, register char * yy_bp )
1566{
1567 register char *yy_cp;
1568
1569 yy_cp = (yy_c_buf_p);
1570
1571 /* undo effects of setting up zconftext */
1572 *yy_cp = (yy_hold_char);
1573
1574 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1575 { /* need to shift things up to make room */
1576 /* +2 for EOB chars. */
1577 register int number_to_move = (yy_n_chars) + 2;
1578 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1579 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1580 register char *source =
1581 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1582
1583 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1584 *--dest = *--source;
1585
1586 yy_cp += (int) (dest - source);
1587 yy_bp += (int) (dest - source);
1588 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1589 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1590
1591 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1592 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1593 }
1594
1595 *--yy_cp = (char) c;
1596
1597 (yytext_ptr) = yy_bp;
1598 (yy_hold_char) = *yy_cp;
1599 (yy_c_buf_p) = yy_cp;
1600}
1601
1602#ifndef YY_NO_INPUT
1603#ifdef __cplusplus
1604 static int yyinput (void)
1605#else
1606 static int input (void)
1607#endif
1608
1609{
1610 int c;
1611
1612 *(yy_c_buf_p) = (yy_hold_char);
1613
1614 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1615 {
1616 /* yy_c_buf_p now points to the character we want to return.
1617 * If this occurs *before* the EOB characters, then it's a
1618 * valid NUL; if not, then we've hit the end of the buffer.
1619 */
1620 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1621 /* This was really a NUL. */
1622 *(yy_c_buf_p) = '\0';
1623
1624 else
1625 { /* need more input */
1626 int offset = (yy_c_buf_p) - (yytext_ptr);
1627 ++(yy_c_buf_p);
1628
1629 switch ( yy_get_next_buffer( ) )
1630 {
1631 case EOB_ACT_LAST_MATCH:
1632 /* This happens because yy_g_n_b()
1633 * sees that we've accumulated a
1634 * token and flags that we need to
1635 * try matching the token before
1636 * proceeding. But for input(),
1637 * there's no matching to consider.
1638 * So convert the EOB_ACT_LAST_MATCH
1639 * to EOB_ACT_END_OF_FILE.
1640 */
1641
1642 /* Reset buffer status. */
1643 zconfrestart(zconfin );
1644
1645 /*FALLTHROUGH*/
1646
1647 case EOB_ACT_END_OF_FILE:
1648 {
1649 if ( zconfwrap( ) )
1650 return EOF;
1651
1652 if ( ! (yy_did_buffer_switch_on_eof) )
1653 YY_NEW_FILE;
1654#ifdef __cplusplus
1655 return yyinput();
1656#else
1657 return input();
1658#endif
1659 }
1660
1661 case EOB_ACT_CONTINUE_SCAN:
1662 (yy_c_buf_p) = (yytext_ptr) + offset;
1663 break;
1664 }
1665 }
1666 }
1667
1668 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1669 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1670 (yy_hold_char) = *++(yy_c_buf_p);
1671
1672 return c;
1673}
1674#endif /* ifndef YY_NO_INPUT */
1675
1676/** Immediately switch to a different input stream.
1677 * @param input_file A readable stream.
1678 *
1679 * @note This function does not reset the start condition to @c INITIAL .
1680 */
1681 void zconfrestart (FILE * input_file )
1682{
1683
1684 if ( ! YY_CURRENT_BUFFER ){
1685 zconfensure_buffer_stack ();
1686 YY_CURRENT_BUFFER_LVALUE =
1687 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1688 }
1689
1690 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1691 zconf_load_buffer_state( );
1692}
1693
1694/** Switch to a different input buffer.
1695 * @param new_buffer The new input buffer.
1696 *
1697 */
1698 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1699{
1700
1701 /* TODO. We should be able to replace this entire function body
1702 * with
1703 * zconfpop_buffer_state();
1704 * zconfpush_buffer_state(new_buffer);
1705 */
1706 zconfensure_buffer_stack ();
1707 if ( YY_CURRENT_BUFFER == new_buffer )
1708 return;
1709
1710 if ( YY_CURRENT_BUFFER )
1711 {
1712 /* Flush out information for old buffer. */
1713 *(yy_c_buf_p) = (yy_hold_char);
1714 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1715 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1716 }
1717
1718 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1719 zconf_load_buffer_state( );
1720
1721 /* We don't actually know whether we did this switch during
1722 * EOF (zconfwrap()) processing, but the only time this flag
1723 * is looked at is after zconfwrap() is called, so it's safe
1724 * to go ahead and always set it.
1725 */
1726 (yy_did_buffer_switch_on_eof) = 1;
1727}
1728
1729static void zconf_load_buffer_state (void)
1730{
1731 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1732 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1733 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1734 (yy_hold_char) = *(yy_c_buf_p);
1735}
1736
1737/** Allocate and initialize an input buffer state.
1738 * @param file A readable stream.
1739 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1740 *
1741 * @return the allocated buffer state.
1742 */
1743 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1744{
1745 YY_BUFFER_STATE b;
1746
1747 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1748 if ( ! b )
1749 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1750
1751 b->yy_buf_size = size;
1752
1753 /* yy_ch_buf has to be 2 characters longer than the size given because
1754 * we need to put in 2 end-of-buffer characters.
1755 */
1756 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1757 if ( ! b->yy_ch_buf )
1758 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1759
1760 b->yy_is_our_buffer = 1;
1761
1762 zconf_init_buffer(b,file );
1763
1764 return b;
1765}
1766
1767/** Destroy the buffer.
1768 * @param b a buffer created with zconf_create_buffer()
1769 *
1770 */
1771 void zconf_delete_buffer (YY_BUFFER_STATE b )
1772{
1773
1774 if ( ! b )
1775 return;
1776
1777 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1778 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1779
1780 if ( b->yy_is_our_buffer )
1781 zconffree((void *) b->yy_ch_buf );
1782
1783 zconffree((void *) b );
1784}
1785
1786/* Initializes or reinitializes a buffer.
1787 * This function is sometimes called more than once on the same buffer,
1788 * such as during a zconfrestart() or at EOF.
1789 */
1790 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1791
1792{
1793 int oerrno = errno;
1794
1795 zconf_flush_buffer(b );
1796
1797 b->yy_input_file = file;
1798 b->yy_fill_buffer = 1;
1799
1800 /* If b is the current buffer, then zconf_init_buffer was _probably_
1801 * called from zconfrestart() or through yy_get_next_buffer.
1802 * In that case, we don't want to reset the lineno or column.
1803 */
1804 if (b != YY_CURRENT_BUFFER){
1805 b->yy_bs_lineno = 1;
1806 b->yy_bs_column = 0;
1807 }
1808
1809 b->yy_is_interactive = 0;
1810
1811 errno = oerrno;
1812}
1813
1814/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1815 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1816 *
1817 */
1818 void zconf_flush_buffer (YY_BUFFER_STATE b )
1819{
1820 if ( ! b )
1821 return;
1822
1823 b->yy_n_chars = 0;
1824
1825 /* We always need two end-of-buffer characters. The first causes
1826 * a transition to the end-of-buffer state. The second causes
1827 * a jam in that state.
1828 */
1829 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1830 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1831
1832 b->yy_buf_pos = &b->yy_ch_buf[0];
1833
1834 b->yy_at_bol = 1;
1835 b->yy_buffer_status = YY_BUFFER_NEW;
1836
1837 if ( b == YY_CURRENT_BUFFER )
1838 zconf_load_buffer_state( );
1839}
1840
1841/** Pushes the new state onto the stack. The new state becomes
1842 * the current state. This function will allocate the stack
1843 * if necessary.
1844 * @param new_buffer The new state.
1845 *
1846 */
1847void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1848{
1849 if (new_buffer == NULL)
1850 return;
1851
1852 zconfensure_buffer_stack();
1853
1854 /* This block is copied from zconf_switch_to_buffer. */
1855 if ( YY_CURRENT_BUFFER )
1856 {
1857 /* Flush out information for old buffer. */
1858 *(yy_c_buf_p) = (yy_hold_char);
1859 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1860 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1861 }
1862
1863 /* Only push if top exists. Otherwise, replace top. */
1864 if (YY_CURRENT_BUFFER)
1865 (yy_buffer_stack_top)++;
1866 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1867
1868 /* copied from zconf_switch_to_buffer. */
1869 zconf_load_buffer_state( );
1870 (yy_did_buffer_switch_on_eof) = 1;
1871}
1872
1873/** Removes and deletes the top of the stack, if present.
1874 * The next element becomes the new top.
1875 *
1876 */
1877void zconfpop_buffer_state (void)
1878{
1879 if (!YY_CURRENT_BUFFER)
1880 return;
1881
1882 zconf_delete_buffer(YY_CURRENT_BUFFER );
1883 YY_CURRENT_BUFFER_LVALUE = NULL;
1884 if ((yy_buffer_stack_top) > 0)
1885 --(yy_buffer_stack_top);
1886
1887 if (YY_CURRENT_BUFFER) {
1888 zconf_load_buffer_state( );
1889 (yy_did_buffer_switch_on_eof) = 1;
1890 }
1891}
1892
1893/* Allocates the stack if it does not exist.
1894 * Guarantees space for at least one push.
1895 */
1896static void zconfensure_buffer_stack (void)
1897{
1898 int num_to_alloc;
1899
1900 if (!(yy_buffer_stack)) {
1901
1902 /* First allocation is just for 2 elements, since we don't know if this
1903 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1904 * immediate realloc on the next call.
1905 */
1906 num_to_alloc = 1;
1907 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1908 (num_to_alloc * sizeof(struct yy_buffer_state*)
1909 );
1910
1911 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1912
1913 (yy_buffer_stack_max) = num_to_alloc;
1914 (yy_buffer_stack_top) = 0;
1915 return;
1916 }
1917
1918 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1919
1920 /* Increase the buffer to prepare for a possible push. */
1921 int grow_size = 8 /* arbitrary grow size */;
1922
1923 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1924 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
1925 ((yy_buffer_stack),
1926 num_to_alloc * sizeof(struct yy_buffer_state*)
1927 );
1928
1929 /* zero only the new slots.*/
1930 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1931 (yy_buffer_stack_max) = num_to_alloc;
1932 }
1933}
1934
1935/** Setup the input buffer state to scan directly from a user-specified character buffer.
1936 * @param base the character buffer
1937 * @param size the size in bytes of the character buffer
1938 *
1939 * @return the newly allocated buffer state object.
1940 */
1941YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1942{
1943 YY_BUFFER_STATE b;
1944
1945 if ( size < 2 ||
1946 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1947 base[size-1] != YY_END_OF_BUFFER_CHAR )
1948 /* They forgot to leave room for the EOB's. */
1949 return 0;
1950
1951 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1952 if ( ! b )
1953 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
1954
1955 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1956 b->yy_buf_pos = b->yy_ch_buf = base;
1957 b->yy_is_our_buffer = 0;
1958 b->yy_input_file = 0;
1959 b->yy_n_chars = b->yy_buf_size;
1960 b->yy_is_interactive = 0;
1961 b->yy_at_bol = 1;
1962 b->yy_fill_buffer = 0;
1963 b->yy_buffer_status = YY_BUFFER_NEW;
1964
1965 zconf_switch_to_buffer(b );
1966
1967 return b;
1968}
1969
1970/** Setup the input buffer state to scan a string. The next call to zconflex() will
1971 * scan from a @e copy of @a str.
Roman Zippela02f0572005-11-08 21:34:53 -08001972 * @param yy_str a NUL-terminated string to scan
Linus Torvalds1da177e2005-04-16 15:20:36 -07001973 *
1974 * @return the newly allocated buffer state object.
1975 * @note If you want to scan bytes that may contain NUL values, then use
1976 * zconf_scan_bytes() instead.
1977 */
Roman Zippel7a884882005-11-08 21:34:51 -08001978YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
Linus Torvalds1da177e2005-04-16 15:20:36 -07001979{
1980
Roman Zippel7a884882005-11-08 21:34:51 -08001981 return zconf_scan_bytes(yy_str,strlen(yy_str) );
Linus Torvalds1da177e2005-04-16 15:20:36 -07001982}
1983
1984/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
1985 * scan from a @e copy of @a bytes.
1986 * @param bytes the byte buffer to scan
1987 * @param len the number of bytes in the buffer pointed to by @a bytes.
1988 *
1989 * @return the newly allocated buffer state object.
1990 */
1991YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
1992{
1993 YY_BUFFER_STATE b;
1994 char *buf;
1995 yy_size_t n;
1996 int i;
1997
1998 /* Get memory for full buffer, including space for trailing EOB's. */
1999 n = len + 2;
2000 buf = (char *) zconfalloc(n );
2001 if ( ! buf )
2002 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2003
2004 for ( i = 0; i < len; ++i )
2005 buf[i] = bytes[i];
2006
2007 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2008
2009 b = zconf_scan_buffer(buf,n );
2010 if ( ! b )
2011 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2012
2013 /* It's okay to grow etc. this buffer, and we should throw it
2014 * away when we're done.
2015 */
2016 b->yy_is_our_buffer = 1;
2017
2018 return b;
2019}
2020
2021#ifndef YY_EXIT_FAILURE
2022#define YY_EXIT_FAILURE 2
2023#endif
2024
2025static void yy_fatal_error (yyconst char* msg )
2026{
2027 (void) fprintf( stderr, "%s\n", msg );
2028 exit( YY_EXIT_FAILURE );
2029}
2030
2031/* Redefine yyless() so it works in section 3 code. */
2032
2033#undef yyless
2034#define yyless(n) \
2035 do \
2036 { \
2037 /* Undo effects of setting up zconftext. */ \
2038 int yyless_macro_arg = (n); \
2039 YY_LESS_LINENO(yyless_macro_arg);\
2040 zconftext[zconfleng] = (yy_hold_char); \
2041 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2042 (yy_hold_char) = *(yy_c_buf_p); \
2043 *(yy_c_buf_p) = '\0'; \
2044 zconfleng = yyless_macro_arg; \
2045 } \
2046 while ( 0 )
2047
2048/* Accessor methods (get/set functions) to struct members. */
2049
2050/** Get the current line number.
2051 *
2052 */
2053int zconfget_lineno (void)
2054{
2055
2056 return zconflineno;
2057}
2058
2059/** Get the input stream.
2060 *
2061 */
2062FILE *zconfget_in (void)
2063{
2064 return zconfin;
2065}
2066
2067/** Get the output stream.
2068 *
2069 */
2070FILE *zconfget_out (void)
2071{
2072 return zconfout;
2073}
2074
2075/** Get the length of the current token.
2076 *
2077 */
2078int zconfget_leng (void)
2079{
2080 return zconfleng;
2081}
2082
2083/** Get the current token.
2084 *
2085 */
2086
2087char *zconfget_text (void)
2088{
2089 return zconftext;
2090}
2091
2092/** Set the current line number.
2093 * @param line_number
2094 *
2095 */
2096void zconfset_lineno (int line_number )
2097{
2098
2099 zconflineno = line_number;
2100}
2101
2102/** Set the input stream. This does not discard the current
2103 * input buffer.
2104 * @param in_str A readable stream.
2105 *
2106 * @see zconf_switch_to_buffer
2107 */
2108void zconfset_in (FILE * in_str )
2109{
2110 zconfin = in_str ;
2111}
2112
2113void zconfset_out (FILE * out_str )
2114{
2115 zconfout = out_str ;
2116}
2117
2118int zconfget_debug (void)
2119{
2120 return zconf_flex_debug;
2121}
2122
2123void zconfset_debug (int bdebug )
2124{
2125 zconf_flex_debug = bdebug ;
2126}
2127
2128/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2129int zconflex_destroy (void)
2130{
2131
2132 /* Pop the buffer stack, destroying each element. */
2133 while(YY_CURRENT_BUFFER){
2134 zconf_delete_buffer(YY_CURRENT_BUFFER );
2135 YY_CURRENT_BUFFER_LVALUE = NULL;
2136 zconfpop_buffer_state();
2137 }
2138
2139 /* Destroy the stack itself. */
2140 zconffree((yy_buffer_stack) );
2141 (yy_buffer_stack) = NULL;
2142
2143 return 0;
2144}
2145
2146/*
2147 * Internal utility routines.
2148 */
2149
2150#ifndef yytext_ptr
2151static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2152{
2153 register int i;
2154 for ( i = 0; i < n; ++i )
2155 s1[i] = s2[i];
2156}
2157#endif
2158
2159#ifdef YY_NEED_STRLEN
2160static int yy_flex_strlen (yyconst char * s )
2161{
2162 register int n;
2163 for ( n = 0; s[n]; ++n )
2164 ;
2165
2166 return n;
2167}
2168#endif
2169
2170void *zconfalloc (yy_size_t size )
2171{
2172 return (void *) malloc( size );
2173}
2174
2175void *zconfrealloc (void * ptr, yy_size_t size )
2176{
2177 /* The cast to (char *) in the following accommodates both
2178 * implementations that use char* generic pointers, and those
2179 * that use void* generic pointers. It works with the latter
2180 * because both ANSI C and C++ allow castless assignment from
2181 * any pointer type to void*, and deal with argument conversions
2182 * as though doing an assignment.
2183 */
2184 return (void *) realloc( (char *) ptr, size );
2185}
2186
2187void zconffree (void * ptr )
2188{
2189 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2190}
2191
2192#define YYTABLES_NAME "yytables"
2193
2194#undef YY_NEW_FILE
2195#undef YY_FLUSH_BUFFER
2196#undef yy_set_bol
2197#undef yy_new_buffer
2198#undef yy_set_interactive
2199#undef yytext_ptr
2200#undef YY_DO_BEFORE_ACTION
2201
2202#ifdef YY_DECL_IS_OURS
2203#undef YY_DECL_IS_OURS
2204#undef YY_DECL
2205#endif
2206
2207void zconf_starthelp(void)
2208{
2209 new_string();
2210 last_ts = first_ts = 0;
2211 BEGIN(HELP);
2212}
2213
2214static void zconf_endhelp(void)
2215{
2216 zconflval.string = text;
2217 BEGIN(INITIAL);
2218}
2219
2220/*
2221 * Try to open specified file with following names:
2222 * ./name
2223 * $(srctree)/name
2224 * The latter is used when srctree is separate from objtree
2225 * when compiling the kernel.
2226 * Return NULL if file is not found.
2227 */
2228FILE *zconf_fopen(const char *name)
2229{
2230 char *env, fullname[PATH_MAX+1];
2231 FILE *f;
2232
2233 f = fopen(name, "r");
2234 if (!f && name[0] != '/') {
2235 env = getenv(SRCTREE);
2236 if (env) {
2237 sprintf(fullname, "%s/%s", env, name);
2238 f = fopen(fullname, "r");
2239 }
2240 }
2241 return f;
2242}
2243
2244void zconf_initscan(const char *name)
2245{
2246 zconfin = zconf_fopen(name);
2247 if (!zconfin) {
2248 printf("can't find file %s\n", name);
2249 exit(1);
2250 }
2251
2252 current_buf = malloc(sizeof(*current_buf));
2253 memset(current_buf, 0, sizeof(*current_buf));
2254
2255 current_file = file_lookup(name);
2256 current_file->lineno = 1;
2257 current_file->flags = FILE_BUSY;
2258}
2259
2260void zconf_nextfile(const char *name)
2261{
2262 struct file *file = file_lookup(name);
2263 struct buffer *buf = malloc(sizeof(*buf));
2264 memset(buf, 0, sizeof(*buf));
2265
2266 current_buf->state = YY_CURRENT_BUFFER;
2267 zconfin = zconf_fopen(name);
2268 if (!zconfin) {
2269 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
2270 exit(1);
2271 }
2272 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2273 buf->parent = current_buf;
2274 current_buf = buf;
2275
2276 if (file->flags & FILE_BUSY) {
2277 printf("recursive scan (%s)?\n", name);
2278 exit(1);
2279 }
2280 if (file->flags & FILE_SCANNED) {
2281 printf("file %s already scanned?\n", name);
2282 exit(1);
2283 }
2284 file->flags |= FILE_BUSY;
2285 file->lineno = 1;
2286 file->parent = current_file;
2287 current_file = file;
2288}
2289
Roman Zippela02f0572005-11-08 21:34:53 -08002290static void zconf_endfile(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002291{
2292 struct buffer *parent;
2293
2294 current_file->flags |= FILE_SCANNED;
2295 current_file->flags &= ~FILE_BUSY;
2296 current_file = current_file->parent;
2297
2298 parent = current_buf->parent;
2299 if (parent) {
2300 fclose(zconfin);
2301 zconf_delete_buffer(YY_CURRENT_BUFFER);
2302 zconf_switch_to_buffer(parent->state);
2303 }
2304 free(current_buf);
2305 current_buf = parent;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002306}
2307
2308int zconf_lineno(void)
2309{
Roman Zippela02f0572005-11-08 21:34:53 -08002310 return current_pos.lineno;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002311}
2312
2313char *zconf_curname(void)
2314{
Roman Zippela02f0572005-11-08 21:34:53 -08002315 return current_pos.file ? current_pos.file->name : "<none>";
Linus Torvalds1da177e2005-04-16 15:20:36 -07002316}
2317