blob: 746691ed010ee5ece7da5c0d4a613f69165b0967 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
Arnaud Lacombe2f76b352011-05-23 01:08:19 -04002#line 3 "scripts/kconfig/zconf.lex.c_shipped"
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;
Arnaud Lacombe2f76b352011-05-23 01:08:19 -040075#endif /* ! C99 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
77/* Limits of integral types. */
78#ifndef INT8_MIN
79#define INT8_MIN (-128)
80#endif
81#ifndef INT16_MIN
82#define INT16_MIN (-32767-1)
83#endif
84#ifndef INT32_MIN
85#define INT32_MIN (-2147483647-1)
86#endif
87#ifndef INT8_MAX
88#define INT8_MAX (127)
89#endif
90#ifndef INT16_MAX
91#define INT16_MAX (32767)
92#endif
93#ifndef INT32_MAX
94#define INT32_MAX (2147483647)
95#endif
96#ifndef UINT8_MAX
97#define UINT8_MAX (255U)
98#endif
99#ifndef UINT16_MAX
100#define UINT16_MAX (65535U)
101#endif
102#ifndef UINT32_MAX
103#define UINT32_MAX (4294967295U)
104#endif
105
106#endif /* ! FLEXINT_H */
107
108#ifdef __cplusplus
109
110/* The "const" storage-class-modifier is valid. */
111#define YY_USE_CONST
112
113#else /* ! __cplusplus */
114
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300115/* C99 requires __STDC__ to be defined as 1. */
116#if defined (__STDC__)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
118#define YY_USE_CONST
119
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300120#endif /* defined (__STDC__) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121#endif /* ! __cplusplus */
122
123#ifdef YY_USE_CONST
124#define yyconst const
125#else
126#define yyconst
127#endif
128
129/* Returned upon end-of-file. */
130#define YY_NULL 0
131
132/* Promotes a possibly negative, possibly signed char to an unsigned
133 * integer for use as an array index. If the signed char is negative,
134 * we want to instead treat it as an 8-bit unsigned char, hence the
135 * double cast.
136 */
137#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
138
139/* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
142 */
143#define BEGIN (yy_start) = 1 + 2 *
144
145/* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
147 * compatibility.
148 */
149#define YY_START (((yy_start) - 1) / 2)
150#define YYSTATE YY_START
151
152/* Action number for EOF rule of a given start state. */
153#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154
155/* Special action meaning "start processing a new file". */
156#define YY_NEW_FILE zconfrestart(zconfin )
157
158#define YY_END_OF_BUFFER_CHAR 0
159
160/* Size of default input buffer. */
161#ifndef YY_BUF_SIZE
162#define YY_BUF_SIZE 16384
163#endif
164
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700165/* The state buf must be large enough to hold one state per character in the main buffer.
166 */
167#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
168
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169#ifndef YY_TYPEDEF_YY_BUFFER_STATE
170#define YY_TYPEDEF_YY_BUFFER_STATE
171typedef struct yy_buffer_state *YY_BUFFER_STATE;
172#endif
173
174extern int zconfleng;
175
176extern FILE *zconfin, *zconfout;
177
178#define EOB_ACT_CONTINUE_SCAN 0
179#define EOB_ACT_END_OF_FILE 1
180#define EOB_ACT_LAST_MATCH 2
181
182 #define YY_LESS_LINENO(n)
183
184/* Return all but the first "n" matched characters back to the input stream. */
185#define yyless(n) \
186 do \
187 { \
188 /* Undo effects of setting up zconftext. */ \
189 int yyless_macro_arg = (n); \
190 YY_LESS_LINENO(yyless_macro_arg);\
191 *yy_cp = (yy_hold_char); \
192 YY_RESTORE_YY_MORE_OFFSET \
193 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
194 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
195 } \
196 while ( 0 )
197
198#define unput(c) yyunput( c, (yytext_ptr) )
199
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200#ifndef YY_TYPEDEF_YY_SIZE_T
201#define YY_TYPEDEF_YY_SIZE_T
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300202typedef size_t yy_size_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203#endif
204
205#ifndef YY_STRUCT_YY_BUFFER_STATE
206#define YY_STRUCT_YY_BUFFER_STATE
207struct yy_buffer_state
208 {
209 FILE *yy_input_file;
210
211 char *yy_ch_buf; /* input buffer */
212 char *yy_buf_pos; /* current position in input buffer */
213
214 /* Size of input buffer in bytes, not including room for EOB
215 * characters.
216 */
217 yy_size_t yy_buf_size;
218
219 /* Number of characters read into yy_ch_buf, not including EOB
220 * characters.
221 */
222 int yy_n_chars;
223
224 /* Whether we "own" the buffer - i.e., we know we created it,
225 * and can realloc() it to grow it, and should free() it to
226 * delete it.
227 */
228 int yy_is_our_buffer;
229
230 /* Whether this is an "interactive" input source; if so, and
231 * if we're using stdio for input, then we want to use getc()
232 * instead of fread(), to make sure we stop fetching input after
233 * each newline.
234 */
235 int yy_is_interactive;
236
237 /* Whether we're considered to be at the beginning of a line.
238 * If so, '^' rules will be active on the next match, otherwise
239 * not.
240 */
241 int yy_at_bol;
242
243 int yy_bs_lineno; /**< The line count. */
244 int yy_bs_column; /**< The column count. */
245
246 /* Whether to try to fill the input buffer when we reach the
247 * end of it.
248 */
249 int yy_fill_buffer;
250
251 int yy_buffer_status;
252
253#define YY_BUFFER_NEW 0
254#define YY_BUFFER_NORMAL 1
255 /* When an EOF's been seen but there's still some text to process
256 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
257 * shouldn't try reading from the input source any more. We might
258 * still have a bunch of tokens to match, though, because of
259 * possible backing-up.
260 *
261 * When we actually see the EOF, we change the status to "new"
262 * (via zconfrestart()), so that the user can continue scanning by
263 * just pointing zconfin at a new input file.
264 */
265#define YY_BUFFER_EOF_PENDING 2
266
267 };
268#endif /* !YY_STRUCT_YY_BUFFER_STATE */
269
270/* Stack of input buffers. */
271static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
272static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
273static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
274
275/* We provide macros for accessing buffer states in case in the
276 * future we want to put the buffer states in a more general
277 * "scanner state".
278 *
279 * Returns the top of the stack, or NULL.
280 */
281#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
282 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
283 : NULL)
284
285/* Same as previous macro, but useful when we know that the buffer stack is not
286 * NULL or when we need an lvalue. For internal use only.
287 */
288#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
289
290/* yy_hold_char holds the character lost when zconftext is formed. */
291static char yy_hold_char;
292static int yy_n_chars; /* number of characters read into yy_ch_buf */
293int zconfleng;
294
295/* Points to current character in buffer. */
296static char *yy_c_buf_p = (char *) 0;
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700297static int yy_init = 0; /* whether we need to initialize */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298static int yy_start = 0; /* start state number */
299
300/* Flag which is used to allow zconfwrap()'s to do buffer switches
301 * instead of setting up a fresh zconfin. A bit of a hack ...
302 */
303static int yy_did_buffer_switch_on_eof;
304
305void zconfrestart (FILE *input_file );
306void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
307YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
308void zconf_delete_buffer (YY_BUFFER_STATE b );
309void zconf_flush_buffer (YY_BUFFER_STATE b );
310void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
311void zconfpop_buffer_state (void );
312
313static void zconfensure_buffer_stack (void );
314static void zconf_load_buffer_state (void );
315static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
316
317#define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
318
319YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
320YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
321YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
322
323void *zconfalloc (yy_size_t );
324void *zconfrealloc (void *,yy_size_t );
325void zconffree (void * );
326
327#define yy_new_buffer zconf_create_buffer
328
329#define yy_set_interactive(is_interactive) \
330 { \
331 if ( ! YY_CURRENT_BUFFER ){ \
332 zconfensure_buffer_stack (); \
333 YY_CURRENT_BUFFER_LVALUE = \
334 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
335 } \
336 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
337 }
338
339#define yy_set_bol(at_bol) \
340 { \
341 if ( ! YY_CURRENT_BUFFER ){\
342 zconfensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
345 } \
346 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
347 }
348
349#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
350
351/* Begin user sect3 */
352
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300353#define zconfwrap(n) 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354#define YY_SKIP_YYWRAP
355
356typedef unsigned char YY_CHAR;
357
358FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
359
360typedef int yy_state_type;
361
362extern int zconflineno;
363
364int zconflineno = 1;
365
366extern char *zconftext;
367#define yytext_ptr zconftext
Roman Zippel7a884882005-11-08 21:34:51 -0800368static yyconst flex_int16_t yy_nxt[][17] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 {
370 {
371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Roman Zippel7a884882005-11-08 21:34:51 -0800372 0, 0, 0, 0, 0, 0, 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 },
374
375 {
376 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
Roman Zippel7a884882005-11-08 21:34:51 -0800377 12, 12, 12, 12, 12, 12, 12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 },
379
380 {
381 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
Roman Zippel7a884882005-11-08 21:34:51 -0800382 12, 12, 12, 12, 12, 12, 12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 },
384
385 {
386 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
Roman Zippel7a884882005-11-08 21:34:51 -0800387 16, 16, 16, 18, 16, 16, 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 },
389
390 {
391 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
Roman Zippel7a884882005-11-08 21:34:51 -0800392 16, 16, 16, 18, 16, 16, 16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393
394 },
395
396 {
Roman Zippel7a884882005-11-08 21:34:51 -0800397 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
398 19, 19, 19, 19, 19, 19, 19
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 },
400
401 {
Roman Zippel7a884882005-11-08 21:34:51 -0800402 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
403 19, 19, 19, 19, 19, 19, 19
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 },
405
406 {
Roman Zippel7a884882005-11-08 21:34:51 -0800407 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
408 22, 22, 22, 22, 22, 25, 22
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 },
410
411 {
Roman Zippel7a884882005-11-08 21:34:51 -0800412 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
413 22, 22, 22, 22, 22, 25, 22
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 },
415
416 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000417 11, 26, 27, 28, 29, 30, 31, 32, 30, 33,
418 34, 35, 36, 36, 37, 38, 39
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419
420 },
421
422 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000423 11, 26, 27, 28, 29, 30, 31, 32, 30, 33,
424 34, 35, 36, 36, 37, 38, 39
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 },
426
427 {
428 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
Roman Zippel7a884882005-11-08 21:34:51 -0800429 -11, -11, -11, -11, -11, -11, -11
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 },
431
432 {
433 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
Roman Zippel7a884882005-11-08 21:34:51 -0800434 -12, -12, -12, -12, -12, -12, -12
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 },
436
437 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000438 11, -13, 40, 41, -13, -13, 42, -13, -13, -13,
Roman Zippel7a884882005-11-08 21:34:51 -0800439 -13, -13, -13, -13, -13, -13, -13
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 },
441
442 {
443 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
Roman Zippel7a884882005-11-08 21:34:51 -0800444 -14, -14, -14, -14, -14, -14, -14
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445
446 },
447
448 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000449 11, 43, 43, 44, 43, 43, 43, 43, 43, 43,
450 43, 43, 43, 43, 43, 43, 43
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 },
452
453 {
454 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
Roman Zippel7a884882005-11-08 21:34:51 -0800455 -16, -16, -16, -16, -16, -16, -16
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 },
457
458 {
459 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
Roman Zippel7a884882005-11-08 21:34:51 -0800460 -17, -17, -17, -17, -17, -17, -17
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 },
462
463 {
464 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000465 -18, -18, -18, 45, -18, -18, -18
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466 },
467
468 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000469 11, 46, 46, -19, 46, 46, 46, 46, 46, 46,
470 46, 46, 46, 46, 46, 46, 46
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471
472 },
473
474 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000475 11, -20, 47, 48, -20, -20, -20, -20, -20, -20,
Roman Zippel7a884882005-11-08 21:34:51 -0800476 -20, -20, -20, -20, -20, -20, -20
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 },
478
479 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000480 11, 49, -21, -21, 49, 49, 49, 49, 49, 49,
481 49, 49, 49, 49, 49, 49, 49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 },
483
484 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000485 11, 50, 50, 51, 50, -22, 50, 50, -22, 50,
486 50, 50, 50, 50, 50, -22, 50
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 },
488
489 {
490 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
Roman Zippel7a884882005-11-08 21:34:51 -0800491 -23, -23, -23, -23, -23, -23, -23
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 },
493
494 {
495 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
Roman Zippel7a884882005-11-08 21:34:51 -0800496 -24, -24, -24, -24, -24, -24, -24
Linus Torvalds1da177e2005-04-16 15:20:36 -0700497
498 },
499
500 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000501 11, 52, 52, 53, 52, 52, 52, 52, 52, 52,
502 52, 52, 52, 52, 52, 52, 52
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503 },
504
505 {
506 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
Roman Zippel7a884882005-11-08 21:34:51 -0800507 -26, -26, -26, -26, -26, -26, -26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 },
509
510 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000511 11, -27, 54, -27, -27, -27, -27, -27, -27, -27,
Roman Zippel7a884882005-11-08 21:34:51 -0800512 -27, -27, -27, -27, -27, -27, -27
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 },
514
515 {
516 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000517 -28, -28, -28, -28, -28, -28, -28
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 },
519
520 {
521 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000522 -29, -29, -29, -29, 55, -29, -29
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523
524 },
525
526 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000527 11, -30, -30, -30, -30, -30, -30, -30, -30, -30,
528 -30, -30, -30, -30, -30, -30, -30
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 },
530
531 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000532 11, 56, 56, -31, 56, 56, 56, 56, 56, 56,
533 56, 56, 56, 56, 56, 56, 56
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 },
535
536 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000537 11, -32, -32, -32, -32, -32, -32, 57, -32, -32,
Roman Zippel7a884882005-11-08 21:34:51 -0800538 -32, -32, -32, -32, -32, -32, -32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 },
540
541 {
Roman Zippel7a884882005-11-08 21:34:51 -0800542 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
543 -33, -33, -33, -33, -33, -33, -33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 },
545
546 {
Roman Zippel7a884882005-11-08 21:34:51 -0800547 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000548 -34, -34, -34, -34, -34, -34, -34
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549
550 },
551
552 {
553 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000554 -35, 58, 59, 59, -35, -35, -35
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 },
556
557 {
558 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000559 -36, 59, 59, 59, -36, -36, -36
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 },
561
562 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000563 11, -37, -37, -37, -37, -37, -37, -37, -37, -37,
Roman Zippel7a884882005-11-08 21:34:51 -0800564 -37, -37, -37, -37, -37, -37, -37
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 },
566
567 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000568 11, -38, -38, 60, -38, -38, -38, -38, -38, -38,
569 -38, -38, -38, -38, -38, -38, -38
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 },
571
572 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000573 11, -39, -39, -39, -39, -39, -39, -39, -39, -39,
574 -39, -39, -39, -39, -39, -39, 61
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575
576 },
577
578 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000579 11, -40, 40, 41, -40, -40, 42, -40, -40, -40,
Roman Zippel7a884882005-11-08 21:34:51 -0800580 -40, -40, -40, -40, -40, -40, -40
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 },
582
583 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000584 11, -41, -41, -41, -41, -41, -41, -41, -41, -41,
585 -41, -41, -41, -41, -41, -41, -41
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 },
587
588 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000589 11, 43, 43, 44, 43, 43, 43, 43, 43, 43,
590 43, 43, 43, 43, 43, 43, 43
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 },
592
593 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000594 11, 43, 43, 44, 43, 43, 43, 43, 43, 43,
595 43, 43, 43, 43, 43, 43, 43
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 },
597
598 {
599 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000600 -44, -44, -44, -44, -44, -44, -44
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601
602 },
603
604 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000605 11, -45, -45, -45, -45, -45, -45, -45, -45, -45,
606 -45, -45, -45, 45, -45, -45, -45
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 },
608
609 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000610 11, 46, 46, -46, 46, 46, 46, 46, 46, 46,
611 46, 46, 46, 46, 46, 46, 46
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 },
613
614 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000615 11, -47, 47, 48, -47, -47, -47, -47, -47, -47,
616 -47, -47, -47, -47, -47, -47, -47
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 },
618
619 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000620 11, 49, -48, -48, 49, 49, 49, 49, 49, 49,
621 49, 49, 49, 49, 49, 49, 49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622 },
623
624 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000625 11, -49, -49, -49, -49, -49, -49, -49, -49, -49,
626 -49, -49, -49, -49, -49, -49, -49
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627
628 },
629
630 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000631 11, 50, 50, 51, 50, -50, 50, 50, -50, 50,
632 50, 50, 50, 50, 50, -50, 50
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 },
634
635 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000636 11, -51, -51, -51, -51, -51, -51, -51, -51, -51,
Roman Zippel7a884882005-11-08 21:34:51 -0800637 -51, -51, -51, -51, -51, -51, -51
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 },
639
640 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000641 11, -52, -52, 53, -52, -52, -52, -52, -52, -52,
Roman Zippel7a884882005-11-08 21:34:51 -0800642 -52, -52, -52, -52, -52, -52, -52
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 },
644
645 {
Roman Zippel7a884882005-11-08 21:34:51 -0800646 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
647 -53, -53, -53, -53, -53, -53, -53
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 },
649
650 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000651 11, -54, 54, -54, -54, -54, -54, -54, -54, -54,
652 -54, -54, -54, -54, -54, -54, -54
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653
654 },
655
656 {
Roman Zippel7a884882005-11-08 21:34:51 -0800657 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
658 -55, -55, -55, -55, -55, -55, -55
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659 },
660
661 {
Jan Beulich2e0d7372015-01-20 12:52:48 +0000662 11, 56, 56, -56, 56, 56, 56, 56, 56, 56,
663 56, 56, 56, 56, 56, 56, 56
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 },
665
666 {
667 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000668 -57, -57, -57, -57, -57, -57, -57
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 },
670
671 {
672 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000673 -58, 62, 59, 59, -58, -58, -58
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 },
675
676 {
677 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000678 -59, 59, 59, 59, -59, -59, -59
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679
680 },
681
682 {
683 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000684 -60, -60, -60, -60, -60, -60, -60
685 },
686
687 {
688 11, -61, -61, -61, -61, -61, -61, -61, -61, -61,
689 -61, -61, -61, -61, -61, -61, -61
690 },
691
692 {
693 11, -62, -62, -62, -62, -62, -62, -62, -62, -62,
694 -62, 59, 59, 59, -62, -62, -62
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 },
696
697 } ;
698
699static yy_state_type yy_get_previous_state (void );
700static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
701static int yy_get_next_buffer (void );
702static void yy_fatal_error (yyconst char msg[] );
703
704/* Done after the current pattern has been matched and before the
705 * corresponding action - sets up zconftext.
706 */
707#define YY_DO_BEFORE_ACTION \
708 (yytext_ptr) = yy_bp; \
709 zconfleng = (size_t) (yy_cp - yy_bp); \
710 (yy_hold_char) = *yy_cp; \
711 *yy_cp = '\0'; \
712 (yy_c_buf_p) = yy_cp;
713
Jan Beulich2e0d7372015-01-20 12:52:48 +0000714#define YY_NUM_RULES 34
715#define YY_END_OF_BUFFER 35
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716/* This struct is not used in this scanner,
717 but its presence is necessary. */
718struct yy_trans_info
719 {
720 flex_int32_t yy_verify;
721 flex_int32_t yy_nxt;
722 };
Jan Beulich2e0d7372015-01-20 12:52:48 +0000723static yyconst flex_int16_t yy_accept[63] =
Linus Torvalds1da177e2005-04-16 15:20:36 -0700724 { 0,
725 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jan Beulich2e0d7372015-01-20 12:52:48 +0000726 35, 5, 4, 2, 3, 7, 8, 6, 33, 30,
727 32, 25, 29, 28, 27, 23, 22, 17, 13, 16,
728 20, 23, 11, 12, 19, 19, 14, 23, 23, 4,
729 2, 3, 3, 1, 6, 33, 30, 32, 31, 25,
730 24, 27, 26, 22, 15, 20, 9, 19, 19, 21,
731 10, 18
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732 } ;
733
734static yyconst flex_int32_t yy_ec[256] =
735 { 0,
736 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
737 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
738 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
739 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
740 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
741 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
742 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
743 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
744 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
Roman Zippel7a884882005-11-08 21:34:51 -0800745 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746
Roman Zippel7a884882005-11-08 21:34:51 -0800747 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
748 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
749 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
751 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
752 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
754 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
756 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
757
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, 1, 1, 1, 1, 1,
762 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
763 1, 1, 1, 1, 1
764 } ;
765
766extern int zconf_flex_debug;
767int zconf_flex_debug = 0;
768
769/* The intent behind this definition is that it'll catch
770 * any uses of REJECT which flex missed.
771 */
772#define REJECT reject_used_but_not_detected
773#define yymore() yymore_used_but_not_detected
774#define YY_MORE_ADJ 0
775#define YY_RESTORE_YY_MORE_OFFSET
776char *zconftext;
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300777#define YY_NO_INPUT 1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778
779/*
780 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
781 * Released under the terms of the GNU GPL v2.0.
782 */
783
784#include <limits.h>
785#include <stdio.h>
786#include <stdlib.h>
787#include <string.h>
788#include <unistd.h>
789
Linus Torvalds1da177e2005-04-16 15:20:36 -0700790#include "lkc.h"
791
792#define START_STRSIZE 16
793
Roman Zippela02f0572005-11-08 21:34:53 -0800794static struct {
795 struct file *file;
796 int lineno;
797} current_pos;
798
Roman Zippel7a884882005-11-08 21:34:51 -0800799static char *text;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800static int text_size, text_asize;
801
802struct buffer {
Masahiro Yamadabb66fc62014-06-10 19:08:13 +0900803 struct buffer *parent;
804 YY_BUFFER_STATE state;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805};
806
807struct buffer *current_buf;
808
809static int last_ts, first_ts;
810
811static void zconf_endhelp(void);
Roman Zippela02f0572005-11-08 21:34:53 -0800812static void zconf_endfile(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813
Josh Triplett65166572009-10-15 12:13:36 -0700814static void new_string(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815{
Michal Marek527ffe52012-11-20 12:12:57 +0100816 text = xmalloc(START_STRSIZE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817 text_asize = START_STRSIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818 text_size = 0;
Roman Zippel7a884882005-11-08 21:34:51 -0800819 *text = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820}
821
Josh Triplett65166572009-10-15 12:13:36 -0700822static void append_string(const char *str, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823{
824 int new_size = text_size + size + 1;
825 if (new_size > text_asize) {
Roman Zippel7a884882005-11-08 21:34:51 -0800826 new_size += START_STRSIZE - 1;
827 new_size &= -START_STRSIZE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828 text = realloc(text, new_size);
829 text_asize = new_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830 }
Roman Zippel7a884882005-11-08 21:34:51 -0800831 memcpy(text + text_size, str, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832 text_size += size;
Roman Zippel7a884882005-11-08 21:34:51 -0800833 text[text_size] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834}
835
Josh Triplett65166572009-10-15 12:13:36 -0700836static void alloc_string(const char *str, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837{
Michal Marek527ffe52012-11-20 12:12:57 +0100838 text = xmalloc(size + 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839 memcpy(text, str, size);
840 text[size] = 0;
841}
842
843#define INITIAL 0
844#define COMMAND 1
845#define HELP 2
846#define STRING 3
847#define PARAM 4
848
Roman Zippel7a884882005-11-08 21:34:51 -0800849#ifndef YY_NO_UNISTD_H
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850/* Special case for "unistd.h", since it is non-ANSI. We include it way
851 * down here because we want the user's section 1 to have been scanned first.
852 * The user has a chance to override it with an option.
853 */
854#include <unistd.h>
Roman Zippel7a884882005-11-08 21:34:51 -0800855#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856
857#ifndef YY_EXTRA_TYPE
858#define YY_EXTRA_TYPE void *
859#endif
860
Roman Zippelf6a88aa2006-06-08 22:12:44 -0700861static int yy_init_globals (void );
862
Adrian Bunkbe2be1d2008-07-17 02:07:59 +0300863/* Accessor methods to globals.
864 These are made visible to non-reentrant scanners for convenience. */
865
866int zconflex_destroy (void );
867
868int zconfget_debug (void );
869
870void zconfset_debug (int debug_flag );
871
872YY_EXTRA_TYPE zconfget_extra (void );
873
874void zconfset_extra (YY_EXTRA_TYPE user_defined );
875
876FILE *zconfget_in (void );
877
878void zconfset_in (FILE * in_str );
879
880FILE *zconfget_out (void );
881
882void zconfset_out (FILE * out_str );
883
884int zconfget_leng (void );
885
886char *zconfget_text (void );
887
888int zconfget_lineno (void );
889
890void zconfset_lineno (int line_number );
891
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892/* Macros after this point can all be overridden by user definitions in
893 * section 1.
894 */
895
896#ifndef YY_SKIP_YYWRAP
897#ifdef __cplusplus
898extern "C" int zconfwrap (void );
899#else
900extern int zconfwrap (void );
901#endif
902#endif
903
904 static void yyunput (int c,char *buf_ptr );
905
906#ifndef yytext_ptr
907static void yy_flex_strncpy (char *,yyconst char *,int );
908#endif
909
910#ifdef YY_NEED_STRLEN
911static int yy_flex_strlen (yyconst char * );
912#endif
913
914#ifndef YY_NO_INPUT
915
916#ifdef __cplusplus
917static int yyinput (void );
918#else
919static int input (void );
920#endif
921
922#endif
923
924/* Amount of stuff to slurp up with each read. */
925#ifndef YY_READ_BUF_SIZE
926#define YY_READ_BUF_SIZE 8192
927#endif
928
929/* Copy whatever the last rule matched to the standard output. */
930#ifndef ECHO
931/* This used to be an fputs(), but since the string might contain NUL's,
932 * we now use fwrite().
933 */
Jan Beulich2e0d7372015-01-20 12:52:48 +0000934#define ECHO fwrite( zconftext, zconfleng, 1, zconfout )
Linus Torvalds1da177e2005-04-16 15:20:36 -0700935#endif
936
937/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
938 * is returned in "result".
939 */
940#ifndef YY_INPUT
941#define YY_INPUT(buf,result,max_size) \
942 errno=0; \
943 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
944 { \
945 if( errno != EINTR) \
946 { \
947 YY_FATAL_ERROR( "input in flex scanner failed" ); \
948 break; \
949 } \
950 errno=0; \
951 clearerr(zconfin); \
952 }\
953\
954
955#endif
956
957/* No semi-colon after return; correct usage is to write "yyterminate();" -
958 * we don't want an extra ';' after the "return" because that will cause
959 * some compilers to complain about unreachable statements.
960 */
961#ifndef yyterminate
962#define yyterminate() return YY_NULL
963#endif
964
965/* Number of entries by which start-condition stack grows. */
966#ifndef YY_START_STACK_INCR
967#define YY_START_STACK_INCR 25
968#endif
969
970/* Report a fatal error. */
971#ifndef YY_FATAL_ERROR
972#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
973#endif
974
975/* end tables serialization structures and prototypes */
976
977/* Default declaration of generated scanner - a define so the user can
978 * easily add parameters.
979 */
980#ifndef YY_DECL
981#define YY_DECL_IS_OURS 1
982
983extern int zconflex (void);
984
985#define YY_DECL int zconflex (void)
986#endif /* !YY_DECL */
987
988/* Code executed at the beginning of each rule, after zconftext and zconfleng
989 * have been set up.
990 */
991#ifndef YY_USER_ACTION
992#define YY_USER_ACTION
993#endif
994
995/* Code executed at the end of each rule. */
996#ifndef YY_BREAK
997#define YY_BREAK break;
998#endif
999
1000#define YY_RULE_SETUP \
1001 YY_USER_ACTION
1002
1003/** The main scanner function which does all the work.
1004 */
1005YY_DECL
1006{
1007 register yy_state_type yy_current_state;
1008 register char *yy_cp, *yy_bp;
1009 register int yy_act;
1010
1011 int str = 0;
1012 int ts, i;
1013
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001014 if ( !(yy_init) )
Linus Torvalds1da177e2005-04-16 15:20:36 -07001015 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001016 (yy_init) = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001017
1018#ifdef YY_USER_INIT
1019 YY_USER_INIT;
1020#endif
1021
1022 if ( ! (yy_start) )
1023 (yy_start) = 1; /* first start state */
1024
1025 if ( ! zconfin )
1026 zconfin = stdin;
1027
1028 if ( ! zconfout )
1029 zconfout = stdout;
1030
1031 if ( ! YY_CURRENT_BUFFER ) {
1032 zconfensure_buffer_stack ();
1033 YY_CURRENT_BUFFER_LVALUE =
1034 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1035 }
1036
1037 zconf_load_buffer_state( );
1038 }
1039
1040 while ( 1 ) /* loops until end-of-file is reached */
1041 {
1042 yy_cp = (yy_c_buf_p);
1043
1044 /* Support of zconftext. */
1045 *yy_cp = (yy_hold_char);
1046
1047 /* yy_bp points to the position in yy_ch_buf of the start of
1048 * the current run.
1049 */
1050 yy_bp = yy_cp;
1051
1052 yy_current_state = (yy_start);
1053yy_match:
1054 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
1055 ++yy_cp;
1056
1057 yy_current_state = -yy_current_state;
1058
1059yy_find_action:
1060 yy_act = yy_accept[yy_current_state];
1061
1062 YY_DO_BEFORE_ACTION;
1063
1064do_action: /* This label is used only to access EOF actions. */
1065
1066 switch ( yy_act )
1067 { /* beginning of action switch */
1068case 1:
1069/* rule 1 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070case 2:
Roman Zippela02f0572005-11-08 21:34:53 -08001071/* rule 2 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001073{
1074 current_file->lineno++;
1075 return T_EOL;
1076}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 YY_BREAK
1078case 3:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001079YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001080
Linus Torvalds1da177e2005-04-16 15:20:36 -07001081 YY_BREAK
1082case 4:
1083YY_RULE_SETUP
1084{
1085 BEGIN(COMMAND);
1086}
1087 YY_BREAK
1088case 5:
1089YY_RULE_SETUP
1090{
1091 unput(zconftext[0]);
1092 BEGIN(COMMAND);
1093}
1094 YY_BREAK
1095
1096case 6:
1097YY_RULE_SETUP
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098{
Arnaud Lacombe2f76b352011-05-23 01:08:19 -04001099 const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
Roman Zippela02f0572005-11-08 21:34:53 -08001100 BEGIN(PARAM);
1101 current_pos.file = current_file;
1102 current_pos.lineno = current_file->lineno;
Roman Zippel7a884882005-11-08 21:34:51 -08001103 if (id && id->flags & TF_COMMAND) {
Roman Zippel3370f9f2005-11-08 21:34:52 -08001104 zconflval.id = id;
Roman Zippel7a884882005-11-08 21:34:51 -08001105 return id->token;
1106 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001107 alloc_string(zconftext, zconfleng);
1108 zconflval.string = text;
1109 return T_WORD;
1110 }
1111 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001112case 7:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001113YY_RULE_SETUP
1114
1115 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001116case 8:
1117/* rule 8 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118YY_RULE_SETUP
Roman Zippela02f0572005-11-08 21:34:53 -08001119{
1120 BEGIN(INITIAL);
1121 current_file->lineno++;
1122 return T_EOL;
1123 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 YY_BREAK
1125
Roman Zippel7a884882005-11-08 21:34:51 -08001126case 9:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001127YY_RULE_SETUP
1128return T_AND;
1129 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001130case 10:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131YY_RULE_SETUP
1132return T_OR;
1133 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001134case 11:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001135YY_RULE_SETUP
1136return T_OPEN_PAREN;
1137 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001138case 12:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001139YY_RULE_SETUP
1140return T_CLOSE_PAREN;
1141 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001142case 13:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001143YY_RULE_SETUP
1144return T_NOT;
1145 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001146case 14:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147YY_RULE_SETUP
1148return T_EQUAL;
1149 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001150case 15:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001151YY_RULE_SETUP
1152return T_UNEQUAL;
1153 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001154case 16:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001155YY_RULE_SETUP
1156{
1157 str = zconftext[0];
1158 new_string();
1159 BEGIN(STRING);
1160 }
1161 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001162case 17:
1163/* rule 17 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164YY_RULE_SETUP
1165BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1166 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001167case 18:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001168YY_RULE_SETUP
1169/* ignore */
1170 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001171case 19:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001172YY_RULE_SETUP
1173{
Arnaud Lacombe2f76b352011-05-23 01:08:19 -04001174 const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
Roman Zippel3370f9f2005-11-08 21:34:52 -08001175 if (id && id->flags & TF_PARAM) {
1176 zconflval.id = id;
Roman Zippel7a884882005-11-08 21:34:51 -08001177 return id->token;
Roman Zippel3370f9f2005-11-08 21:34:52 -08001178 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001179 alloc_string(zconftext, zconfleng);
1180 zconflval.string = text;
1181 return T_WORD;
1182 }
1183 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001184case 20:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001185YY_RULE_SETUP
1186/* comment */
1187 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001188case 21:
1189/* rule 21 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001190YY_RULE_SETUP
1191current_file->lineno++;
1192 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001193case 22:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001194YY_RULE_SETUP
1195
1196 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001197case 23:
1198YY_RULE_SETUP
1199{
1200 fprintf(stderr,
1201 "%s:%d:warning: ignoring unsupported character '%c'\n",
1202 zconf_curname(), zconf_lineno(), *zconftext);
1203 }
1204 YY_BREAK
Linus Torvalds1da177e2005-04-16 15:20:36 -07001205case YY_STATE_EOF(PARAM):
1206{
1207 BEGIN(INITIAL);
1208 }
1209 YY_BREAK
1210
Jan Beulich2e0d7372015-01-20 12:52:48 +00001211case 24:
1212/* rule 24 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001213*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1214(yy_c_buf_p) = yy_cp -= 1;
1215YY_DO_BEFORE_ACTION; /* set up zconftext again */
1216YY_RULE_SETUP
1217{
1218 append_string(zconftext, zconfleng);
1219 zconflval.string = text;
1220 return T_WORD_QUOTE;
1221 }
1222 YY_BREAK
Roman Zippel7a884882005-11-08 21:34:51 -08001223case 25:
Jan Beulich2e0d7372015-01-20 12:52:48 +00001224YY_RULE_SETUP
1225{
1226 append_string(zconftext, zconfleng);
1227 }
1228 YY_BREAK
1229case 26:
1230/* rule 26 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1232(yy_c_buf_p) = yy_cp -= 1;
1233YY_DO_BEFORE_ACTION; /* set up zconftext again */
1234YY_RULE_SETUP
1235{
1236 append_string(zconftext + 1, zconfleng - 1);
1237 zconflval.string = text;
1238 return T_WORD_QUOTE;
1239 }
1240 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001241case 27:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001242YY_RULE_SETUP
1243{
1244 append_string(zconftext + 1, zconfleng - 1);
1245 }
1246 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001247case 28:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001248YY_RULE_SETUP
1249{
1250 if (str == zconftext[0]) {
1251 BEGIN(PARAM);
1252 zconflval.string = text;
1253 return T_WORD_QUOTE;
1254 } else
1255 append_string(zconftext, 1);
1256 }
1257 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001258case 29:
1259/* rule 29 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001260YY_RULE_SETUP
1261{
1262 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1263 current_file->lineno++;
1264 BEGIN(INITIAL);
1265 return T_EOL;
1266 }
1267 YY_BREAK
1268case YY_STATE_EOF(STRING):
1269{
1270 BEGIN(INITIAL);
1271 }
1272 YY_BREAK
1273
Jan Beulich2e0d7372015-01-20 12:52:48 +00001274case 30:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001275YY_RULE_SETUP
1276{
1277 ts = 0;
1278 for (i = 0; i < zconfleng; i++) {
1279 if (zconftext[i] == '\t')
1280 ts = (ts & ~7) + 8;
1281 else
1282 ts++;
1283 }
1284 last_ts = ts;
1285 if (first_ts) {
1286 if (ts < first_ts) {
1287 zconf_endhelp();
1288 return T_HELPTEXT;
1289 }
1290 ts -= first_ts;
1291 while (ts > 8) {
1292 append_string(" ", 8);
1293 ts -= 8;
1294 }
1295 append_string(" ", ts);
1296 }
1297 }
1298 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001299case 31:
1300/* rule 31 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001301*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1302(yy_c_buf_p) = yy_cp -= 1;
1303YY_DO_BEFORE_ACTION; /* set up zconftext again */
1304YY_RULE_SETUP
1305{
1306 current_file->lineno++;
1307 zconf_endhelp();
1308 return T_HELPTEXT;
1309 }
1310 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001311case 32:
1312/* rule 32 can match eol */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001313YY_RULE_SETUP
1314{
1315 current_file->lineno++;
1316 append_string("\n", 1);
1317 }
1318 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001319case 33:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001320YY_RULE_SETUP
1321{
EGRY Gaborf7a4b4c2008-01-11 23:55:20 +01001322 while (zconfleng) {
1323 if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
1324 break;
1325 zconfleng--;
1326 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001327 append_string(zconftext, zconfleng);
1328 if (!first_ts)
1329 first_ts = last_ts;
1330 }
1331 YY_BREAK
1332case YY_STATE_EOF(HELP):
1333{
1334 zconf_endhelp();
1335 return T_HELPTEXT;
1336 }
1337 YY_BREAK
1338
1339case YY_STATE_EOF(INITIAL):
1340case YY_STATE_EOF(COMMAND):
1341{
Roman Zippela02f0572005-11-08 21:34:53 -08001342 if (current_file) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001343 zconf_endfile();
Roman Zippela02f0572005-11-08 21:34:53 -08001344 return T_EOL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001345 }
1346 fclose(zconfin);
1347 yyterminate();
1348}
1349 YY_BREAK
Jan Beulich2e0d7372015-01-20 12:52:48 +00001350case 34:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001351YY_RULE_SETUP
1352YY_FATAL_ERROR( "flex scanner jammed" );
1353 YY_BREAK
1354
1355 case YY_END_OF_BUFFER:
1356 {
1357 /* Amount of text matched not including the EOB char. */
1358 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1359
1360 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1361 *yy_cp = (yy_hold_char);
1362 YY_RESTORE_YY_MORE_OFFSET
1363
1364 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1365 {
1366 /* We're scanning a new file or input source. It's
1367 * possible that this happened because the user
1368 * just pointed zconfin at a new source and called
1369 * zconflex(). If so, then we have to assure
1370 * consistency between YY_CURRENT_BUFFER and our
1371 * globals. Here is the right place to do so, because
1372 * this is the first action (other than possibly a
1373 * back-up) that will match for the new input source.
1374 */
1375 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1376 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1377 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1378 }
1379
1380 /* Note that here we test for yy_c_buf_p "<=" to the position
1381 * of the first EOB in the buffer, since yy_c_buf_p will
1382 * already have been incremented past the NUL character
1383 * (since all states make transitions on EOB to the
1384 * end-of-buffer state). Contrast this with the test
1385 * in input().
1386 */
1387 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1388 { /* This was really a NUL. */
1389 yy_state_type yy_next_state;
1390
1391 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1392
1393 yy_current_state = yy_get_previous_state( );
1394
1395 /* Okay, we're now positioned to make the NUL
1396 * transition. We couldn't have
1397 * yy_get_previous_state() go ahead and do it
1398 * for us because it doesn't know how to deal
1399 * with the possibility of jamming (and we don't
1400 * want to build jamming into it because then it
1401 * will run more slowly).
1402 */
1403
1404 yy_next_state = yy_try_NUL_trans( yy_current_state );
1405
1406 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1407
1408 if ( yy_next_state )
1409 {
1410 /* Consume the NUL. */
1411 yy_cp = ++(yy_c_buf_p);
1412 yy_current_state = yy_next_state;
1413 goto yy_match;
1414 }
1415
1416 else
1417 {
1418 yy_cp = (yy_c_buf_p);
1419 goto yy_find_action;
1420 }
1421 }
1422
1423 else switch ( yy_get_next_buffer( ) )
1424 {
1425 case EOB_ACT_END_OF_FILE:
1426 {
1427 (yy_did_buffer_switch_on_eof) = 0;
1428
1429 if ( zconfwrap( ) )
1430 {
1431 /* Note: because we've taken care in
1432 * yy_get_next_buffer() to have set up
1433 * zconftext, we can now set up
1434 * yy_c_buf_p so that if some total
1435 * hoser (like flex itself) wants to
1436 * call the scanner after we return the
1437 * YY_NULL, it'll still work - another
1438 * YY_NULL will get returned.
1439 */
1440 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1441
1442 yy_act = YY_STATE_EOF(YY_START);
1443 goto do_action;
1444 }
1445
1446 else
1447 {
1448 if ( ! (yy_did_buffer_switch_on_eof) )
1449 YY_NEW_FILE;
1450 }
1451 break;
1452 }
1453
1454 case EOB_ACT_CONTINUE_SCAN:
1455 (yy_c_buf_p) =
1456 (yytext_ptr) + yy_amount_of_matched_text;
1457
1458 yy_current_state = yy_get_previous_state( );
1459
1460 yy_cp = (yy_c_buf_p);
1461 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1462 goto yy_match;
1463
1464 case EOB_ACT_LAST_MATCH:
1465 (yy_c_buf_p) =
1466 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1467
1468 yy_current_state = yy_get_previous_state( );
1469
1470 yy_cp = (yy_c_buf_p);
1471 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1472 goto yy_find_action;
1473 }
1474 break;
1475 }
1476
1477 default:
1478 YY_FATAL_ERROR(
1479 "fatal flex scanner internal error--no action found" );
1480 } /* end of action switch */
1481 } /* end of scanning one token */
1482} /* end of zconflex */
1483
1484/* yy_get_next_buffer - try to read in a new buffer
1485 *
1486 * Returns a code representing an action:
1487 * EOB_ACT_LAST_MATCH -
1488 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1489 * EOB_ACT_END_OF_FILE - end of file
1490 */
1491static int yy_get_next_buffer (void)
1492{
1493 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1494 register char *source = (yytext_ptr);
1495 register int number_to_move, i;
1496 int ret_val;
1497
1498 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1499 YY_FATAL_ERROR(
1500 "fatal flex scanner internal error--end of buffer missed" );
1501
1502 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1503 { /* Don't try to fill the buffer, so this is an EOF. */
1504 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1505 {
1506 /* We matched a single character, the EOB, so
1507 * treat this as a final EOF.
1508 */
1509 return EOB_ACT_END_OF_FILE;
1510 }
1511
1512 else
1513 {
1514 /* We matched some text prior to the EOB, first
1515 * process it.
1516 */
1517 return EOB_ACT_LAST_MATCH;
1518 }
1519 }
1520
1521 /* Try to read more data. */
1522
1523 /* First move last chars to start of buffer. */
1524 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1525
1526 for ( i = 0; i < number_to_move; ++i )
1527 *(dest++) = *(source++);
1528
1529 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1530 /* don't do the read, it's not guaranteed to return an EOF,
1531 * just force an EOF
1532 */
1533 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1534
1535 else
1536 {
Roman Zippelf6a88aa2006-06-08 22:12:44 -07001537 int num_to_read =
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1539
1540 while ( num_to_read <= 0 )
1541 { /* Not enough room in the buffer - grow it. */
1542
1543 /* just a shorter name for the current buffer */
1544 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1545
1546 int yy_c_buf_p_offset =
1547 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1548
1549 if ( b->yy_is_our_buffer )
1550 {
1551 int new_size = b->yy_buf_size * 2;
1552
1553 if ( new_size <= 0 )
1554 b->yy_buf_size += b->yy_buf_size / 8;
1555 else
1556 b->yy_buf_size *= 2;
1557
1558 b->yy_ch_buf = (char *)
1559 /* Include room in for 2 EOB chars. */
1560 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1561 }
1562 else
1563 /* Can't grow it, we don't own it. */
1564 b->yy_ch_buf = 0;
1565
1566 if ( ! b->yy_ch_buf )
1567 YY_FATAL_ERROR(
1568 "fatal error - scanner input buffer overflow" );
1569
1570 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1571
1572 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1573 number_to_move - 1;
1574
1575 }
1576
1577 if ( num_to_read > YY_READ_BUF_SIZE )
1578 num_to_read = YY_READ_BUF_SIZE;
1579
1580 /* Read in more data. */
1581 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
Roman Zippel5a1aa8a2008-02-29 05:11:50 +01001582 (yy_n_chars), (size_t) num_to_read );
Linus Torvalds1da177e2005-04-16 15:20:36 -07001583
1584 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1585 }
1586
1587 if ( (yy_n_chars) == 0 )
1588 {
1589 if ( number_to_move == YY_MORE_ADJ )
1590 {
1591 ret_val = EOB_ACT_END_OF_FILE;
1592 zconfrestart(zconfin );
1593 }
1594
1595 else
1596 {
1597 ret_val = EOB_ACT_LAST_MATCH;
1598 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1599 YY_BUFFER_EOF_PENDING;
1600 }
1601 }
1602
1603 else
1604 ret_val = EOB_ACT_CONTINUE_SCAN;
1605
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03001606 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1607 /* Extend the array by 50%, plus the number we really need. */
1608 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1609 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1610 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1611 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1612 }
1613
Linus Torvalds1da177e2005-04-16 15:20:36 -07001614 (yy_n_chars) += number_to_move;
1615 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1616 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1617
1618 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1619
1620 return ret_val;
1621}
1622
1623/* yy_get_previous_state - get the state just before the EOB char was reached */
1624
1625 static yy_state_type yy_get_previous_state (void)
1626{
1627 register yy_state_type yy_current_state;
1628 register char *yy_cp;
1629
1630 yy_current_state = (yy_start);
1631
1632 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1633 {
1634 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1635 }
1636
1637 return yy_current_state;
1638}
1639
1640/* yy_try_NUL_trans - try to make a transition on the NUL character
1641 *
1642 * synopsis
1643 * next_state = yy_try_NUL_trans( current_state );
1644 */
1645 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1646{
1647 register int yy_is_jam;
1648
1649 yy_current_state = yy_nxt[yy_current_state][1];
1650 yy_is_jam = (yy_current_state <= 0);
1651
1652 return yy_is_jam ? 0 : yy_current_state;
1653}
1654
1655 static void yyunput (int c, register char * yy_bp )
1656{
1657 register char *yy_cp;
1658
1659 yy_cp = (yy_c_buf_p);
1660
1661 /* undo effects of setting up zconftext */
1662 *yy_cp = (yy_hold_char);
1663
1664 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1665 { /* need to shift things up to make room */
1666 /* +2 for EOB chars. */
1667 register int number_to_move = (yy_n_chars) + 2;
1668 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1669 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1670 register char *source =
1671 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1672
1673 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1674 *--dest = *--source;
1675
1676 yy_cp += (int) (dest - source);
1677 yy_bp += (int) (dest - source);
1678 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1679 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1680
1681 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1682 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1683 }
1684
1685 *--yy_cp = (char) c;
1686
1687 (yytext_ptr) = yy_bp;
1688 (yy_hold_char) = *yy_cp;
1689 (yy_c_buf_p) = yy_cp;
1690}
1691
1692#ifndef YY_NO_INPUT
1693#ifdef __cplusplus
1694 static int yyinput (void)
1695#else
1696 static int input (void)
1697#endif
1698
1699{
1700 int c;
1701
1702 *(yy_c_buf_p) = (yy_hold_char);
1703
1704 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1705 {
1706 /* yy_c_buf_p now points to the character we want to return.
1707 * If this occurs *before* the EOB characters, then it's a
1708 * valid NUL; if not, then we've hit the end of the buffer.
1709 */
1710 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1711 /* This was really a NUL. */
1712 *(yy_c_buf_p) = '\0';
1713
1714 else
1715 { /* need more input */
1716 int offset = (yy_c_buf_p) - (yytext_ptr);
1717 ++(yy_c_buf_p);
1718
1719 switch ( yy_get_next_buffer( ) )
1720 {
1721 case EOB_ACT_LAST_MATCH:
1722 /* This happens because yy_g_n_b()
1723 * sees that we've accumulated a
1724 * token and flags that we need to
1725 * try matching the token before
1726 * proceeding. But for input(),
1727 * there's no matching to consider.
1728 * So convert the EOB_ACT_LAST_MATCH
1729 * to EOB_ACT_END_OF_FILE.
1730 */
1731
1732 /* Reset buffer status. */
1733 zconfrestart(zconfin );
1734
1735 /*FALLTHROUGH*/
1736
1737 case EOB_ACT_END_OF_FILE:
1738 {
1739 if ( zconfwrap( ) )
1740 return EOF;
1741
1742 if ( ! (yy_did_buffer_switch_on_eof) )
1743 YY_NEW_FILE;
1744#ifdef __cplusplus
1745 return yyinput();
1746#else
1747 return input();
1748#endif
1749 }
1750
1751 case EOB_ACT_CONTINUE_SCAN:
1752 (yy_c_buf_p) = (yytext_ptr) + offset;
1753 break;
1754 }
1755 }
1756 }
1757
1758 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1759 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1760 (yy_hold_char) = *++(yy_c_buf_p);
1761
1762 return c;
1763}
1764#endif /* ifndef YY_NO_INPUT */
1765
1766/** Immediately switch to a different input stream.
1767 * @param input_file A readable stream.
1768 *
1769 * @note This function does not reset the start condition to @c INITIAL .
1770 */
1771 void zconfrestart (FILE * input_file )
1772{
1773
1774 if ( ! YY_CURRENT_BUFFER ){
1775 zconfensure_buffer_stack ();
1776 YY_CURRENT_BUFFER_LVALUE =
1777 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1778 }
1779
1780 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1781 zconf_load_buffer_state( );
1782}
1783
1784/** Switch to a different input buffer.
1785 * @param new_buffer The new input buffer.
1786 *
1787 */
1788 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1789{
1790
1791 /* TODO. We should be able to replace this entire function body
1792 * with
1793 * zconfpop_buffer_state();
1794 * zconfpush_buffer_state(new_buffer);
1795 */
1796 zconfensure_buffer_stack ();
1797 if ( YY_CURRENT_BUFFER == new_buffer )
1798 return;
1799
1800 if ( YY_CURRENT_BUFFER )
1801 {
1802 /* Flush out information for old buffer. */
1803 *(yy_c_buf_p) = (yy_hold_char);
1804 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1805 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1806 }
1807
1808 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1809 zconf_load_buffer_state( );
1810
1811 /* We don't actually know whether we did this switch during
1812 * EOF (zconfwrap()) processing, but the only time this flag
1813 * is looked at is after zconfwrap() is called, so it's safe
1814 * to go ahead and always set it.
1815 */
1816 (yy_did_buffer_switch_on_eof) = 1;
1817}
1818
1819static void zconf_load_buffer_state (void)
1820{
1821 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1822 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1823 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1824 (yy_hold_char) = *(yy_c_buf_p);
1825}
1826
1827/** Allocate and initialize an input buffer state.
1828 * @param file A readable stream.
1829 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1830 *
1831 * @return the allocated buffer state.
1832 */
1833 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1834{
1835 YY_BUFFER_STATE b;
1836
1837 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1838 if ( ! b )
1839 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1840
1841 b->yy_buf_size = size;
1842
1843 /* yy_ch_buf has to be 2 characters longer than the size given because
1844 * we need to put in 2 end-of-buffer characters.
1845 */
1846 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1847 if ( ! b->yy_ch_buf )
1848 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1849
1850 b->yy_is_our_buffer = 1;
1851
1852 zconf_init_buffer(b,file );
1853
1854 return b;
1855}
1856
1857/** Destroy the buffer.
1858 * @param b a buffer created with zconf_create_buffer()
1859 *
1860 */
1861 void zconf_delete_buffer (YY_BUFFER_STATE b )
1862{
1863
1864 if ( ! b )
1865 return;
1866
1867 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1868 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1869
1870 if ( b->yy_is_our_buffer )
1871 zconffree((void *) b->yy_ch_buf );
1872
1873 zconffree((void *) b );
1874}
1875
1876/* Initializes or reinitializes a buffer.
1877 * This function is sometimes called more than once on the same buffer,
1878 * such as during a zconfrestart() or at EOF.
1879 */
1880 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1881
1882{
1883 int oerrno = errno;
1884
1885 zconf_flush_buffer(b );
1886
1887 b->yy_input_file = file;
1888 b->yy_fill_buffer = 1;
1889
1890 /* If b is the current buffer, then zconf_init_buffer was _probably_
1891 * called from zconfrestart() or through yy_get_next_buffer.
1892 * In that case, we don't want to reset the lineno or column.
1893 */
1894 if (b != YY_CURRENT_BUFFER){
1895 b->yy_bs_lineno = 1;
1896 b->yy_bs_column = 0;
1897 }
1898
1899 b->yy_is_interactive = 0;
1900
1901 errno = oerrno;
1902}
1903
1904/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1905 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1906 *
1907 */
1908 void zconf_flush_buffer (YY_BUFFER_STATE b )
1909{
1910 if ( ! b )
1911 return;
1912
1913 b->yy_n_chars = 0;
1914
1915 /* We always need two end-of-buffer characters. The first causes
1916 * a transition to the end-of-buffer state. The second causes
1917 * a jam in that state.
1918 */
1919 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1920 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1921
1922 b->yy_buf_pos = &b->yy_ch_buf[0];
1923
1924 b->yy_at_bol = 1;
1925 b->yy_buffer_status = YY_BUFFER_NEW;
1926
1927 if ( b == YY_CURRENT_BUFFER )
1928 zconf_load_buffer_state( );
1929}
1930
1931/** Pushes the new state onto the stack. The new state becomes
1932 * the current state. This function will allocate the stack
1933 * if necessary.
1934 * @param new_buffer The new state.
1935 *
1936 */
1937void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1938{
1939 if (new_buffer == NULL)
1940 return;
1941
1942 zconfensure_buffer_stack();
1943
1944 /* This block is copied from zconf_switch_to_buffer. */
1945 if ( YY_CURRENT_BUFFER )
1946 {
1947 /* Flush out information for old buffer. */
1948 *(yy_c_buf_p) = (yy_hold_char);
1949 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1950 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1951 }
1952
1953 /* Only push if top exists. Otherwise, replace top. */
1954 if (YY_CURRENT_BUFFER)
1955 (yy_buffer_stack_top)++;
1956 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1957
1958 /* copied from zconf_switch_to_buffer. */
1959 zconf_load_buffer_state( );
1960 (yy_did_buffer_switch_on_eof) = 1;
1961}
1962
1963/** Removes and deletes the top of the stack, if present.
1964 * The next element becomes the new top.
1965 *
1966 */
1967void zconfpop_buffer_state (void)
1968{
1969 if (!YY_CURRENT_BUFFER)
1970 return;
1971
1972 zconf_delete_buffer(YY_CURRENT_BUFFER );
1973 YY_CURRENT_BUFFER_LVALUE = NULL;
1974 if ((yy_buffer_stack_top) > 0)
1975 --(yy_buffer_stack_top);
1976
1977 if (YY_CURRENT_BUFFER) {
1978 zconf_load_buffer_state( );
1979 (yy_did_buffer_switch_on_eof) = 1;
1980 }
1981}
1982
1983/* Allocates the stack if it does not exist.
1984 * Guarantees space for at least one push.
1985 */
1986static void zconfensure_buffer_stack (void)
1987{
1988 int num_to_alloc;
1989
1990 if (!(yy_buffer_stack)) {
1991
1992 /* First allocation is just for 2 elements, since we don't know if this
1993 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1994 * immediate realloc on the next call.
1995 */
1996 num_to_alloc = 1;
1997 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1998 (num_to_alloc * sizeof(struct yy_buffer_state*)
1999 );
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03002000 if ( ! (yy_buffer_stack) )
2001 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
2002
Linus Torvalds1da177e2005-04-16 15:20:36 -07002003 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2004
2005 (yy_buffer_stack_max) = num_to_alloc;
2006 (yy_buffer_stack_top) = 0;
2007 return;
2008 }
2009
2010 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2011
2012 /* Increase the buffer to prepare for a possible push. */
2013 int grow_size = 8 /* arbitrary grow size */;
2014
2015 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2016 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
2017 ((yy_buffer_stack),
2018 num_to_alloc * sizeof(struct yy_buffer_state*)
2019 );
Adrian Bunkbe2be1d2008-07-17 02:07:59 +03002020 if ( ! (yy_buffer_stack) )
2021 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
Linus Torvalds1da177e2005-04-16 15:20:36 -07002022
2023 /* zero only the new slots.*/
2024 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2025 (yy_buffer_stack_max) = num_to_alloc;
2026 }
2027}
2028
2029/** Setup the input buffer state to scan directly from a user-specified character buffer.
2030 * @param base the character buffer
2031 * @param size the size in bytes of the character buffer
2032 *
2033 * @return the newly allocated buffer state object.
2034 */
2035YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
2036{
2037 YY_BUFFER_STATE b;
2038
2039 if ( size < 2 ||
2040 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2041 base[size-1] != YY_END_OF_BUFFER_CHAR )
2042 /* They forgot to leave room for the EOB's. */
2043 return 0;
2044
2045 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
2046 if ( ! b )
2047 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
2048
2049 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2050 b->yy_buf_pos = b->yy_ch_buf = base;
2051 b->yy_is_our_buffer = 0;
2052 b->yy_input_file = 0;
2053 b->yy_n_chars = b->yy_buf_size;
2054 b->yy_is_interactive = 0;
2055 b->yy_at_bol = 1;
2056 b->yy_fill_buffer = 0;
2057 b->yy_buffer_status = YY_BUFFER_NEW;
2058
2059 zconf_switch_to_buffer(b );
2060
2061 return b;
2062}
2063
2064/** Setup the input buffer state to scan a string. The next call to zconflex() will
2065 * scan from a @e copy of @a str.
Roman Zippel5a1aa8a2008-02-29 05:11:50 +01002066 * @param yystr a NUL-terminated string to scan
Linus Torvalds1da177e2005-04-16 15:20:36 -07002067 *
2068 * @return the newly allocated buffer state object.
2069 * @note If you want to scan bytes that may contain NUL values, then use
2070 * zconf_scan_bytes() instead.
2071 */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002072YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002073{
2074
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002075 return zconf_scan_bytes(yystr,strlen(yystr) );
Linus Torvalds1da177e2005-04-16 15:20:36 -07002076}
2077
2078/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
2079 * scan from a @e copy of @a bytes.
Arnaud Lacombe2f76b352011-05-23 01:08:19 -04002080 * @param bytes the byte buffer to scan
2081 * @param len the number of bytes in the buffer pointed to by @a bytes.
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082 *
2083 * @return the newly allocated buffer state object.
2084 */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002085YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002086{
2087 YY_BUFFER_STATE b;
2088 char *buf;
2089 yy_size_t n;
2090 int i;
2091
2092 /* Get memory for full buffer, including space for trailing EOB's. */
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002093 n = _yybytes_len + 2;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002094 buf = (char *) zconfalloc(n );
2095 if ( ! buf )
2096 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2097
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002098 for ( i = 0; i < _yybytes_len; ++i )
2099 buf[i] = yybytes[i];
Linus Torvalds1da177e2005-04-16 15:20:36 -07002100
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002101 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002102
2103 b = zconf_scan_buffer(buf,n );
2104 if ( ! b )
2105 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2106
2107 /* It's okay to grow etc. this buffer, and we should throw it
2108 * away when we're done.
2109 */
2110 b->yy_is_our_buffer = 1;
2111
2112 return b;
2113}
2114
2115#ifndef YY_EXIT_FAILURE
2116#define YY_EXIT_FAILURE 2
2117#endif
2118
2119static void yy_fatal_error (yyconst char* msg )
2120{
2121 (void) fprintf( stderr, "%s\n", msg );
2122 exit( YY_EXIT_FAILURE );
2123}
2124
2125/* Redefine yyless() so it works in section 3 code. */
2126
2127#undef yyless
2128#define yyless(n) \
2129 do \
2130 { \
2131 /* Undo effects of setting up zconftext. */ \
2132 int yyless_macro_arg = (n); \
2133 YY_LESS_LINENO(yyless_macro_arg);\
2134 zconftext[zconfleng] = (yy_hold_char); \
2135 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2136 (yy_hold_char) = *(yy_c_buf_p); \
2137 *(yy_c_buf_p) = '\0'; \
2138 zconfleng = yyless_macro_arg; \
2139 } \
2140 while ( 0 )
2141
2142/* Accessor methods (get/set functions) to struct members. */
2143
2144/** Get the current line number.
2145 *
2146 */
2147int zconfget_lineno (void)
2148{
2149
2150 return zconflineno;
2151}
2152
2153/** Get the input stream.
2154 *
2155 */
2156FILE *zconfget_in (void)
2157{
2158 return zconfin;
2159}
2160
2161/** Get the output stream.
2162 *
2163 */
2164FILE *zconfget_out (void)
2165{
2166 return zconfout;
2167}
2168
2169/** Get the length of the current token.
2170 *
2171 */
2172int zconfget_leng (void)
2173{
2174 return zconfleng;
2175}
2176
2177/** Get the current token.
2178 *
2179 */
2180
2181char *zconfget_text (void)
2182{
2183 return zconftext;
2184}
2185
2186/** Set the current line number.
2187 * @param line_number
2188 *
2189 */
2190void zconfset_lineno (int line_number )
2191{
2192
2193 zconflineno = line_number;
2194}
2195
2196/** Set the input stream. This does not discard the current
2197 * input buffer.
2198 * @param in_str A readable stream.
2199 *
2200 * @see zconf_switch_to_buffer
2201 */
2202void zconfset_in (FILE * in_str )
2203{
2204 zconfin = in_str ;
2205}
2206
2207void zconfset_out (FILE * out_str )
2208{
2209 zconfout = out_str ;
2210}
2211
2212int zconfget_debug (void)
2213{
2214 return zconf_flex_debug;
2215}
2216
2217void zconfset_debug (int bdebug )
2218{
2219 zconf_flex_debug = bdebug ;
2220}
2221
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002222static int yy_init_globals (void)
2223{
2224 /* Initialization is the same as for the non-reentrant scanner.
2225 * This function is called from zconflex_destroy(), so don't allocate here.
2226 */
2227
2228 (yy_buffer_stack) = 0;
2229 (yy_buffer_stack_top) = 0;
2230 (yy_buffer_stack_max) = 0;
2231 (yy_c_buf_p) = (char *) 0;
2232 (yy_init) = 0;
2233 (yy_start) = 0;
2234
2235/* Defined in main.c */
2236#ifdef YY_STDINIT
2237 zconfin = stdin;
2238 zconfout = stdout;
2239#else
2240 zconfin = (FILE *) 0;
2241 zconfout = (FILE *) 0;
2242#endif
2243
2244 /* For future reference: Set errno on error, since we are called by
2245 * zconflex_init()
2246 */
2247 return 0;
2248}
2249
Linus Torvalds1da177e2005-04-16 15:20:36 -07002250/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2251int zconflex_destroy (void)
2252{
2253
2254 /* Pop the buffer stack, destroying each element. */
2255 while(YY_CURRENT_BUFFER){
2256 zconf_delete_buffer(YY_CURRENT_BUFFER );
2257 YY_CURRENT_BUFFER_LVALUE = NULL;
2258 zconfpop_buffer_state();
2259 }
2260
2261 /* Destroy the stack itself. */
2262 zconffree((yy_buffer_stack) );
2263 (yy_buffer_stack) = NULL;
2264
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002265 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2266 * zconflex() is called, initialization will occur. */
2267 yy_init_globals( );
2268
Linus Torvalds1da177e2005-04-16 15:20:36 -07002269 return 0;
2270}
2271
2272/*
2273 * Internal utility routines.
2274 */
2275
2276#ifndef yytext_ptr
2277static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2278{
2279 register int i;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002280 for ( i = 0; i < n; ++i )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002281 s1[i] = s2[i];
2282}
2283#endif
2284
2285#ifdef YY_NEED_STRLEN
2286static int yy_flex_strlen (yyconst char * s )
2287{
2288 register int n;
Roman Zippelf6a88aa2006-06-08 22:12:44 -07002289 for ( n = 0; s[n]; ++n )
Linus Torvalds1da177e2005-04-16 15:20:36 -07002290 ;
2291
2292 return n;
2293}
2294#endif
2295
2296void *zconfalloc (yy_size_t size )
2297{
2298 return (void *) malloc( size );
2299}
2300
2301void *zconfrealloc (void * ptr, yy_size_t size )
2302{
2303 /* The cast to (char *) in the following accommodates both
2304 * implementations that use char* generic pointers, and those
2305 * that use void* generic pointers. It works with the latter
2306 * because both ANSI C and C++ allow castless assignment from
2307 * any pointer type to void*, and deal with argument conversions
2308 * as though doing an assignment.
2309 */
2310 return (void *) realloc( (char *) ptr, size );
2311}
2312
2313void zconffree (void * ptr )
2314{
2315 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2316}
2317
2318#define YYTABLES_NAME "yytables"
2319
Linus Torvalds1da177e2005-04-16 15:20:36 -07002320void zconf_starthelp(void)
2321{
2322 new_string();
2323 last_ts = first_ts = 0;
2324 BEGIN(HELP);
2325}
2326
2327static void zconf_endhelp(void)
2328{
2329 zconflval.string = text;
2330 BEGIN(INITIAL);
2331}
2332
2333/*
2334 * Try to open specified file with following names:
2335 * ./name
2336 * $(srctree)/name
2337 * The latter is used when srctree is separate from objtree
2338 * when compiling the kernel.
2339 * Return NULL if file is not found.
2340 */
2341FILE *zconf_fopen(const char *name)
2342{
2343 char *env, fullname[PATH_MAX+1];
2344 FILE *f;
2345
2346 f = fopen(name, "r");
Marcin Garski11de39e2007-05-05 22:49:00 +02002347 if (!f && name != NULL && name[0] != '/') {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002348 env = getenv(SRCTREE);
2349 if (env) {
2350 sprintf(fullname, "%s/%s", env, name);
2351 f = fopen(fullname, "r");
2352 }
2353 }
2354 return f;
2355}
2356
2357void zconf_initscan(const char *name)
2358{
2359 zconfin = zconf_fopen(name);
2360 if (!zconfin) {
2361 printf("can't find file %s\n", name);
2362 exit(1);
2363 }
2364
Michal Marek527ffe52012-11-20 12:12:57 +01002365 current_buf = xmalloc(sizeof(*current_buf));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002366 memset(current_buf, 0, sizeof(*current_buf));
2367
2368 current_file = file_lookup(name);
2369 current_file->lineno = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002370}
2371
2372void zconf_nextfile(const char *name)
2373{
Yann E. MORINf094f8a2011-02-24 19:36:42 +01002374 struct file *iter;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002375 struct file *file = file_lookup(name);
Michal Marek527ffe52012-11-20 12:12:57 +01002376 struct buffer *buf = xmalloc(sizeof(*buf));
Linus Torvalds1da177e2005-04-16 15:20:36 -07002377 memset(buf, 0, sizeof(*buf));
2378
2379 current_buf->state = YY_CURRENT_BUFFER;
Arnaud Lacombec0920a12010-09-10 21:23:28 -04002380 zconfin = zconf_fopen(file->name);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002381 if (!zconfin) {
Arnaud Lacombec0920a12010-09-10 21:23:28 -04002382 printf("%s:%d: can't open file \"%s\"\n",
2383 zconf_curname(), zconf_lineno(), file->name);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002384 exit(1);
2385 }
2386 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2387 buf->parent = current_buf;
2388 current_buf = buf;
2389
Yann E. MORINf094f8a2011-02-24 19:36:42 +01002390 for (iter = current_file->parent; iter; iter = iter->parent ) {
2391 if (!strcmp(current_file->name,iter->name) ) {
2392 printf("%s:%d: recursive inclusion detected. "
2393 "Inclusion path:\n current file : '%s'\n",
2394 zconf_curname(), zconf_lineno(),
2395 zconf_curname());
2396 iter = current_file->parent;
2397 while (iter && \
2398 strcmp(iter->name,current_file->name)) {
2399 printf(" included from: '%s:%d'\n",
2400 iter->name, iter->lineno-1);
2401 iter = iter->parent;
2402 }
2403 if (iter)
2404 printf(" included from: '%s:%d'\n",
2405 iter->name, iter->lineno+1);
2406 exit(1);
2407 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002408 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002409 file->lineno = 1;
2410 file->parent = current_file;
2411 current_file = file;
2412}
2413
Roman Zippela02f0572005-11-08 21:34:53 -08002414static void zconf_endfile(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002415{
2416 struct buffer *parent;
2417
Linus Torvalds1da177e2005-04-16 15:20:36 -07002418 current_file = current_file->parent;
2419
2420 parent = current_buf->parent;
2421 if (parent) {
2422 fclose(zconfin);
2423 zconf_delete_buffer(YY_CURRENT_BUFFER);
2424 zconf_switch_to_buffer(parent->state);
2425 }
2426 free(current_buf);
2427 current_buf = parent;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002428}
2429
2430int zconf_lineno(void)
2431{
Roman Zippela02f0572005-11-08 21:34:53 -08002432 return current_pos.lineno;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002433}
2434
Arnaud Lacombec0920a12010-09-10 21:23:28 -04002435const char *zconf_curname(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002436{
Roman Zippela02f0572005-11-08 21:34:53 -08002437 return current_pos.file ? current_pos.file->name : "<none>";
Linus Torvalds1da177e2005-04-16 15:20:36 -07002438}
2439