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