blob: d9182916f72494d3138a93a352f24a11ee3f06e7 [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
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03008#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
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#define FLEX_SCANNER
28#define YY_FLEX_MAJOR_VERSION 2
29#define YY_FLEX_MINOR_VERSION 5
Adrian Bunkbe2be1d2008-07-17 02:07:59 +030030#define YY_FLEX_SUBMINOR_VERSION 35
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#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
Adrian Bunkbe2be1d2008-07-17 02:07:59 +030052#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
Roman Zippelf6a88aa2006-06-08 22:12:44 -070053
54/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
Sam Ravnborg14f31562007-09-26 20:15:39 +020055 * if you want the limit (max/min) macros for int types.
Roman Zippelf6a88aa2006-06-08 22:12:44 -070056 */
57#ifndef __STDC_LIMIT_MACROS
58#define __STDC_LIMIT_MACROS 1
59#endif
60
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#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;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
76/* Limits of integral types. */
77#ifndef INT8_MIN
78#define INT8_MIN (-128)
79#endif
80#ifndef INT16_MIN
81#define INT16_MIN (-32767-1)
82#endif
83#ifndef INT32_MIN
84#define INT32_MIN (-2147483647-1)
85#endif
86#ifndef INT8_MAX
87#define INT8_MAX (127)
88#endif
89#ifndef INT16_MAX
90#define INT16_MAX (32767)
91#endif
92#ifndef INT32_MAX
93#define INT32_MAX (2147483647)
94#endif
95#ifndef UINT8_MAX
96#define UINT8_MAX (255U)
97#endif
98#ifndef UINT16_MAX
99#define UINT16_MAX (65535U)
100#endif
101#ifndef UINT32_MAX
102#define UINT32_MAX (4294967295U)
103#endif
104
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300105#endif /* ! C99 */
106
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107#endif /* ! FLEXINT_H */
108
109#ifdef __cplusplus
110
111/* The "const" storage-class-modifier is valid. */
112#define YY_USE_CONST
113
114#else /* ! __cplusplus */
115
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300116/* C99 requires __STDC__ to be defined as 1. */
117#if defined (__STDC__)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
119#define YY_USE_CONST
120
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300121#endif /* defined (__STDC__) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122#endif /* ! __cplusplus */
123
124#ifdef YY_USE_CONST
125#define yyconst const
126#else
127#define yyconst
128#endif
129
130/* Returned upon end-of-file. */
131#define YY_NULL 0
132
133/* Promotes a possibly negative, possibly signed char to an unsigned
134 * integer for use as an array index. If the signed char is negative,
135 * we want to instead treat it as an 8-bit unsigned char, hence the
136 * double cast.
137 */
138#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139
140/* Enter a start condition. This macro really ought to take a parameter,
141 * but we do it the disgusting crufty way forced on us by the ()-less
142 * definition of BEGIN.
143 */
144#define BEGIN (yy_start) = 1 + 2 *
145
146/* Translate the current start state into a value that can be later handed
147 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 * compatibility.
149 */
150#define YY_START (((yy_start) - 1) / 2)
151#define YYSTATE YY_START
152
153/* Action number for EOF rule of a given start state. */
154#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155
156/* Special action meaning "start processing a new file". */
157#define YY_NEW_FILE zconfrestart(zconfin )
158
159#define YY_END_OF_BUFFER_CHAR 0
160
161/* Size of default input buffer. */
162#ifndef YY_BUF_SIZE
Josh Triplett65166572009-10-15 12:13:36 -0700163#ifdef __ia64__
164/* On IA-64, the buffer size is 16k, not 8k.
165 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
166 * Ditto for the __ia64__ case accordingly.
167 */
168#define YY_BUF_SIZE 32768
169#else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170#define YY_BUF_SIZE 16384
Josh Triplett65166572009-10-15 12:13:36 -0700171#endif /* __ia64__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172#endif
173
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700174/* The state buf must be large enough to hold one state per character in the main buffer.
175 */
176#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178#ifndef YY_TYPEDEF_YY_BUFFER_STATE
179#define YY_TYPEDEF_YY_BUFFER_STATE
180typedef struct yy_buffer_state *YY_BUFFER_STATE;
181#endif
182
183extern int zconfleng;
184
185extern FILE *zconfin, *zconfout;
186
187#define EOB_ACT_CONTINUE_SCAN 0
188#define EOB_ACT_END_OF_FILE 1
189#define EOB_ACT_LAST_MATCH 2
190
191 #define YY_LESS_LINENO(n)
192
193/* Return all but the first "n" matched characters back to the input stream. */
194#define yyless(n) \
195 do \
196 { \
197 /* Undo effects of setting up zconftext. */ \
198 int yyless_macro_arg = (n); \
199 YY_LESS_LINENO(yyless_macro_arg);\
200 *yy_cp = (yy_hold_char); \
201 YY_RESTORE_YY_MORE_OFFSET \
202 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
203 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
204 } \
205 while ( 0 )
206
207#define unput(c) yyunput( c, (yytext_ptr) )
208
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209#ifndef YY_TYPEDEF_YY_SIZE_T
210#define YY_TYPEDEF_YY_SIZE_T
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300211typedef size_t yy_size_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212#endif
213
214#ifndef YY_STRUCT_YY_BUFFER_STATE
215#define YY_STRUCT_YY_BUFFER_STATE
216struct yy_buffer_state
217 {
218 FILE *yy_input_file;
219
220 char *yy_ch_buf; /* input buffer */
221 char *yy_buf_pos; /* current position in input buffer */
222
223 /* Size of input buffer in bytes, not including room for EOB
224 * characters.
225 */
226 yy_size_t yy_buf_size;
227
228 /* Number of characters read into yy_ch_buf, not including EOB
229 * characters.
230 */
231 int yy_n_chars;
232
233 /* Whether we "own" the buffer - i.e., we know we created it,
234 * and can realloc() it to grow it, and should free() it to
235 * delete it.
236 */
237 int yy_is_our_buffer;
238
239 /* Whether this is an "interactive" input source; if so, and
240 * if we're using stdio for input, then we want to use getc()
241 * instead of fread(), to make sure we stop fetching input after
242 * each newline.
243 */
244 int yy_is_interactive;
245
246 /* Whether we're considered to be at the beginning of a line.
247 * If so, '^' rules will be active on the next match, otherwise
248 * not.
249 */
250 int yy_at_bol;
251
252 int yy_bs_lineno; /**< The line count. */
253 int yy_bs_column; /**< The column count. */
254
255 /* Whether to try to fill the input buffer when we reach the
256 * end of it.
257 */
258 int yy_fill_buffer;
259
260 int yy_buffer_status;
261
262#define YY_BUFFER_NEW 0
263#define YY_BUFFER_NORMAL 1
264 /* When an EOF's been seen but there's still some text to process
265 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
266 * shouldn't try reading from the input source any more. We might
267 * still have a bunch of tokens to match, though, because of
268 * possible backing-up.
269 *
270 * When we actually see the EOF, we change the status to "new"
271 * (via zconfrestart()), so that the user can continue scanning by
272 * just pointing zconfin at a new input file.
273 */
274#define YY_BUFFER_EOF_PENDING 2
275
276 };
277#endif /* !YY_STRUCT_YY_BUFFER_STATE */
278
279/* Stack of input buffers. */
280static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
281static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
282static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
283
284/* We provide macros for accessing buffer states in case in the
285 * future we want to put the buffer states in a more general
286 * "scanner state".
287 *
288 * Returns the top of the stack, or NULL.
289 */
290#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
291 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
292 : NULL)
293
294/* Same as previous macro, but useful when we know that the buffer stack is not
295 * NULL or when we need an lvalue. For internal use only.
296 */
297#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
298
299/* yy_hold_char holds the character lost when zconftext is formed. */
300static char yy_hold_char;
301static int yy_n_chars; /* number of characters read into yy_ch_buf */
302int zconfleng;
303
304/* Points to current character in buffer. */
305static char *yy_c_buf_p = (char *) 0;
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700306static int yy_init = 0; /* whether we need to initialize */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307static int yy_start = 0; /* start state number */
308
309/* Flag which is used to allow zconfwrap()'s to do buffer switches
310 * instead of setting up a fresh zconfin. A bit of a hack ...
311 */
312static int yy_did_buffer_switch_on_eof;
313
314void zconfrestart (FILE *input_file );
315void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
316YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
317void zconf_delete_buffer (YY_BUFFER_STATE b );
318void zconf_flush_buffer (YY_BUFFER_STATE b );
319void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
320void zconfpop_buffer_state (void );
321
322static void zconfensure_buffer_stack (void );
323static void zconf_load_buffer_state (void );
324static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
325
326#define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
327
328YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
329YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
330YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
331
332void *zconfalloc (yy_size_t );
333void *zconfrealloc (void *,yy_size_t );
334void zconffree (void * );
335
336#define yy_new_buffer zconf_create_buffer
337
338#define yy_set_interactive(is_interactive) \
339 { \
340 if ( ! YY_CURRENT_BUFFER ){ \
341 zconfensure_buffer_stack (); \
342 YY_CURRENT_BUFFER_LVALUE = \
343 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
344 } \
345 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
346 }
347
348#define yy_set_bol(at_bol) \
349 { \
350 if ( ! YY_CURRENT_BUFFER ){\
351 zconfensure_buffer_stack (); \
352 YY_CURRENT_BUFFER_LVALUE = \
353 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
354 } \
355 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
356 }
357
358#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
359
360/* Begin user sect3 */
361
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300362#define zconfwrap(n) 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363#define YY_SKIP_YYWRAP
364
365typedef unsigned char YY_CHAR;
366
367FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
368
369typedef int yy_state_type;
370
371extern int zconflineno;
372
373int zconflineno = 1;
374
375extern char *zconftext;
376#define yytext_ptr zconftext
Roman Zippel7a884882005-11-08 21:34:51 -0800377static yyconst flex_int16_t yy_nxt[][17] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 {
379 {
380 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Roman Zippel7a884882005-11-08 21:34:51 -0800381 0, 0, 0, 0, 0, 0, 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 },
383
384 {
385 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
Roman Zippel7a884882005-11-08 21:34:51 -0800386 12, 12, 12, 12, 12, 12, 12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 },
388
389 {
390 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
Roman Zippel7a884882005-11-08 21:34:51 -0800391 12, 12, 12, 12, 12, 12, 12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392 },
393
394 {
395 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
Roman Zippel7a884882005-11-08 21:34:51 -0800396 16, 16, 16, 18, 16, 16, 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397 },
398
399 {
400 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
Roman Zippel7a884882005-11-08 21:34:51 -0800401 16, 16, 16, 18, 16, 16, 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402
403 },
404
405 {
Roman Zippel7a884882005-11-08 21:34:51 -0800406 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
407 19, 19, 19, 19, 19, 19, 19
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 },
409
410 {
Roman Zippel7a884882005-11-08 21:34:51 -0800411 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
412 19, 19, 19, 19, 19, 19, 19
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 },
414
415 {
Roman Zippel7a884882005-11-08 21:34:51 -0800416 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
417 22, 22, 22, 22, 22, 25, 22
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 },
419
420 {
Roman Zippel7a884882005-11-08 21:34:51 -0800421 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
422 22, 22, 22, 22, 22, 25, 22
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 },
424
425 {
Roman Zippel7a884882005-11-08 21:34:51 -0800426 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
427 33, 34, 35, 35, 36, 37, 38
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428
429 },
430
431 {
Roman Zippel7a884882005-11-08 21:34:51 -0800432 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
433 33, 34, 35, 35, 36, 37, 38
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 },
435
436 {
437 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
Roman Zippel7a884882005-11-08 21:34:51 -0800438 -11, -11, -11, -11, -11, -11, -11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 },
440
441 {
442 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
Roman Zippel7a884882005-11-08 21:34:51 -0800443 -12, -12, -12, -12, -12, -12, -12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 },
445
446 {
Roman Zippel7a884882005-11-08 21:34:51 -0800447 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
448 -13, -13, -13, -13, -13, -13, -13
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 },
450
451 {
452 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
Roman Zippel7a884882005-11-08 21:34:51 -0800453 -14, -14, -14, -14, -14, -14, -14
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454
455 },
456
457 {
Roman Zippel7a884882005-11-08 21:34:51 -0800458 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
459 42, 42, 42, 42, 42, 42, 42
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 },
461
462 {
463 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
Roman Zippel7a884882005-11-08 21:34:51 -0800464 -16, -16, -16, -16, -16, -16, -16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 },
466
467 {
468 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
Roman Zippel7a884882005-11-08 21:34:51 -0800469 -17, -17, -17, -17, -17, -17, -17
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 },
471
472 {
473 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
Roman Zippel7a884882005-11-08 21:34:51 -0800474 -18, -18, -18, 44, -18, -18, -18
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 },
476
477 {
Roman Zippel7a884882005-11-08 21:34:51 -0800478 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
479 45, 45, 45, 45, 45, 45, 45
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480
481 },
482
483 {
Roman Zippel7a884882005-11-08 21:34:51 -0800484 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
485 -20, -20, -20, -20, -20, -20, -20
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 },
487
488 {
Roman Zippel7a884882005-11-08 21:34:51 -0800489 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
490 48, 48, 48, 48, 48, 48, 48
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 },
492
493 {
Roman Zippel7a884882005-11-08 21:34:51 -0800494 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
495 49, 49, 49, 49, 49, -22, 49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 },
497
498 {
499 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
Roman Zippel7a884882005-11-08 21:34:51 -0800500 -23, -23, -23, -23, -23, -23, -23
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 },
502
503 {
504 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
Roman Zippel7a884882005-11-08 21:34:51 -0800505 -24, -24, -24, -24, -24, -24, -24
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506
507 },
508
509 {
Roman Zippel7a884882005-11-08 21:34:51 -0800510 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
511 51, 51, 51, 51, 51, 51, 51
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 },
513
514 {
515 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
Roman Zippel7a884882005-11-08 21:34:51 -0800516 -26, -26, -26, -26, -26, -26, -26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 },
518
519 {
520 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
Roman Zippel7a884882005-11-08 21:34:51 -0800521 -27, -27, -27, -27, -27, -27, -27
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522 },
523
524 {
525 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
Roman Zippel7a884882005-11-08 21:34:51 -0800526 -28, -28, -28, -28, 53, -28, -28
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 },
528
529 {
530 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
Roman Zippel7a884882005-11-08 21:34:51 -0800531 -29, -29, -29, -29, -29, -29, -29
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532
533 },
534
535 {
Roman Zippel7a884882005-11-08 21:34:51 -0800536 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
537 54, 54, 54, 54, 54, 54, 54
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 },
539
540 {
Roman Zippel7a884882005-11-08 21:34:51 -0800541 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
542 -31, -31, -31, -31, -31, -31, -31
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 },
544
545 {
Roman Zippel7a884882005-11-08 21:34:51 -0800546 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
547 -32, -32, -32, -32, -32, -32, -32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 },
549
550 {
Roman Zippel7a884882005-11-08 21:34:51 -0800551 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
552 -33, -33, -33, -33, -33, -33, -33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 },
554
555 {
Roman Zippel7a884882005-11-08 21:34:51 -0800556 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
557 -34, 56, 57, 57, -34, -34, -34
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558
559 },
560
561 {
562 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
Roman Zippel7a884882005-11-08 21:34:51 -0800563 -35, 57, 57, 57, -35, -35, -35
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 },
565
566 {
567 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
Roman Zippel7a884882005-11-08 21:34:51 -0800568 -36, -36, -36, -36, -36, -36, -36
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 },
570
571 {
Roman Zippel7a884882005-11-08 21:34:51 -0800572 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
573 -37, -37, -37, -37, -37, -37, -37
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 },
575
576 {
577 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
Roman Zippel7a884882005-11-08 21:34:51 -0800578 -38, -38, -38, -38, -38, -38, 59
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 },
580
581 {
Roman Zippel7a884882005-11-08 21:34:51 -0800582 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
583 -39, -39, -39, -39, -39, -39, -39
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584
585 },
586
587 {
588 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
Roman Zippel7a884882005-11-08 21:34:51 -0800589 -40, -40, -40, -40, -40, -40, -40
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 },
591
592 {
Roman Zippel7a884882005-11-08 21:34:51 -0800593 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
594 42, 42, 42, 42, 42, 42, 42
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 },
596
597 {
Roman Zippel7a884882005-11-08 21:34:51 -0800598 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
599 42, 42, 42, 42, 42, 42, 42
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 },
601
602 {
Roman Zippel7a884882005-11-08 21:34:51 -0800603 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
604 -43, -43, -43, -43, -43, -43, -43
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605 },
606
607 {
608 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
Roman Zippel7a884882005-11-08 21:34:51 -0800609 -44, -44, -44, 44, -44, -44, -44
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610
611 },
612
613 {
Roman Zippel7a884882005-11-08 21:34:51 -0800614 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
615 45, 45, 45, 45, 45, 45, 45
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 },
617
618 {
Roman Zippel7a884882005-11-08 21:34:51 -0800619 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
620 -46, -46, -46, -46, -46, -46, -46
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 },
622
623 {
Roman Zippel7a884882005-11-08 21:34:51 -0800624 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
625 48, 48, 48, 48, 48, 48, 48
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 },
627
628 {
629 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
Roman Zippel7a884882005-11-08 21:34:51 -0800630 -48, -48, -48, -48, -48, -48, -48
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631 },
632
633 {
Roman Zippel7a884882005-11-08 21:34:51 -0800634 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
635 49, 49, 49, 49, 49, -49, 49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636
637 },
638
639 {
640 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
Roman Zippel7a884882005-11-08 21:34:51 -0800641 -50, -50, -50, -50, -50, -50, -50
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 },
643
644 {
Roman Zippel7a884882005-11-08 21:34:51 -0800645 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
646 -51, -51, -51, -51, -51, -51, -51
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 },
648
649 {
650 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
Roman Zippel7a884882005-11-08 21:34:51 -0800651 -52, -52, -52, -52, -52, -52, -52
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 },
653
654 {
Roman Zippel7a884882005-11-08 21:34:51 -0800655 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
656 -53, -53, -53, -53, -53, -53, -53
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657 },
658
659 {
Roman Zippel7a884882005-11-08 21:34:51 -0800660 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
661 54, 54, 54, 54, 54, 54, 54
Linus Torvalds1da177e2005-04-16 15:20:36 -0700662
663 },
664
665 {
Roman Zippel7a884882005-11-08 21:34:51 -0800666 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
667 -55, -55, -55, -55, -55, -55, -55
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668 },
669
670 {
Roman Zippel7a884882005-11-08 21:34:51 -0800671 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
672 -56, 60, 57, 57, -56, -56, -56
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673 },
674
675 {
676 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
Roman Zippel7a884882005-11-08 21:34:51 -0800677 -57, 57, 57, 57, -57, -57, -57
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 },
679
680 {
681 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
Roman Zippel7a884882005-11-08 21:34:51 -0800682 -58, -58, -58, -58, -58, -58, -58
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 },
684
685 {
686 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
Roman Zippel7a884882005-11-08 21:34:51 -0800687 -59, -59, -59, -59, -59, -59, -59
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688
689 },
690
691 {
692 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
Roman Zippel7a884882005-11-08 21:34:51 -0800693 -60, 57, 57, 57, -60, -60, -60
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 },
695
696 } ;
697
698static yy_state_type yy_get_previous_state (void );
699static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
700static int yy_get_next_buffer (void );
701static void yy_fatal_error (yyconst char msg[] );
702
703/* Done after the current pattern has been matched and before the
704 * corresponding action - sets up zconftext.
705 */
706#define YY_DO_BEFORE_ACTION \
707 (yytext_ptr) = yy_bp; \
708 zconfleng = (size_t) (yy_cp - yy_bp); \
709 (yy_hold_char) = *yy_cp; \
710 *yy_cp = '\0'; \
711 (yy_c_buf_p) = yy_cp;
712
Roman Zippel7a884882005-11-08 21:34:51 -0800713#define YY_NUM_RULES 33
714#define YY_END_OF_BUFFER 34
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715/* This struct is not used in this scanner,
716 but its presence is necessary. */
717struct yy_trans_info
718 {
719 flex_int32_t yy_verify;
720 flex_int32_t yy_nxt;
721 };
Roman Zippel7a884882005-11-08 21:34:51 -0800722static yyconst flex_int16_t yy_accept[61] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723 { 0,
724 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Roman Zippela02f0572005-11-08 21:34:53 -0800725 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
Roman Zippel7a884882005-11-08 21:34:51 -0800726 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
Roman Zippela02f0572005-11-08 21:34:53 -0800727 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
728 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
Roman Zippel7a884882005-11-08 21:34:51 -0800729 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730 } ;
731
732static yyconst flex_int32_t yy_ec[256] =
733 { 0,
734 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
735 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
736 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
737 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
738 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
739 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
740 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
741 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
742 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
Roman Zippel7a884882005-11-08 21:34:51 -0800743 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744
Roman Zippel7a884882005-11-08 21:34:51 -0800745 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
746 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
747 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
749 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
750 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
751 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
752 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
754 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
755
756 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
757 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
758 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
759 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
760 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
761 1, 1, 1, 1, 1
762 } ;
763
764extern int zconf_flex_debug;
765int zconf_flex_debug = 0;
766
767/* The intent behind this definition is that it'll catch
768 * any uses of REJECT which flex missed.
769 */
770#define REJECT reject_used_but_not_detected
771#define yymore() yymore_used_but_not_detected
772#define YY_MORE_ADJ 0
773#define YY_RESTORE_YY_MORE_OFFSET
774char *zconftext;
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300775#define YY_NO_INPUT 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776
777/*
778 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
779 * Released under the terms of the GNU GPL v2.0.
780 */
781
782#include <limits.h>
783#include <stdio.h>
784#include <stdlib.h>
785#include <string.h>
786#include <unistd.h>
787
788#define LKC_DIRECT_LINK
789#include "lkc.h"
790
791#define START_STRSIZE 16
792
Roman Zippela02f0572005-11-08 21:34:53 -0800793static struct {
794 struct file *file;
795 int lineno;
796} current_pos;
797
Roman Zippel7a884882005-11-08 21:34:51 -0800798static char *text;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799static int text_size, text_asize;
800
801struct buffer {
802 struct buffer *parent;
803 YY_BUFFER_STATE state;
804};
805
806struct buffer *current_buf;
807
808static int last_ts, first_ts;
809
810static void zconf_endhelp(void);
Roman Zippela02f0572005-11-08 21:34:53 -0800811static void zconf_endfile(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812
Josh Triplett65166572009-10-15 12:13:36 -0700813static void new_string(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814{
815 text = malloc(START_STRSIZE);
816 text_asize = START_STRSIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 text_size = 0;
Roman Zippel7a884882005-11-08 21:34:51 -0800818 *text = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819}
820
Josh Triplett65166572009-10-15 12:13:36 -0700821static void append_string(const char *str, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822{
823 int new_size = text_size + size + 1;
824 if (new_size > text_asize) {
Roman Zippel7a884882005-11-08 21:34:51 -0800825 new_size += START_STRSIZE - 1;
826 new_size &= -START_STRSIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 text = realloc(text, new_size);
828 text_asize = new_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829 }
Roman Zippel7a884882005-11-08 21:34:51 -0800830 memcpy(text + text_size, str, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 text_size += size;
Roman Zippel7a884882005-11-08 21:34:51 -0800832 text[text_size] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833}
834
Josh Triplett65166572009-10-15 12:13:36 -0700835static void alloc_string(const char *str, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836{
837 text = malloc(size + 1);
838 memcpy(text, str, size);
839 text[size] = 0;
840}
841
842#define INITIAL 0
843#define COMMAND 1
844#define HELP 2
845#define STRING 3
846#define PARAM 4
847
Roman Zippel7a884882005-11-08 21:34:51 -0800848#ifndef YY_NO_UNISTD_H
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849/* Special case for "unistd.h", since it is non-ANSI. We include it way
850 * down here because we want the user's section 1 to have been scanned first.
851 * The user has a chance to override it with an option.
852 */
853#include <unistd.h>
Roman Zippel7a884882005-11-08 21:34:51 -0800854#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855
856#ifndef YY_EXTRA_TYPE
857#define YY_EXTRA_TYPE void *
858#endif
859
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700860static int yy_init_globals (void );
861
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300862/* Accessor methods to globals.
863 These are made visible to non-reentrant scanners for convenience. */
864
865int zconflex_destroy (void );
866
867int zconfget_debug (void );
868
869void zconfset_debug (int debug_flag );
870
871YY_EXTRA_TYPE zconfget_extra (void );
872
873void zconfset_extra (YY_EXTRA_TYPE user_defined );
874
875FILE *zconfget_in (void );
876
877void zconfset_in (FILE * in_str );
878
879FILE *zconfget_out (void );
880
881void zconfset_out (FILE * out_str );
882
883int zconfget_leng (void );
884
885char *zconfget_text (void );
886
887int zconfget_lineno (void );
888
889void zconfset_lineno (int line_number );
890
Linus Torvalds1da177e2005-04-16 15:20:36 -0700891/* Macros after this point can all be overridden by user definitions in
892 * section 1.
893 */
894
895#ifndef YY_SKIP_YYWRAP
896#ifdef __cplusplus
897extern "C" int zconfwrap (void );
898#else
899extern int zconfwrap (void );
900#endif
901#endif
902
903 static void yyunput (int c,char *buf_ptr );
904
905#ifndef yytext_ptr
906static void yy_flex_strncpy (char *,yyconst char *,int );
907#endif
908
909#ifdef YY_NEED_STRLEN
910static int yy_flex_strlen (yyconst char * );
911#endif
912
913#ifndef YY_NO_INPUT
914
915#ifdef __cplusplus
916static int yyinput (void );
917#else
918static int input (void );
919#endif
920
921#endif
922
923/* Amount of stuff to slurp up with each read. */
924#ifndef YY_READ_BUF_SIZE
Josh Triplett65166572009-10-15 12:13:36 -0700925#ifdef __ia64__
926/* On IA-64, the buffer size is 16k, not 8k */
927#define YY_READ_BUF_SIZE 16384
928#else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700929#define YY_READ_BUF_SIZE 8192
Josh Triplett65166572009-10-15 12:13:36 -0700930#endif /* __ia64__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700931#endif
932
933/* Copy whatever the last rule matched to the standard output. */
934#ifndef ECHO
935/* This used to be an fputs(), but since the string might contain NUL's,
936 * we now use fwrite().
937 */
Josh Triplett65166572009-10-15 12:13:36 -0700938#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700939#endif
940
941/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
942 * is returned in "result".
943 */
944#ifndef YY_INPUT
945#define YY_INPUT(buf,result,max_size) \
946 errno=0; \
947 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
948 { \
949 if( errno != EINTR) \
950 { \
951 YY_FATAL_ERROR( "input in flex scanner failed" ); \
952 break; \
953 } \
954 errno=0; \
955 clearerr(zconfin); \
956 }\
957\
958
959#endif
960
961/* No semi-colon after return; correct usage is to write "yyterminate();" -
962 * we don't want an extra ';' after the "return" because that will cause
963 * some compilers to complain about unreachable statements.
964 */
965#ifndef yyterminate
966#define yyterminate() return YY_NULL
967#endif
968
969/* Number of entries by which start-condition stack grows. */
970#ifndef YY_START_STACK_INCR
971#define YY_START_STACK_INCR 25
972#endif
973
974/* Report a fatal error. */
975#ifndef YY_FATAL_ERROR
976#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
977#endif
978
979/* end tables serialization structures and prototypes */
980
981/* Default declaration of generated scanner - a define so the user can
982 * easily add parameters.
983 */
984#ifndef YY_DECL
985#define YY_DECL_IS_OURS 1
986
987extern int zconflex (void);
988
989#define YY_DECL int zconflex (void)
990#endif /* !YY_DECL */
991
992/* Code executed at the beginning of each rule, after zconftext and zconfleng
993 * have been set up.
994 */
995#ifndef YY_USER_ACTION
996#define YY_USER_ACTION
997#endif
998
999/* Code executed at the end of each rule. */
1000#ifndef YY_BREAK
1001#define YY_BREAK break;
1002#endif
1003
1004#define YY_RULE_SETUP \
1005 YY_USER_ACTION
1006
1007/** The main scanner function which does all the work.
1008 */
1009YY_DECL
1010{
1011 register yy_state_type yy_current_state;
1012 register char *yy_cp, *yy_bp;
1013 register int yy_act;
1014
1015 int str = 0;
1016 int ts, i;
1017
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001018 if ( !(yy_init) )
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001020 (yy_init) = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001021
1022#ifdef YY_USER_INIT
1023 YY_USER_INIT;
1024#endif
1025
1026 if ( ! (yy_start) )
1027 (yy_start) = 1; /* first start state */
1028
1029 if ( ! zconfin )
1030 zconfin = stdin;
1031
1032 if ( ! zconfout )
1033 zconfout = stdout;
1034
1035 if ( ! YY_CURRENT_BUFFER ) {
1036 zconfensure_buffer_stack ();
1037 YY_CURRENT_BUFFER_LVALUE =
1038 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1039 }
1040
1041 zconf_load_buffer_state( );
1042 }
1043
1044 while ( 1 ) /* loops until end-of-file is reached */
1045 {
1046 yy_cp = (yy_c_buf_p);
1047
1048 /* Support of zconftext. */
1049 *yy_cp = (yy_hold_char);
1050
1051 /* yy_bp points to the position in yy_ch_buf of the start of
1052 * the current run.
1053 */
1054 yy_bp = yy_cp;
1055
1056 yy_current_state = (yy_start);
1057yy_match:
1058 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
1059 ++yy_cp;
1060
1061 yy_current_state = -yy_current_state;
1062
1063yy_find_action:
1064 yy_act = yy_accept[yy_current_state];
1065
1066 YY_DO_BEFORE_ACTION;
1067
1068do_action: /* This label is used only to access EOF actions. */
1069
1070 switch ( yy_act )
1071 { /* beginning of action switch */
1072case 1:
1073/* rule 1 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001074case 2:
Roman Zippela02f0572005-11-08 21:34:53 -08001075/* rule 2 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001076YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001077{
1078 current_file->lineno++;
1079 return T_EOL;
1080}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001081 YY_BREAK
1082case 3:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001083YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001084
Linus Torvalds1da177e2005-04-16 15:20:36 -07001085 YY_BREAK
1086case 4:
1087YY_RULE_SETUP
1088{
1089 BEGIN(COMMAND);
1090}
1091 YY_BREAK
1092case 5:
1093YY_RULE_SETUP
1094{
1095 unput(zconftext[0]);
1096 BEGIN(COMMAND);
1097}
1098 YY_BREAK
1099
1100case 6:
1101YY_RULE_SETUP
Linus Torvalds1da177e2005-04-16 15:20:36 -07001102{
Roman Zippel7a884882005-11-08 21:34:51 -08001103 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
Roman Zippela02f0572005-11-08 21:34:53 -08001104 BEGIN(PARAM);
1105 current_pos.file = current_file;
1106 current_pos.lineno = current_file->lineno;
Roman Zippel7a884882005-11-08 21:34:51 -08001107 if (id && id->flags & TF_COMMAND) {
Roman Zippel3370f9f2005-11-08 21:34:52 -08001108 zconflval.id = id;
Roman Zippel7a884882005-11-08 21:34:51 -08001109 return id->token;
1110 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 alloc_string(zconftext, zconfleng);
1112 zconflval.string = text;
1113 return T_WORD;
1114 }
1115 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001116case 7:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001117YY_RULE_SETUP
1118
1119 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001120case 8:
1121/* rule 8 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001122YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001123{
1124 BEGIN(INITIAL);
1125 current_file->lineno++;
1126 return T_EOL;
1127 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001128 YY_BREAK
1129
Roman Zippel7a884882005-11-08 21:34:51 -08001130case 9:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131YY_RULE_SETUP
1132return T_AND;
1133 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001134case 10:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001135YY_RULE_SETUP
1136return T_OR;
1137 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001138case 11:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139YY_RULE_SETUP
1140return T_OPEN_PAREN;
1141 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001142case 12:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001143YY_RULE_SETUP
1144return T_CLOSE_PAREN;
1145 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001146case 13:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147YY_RULE_SETUP
1148return T_NOT;
1149 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001150case 14:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001151YY_RULE_SETUP
1152return T_EQUAL;
1153 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001154case 15:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001155YY_RULE_SETUP
1156return T_UNEQUAL;
1157 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001158case 16:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001159YY_RULE_SETUP
1160{
1161 str = zconftext[0];
1162 new_string();
1163 BEGIN(STRING);
1164 }
1165 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001166case 17:
1167/* rule 17 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001168YY_RULE_SETUP
1169BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1170 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001171case 18:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001172YY_RULE_SETUP
1173/* ignore */
1174 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001175case 19:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001176YY_RULE_SETUP
1177{
Roman Zippel7a884882005-11-08 21:34:51 -08001178 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
Roman Zippel3370f9f2005-11-08 21:34:52 -08001179 if (id && id->flags & TF_PARAM) {
1180 zconflval.id = id;
Roman Zippel7a884882005-11-08 21:34:51 -08001181 return id->token;
Roman Zippel3370f9f2005-11-08 21:34:52 -08001182 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001183 alloc_string(zconftext, zconfleng);
1184 zconflval.string = text;
1185 return T_WORD;
1186 }
1187 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001188case 20:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001189YY_RULE_SETUP
1190/* comment */
1191 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001192case 21:
1193/* rule 21 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001194YY_RULE_SETUP
1195current_file->lineno++;
1196 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001197case 22:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001198YY_RULE_SETUP
1199
1200 YY_BREAK
1201case YY_STATE_EOF(PARAM):
1202{
1203 BEGIN(INITIAL);
1204 }
1205 YY_BREAK
1206
Roman Zippel7a884882005-11-08 21:34:51 -08001207case 23:
1208/* rule 23 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001209*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1210(yy_c_buf_p) = yy_cp -= 1;
1211YY_DO_BEFORE_ACTION; /* set up zconftext again */
1212YY_RULE_SETUP
1213{
1214 append_string(zconftext, zconfleng);
1215 zconflval.string = text;
1216 return T_WORD_QUOTE;
1217 }
1218 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001219case 24:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001220YY_RULE_SETUP
1221{
1222 append_string(zconftext, zconfleng);
1223 }
1224 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001225case 25:
1226/* rule 25 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001227*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1228(yy_c_buf_p) = yy_cp -= 1;
1229YY_DO_BEFORE_ACTION; /* set up zconftext again */
1230YY_RULE_SETUP
1231{
1232 append_string(zconftext + 1, zconfleng - 1);
1233 zconflval.string = text;
1234 return T_WORD_QUOTE;
1235 }
1236 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001237case 26:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001238YY_RULE_SETUP
1239{
1240 append_string(zconftext + 1, zconfleng - 1);
1241 }
1242 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001243case 27:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001244YY_RULE_SETUP
1245{
1246 if (str == zconftext[0]) {
1247 BEGIN(PARAM);
1248 zconflval.string = text;
1249 return T_WORD_QUOTE;
1250 } else
1251 append_string(zconftext, 1);
1252 }
1253 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001254case 28:
1255/* rule 28 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001256YY_RULE_SETUP
1257{
1258 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1259 current_file->lineno++;
1260 BEGIN(INITIAL);
1261 return T_EOL;
1262 }
1263 YY_BREAK
1264case YY_STATE_EOF(STRING):
1265{
1266 BEGIN(INITIAL);
1267 }
1268 YY_BREAK
1269
Roman Zippel7a884882005-11-08 21:34:51 -08001270case 29:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001271YY_RULE_SETUP
1272{
1273 ts = 0;
1274 for (i = 0; i < zconfleng; i++) {
1275 if (zconftext[i] == '\t')
1276 ts = (ts & ~7) + 8;
1277 else
1278 ts++;
1279 }
1280 last_ts = ts;
1281 if (first_ts) {
1282 if (ts < first_ts) {
1283 zconf_endhelp();
1284 return T_HELPTEXT;
1285 }
1286 ts -= first_ts;
1287 while (ts > 8) {
1288 append_string(" ", 8);
1289 ts -= 8;
1290 }
1291 append_string(" ", ts);
1292 }
1293 }
1294 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001295case 30:
1296/* rule 30 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001297*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1298(yy_c_buf_p) = yy_cp -= 1;
1299YY_DO_BEFORE_ACTION; /* set up zconftext again */
1300YY_RULE_SETUP
1301{
1302 current_file->lineno++;
1303 zconf_endhelp();
1304 return T_HELPTEXT;
1305 }
1306 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001307case 31:
1308/* rule 31 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001309YY_RULE_SETUP
1310{
1311 current_file->lineno++;
1312 append_string("\n", 1);
1313 }
1314 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001315case 32:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001316YY_RULE_SETUP
1317{
EGRY Gaborf7a4b4c2008-01-11 23:55:20 +01001318 while (zconfleng) {
1319 if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
1320 break;
1321 zconfleng--;
1322 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001323 append_string(zconftext, zconfleng);
1324 if (!first_ts)
1325 first_ts = last_ts;
1326 }
1327 YY_BREAK
1328case YY_STATE_EOF(HELP):
1329{
1330 zconf_endhelp();
1331 return T_HELPTEXT;
1332 }
1333 YY_BREAK
1334
1335case YY_STATE_EOF(INITIAL):
1336case YY_STATE_EOF(COMMAND):
1337{
Roman Zippela02f0572005-11-08 21:34:53 -08001338 if (current_file) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001339 zconf_endfile();
Roman Zippela02f0572005-11-08 21:34:53 -08001340 return T_EOL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001341 }
1342 fclose(zconfin);
1343 yyterminate();
1344}
1345 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001346case 33:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001347YY_RULE_SETUP
1348YY_FATAL_ERROR( "flex scanner jammed" );
1349 YY_BREAK
1350
1351 case YY_END_OF_BUFFER:
1352 {
1353 /* Amount of text matched not including the EOB char. */
1354 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1355
1356 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1357 *yy_cp = (yy_hold_char);
1358 YY_RESTORE_YY_MORE_OFFSET
1359
1360 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1361 {
1362 /* We're scanning a new file or input source. It's
1363 * possible that this happened because the user
1364 * just pointed zconfin at a new source and called
1365 * zconflex(). If so, then we have to assure
1366 * consistency between YY_CURRENT_BUFFER and our
1367 * globals. Here is the right place to do so, because
1368 * this is the first action (other than possibly a
1369 * back-up) that will match for the new input source.
1370 */
1371 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1372 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1373 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1374 }
1375
1376 /* Note that here we test for yy_c_buf_p "<=" to the position
1377 * of the first EOB in the buffer, since yy_c_buf_p will
1378 * already have been incremented past the NUL character
1379 * (since all states make transitions on EOB to the
1380 * end-of-buffer state). Contrast this with the test
1381 * in input().
1382 */
1383 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1384 { /* This was really a NUL. */
1385 yy_state_type yy_next_state;
1386
1387 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1388
1389 yy_current_state = yy_get_previous_state( );
1390
1391 /* Okay, we're now positioned to make the NUL
1392 * transition. We couldn't have
1393 * yy_get_previous_state() go ahead and do it
1394 * for us because it doesn't know how to deal
1395 * with the possibility of jamming (and we don't
1396 * want to build jamming into it because then it
1397 * will run more slowly).
1398 */
1399
1400 yy_next_state = yy_try_NUL_trans( yy_current_state );
1401
1402 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1403
1404 if ( yy_next_state )
1405 {
1406 /* Consume the NUL. */
1407 yy_cp = ++(yy_c_buf_p);
1408 yy_current_state = yy_next_state;
1409 goto yy_match;
1410 }
1411
1412 else
1413 {
1414 yy_cp = (yy_c_buf_p);
1415 goto yy_find_action;
1416 }
1417 }
1418
1419 else switch ( yy_get_next_buffer( ) )
1420 {
1421 case EOB_ACT_END_OF_FILE:
1422 {
1423 (yy_did_buffer_switch_on_eof) = 0;
1424
1425 if ( zconfwrap( ) )
1426 {
1427 /* Note: because we've taken care in
1428 * yy_get_next_buffer() to have set up
1429 * zconftext, we can now set up
1430 * yy_c_buf_p so that if some total
1431 * hoser (like flex itself) wants to
1432 * call the scanner after we return the
1433 * YY_NULL, it'll still work - another
1434 * YY_NULL will get returned.
1435 */
1436 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1437
1438 yy_act = YY_STATE_EOF(YY_START);
1439 goto do_action;
1440 }
1441
1442 else
1443 {
1444 if ( ! (yy_did_buffer_switch_on_eof) )
1445 YY_NEW_FILE;
1446 }
1447 break;
1448 }
1449
1450 case EOB_ACT_CONTINUE_SCAN:
1451 (yy_c_buf_p) =
1452 (yytext_ptr) + yy_amount_of_matched_text;
1453
1454 yy_current_state = yy_get_previous_state( );
1455
1456 yy_cp = (yy_c_buf_p);
1457 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1458 goto yy_match;
1459
1460 case EOB_ACT_LAST_MATCH:
1461 (yy_c_buf_p) =
1462 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1463
1464 yy_current_state = yy_get_previous_state( );
1465
1466 yy_cp = (yy_c_buf_p);
1467 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1468 goto yy_find_action;
1469 }
1470 break;
1471 }
1472
1473 default:
1474 YY_FATAL_ERROR(
1475 "fatal flex scanner internal error--no action found" );
1476 } /* end of action switch */
1477 } /* end of scanning one token */
1478} /* end of zconflex */
1479
1480/* yy_get_next_buffer - try to read in a new buffer
1481 *
1482 * Returns a code representing an action:
1483 * EOB_ACT_LAST_MATCH -
1484 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1485 * EOB_ACT_END_OF_FILE - end of file
1486 */
1487static int yy_get_next_buffer (void)
1488{
1489 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1490 register char *source = (yytext_ptr);
1491 register int number_to_move, i;
1492 int ret_val;
1493
1494 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1495 YY_FATAL_ERROR(
1496 "fatal flex scanner internal error--end of buffer missed" );
1497
1498 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1499 { /* Don't try to fill the buffer, so this is an EOF. */
1500 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1501 {
1502 /* We matched a single character, the EOB, so
1503 * treat this as a final EOF.
1504 */
1505 return EOB_ACT_END_OF_FILE;
1506 }
1507
1508 else
1509 {
1510 /* We matched some text prior to the EOB, first
1511 * process it.
1512 */
1513 return EOB_ACT_LAST_MATCH;
1514 }
1515 }
1516
1517 /* Try to read more data. */
1518
1519 /* First move last chars to start of buffer. */
1520 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1521
1522 for ( i = 0; i < number_to_move; ++i )
1523 *(dest++) = *(source++);
1524
1525 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1526 /* don't do the read, it's not guaranteed to return an EOF,
1527 * just force an EOF
1528 */
1529 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1530
1531 else
1532 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001533 int num_to_read =
Linus Torvalds1da177e2005-04-16 15:20:36 -07001534 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1535
1536 while ( num_to_read <= 0 )
1537 { /* Not enough room in the buffer - grow it. */
1538
1539 /* just a shorter name for the current buffer */
1540 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1541
1542 int yy_c_buf_p_offset =
1543 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1544
1545 if ( b->yy_is_our_buffer )
1546 {
1547 int new_size = b->yy_buf_size * 2;
1548
1549 if ( new_size <= 0 )
1550 b->yy_buf_size += b->yy_buf_size / 8;
1551 else
1552 b->yy_buf_size *= 2;
1553
1554 b->yy_ch_buf = (char *)
1555 /* Include room in for 2 EOB chars. */
1556 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1557 }
1558 else
1559 /* Can't grow it, we don't own it. */
1560 b->yy_ch_buf = 0;
1561
1562 if ( ! b->yy_ch_buf )
1563 YY_FATAL_ERROR(
1564 "fatal error - scanner input buffer overflow" );
1565
1566 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1567
1568 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1569 number_to_move - 1;
1570
1571 }
1572
1573 if ( num_to_read > YY_READ_BUF_SIZE )
1574 num_to_read = YY_READ_BUF_SIZE;
1575
1576 /* Read in more data. */
1577 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Roman Zippel5a1aa8a2008-02-29 05:11:50 +01001578 (yy_n_chars), (size_t) num_to_read );
Linus Torvalds1da177e2005-04-16 15:20:36 -07001579
1580 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1581 }
1582
1583 if ( (yy_n_chars) == 0 )
1584 {
1585 if ( number_to_move == YY_MORE_ADJ )
1586 {
1587 ret_val = EOB_ACT_END_OF_FILE;
1588 zconfrestart(zconfin );
1589 }
1590
1591 else
1592 {
1593 ret_val = EOB_ACT_LAST_MATCH;
1594 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1595 YY_BUFFER_EOF_PENDING;
1596 }
1597 }
1598
1599 else
1600 ret_val = EOB_ACT_CONTINUE_SCAN;
1601
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03001602 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1603 /* Extend the array by 50%, plus the number we really need. */
1604 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1605 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1606 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1607 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1608 }
1609
Linus Torvalds1da177e2005-04-16 15:20:36 -07001610 (yy_n_chars) += number_to_move;
1611 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1612 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1613
1614 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1615
1616 return ret_val;
1617}
1618
1619/* yy_get_previous_state - get the state just before the EOB char was reached */
1620
1621 static yy_state_type yy_get_previous_state (void)
1622{
1623 register yy_state_type yy_current_state;
1624 register char *yy_cp;
1625
1626 yy_current_state = (yy_start);
1627
1628 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1629 {
1630 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1631 }
1632
1633 return yy_current_state;
1634}
1635
1636/* yy_try_NUL_trans - try to make a transition on the NUL character
1637 *
1638 * synopsis
1639 * next_state = yy_try_NUL_trans( current_state );
1640 */
1641 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1642{
1643 register int yy_is_jam;
1644
1645 yy_current_state = yy_nxt[yy_current_state][1];
1646 yy_is_jam = (yy_current_state <= 0);
1647
1648 return yy_is_jam ? 0 : yy_current_state;
1649}
1650
1651 static void yyunput (int c, register char * yy_bp )
1652{
1653 register char *yy_cp;
1654
1655 yy_cp = (yy_c_buf_p);
1656
1657 /* undo effects of setting up zconftext */
1658 *yy_cp = (yy_hold_char);
1659
1660 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1661 { /* need to shift things up to make room */
1662 /* +2 for EOB chars. */
1663 register int number_to_move = (yy_n_chars) + 2;
1664 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1665 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1666 register char *source =
1667 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1668
1669 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1670 *--dest = *--source;
1671
1672 yy_cp += (int) (dest - source);
1673 yy_bp += (int) (dest - source);
1674 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1675 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1676
1677 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1678 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1679 }
1680
1681 *--yy_cp = (char) c;
1682
1683 (yytext_ptr) = yy_bp;
1684 (yy_hold_char) = *yy_cp;
1685 (yy_c_buf_p) = yy_cp;
1686}
1687
1688#ifndef YY_NO_INPUT
1689#ifdef __cplusplus
1690 static int yyinput (void)
1691#else
1692 static int input (void)
1693#endif
1694
1695{
1696 int c;
1697
1698 *(yy_c_buf_p) = (yy_hold_char);
1699
1700 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1701 {
1702 /* yy_c_buf_p now points to the character we want to return.
1703 * If this occurs *before* the EOB characters, then it's a
1704 * valid NUL; if not, then we've hit the end of the buffer.
1705 */
1706 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1707 /* This was really a NUL. */
1708 *(yy_c_buf_p) = '\0';
1709
1710 else
1711 { /* need more input */
1712 int offset = (yy_c_buf_p) - (yytext_ptr);
1713 ++(yy_c_buf_p);
1714
1715 switch ( yy_get_next_buffer( ) )
1716 {
1717 case EOB_ACT_LAST_MATCH:
1718 /* This happens because yy_g_n_b()
1719 * sees that we've accumulated a
1720 * token and flags that we need to
1721 * try matching the token before
1722 * proceeding. But for input(),
1723 * there's no matching to consider.
1724 * So convert the EOB_ACT_LAST_MATCH
1725 * to EOB_ACT_END_OF_FILE.
1726 */
1727
1728 /* Reset buffer status. */
1729 zconfrestart(zconfin );
1730
1731 /*FALLTHROUGH*/
1732
1733 case EOB_ACT_END_OF_FILE:
1734 {
1735 if ( zconfwrap( ) )
1736 return EOF;
1737
1738 if ( ! (yy_did_buffer_switch_on_eof) )
1739 YY_NEW_FILE;
1740#ifdef __cplusplus
1741 return yyinput();
1742#else
1743 return input();
1744#endif
1745 }
1746
1747 case EOB_ACT_CONTINUE_SCAN:
1748 (yy_c_buf_p) = (yytext_ptr) + offset;
1749 break;
1750 }
1751 }
1752 }
1753
1754 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1755 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1756 (yy_hold_char) = *++(yy_c_buf_p);
1757
1758 return c;
1759}
1760#endif /* ifndef YY_NO_INPUT */
1761
1762/** Immediately switch to a different input stream.
1763 * @param input_file A readable stream.
1764 *
1765 * @note This function does not reset the start condition to @c INITIAL .
1766 */
1767 void zconfrestart (FILE * input_file )
1768{
1769
1770 if ( ! YY_CURRENT_BUFFER ){
1771 zconfensure_buffer_stack ();
1772 YY_CURRENT_BUFFER_LVALUE =
1773 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1774 }
1775
1776 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1777 zconf_load_buffer_state( );
1778}
1779
1780/** Switch to a different input buffer.
1781 * @param new_buffer The new input buffer.
1782 *
1783 */
1784 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1785{
1786
1787 /* TODO. We should be able to replace this entire function body
1788 * with
1789 * zconfpop_buffer_state();
1790 * zconfpush_buffer_state(new_buffer);
1791 */
1792 zconfensure_buffer_stack ();
1793 if ( YY_CURRENT_BUFFER == new_buffer )
1794 return;
1795
1796 if ( YY_CURRENT_BUFFER )
1797 {
1798 /* Flush out information for old buffer. */
1799 *(yy_c_buf_p) = (yy_hold_char);
1800 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1801 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1802 }
1803
1804 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1805 zconf_load_buffer_state( );
1806
1807 /* We don't actually know whether we did this switch during
1808 * EOF (zconfwrap()) processing, but the only time this flag
1809 * is looked at is after zconfwrap() is called, so it's safe
1810 * to go ahead and always set it.
1811 */
1812 (yy_did_buffer_switch_on_eof) = 1;
1813}
1814
1815static void zconf_load_buffer_state (void)
1816{
1817 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1818 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1819 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1820 (yy_hold_char) = *(yy_c_buf_p);
1821}
1822
1823/** Allocate and initialize an input buffer state.
1824 * @param file A readable stream.
1825 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1826 *
1827 * @return the allocated buffer state.
1828 */
1829 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1830{
1831 YY_BUFFER_STATE b;
1832
1833 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1834 if ( ! b )
1835 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1836
1837 b->yy_buf_size = size;
1838
1839 /* yy_ch_buf has to be 2 characters longer than the size given because
1840 * we need to put in 2 end-of-buffer characters.
1841 */
1842 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1843 if ( ! b->yy_ch_buf )
1844 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1845
1846 b->yy_is_our_buffer = 1;
1847
1848 zconf_init_buffer(b,file );
1849
1850 return b;
1851}
1852
1853/** Destroy the buffer.
1854 * @param b a buffer created with zconf_create_buffer()
1855 *
1856 */
1857 void zconf_delete_buffer (YY_BUFFER_STATE b )
1858{
1859
1860 if ( ! b )
1861 return;
1862
1863 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1864 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1865
1866 if ( b->yy_is_our_buffer )
1867 zconffree((void *) b->yy_ch_buf );
1868
1869 zconffree((void *) b );
1870}
1871
1872/* Initializes or reinitializes a buffer.
1873 * This function is sometimes called more than once on the same buffer,
1874 * such as during a zconfrestart() or at EOF.
1875 */
1876 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1877
1878{
1879 int oerrno = errno;
1880
1881 zconf_flush_buffer(b );
1882
1883 b->yy_input_file = file;
1884 b->yy_fill_buffer = 1;
1885
1886 /* If b is the current buffer, then zconf_init_buffer was _probably_
1887 * called from zconfrestart() or through yy_get_next_buffer.
1888 * In that case, we don't want to reset the lineno or column.
1889 */
1890 if (b != YY_CURRENT_BUFFER){
1891 b->yy_bs_lineno = 1;
1892 b->yy_bs_column = 0;
1893 }
1894
1895 b->yy_is_interactive = 0;
1896
1897 errno = oerrno;
1898}
1899
1900/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1901 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1902 *
1903 */
1904 void zconf_flush_buffer (YY_BUFFER_STATE b )
1905{
1906 if ( ! b )
1907 return;
1908
1909 b->yy_n_chars = 0;
1910
1911 /* We always need two end-of-buffer characters. The first causes
1912 * a transition to the end-of-buffer state. The second causes
1913 * a jam in that state.
1914 */
1915 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1916 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1917
1918 b->yy_buf_pos = &b->yy_ch_buf[0];
1919
1920 b->yy_at_bol = 1;
1921 b->yy_buffer_status = YY_BUFFER_NEW;
1922
1923 if ( b == YY_CURRENT_BUFFER )
1924 zconf_load_buffer_state( );
1925}
1926
1927/** Pushes the new state onto the stack. The new state becomes
1928 * the current state. This function will allocate the stack
1929 * if necessary.
1930 * @param new_buffer The new state.
1931 *
1932 */
1933void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1934{
1935 if (new_buffer == NULL)
1936 return;
1937
1938 zconfensure_buffer_stack();
1939
1940 /* This block is copied from zconf_switch_to_buffer. */
1941 if ( YY_CURRENT_BUFFER )
1942 {
1943 /* Flush out information for old buffer. */
1944 *(yy_c_buf_p) = (yy_hold_char);
1945 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1946 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1947 }
1948
1949 /* Only push if top exists. Otherwise, replace top. */
1950 if (YY_CURRENT_BUFFER)
1951 (yy_buffer_stack_top)++;
1952 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1953
1954 /* copied from zconf_switch_to_buffer. */
1955 zconf_load_buffer_state( );
1956 (yy_did_buffer_switch_on_eof) = 1;
1957}
1958
1959/** Removes and deletes the top of the stack, if present.
1960 * The next element becomes the new top.
1961 *
1962 */
1963void zconfpop_buffer_state (void)
1964{
1965 if (!YY_CURRENT_BUFFER)
1966 return;
1967
1968 zconf_delete_buffer(YY_CURRENT_BUFFER );
1969 YY_CURRENT_BUFFER_LVALUE = NULL;
1970 if ((yy_buffer_stack_top) > 0)
1971 --(yy_buffer_stack_top);
1972
1973 if (YY_CURRENT_BUFFER) {
1974 zconf_load_buffer_state( );
1975 (yy_did_buffer_switch_on_eof) = 1;
1976 }
1977}
1978
1979/* Allocates the stack if it does not exist.
1980 * Guarantees space for at least one push.
1981 */
1982static void zconfensure_buffer_stack (void)
1983{
1984 int num_to_alloc;
1985
1986 if (!(yy_buffer_stack)) {
1987
1988 /* First allocation is just for 2 elements, since we don't know if this
1989 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1990 * immediate realloc on the next call.
1991 */
1992 num_to_alloc = 1;
1993 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1994 (num_to_alloc * sizeof(struct yy_buffer_state*)
1995 );
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03001996 if ( ! (yy_buffer_stack) )
1997 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
1998
Linus Torvalds1da177e2005-04-16 15:20:36 -07001999 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2000
2001 (yy_buffer_stack_max) = num_to_alloc;
2002 (yy_buffer_stack_top) = 0;
2003 return;
2004 }
2005
2006 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2007
2008 /* Increase the buffer to prepare for a possible push. */
2009 int grow_size = 8 /* arbitrary grow size */;
2010
2011 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2012 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
2013 ((yy_buffer_stack),
2014 num_to_alloc * sizeof(struct yy_buffer_state*)
2015 );
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03002016 if ( ! (yy_buffer_stack) )
2017 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
Linus Torvalds1da177e2005-04-16 15:20:36 -07002018
2019 /* zero only the new slots.*/
2020 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2021 (yy_buffer_stack_max) = num_to_alloc;
2022 }
2023}
2024
2025/** Setup the input buffer state to scan directly from a user-specified character buffer.
2026 * @param base the character buffer
2027 * @param size the size in bytes of the character buffer
2028 *
2029 * @return the newly allocated buffer state object.
2030 */
2031YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
2032{
2033 YY_BUFFER_STATE b;
2034
2035 if ( size < 2 ||
2036 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2037 base[size-1] != YY_END_OF_BUFFER_CHAR )
2038 /* They forgot to leave room for the EOB's. */
2039 return 0;
2040
2041 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
2042 if ( ! b )
2043 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
2044
2045 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2046 b->yy_buf_pos = b->yy_ch_buf = base;
2047 b->yy_is_our_buffer = 0;
2048 b->yy_input_file = 0;
2049 b->yy_n_chars = b->yy_buf_size;
2050 b->yy_is_interactive = 0;
2051 b->yy_at_bol = 1;
2052 b->yy_fill_buffer = 0;
2053 b->yy_buffer_status = YY_BUFFER_NEW;
2054
2055 zconf_switch_to_buffer(b );
2056
2057 return b;
2058}
2059
2060/** Setup the input buffer state to scan a string. The next call to zconflex() will
2061 * scan from a @e copy of @a str.
Roman Zippel5a1aa8a2008-02-29 05:11:50 +01002062 * @param yystr a NUL-terminated string to scan
Linus Torvalds1da177e2005-04-16 15:20:36 -07002063 *
2064 * @return the newly allocated buffer state object.
2065 * @note If you want to scan bytes that may contain NUL values, then use
2066 * zconf_scan_bytes() instead.
2067 */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002068YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002069{
2070
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002071 return zconf_scan_bytes(yystr,strlen(yystr) );
Linus Torvalds1da177e2005-04-16 15:20:36 -07002072}
2073
2074/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
2075 * scan from a @e copy of @a bytes.
Josh Triplett65166572009-10-15 12:13:36 -07002076 * @param yybytes the byte buffer to scan
2077 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
Linus Torvalds1da177e2005-04-16 15:20:36 -07002078 *
2079 * @return the newly allocated buffer state object.
2080 */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002081YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082{
2083 YY_BUFFER_STATE b;
2084 char *buf;
2085 yy_size_t n;
2086 int i;
2087
2088 /* Get memory for full buffer, including space for trailing EOB's. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002089 n = _yybytes_len + 2;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002090 buf = (char *) zconfalloc(n );
2091 if ( ! buf )
2092 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2093
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002094 for ( i = 0; i < _yybytes_len; ++i )
2095 buf[i] = yybytes[i];
Linus Torvalds1da177e2005-04-16 15:20:36 -07002096
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002097 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002098
2099 b = zconf_scan_buffer(buf,n );
2100 if ( ! b )
2101 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2102
2103 /* It's okay to grow etc. this buffer, and we should throw it
2104 * away when we're done.
2105 */
2106 b->yy_is_our_buffer = 1;
2107
2108 return b;
2109}
2110
2111#ifndef YY_EXIT_FAILURE
2112#define YY_EXIT_FAILURE 2
2113#endif
2114
2115static void yy_fatal_error (yyconst char* msg )
2116{
2117 (void) fprintf( stderr, "%s\n", msg );
2118 exit( YY_EXIT_FAILURE );
2119}
2120
2121/* Redefine yyless() so it works in section 3 code. */
2122
2123#undef yyless
2124#define yyless(n) \
2125 do \
2126 { \
2127 /* Undo effects of setting up zconftext. */ \
2128 int yyless_macro_arg = (n); \
2129 YY_LESS_LINENO(yyless_macro_arg);\
2130 zconftext[zconfleng] = (yy_hold_char); \
2131 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2132 (yy_hold_char) = *(yy_c_buf_p); \
2133 *(yy_c_buf_p) = '\0'; \
2134 zconfleng = yyless_macro_arg; \
2135 } \
2136 while ( 0 )
2137
2138/* Accessor methods (get/set functions) to struct members. */
2139
2140/** Get the current line number.
2141 *
2142 */
2143int zconfget_lineno (void)
2144{
2145
2146 return zconflineno;
2147}
2148
2149/** Get the input stream.
2150 *
2151 */
2152FILE *zconfget_in (void)
2153{
2154 return zconfin;
2155}
2156
2157/** Get the output stream.
2158 *
2159 */
2160FILE *zconfget_out (void)
2161{
2162 return zconfout;
2163}
2164
2165/** Get the length of the current token.
2166 *
2167 */
2168int zconfget_leng (void)
2169{
2170 return zconfleng;
2171}
2172
2173/** Get the current token.
2174 *
2175 */
2176
2177char *zconfget_text (void)
2178{
2179 return zconftext;
2180}
2181
2182/** Set the current line number.
2183 * @param line_number
2184 *
2185 */
2186void zconfset_lineno (int line_number )
2187{
2188
2189 zconflineno = line_number;
2190}
2191
2192/** Set the input stream. This does not discard the current
2193 * input buffer.
2194 * @param in_str A readable stream.
2195 *
2196 * @see zconf_switch_to_buffer
2197 */
2198void zconfset_in (FILE * in_str )
2199{
2200 zconfin = in_str ;
2201}
2202
2203void zconfset_out (FILE * out_str )
2204{
2205 zconfout = out_str ;
2206}
2207
2208int zconfget_debug (void)
2209{
2210 return zconf_flex_debug;
2211}
2212
2213void zconfset_debug (int bdebug )
2214{
2215 zconf_flex_debug = bdebug ;
2216}
2217
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002218static int yy_init_globals (void)
2219{
2220 /* Initialization is the same as for the non-reentrant scanner.
2221 * This function is called from zconflex_destroy(), so don't allocate here.
2222 */
2223
2224 (yy_buffer_stack) = 0;
2225 (yy_buffer_stack_top) = 0;
2226 (yy_buffer_stack_max) = 0;
2227 (yy_c_buf_p) = (char *) 0;
2228 (yy_init) = 0;
2229 (yy_start) = 0;
2230
2231/* Defined in main.c */
2232#ifdef YY_STDINIT
2233 zconfin = stdin;
2234 zconfout = stdout;
2235#else
2236 zconfin = (FILE *) 0;
2237 zconfout = (FILE *) 0;
2238#endif
2239
2240 /* For future reference: Set errno on error, since we are called by
2241 * zconflex_init()
2242 */
2243 return 0;
2244}
2245
Linus Torvalds1da177e2005-04-16 15:20:36 -07002246/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2247int zconflex_destroy (void)
2248{
2249
2250 /* Pop the buffer stack, destroying each element. */
2251 while(YY_CURRENT_BUFFER){
2252 zconf_delete_buffer(YY_CURRENT_BUFFER );
2253 YY_CURRENT_BUFFER_LVALUE = NULL;
2254 zconfpop_buffer_state();
2255 }
2256
2257 /* Destroy the stack itself. */
2258 zconffree((yy_buffer_stack) );
2259 (yy_buffer_stack) = NULL;
2260
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002261 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2262 * zconflex() is called, initialization will occur. */
2263 yy_init_globals( );
2264
Linus Torvalds1da177e2005-04-16 15:20:36 -07002265 return 0;
2266}
2267
2268/*
2269 * Internal utility routines.
2270 */
2271
2272#ifndef yytext_ptr
2273static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2274{
2275 register int i;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002276 for ( i = 0; i < n; ++i )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002277 s1[i] = s2[i];
2278}
2279#endif
2280
2281#ifdef YY_NEED_STRLEN
2282static int yy_flex_strlen (yyconst char * s )
2283{
2284 register int n;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002285 for ( n = 0; s[n]; ++n )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002286 ;
2287
2288 return n;
2289}
2290#endif
2291
2292void *zconfalloc (yy_size_t size )
2293{
2294 return (void *) malloc( size );
2295}
2296
2297void *zconfrealloc (void * ptr, yy_size_t size )
2298{
2299 /* The cast to (char *) in the following accommodates both
2300 * implementations that use char* generic pointers, and those
2301 * that use void* generic pointers. It works with the latter
2302 * because both ANSI C and C++ allow castless assignment from
2303 * any pointer type to void*, and deal with argument conversions
2304 * as though doing an assignment.
2305 */
2306 return (void *) realloc( (char *) ptr, size );
2307}
2308
2309void zconffree (void * ptr )
2310{
2311 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2312}
2313
2314#define YYTABLES_NAME "yytables"
2315
Linus Torvalds1da177e2005-04-16 15:20:36 -07002316void zconf_starthelp(void)
2317{
2318 new_string();
2319 last_ts = first_ts = 0;
2320 BEGIN(HELP);
2321}
2322
2323static void zconf_endhelp(void)
2324{
2325 zconflval.string = text;
2326 BEGIN(INITIAL);
2327}
2328
2329/*
2330 * Try to open specified file with following names:
2331 * ./name
2332 * $(srctree)/name
2333 * The latter is used when srctree is separate from objtree
2334 * when compiling the kernel.
2335 * Return NULL if file is not found.
2336 */
2337FILE *zconf_fopen(const char *name)
2338{
2339 char *env, fullname[PATH_MAX+1];
2340 FILE *f;
2341
2342 f = fopen(name, "r");
Marcin Garski11de39e2007-05-05 22:49:00 +02002343 if (!f && name != NULL && name[0] != '/') {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002344 env = getenv(SRCTREE);
2345 if (env) {
2346 sprintf(fullname, "%s/%s", env, name);
2347 f = fopen(fullname, "r");
2348 }
2349 }
2350 return f;
2351}
2352
2353void zconf_initscan(const char *name)
2354{
2355 zconfin = zconf_fopen(name);
2356 if (!zconfin) {
2357 printf("can't find file %s\n", name);
2358 exit(1);
2359 }
2360
2361 current_buf = malloc(sizeof(*current_buf));
2362 memset(current_buf, 0, sizeof(*current_buf));
2363
2364 current_file = file_lookup(name);
2365 current_file->lineno = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002366}
2367
2368void zconf_nextfile(const char *name)
2369{
Yann E. MORINf094f8a2011-02-24 19:36:42 +01002370 struct file *iter;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002371 struct file *file = file_lookup(name);
2372 struct buffer *buf = malloc(sizeof(*buf));
2373 memset(buf, 0, sizeof(*buf));
2374
2375 current_buf->state = YY_CURRENT_BUFFER;
Arnaud Lacombec0920a12010-09-10 21:23:28 -04002376 zconfin = zconf_fopen(file->name);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002377 if (!zconfin) {
Arnaud Lacombec0920a12010-09-10 21:23:28 -04002378 printf("%s:%d: can't open file \"%s\"\n",
2379 zconf_curname(), zconf_lineno(), file->name);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002380 exit(1);
2381 }
2382 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2383 buf->parent = current_buf;
2384 current_buf = buf;
2385
Yann E. MORINf094f8a2011-02-24 19:36:42 +01002386 for (iter = current_file->parent; iter; iter = iter->parent ) {
2387 if (!strcmp(current_file->name,iter->name) ) {
2388 printf("%s:%d: recursive inclusion detected. "
2389 "Inclusion path:\n current file : '%s'\n",
2390 zconf_curname(), zconf_lineno(),
2391 zconf_curname());
2392 iter = current_file->parent;
2393 while (iter && \
2394 strcmp(iter->name,current_file->name)) {
2395 printf(" included from: '%s:%d'\n",
2396 iter->name, iter->lineno-1);
2397 iter = iter->parent;
2398 }
2399 if (iter)
2400 printf(" included from: '%s:%d'\n",
2401 iter->name, iter->lineno+1);
2402 exit(1);
2403 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002404 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002405 file->lineno = 1;
2406 file->parent = current_file;
2407 current_file = file;
2408}
2409
Roman Zippela02f0572005-11-08 21:34:53 -08002410static void zconf_endfile(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002411{
2412 struct buffer *parent;
2413
Linus Torvalds1da177e2005-04-16 15:20:36 -07002414 current_file = current_file->parent;
2415
2416 parent = current_buf->parent;
2417 if (parent) {
2418 fclose(zconfin);
2419 zconf_delete_buffer(YY_CURRENT_BUFFER);
2420 zconf_switch_to_buffer(parent->state);
2421 }
2422 free(current_buf);
2423 current_buf = parent;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002424}
2425
2426int zconf_lineno(void)
2427{
Roman Zippela02f0572005-11-08 21:34:53 -08002428 return current_pos.lineno;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002429}
2430
Arnaud Lacombec0920a12010-09-10 21:23:28 -04002431const char *zconf_curname(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002432{
Roman Zippela02f0572005-11-08 21:34:53 -08002433 return current_pos.file ? current_pos.file->name : "<none>";
Linus Torvalds1da177e2005-04-16 15:20:36 -07002434}
2435