1.1 --- a/.hgignore Sat Jan 14 18:22:06 2012 +0100
1.2 +++ b/.hgignore Sun Jan 15 01:04:26 2012 +0100
1.3 @@ -17,6 +17,10 @@
1.4 kconfig/?conf
1.5 kconfig/**.o
1.6 kconfig/**.dep
1.7 +kconfig/lex.backup
1.8 +kconfig/lex.zconf.c
1.9 +kconfig/zconf.hash.c
1.10 +kconfig/zconf.tab.c
1.11 config/configure.in
1.12 config.gen/
1.13 .config
2.1 --- a/configure.ac Sat Jan 14 18:22:06 2012 +0100
2.2 +++ b/configure.ac Sun Jan 15 01:04:26 2012 +0100
2.3 @@ -124,6 +124,7 @@
2.4
2.5 ACX_CHECK_PROGS_REQ([bison], [bison])
2.6 ACX_CHECK_PROGS_REQ([flex], [flex])
2.7 +ACX_CHECK_PROGS_REQ([gperf], [gperf])
2.8 ACX_CHECK_PROGS_REQ([awk], [gawk mawk nawk awk])
2.9 ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
2.10 ACX_CHECK_PROGS_REQ([cut], [cut])
3.1 --- a/kconfig/Makefile Sat Jan 14 18:22:06 2012 +0100
3.2 +++ b/kconfig/Makefile Sun Jan 15 01:04:26 2012 +0100
3.3 @@ -22,7 +22,7 @@
3.4 COMMON_SRC = zconf.tab.c
3.5 COMMON_OBJ = $(patsubst %.c,%.o,$(COMMON_SRC))
3.6 COMMON_DEP = $(patsubst %.o,%.dep,$(COMMON_OBJ))
3.7 -$(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS)
3.8 +$(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS) -I.
3.9
3.10 # lxdialog source files
3.11 LX_SRC = $(wildcard lxdialog/*.c)
3.12 @@ -73,6 +73,23 @@
3.13 @echo " DEP '$@'"
3.14 @$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
3.15
3.16 +# Generate the grammar parser
3.17 +zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c
3.18 +zconf.tab.dep: zconf.tab.c zconf.hash.c lex.zconf.c
3.19 +
3.20 +.PRECIOUS: zconf.tab.c
3.21 +zconf.tab.c: zconf.y
3.22 + @echo " BISON '$@'"
3.23 + @bison -l -b zconf -p zconf $<
3.24 +
3.25 +zconf.hash.c: zconf.gperf
3.26 + @echo " GPERF '$@'"
3.27 + @gperf < $< > $@
3.28 +
3.29 +lex.zconf.c: zconf.l
3.30 + @echo " LEX '$@'"
3.31 + @flex -L -P zconf -o $@ $<
3.32 +
3.33 # Build C files
3.34 %.o: %.c
3.35 @echo " CC '$@'"
3.36 @@ -97,3 +114,4 @@
3.37 clean:
3.38 @echo " RM 'kconfig'"
3.39 @rm -f conf mconf nconf $(ALL_OBJS) $(ALL_DEPS)
3.40 + @rm -f rm -f zconf.tab.c zconf.hash.c lex.zconf.c lex.backup
4.1 --- a/kconfig/lex.zconf.c Sat Jan 14 18:22:06 2012 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,2435 +0,0 @@
4.4 -
4.5 -#line 3 "scripts/kconfig/lex.zconf.c"
4.6 -
4.7 -#define YY_INT_ALIGNED short int
4.8 -
4.9 -/* A lexical scanner generated by flex */
4.10 -
4.11 -#define yy_create_buffer zconf_create_buffer
4.12 -#define yy_delete_buffer zconf_delete_buffer
4.13 -#define yy_flex_debug zconf_flex_debug
4.14 -#define yy_init_buffer zconf_init_buffer
4.15 -#define yy_flush_buffer zconf_flush_buffer
4.16 -#define yy_load_buffer_state zconf_load_buffer_state
4.17 -#define yy_switch_to_buffer zconf_switch_to_buffer
4.18 -#define yyin zconfin
4.19 -#define yyleng zconfleng
4.20 -#define yylex zconflex
4.21 -#define yylineno zconflineno
4.22 -#define yyout zconfout
4.23 -#define yyrestart zconfrestart
4.24 -#define yytext zconftext
4.25 -#define yywrap zconfwrap
4.26 -#define yyalloc zconfalloc
4.27 -#define yyrealloc zconfrealloc
4.28 -#define yyfree zconffree
4.29 -
4.30 -#define FLEX_SCANNER
4.31 -#define YY_FLEX_MAJOR_VERSION 2
4.32 -#define YY_FLEX_MINOR_VERSION 5
4.33 -#define YY_FLEX_SUBMINOR_VERSION 35
4.34 -#if YY_FLEX_SUBMINOR_VERSION > 0
4.35 -#define FLEX_BETA
4.36 -#endif
4.37 -
4.38 -/* First, we deal with platform-specific or compiler-specific issues. */
4.39 -
4.40 -/* begin standard C headers. */
4.41 -#include <stdio.h>
4.42 -#include <string.h>
4.43 -#include <errno.h>
4.44 -#include <stdlib.h>
4.45 -
4.46 -/* end standard C headers. */
4.47 -
4.48 -/* flex integer type definitions */
4.49 -
4.50 -#ifndef FLEXINT_H
4.51 -#define FLEXINT_H
4.52 -
4.53 -/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
4.54 -
4.55 -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
4.56 -
4.57 -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
4.58 - * if you want the limit (max/min) macros for int types.
4.59 - */
4.60 -#ifndef __STDC_LIMIT_MACROS
4.61 -#define __STDC_LIMIT_MACROS 1
4.62 -#endif
4.63 -
4.64 -#include <inttypes.h>
4.65 -typedef int8_t flex_int8_t;
4.66 -typedef uint8_t flex_uint8_t;
4.67 -typedef int16_t flex_int16_t;
4.68 -typedef uint16_t flex_uint16_t;
4.69 -typedef int32_t flex_int32_t;
4.70 -typedef uint32_t flex_uint32_t;
4.71 -#else
4.72 -typedef signed char flex_int8_t;
4.73 -typedef short int flex_int16_t;
4.74 -typedef int flex_int32_t;
4.75 -typedef unsigned char flex_uint8_t;
4.76 -typedef unsigned short int flex_uint16_t;
4.77 -typedef unsigned int flex_uint32_t;
4.78 -
4.79 -/* Limits of integral types. */
4.80 -#ifndef INT8_MIN
4.81 -#define INT8_MIN (-128)
4.82 -#endif
4.83 -#ifndef INT16_MIN
4.84 -#define INT16_MIN (-32767-1)
4.85 -#endif
4.86 -#ifndef INT32_MIN
4.87 -#define INT32_MIN (-2147483647-1)
4.88 -#endif
4.89 -#ifndef INT8_MAX
4.90 -#define INT8_MAX (127)
4.91 -#endif
4.92 -#ifndef INT16_MAX
4.93 -#define INT16_MAX (32767)
4.94 -#endif
4.95 -#ifndef INT32_MAX
4.96 -#define INT32_MAX (2147483647)
4.97 -#endif
4.98 -#ifndef UINT8_MAX
4.99 -#define UINT8_MAX (255U)
4.100 -#endif
4.101 -#ifndef UINT16_MAX
4.102 -#define UINT16_MAX (65535U)
4.103 -#endif
4.104 -#ifndef UINT32_MAX
4.105 -#define UINT32_MAX (4294967295U)
4.106 -#endif
4.107 -
4.108 -#endif /* ! C99 */
4.109 -
4.110 -#endif /* ! FLEXINT_H */
4.111 -
4.112 -#ifdef __cplusplus
4.113 -
4.114 -/* The "const" storage-class-modifier is valid. */
4.115 -#define YY_USE_CONST
4.116 -
4.117 -#else /* ! __cplusplus */
4.118 -
4.119 -/* C99 requires __STDC__ to be defined as 1. */
4.120 -#if defined (__STDC__)
4.121 -
4.122 -#define YY_USE_CONST
4.123 -
4.124 -#endif /* defined (__STDC__) */
4.125 -#endif /* ! __cplusplus */
4.126 -
4.127 -#ifdef YY_USE_CONST
4.128 -#define yyconst const
4.129 -#else
4.130 -#define yyconst
4.131 -#endif
4.132 -
4.133 -/* Returned upon end-of-file. */
4.134 -#define YY_NULL 0
4.135 -
4.136 -/* Promotes a possibly negative, possibly signed char to an unsigned
4.137 - * integer for use as an array index. If the signed char is negative,
4.138 - * we want to instead treat it as an 8-bit unsigned char, hence the
4.139 - * double cast.
4.140 - */
4.141 -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
4.142 -
4.143 -/* Enter a start condition. This macro really ought to take a parameter,
4.144 - * but we do it the disgusting crufty way forced on us by the ()-less
4.145 - * definition of BEGIN.
4.146 - */
4.147 -#define BEGIN (yy_start) = 1 + 2 *
4.148 -
4.149 -/* Translate the current start state into a value that can be later handed
4.150 - * to BEGIN to return to the state. The YYSTATE alias is for lex
4.151 - * compatibility.
4.152 - */
4.153 -#define YY_START (((yy_start) - 1) / 2)
4.154 -#define YYSTATE YY_START
4.155 -
4.156 -/* Action number for EOF rule of a given start state. */
4.157 -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
4.158 -
4.159 -/* Special action meaning "start processing a new file". */
4.160 -#define YY_NEW_FILE zconfrestart(zconfin )
4.161 -
4.162 -#define YY_END_OF_BUFFER_CHAR 0
4.163 -
4.164 -/* Size of default input buffer. */
4.165 -#ifndef YY_BUF_SIZE
4.166 -#ifdef __ia64__
4.167 -/* On IA-64, the buffer size is 16k, not 8k.
4.168 - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
4.169 - * Ditto for the __ia64__ case accordingly.
4.170 - */
4.171 -#define YY_BUF_SIZE 32768
4.172 -#else
4.173 -#define YY_BUF_SIZE 16384
4.174 -#endif /* __ia64__ */
4.175 -#endif
4.176 -
4.177 -/* The state buf must be large enough to hold one state per character in the main buffer.
4.178 - */
4.179 -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
4.180 -
4.181 -#ifndef YY_TYPEDEF_YY_BUFFER_STATE
4.182 -#define YY_TYPEDEF_YY_BUFFER_STATE
4.183 -typedef struct yy_buffer_state *YY_BUFFER_STATE;
4.184 -#endif
4.185 -
4.186 -extern int zconfleng;
4.187 -
4.188 -extern FILE *zconfin, *zconfout;
4.189 -
4.190 -#define EOB_ACT_CONTINUE_SCAN 0
4.191 -#define EOB_ACT_END_OF_FILE 1
4.192 -#define EOB_ACT_LAST_MATCH 2
4.193 -
4.194 - #define YY_LESS_LINENO(n)
4.195 -
4.196 -/* Return all but the first "n" matched characters back to the input stream. */
4.197 -#define yyless(n) \
4.198 - do \
4.199 - { \
4.200 - /* Undo effects of setting up zconftext. */ \
4.201 - int yyless_macro_arg = (n); \
4.202 - YY_LESS_LINENO(yyless_macro_arg);\
4.203 - *yy_cp = (yy_hold_char); \
4.204 - YY_RESTORE_YY_MORE_OFFSET \
4.205 - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
4.206 - YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
4.207 - } \
4.208 - while ( 0 )
4.209 -
4.210 -#define unput(c) yyunput( c, (yytext_ptr) )
4.211 -
4.212 -#ifndef YY_TYPEDEF_YY_SIZE_T
4.213 -#define YY_TYPEDEF_YY_SIZE_T
4.214 -typedef size_t yy_size_t;
4.215 -#endif
4.216 -
4.217 -#ifndef YY_STRUCT_YY_BUFFER_STATE
4.218 -#define YY_STRUCT_YY_BUFFER_STATE
4.219 -struct yy_buffer_state
4.220 - {
4.221 - FILE *yy_input_file;
4.222 -
4.223 - char *yy_ch_buf; /* input buffer */
4.224 - char *yy_buf_pos; /* current position in input buffer */
4.225 -
4.226 - /* Size of input buffer in bytes, not including room for EOB
4.227 - * characters.
4.228 - */
4.229 - yy_size_t yy_buf_size;
4.230 -
4.231 - /* Number of characters read into yy_ch_buf, not including EOB
4.232 - * characters.
4.233 - */
4.234 - int yy_n_chars;
4.235 -
4.236 - /* Whether we "own" the buffer - i.e., we know we created it,
4.237 - * and can realloc() it to grow it, and should free() it to
4.238 - * delete it.
4.239 - */
4.240 - int yy_is_our_buffer;
4.241 -
4.242 - /* Whether this is an "interactive" input source; if so, and
4.243 - * if we're using stdio for input, then we want to use getc()
4.244 - * instead of fread(), to make sure we stop fetching input after
4.245 - * each newline.
4.246 - */
4.247 - int yy_is_interactive;
4.248 -
4.249 - /* Whether we're considered to be at the beginning of a line.
4.250 - * If so, '^' rules will be active on the next match, otherwise
4.251 - * not.
4.252 - */
4.253 - int yy_at_bol;
4.254 -
4.255 - int yy_bs_lineno; /**< The line count. */
4.256 - int yy_bs_column; /**< The column count. */
4.257 -
4.258 - /* Whether to try to fill the input buffer when we reach the
4.259 - * end of it.
4.260 - */
4.261 - int yy_fill_buffer;
4.262 -
4.263 - int yy_buffer_status;
4.264 -
4.265 -#define YY_BUFFER_NEW 0
4.266 -#define YY_BUFFER_NORMAL 1
4.267 - /* When an EOF's been seen but there's still some text to process
4.268 - * then we mark the buffer as YY_EOF_PENDING, to indicate that we
4.269 - * shouldn't try reading from the input source any more. We might
4.270 - * still have a bunch of tokens to match, though, because of
4.271 - * possible backing-up.
4.272 - *
4.273 - * When we actually see the EOF, we change the status to "new"
4.274 - * (via zconfrestart()), so that the user can continue scanning by
4.275 - * just pointing zconfin at a new input file.
4.276 - */
4.277 -#define YY_BUFFER_EOF_PENDING 2
4.278 -
4.279 - };
4.280 -#endif /* !YY_STRUCT_YY_BUFFER_STATE */
4.281 -
4.282 -/* Stack of input buffers. */
4.283 -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
4.284 -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
4.285 -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
4.286 -
4.287 -/* We provide macros for accessing buffer states in case in the
4.288 - * future we want to put the buffer states in a more general
4.289 - * "scanner state".
4.290 - *
4.291 - * Returns the top of the stack, or NULL.
4.292 - */
4.293 -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
4.294 - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
4.295 - : NULL)
4.296 -
4.297 -/* Same as previous macro, but useful when we know that the buffer stack is not
4.298 - * NULL or when we need an lvalue. For internal use only.
4.299 - */
4.300 -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
4.301 -
4.302 -/* yy_hold_char holds the character lost when zconftext is formed. */
4.303 -static char yy_hold_char;
4.304 -static int yy_n_chars; /* number of characters read into yy_ch_buf */
4.305 -int zconfleng;
4.306 -
4.307 -/* Points to current character in buffer. */
4.308 -static char *yy_c_buf_p = (char *) 0;
4.309 -static int yy_init = 0; /* whether we need to initialize */
4.310 -static int yy_start = 0; /* start state number */
4.311 -
4.312 -/* Flag which is used to allow zconfwrap()'s to do buffer switches
4.313 - * instead of setting up a fresh zconfin. A bit of a hack ...
4.314 - */
4.315 -static int yy_did_buffer_switch_on_eof;
4.316 -
4.317 -void zconfrestart (FILE *input_file );
4.318 -void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
4.319 -YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
4.320 -void zconf_delete_buffer (YY_BUFFER_STATE b );
4.321 -void zconf_flush_buffer (YY_BUFFER_STATE b );
4.322 -void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
4.323 -void zconfpop_buffer_state (void );
4.324 -
4.325 -static void zconfensure_buffer_stack (void );
4.326 -static void zconf_load_buffer_state (void );
4.327 -static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
4.328 -
4.329 -#define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
4.330 -
4.331 -YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
4.332 -YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
4.333 -YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
4.334 -
4.335 -void *zconfalloc (yy_size_t );
4.336 -void *zconfrealloc (void *,yy_size_t );
4.337 -void zconffree (void * );
4.338 -
4.339 -#define yy_new_buffer zconf_create_buffer
4.340 -
4.341 -#define yy_set_interactive(is_interactive) \
4.342 - { \
4.343 - if ( ! YY_CURRENT_BUFFER ){ \
4.344 - zconfensure_buffer_stack (); \
4.345 - YY_CURRENT_BUFFER_LVALUE = \
4.346 - zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
4.347 - } \
4.348 - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
4.349 - }
4.350 -
4.351 -#define yy_set_bol(at_bol) \
4.352 - { \
4.353 - if ( ! YY_CURRENT_BUFFER ){\
4.354 - zconfensure_buffer_stack (); \
4.355 - YY_CURRENT_BUFFER_LVALUE = \
4.356 - zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
4.357 - } \
4.358 - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
4.359 - }
4.360 -
4.361 -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
4.362 -
4.363 -/* Begin user sect3 */
4.364 -
4.365 -#define zconfwrap(n) 1
4.366 -#define YY_SKIP_YYWRAP
4.367 -
4.368 -typedef unsigned char YY_CHAR;
4.369 -
4.370 -FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
4.371 -
4.372 -typedef int yy_state_type;
4.373 -
4.374 -extern int zconflineno;
4.375 -
4.376 -int zconflineno = 1;
4.377 -
4.378 -extern char *zconftext;
4.379 -#define yytext_ptr zconftext
4.380 -static yyconst flex_int16_t yy_nxt[][17] =
4.381 - {
4.382 - {
4.383 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4.384 - 0, 0, 0, 0, 0, 0, 0
4.385 - },
4.386 -
4.387 - {
4.388 - 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
4.389 - 12, 12, 12, 12, 12, 12, 12
4.390 - },
4.391 -
4.392 - {
4.393 - 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
4.394 - 12, 12, 12, 12, 12, 12, 12
4.395 - },
4.396 -
4.397 - {
4.398 - 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
4.399 - 16, 16, 16, 18, 16, 16, 16
4.400 - },
4.401 -
4.402 - {
4.403 - 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
4.404 - 16, 16, 16, 18, 16, 16, 16
4.405 -
4.406 - },
4.407 -
4.408 - {
4.409 - 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
4.410 - 19, 19, 19, 19, 19, 19, 19
4.411 - },
4.412 -
4.413 - {
4.414 - 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
4.415 - 19, 19, 19, 19, 19, 19, 19
4.416 - },
4.417 -
4.418 - {
4.419 - 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
4.420 - 22, 22, 22, 22, 22, 25, 22
4.421 - },
4.422 -
4.423 - {
4.424 - 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
4.425 - 22, 22, 22, 22, 22, 25, 22
4.426 - },
4.427 -
4.428 - {
4.429 - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
4.430 - 33, 34, 35, 35, 36, 37, 38
4.431 -
4.432 - },
4.433 -
4.434 - {
4.435 - 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
4.436 - 33, 34, 35, 35, 36, 37, 38
4.437 - },
4.438 -
4.439 - {
4.440 - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
4.441 - -11, -11, -11, -11, -11, -11, -11
4.442 - },
4.443 -
4.444 - {
4.445 - 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
4.446 - -12, -12, -12, -12, -12, -12, -12
4.447 - },
4.448 -
4.449 - {
4.450 - 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
4.451 - -13, -13, -13, -13, -13, -13, -13
4.452 - },
4.453 -
4.454 - {
4.455 - 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
4.456 - -14, -14, -14, -14, -14, -14, -14
4.457 -
4.458 - },
4.459 -
4.460 - {
4.461 - 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
4.462 - 42, 42, 42, 42, 42, 42, 42
4.463 - },
4.464 -
4.465 - {
4.466 - 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
4.467 - -16, -16, -16, -16, -16, -16, -16
4.468 - },
4.469 -
4.470 - {
4.471 - 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
4.472 - -17, -17, -17, -17, -17, -17, -17
4.473 - },
4.474 -
4.475 - {
4.476 - 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
4.477 - -18, -18, -18, 44, -18, -18, -18
4.478 - },
4.479 -
4.480 - {
4.481 - 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
4.482 - 45, 45, 45, 45, 45, 45, 45
4.483 -
4.484 - },
4.485 -
4.486 - {
4.487 - 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
4.488 - -20, -20, -20, -20, -20, -20, -20
4.489 - },
4.490 -
4.491 - {
4.492 - 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
4.493 - 48, 48, 48, 48, 48, 48, 48
4.494 - },
4.495 -
4.496 - {
4.497 - 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
4.498 - 49, 49, 49, 49, 49, -22, 49
4.499 - },
4.500 -
4.501 - {
4.502 - 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
4.503 - -23, -23, -23, -23, -23, -23, -23
4.504 - },
4.505 -
4.506 - {
4.507 - 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
4.508 - -24, -24, -24, -24, -24, -24, -24
4.509 -
4.510 - },
4.511 -
4.512 - {
4.513 - 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
4.514 - 51, 51, 51, 51, 51, 51, 51
4.515 - },
4.516 -
4.517 - {
4.518 - 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
4.519 - -26, -26, -26, -26, -26, -26, -26
4.520 - },
4.521 -
4.522 - {
4.523 - 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
4.524 - -27, -27, -27, -27, -27, -27, -27
4.525 - },
4.526 -
4.527 - {
4.528 - 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
4.529 - -28, -28, -28, -28, 53, -28, -28
4.530 - },
4.531 -
4.532 - {
4.533 - 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
4.534 - -29, -29, -29, -29, -29, -29, -29
4.535 -
4.536 - },
4.537 -
4.538 - {
4.539 - 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
4.540 - 54, 54, 54, 54, 54, 54, 54
4.541 - },
4.542 -
4.543 - {
4.544 - 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
4.545 - -31, -31, -31, -31, -31, -31, -31
4.546 - },
4.547 -
4.548 - {
4.549 - 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
4.550 - -32, -32, -32, -32, -32, -32, -32
4.551 - },
4.552 -
4.553 - {
4.554 - 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
4.555 - -33, -33, -33, -33, -33, -33, -33
4.556 - },
4.557 -
4.558 - {
4.559 - 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
4.560 - -34, 56, 57, 57, -34, -34, -34
4.561 -
4.562 - },
4.563 -
4.564 - {
4.565 - 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
4.566 - -35, 57, 57, 57, -35, -35, -35
4.567 - },
4.568 -
4.569 - {
4.570 - 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
4.571 - -36, -36, -36, -36, -36, -36, -36
4.572 - },
4.573 -
4.574 - {
4.575 - 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
4.576 - -37, -37, -37, -37, -37, -37, -37
4.577 - },
4.578 -
4.579 - {
4.580 - 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
4.581 - -38, -38, -38, -38, -38, -38, 59
4.582 - },
4.583 -
4.584 - {
4.585 - 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
4.586 - -39, -39, -39, -39, -39, -39, -39
4.587 -
4.588 - },
4.589 -
4.590 - {
4.591 - 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
4.592 - -40, -40, -40, -40, -40, -40, -40
4.593 - },
4.594 -
4.595 - {
4.596 - 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
4.597 - 42, 42, 42, 42, 42, 42, 42
4.598 - },
4.599 -
4.600 - {
4.601 - 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
4.602 - 42, 42, 42, 42, 42, 42, 42
4.603 - },
4.604 -
4.605 - {
4.606 - 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
4.607 - -43, -43, -43, -43, -43, -43, -43
4.608 - },
4.609 -
4.610 - {
4.611 - 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
4.612 - -44, -44, -44, 44, -44, -44, -44
4.613 -
4.614 - },
4.615 -
4.616 - {
4.617 - 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
4.618 - 45, 45, 45, 45, 45, 45, 45
4.619 - },
4.620 -
4.621 - {
4.622 - 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
4.623 - -46, -46, -46, -46, -46, -46, -46
4.624 - },
4.625 -
4.626 - {
4.627 - 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
4.628 - 48, 48, 48, 48, 48, 48, 48
4.629 - },
4.630 -
4.631 - {
4.632 - 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
4.633 - -48, -48, -48, -48, -48, -48, -48
4.634 - },
4.635 -
4.636 - {
4.637 - 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
4.638 - 49, 49, 49, 49, 49, -49, 49
4.639 -
4.640 - },
4.641 -
4.642 - {
4.643 - 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
4.644 - -50, -50, -50, -50, -50, -50, -50
4.645 - },
4.646 -
4.647 - {
4.648 - 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
4.649 - -51, -51, -51, -51, -51, -51, -51
4.650 - },
4.651 -
4.652 - {
4.653 - 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
4.654 - -52, -52, -52, -52, -52, -52, -52
4.655 - },
4.656 -
4.657 - {
4.658 - 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
4.659 - -53, -53, -53, -53, -53, -53, -53
4.660 - },
4.661 -
4.662 - {
4.663 - 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
4.664 - 54, 54, 54, 54, 54, 54, 54
4.665 -
4.666 - },
4.667 -
4.668 - {
4.669 - 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
4.670 - -55, -55, -55, -55, -55, -55, -55
4.671 - },
4.672 -
4.673 - {
4.674 - 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
4.675 - -56, 60, 57, 57, -56, -56, -56
4.676 - },
4.677 -
4.678 - {
4.679 - 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
4.680 - -57, 57, 57, 57, -57, -57, -57
4.681 - },
4.682 -
4.683 - {
4.684 - 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
4.685 - -58, -58, -58, -58, -58, -58, -58
4.686 - },
4.687 -
4.688 - {
4.689 - 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
4.690 - -59, -59, -59, -59, -59, -59, -59
4.691 -
4.692 - },
4.693 -
4.694 - {
4.695 - 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
4.696 - -60, 57, 57, 57, -60, -60, -60
4.697 - },
4.698 -
4.699 - } ;
4.700 -
4.701 -static yy_state_type yy_get_previous_state (void );
4.702 -static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
4.703 -static int yy_get_next_buffer (void );
4.704 -static void yy_fatal_error (yyconst char msg[] );
4.705 -
4.706 -/* Done after the current pattern has been matched and before the
4.707 - * corresponding action - sets up zconftext.
4.708 - */
4.709 -#define YY_DO_BEFORE_ACTION \
4.710 - (yytext_ptr) = yy_bp; \
4.711 - zconfleng = (size_t) (yy_cp - yy_bp); \
4.712 - (yy_hold_char) = *yy_cp; \
4.713 - *yy_cp = '\0'; \
4.714 - (yy_c_buf_p) = yy_cp;
4.715 -
4.716 -#define YY_NUM_RULES 33
4.717 -#define YY_END_OF_BUFFER 34
4.718 -/* This struct is not used in this scanner,
4.719 - but its presence is necessary. */
4.720 -struct yy_trans_info
4.721 - {
4.722 - flex_int32_t yy_verify;
4.723 - flex_int32_t yy_nxt;
4.724 - };
4.725 -static yyconst flex_int16_t yy_accept[61] =
4.726 - { 0,
4.727 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4.728 - 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
4.729 - 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
4.730 - 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
4.731 - 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
4.732 - 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
4.733 - } ;
4.734 -
4.735 -static yyconst flex_int32_t yy_ec[256] =
4.736 - { 0,
4.737 - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
4.738 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.739 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.740 - 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
4.741 - 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
4.742 - 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
4.743 - 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
4.744 - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
4.745 - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
4.746 - 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
4.747 -
4.748 - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
4.749 - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
4.750 - 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
4.751 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.752 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.753 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.754 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.755 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.756 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.757 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.758 -
4.759 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.760 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.761 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.762 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.763 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4.764 - 1, 1, 1, 1, 1
4.765 - } ;
4.766 -
4.767 -extern int zconf_flex_debug;
4.768 -int zconf_flex_debug = 0;
4.769 -
4.770 -/* The intent behind this definition is that it'll catch
4.771 - * any uses of REJECT which flex missed.
4.772 - */
4.773 -#define REJECT reject_used_but_not_detected
4.774 -#define yymore() yymore_used_but_not_detected
4.775 -#define YY_MORE_ADJ 0
4.776 -#define YY_RESTORE_YY_MORE_OFFSET
4.777 -char *zconftext;
4.778 -#define YY_NO_INPUT 1
4.779 -
4.780 -/*
4.781 - * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4.782 - * Released under the terms of the GNU GPL v2.0.
4.783 - */
4.784 -
4.785 -#include <limits.h>
4.786 -#include <stdio.h>
4.787 -#include <stdlib.h>
4.788 -#include <string.h>
4.789 -#include <unistd.h>
4.790 -
4.791 -#define LKC_DIRECT_LINK
4.792 -#include "lkc.h"
4.793 -
4.794 -#define START_STRSIZE 16
4.795 -
4.796 -static struct {
4.797 - struct file *file;
4.798 - int lineno;
4.799 -} current_pos;
4.800 -
4.801 -static char *text;
4.802 -static int text_size, text_asize;
4.803 -
4.804 -struct buffer {
4.805 - struct buffer *parent;
4.806 - YY_BUFFER_STATE state;
4.807 -};
4.808 -
4.809 -struct buffer *current_buf;
4.810 -
4.811 -static int last_ts, first_ts;
4.812 -
4.813 -static void zconf_endhelp(void);
4.814 -static void zconf_endfile(void);
4.815 -
4.816 -static void new_string(void)
4.817 -{
4.818 - text = malloc(START_STRSIZE);
4.819 - text_asize = START_STRSIZE;
4.820 - text_size = 0;
4.821 - *text = 0;
4.822 -}
4.823 -
4.824 -static void append_string(const char *str, int size)
4.825 -{
4.826 - int new_size = text_size + size + 1;
4.827 - if (new_size > text_asize) {
4.828 - new_size += START_STRSIZE - 1;
4.829 - new_size &= -START_STRSIZE;
4.830 - text = realloc(text, new_size);
4.831 - text_asize = new_size;
4.832 - }
4.833 - memcpy(text + text_size, str, size);
4.834 - text_size += size;
4.835 - text[text_size] = 0;
4.836 -}
4.837 -
4.838 -static void alloc_string(const char *str, int size)
4.839 -{
4.840 - text = malloc(size + 1);
4.841 - memcpy(text, str, size);
4.842 - text[size] = 0;
4.843 -}
4.844 -
4.845 -#define INITIAL 0
4.846 -#define COMMAND 1
4.847 -#define HELP 2
4.848 -#define STRING 3
4.849 -#define PARAM 4
4.850 -
4.851 -#ifndef YY_NO_UNISTD_H
4.852 -/* Special case for "unistd.h", since it is non-ANSI. We include it way
4.853 - * down here because we want the user's section 1 to have been scanned first.
4.854 - * The user has a chance to override it with an option.
4.855 - */
4.856 -#include <unistd.h>
4.857 -#endif
4.858 -
4.859 -#ifndef YY_EXTRA_TYPE
4.860 -#define YY_EXTRA_TYPE void *
4.861 -#endif
4.862 -
4.863 -static int yy_init_globals (void );
4.864 -
4.865 -/* Accessor methods to globals.
4.866 - These are made visible to non-reentrant scanners for convenience. */
4.867 -
4.868 -int zconflex_destroy (void );
4.869 -
4.870 -int zconfget_debug (void );
4.871 -
4.872 -void zconfset_debug (int debug_flag );
4.873 -
4.874 -YY_EXTRA_TYPE zconfget_extra (void );
4.875 -
4.876 -void zconfset_extra (YY_EXTRA_TYPE user_defined );
4.877 -
4.878 -FILE *zconfget_in (void );
4.879 -
4.880 -void zconfset_in (FILE * in_str );
4.881 -
4.882 -FILE *zconfget_out (void );
4.883 -
4.884 -void zconfset_out (FILE * out_str );
4.885 -
4.886 -int zconfget_leng (void );
4.887 -
4.888 -char *zconfget_text (void );
4.889 -
4.890 -int zconfget_lineno (void );
4.891 -
4.892 -void zconfset_lineno (int line_number );
4.893 -
4.894 -/* Macros after this point can all be overridden by user definitions in
4.895 - * section 1.
4.896 - */
4.897 -
4.898 -#ifndef YY_SKIP_YYWRAP
4.899 -#ifdef __cplusplus
4.900 -extern "C" int zconfwrap (void );
4.901 -#else
4.902 -extern int zconfwrap (void );
4.903 -#endif
4.904 -#endif
4.905 -
4.906 - static void yyunput (int c,char *buf_ptr );
4.907 -
4.908 -#ifndef yytext_ptr
4.909 -static void yy_flex_strncpy (char *,yyconst char *,int );
4.910 -#endif
4.911 -
4.912 -#ifdef YY_NEED_STRLEN
4.913 -static int yy_flex_strlen (yyconst char * );
4.914 -#endif
4.915 -
4.916 -#ifndef YY_NO_INPUT
4.917 -
4.918 -#ifdef __cplusplus
4.919 -static int yyinput (void );
4.920 -#else
4.921 -static int input (void );
4.922 -#endif
4.923 -
4.924 -#endif
4.925 -
4.926 -/* Amount of stuff to slurp up with each read. */
4.927 -#ifndef YY_READ_BUF_SIZE
4.928 -#ifdef __ia64__
4.929 -/* On IA-64, the buffer size is 16k, not 8k */
4.930 -#define YY_READ_BUF_SIZE 16384
4.931 -#else
4.932 -#define YY_READ_BUF_SIZE 8192
4.933 -#endif /* __ia64__ */
4.934 -#endif
4.935 -
4.936 -/* Copy whatever the last rule matched to the standard output. */
4.937 -#ifndef ECHO
4.938 -/* This used to be an fputs(), but since the string might contain NUL's,
4.939 - * we now use fwrite().
4.940 - */
4.941 -#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0)
4.942 -#endif
4.943 -
4.944 -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
4.945 - * is returned in "result".
4.946 - */
4.947 -#ifndef YY_INPUT
4.948 -#define YY_INPUT(buf,result,max_size) \
4.949 - errno=0; \
4.950 - while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
4.951 - { \
4.952 - if( errno != EINTR) \
4.953 - { \
4.954 - YY_FATAL_ERROR( "input in flex scanner failed" ); \
4.955 - break; \
4.956 - } \
4.957 - errno=0; \
4.958 - clearerr(zconfin); \
4.959 - }\
4.960 -\
4.961 -
4.962 -#endif
4.963 -
4.964 -/* No semi-colon after return; correct usage is to write "yyterminate();" -
4.965 - * we don't want an extra ';' after the "return" because that will cause
4.966 - * some compilers to complain about unreachable statements.
4.967 - */
4.968 -#ifndef yyterminate
4.969 -#define yyterminate() return YY_NULL
4.970 -#endif
4.971 -
4.972 -/* Number of entries by which start-condition stack grows. */
4.973 -#ifndef YY_START_STACK_INCR
4.974 -#define YY_START_STACK_INCR 25
4.975 -#endif
4.976 -
4.977 -/* Report a fatal error. */
4.978 -#ifndef YY_FATAL_ERROR
4.979 -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
4.980 -#endif
4.981 -
4.982 -/* end tables serialization structures and prototypes */
4.983 -
4.984 -/* Default declaration of generated scanner - a define so the user can
4.985 - * easily add parameters.
4.986 - */
4.987 -#ifndef YY_DECL
4.988 -#define YY_DECL_IS_OURS 1
4.989 -
4.990 -extern int zconflex (void);
4.991 -
4.992 -#define YY_DECL int zconflex (void)
4.993 -#endif /* !YY_DECL */
4.994 -
4.995 -/* Code executed at the beginning of each rule, after zconftext and zconfleng
4.996 - * have been set up.
4.997 - */
4.998 -#ifndef YY_USER_ACTION
4.999 -#define YY_USER_ACTION
4.1000 -#endif
4.1001 -
4.1002 -/* Code executed at the end of each rule. */
4.1003 -#ifndef YY_BREAK
4.1004 -#define YY_BREAK break;
4.1005 -#endif
4.1006 -
4.1007 -#define YY_RULE_SETUP \
4.1008 - YY_USER_ACTION
4.1009 -
4.1010 -/** The main scanner function which does all the work.
4.1011 - */
4.1012 -YY_DECL
4.1013 -{
4.1014 - register yy_state_type yy_current_state;
4.1015 - register char *yy_cp, *yy_bp;
4.1016 - register int yy_act;
4.1017 -
4.1018 - int str = 0;
4.1019 - int ts, i;
4.1020 -
4.1021 - if ( !(yy_init) )
4.1022 - {
4.1023 - (yy_init) = 1;
4.1024 -
4.1025 -#ifdef YY_USER_INIT
4.1026 - YY_USER_INIT;
4.1027 -#endif
4.1028 -
4.1029 - if ( ! (yy_start) )
4.1030 - (yy_start) = 1; /* first start state */
4.1031 -
4.1032 - if ( ! zconfin )
4.1033 - zconfin = stdin;
4.1034 -
4.1035 - if ( ! zconfout )
4.1036 - zconfout = stdout;
4.1037 -
4.1038 - if ( ! YY_CURRENT_BUFFER ) {
4.1039 - zconfensure_buffer_stack ();
4.1040 - YY_CURRENT_BUFFER_LVALUE =
4.1041 - zconf_create_buffer(zconfin,YY_BUF_SIZE );
4.1042 - }
4.1043 -
4.1044 - zconf_load_buffer_state( );
4.1045 - }
4.1046 -
4.1047 - while ( 1 ) /* loops until end-of-file is reached */
4.1048 - {
4.1049 - yy_cp = (yy_c_buf_p);
4.1050 -
4.1051 - /* Support of zconftext. */
4.1052 - *yy_cp = (yy_hold_char);
4.1053 -
4.1054 - /* yy_bp points to the position in yy_ch_buf of the start of
4.1055 - * the current run.
4.1056 - */
4.1057 - yy_bp = yy_cp;
4.1058 -
4.1059 - yy_current_state = (yy_start);
4.1060 -yy_match:
4.1061 - while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
4.1062 - ++yy_cp;
4.1063 -
4.1064 - yy_current_state = -yy_current_state;
4.1065 -
4.1066 -yy_find_action:
4.1067 - yy_act = yy_accept[yy_current_state];
4.1068 -
4.1069 - YY_DO_BEFORE_ACTION;
4.1070 -
4.1071 -do_action: /* This label is used only to access EOF actions. */
4.1072 -
4.1073 - switch ( yy_act )
4.1074 - { /* beginning of action switch */
4.1075 -case 1:
4.1076 -/* rule 1 can match eol */
4.1077 -case 2:
4.1078 -/* rule 2 can match eol */
4.1079 -YY_RULE_SETUP
4.1080 -{
4.1081 - current_file->lineno++;
4.1082 - return T_EOL;
4.1083 -}
4.1084 - YY_BREAK
4.1085 -case 3:
4.1086 -YY_RULE_SETUP
4.1087 -
4.1088 - YY_BREAK
4.1089 -case 4:
4.1090 -YY_RULE_SETUP
4.1091 -{
4.1092 - BEGIN(COMMAND);
4.1093 -}
4.1094 - YY_BREAK
4.1095 -case 5:
4.1096 -YY_RULE_SETUP
4.1097 -{
4.1098 - unput(zconftext[0]);
4.1099 - BEGIN(COMMAND);
4.1100 -}
4.1101 - YY_BREAK
4.1102 -
4.1103 -case 6:
4.1104 -YY_RULE_SETUP
4.1105 -{
4.1106 - struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
4.1107 - BEGIN(PARAM);
4.1108 - current_pos.file = current_file;
4.1109 - current_pos.lineno = current_file->lineno;
4.1110 - if (id && id->flags & TF_COMMAND) {
4.1111 - zconflval.id = id;
4.1112 - return id->token;
4.1113 - }
4.1114 - alloc_string(zconftext, zconfleng);
4.1115 - zconflval.string = text;
4.1116 - return T_WORD;
4.1117 - }
4.1118 - YY_BREAK
4.1119 -case 7:
4.1120 -YY_RULE_SETUP
4.1121 -
4.1122 - YY_BREAK
4.1123 -case 8:
4.1124 -/* rule 8 can match eol */
4.1125 -YY_RULE_SETUP
4.1126 -{
4.1127 - BEGIN(INITIAL);
4.1128 - current_file->lineno++;
4.1129 - return T_EOL;
4.1130 - }
4.1131 - YY_BREAK
4.1132 -
4.1133 -case 9:
4.1134 -YY_RULE_SETUP
4.1135 -return T_AND;
4.1136 - YY_BREAK
4.1137 -case 10:
4.1138 -YY_RULE_SETUP
4.1139 -return T_OR;
4.1140 - YY_BREAK
4.1141 -case 11:
4.1142 -YY_RULE_SETUP
4.1143 -return T_OPEN_PAREN;
4.1144 - YY_BREAK
4.1145 -case 12:
4.1146 -YY_RULE_SETUP
4.1147 -return T_CLOSE_PAREN;
4.1148 - YY_BREAK
4.1149 -case 13:
4.1150 -YY_RULE_SETUP
4.1151 -return T_NOT;
4.1152 - YY_BREAK
4.1153 -case 14:
4.1154 -YY_RULE_SETUP
4.1155 -return T_EQUAL;
4.1156 - YY_BREAK
4.1157 -case 15:
4.1158 -YY_RULE_SETUP
4.1159 -return T_UNEQUAL;
4.1160 - YY_BREAK
4.1161 -case 16:
4.1162 -YY_RULE_SETUP
4.1163 -{
4.1164 - str = zconftext[0];
4.1165 - new_string();
4.1166 - BEGIN(STRING);
4.1167 - }
4.1168 - YY_BREAK
4.1169 -case 17:
4.1170 -/* rule 17 can match eol */
4.1171 -YY_RULE_SETUP
4.1172 -BEGIN(INITIAL); current_file->lineno++; return T_EOL;
4.1173 - YY_BREAK
4.1174 -case 18:
4.1175 -YY_RULE_SETUP
4.1176 -/* ignore */
4.1177 - YY_BREAK
4.1178 -case 19:
4.1179 -YY_RULE_SETUP
4.1180 -{
4.1181 - struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
4.1182 - if (id && id->flags & TF_PARAM) {
4.1183 - zconflval.id = id;
4.1184 - return id->token;
4.1185 - }
4.1186 - alloc_string(zconftext, zconfleng);
4.1187 - zconflval.string = text;
4.1188 - return T_WORD;
4.1189 - }
4.1190 - YY_BREAK
4.1191 -case 20:
4.1192 -YY_RULE_SETUP
4.1193 -/* comment */
4.1194 - YY_BREAK
4.1195 -case 21:
4.1196 -/* rule 21 can match eol */
4.1197 -YY_RULE_SETUP
4.1198 -current_file->lineno++;
4.1199 - YY_BREAK
4.1200 -case 22:
4.1201 -YY_RULE_SETUP
4.1202 -
4.1203 - YY_BREAK
4.1204 -case YY_STATE_EOF(PARAM):
4.1205 -{
4.1206 - BEGIN(INITIAL);
4.1207 - }
4.1208 - YY_BREAK
4.1209 -
4.1210 -case 23:
4.1211 -/* rule 23 can match eol */
4.1212 -*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
4.1213 -(yy_c_buf_p) = yy_cp -= 1;
4.1214 -YY_DO_BEFORE_ACTION; /* set up zconftext again */
4.1215 -YY_RULE_SETUP
4.1216 -{
4.1217 - append_string(zconftext, zconfleng);
4.1218 - zconflval.string = text;
4.1219 - return T_WORD_QUOTE;
4.1220 - }
4.1221 - YY_BREAK
4.1222 -case 24:
4.1223 -YY_RULE_SETUP
4.1224 -{
4.1225 - append_string(zconftext, zconfleng);
4.1226 - }
4.1227 - YY_BREAK
4.1228 -case 25:
4.1229 -/* rule 25 can match eol */
4.1230 -*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
4.1231 -(yy_c_buf_p) = yy_cp -= 1;
4.1232 -YY_DO_BEFORE_ACTION; /* set up zconftext again */
4.1233 -YY_RULE_SETUP
4.1234 -{
4.1235 - append_string(zconftext + 1, zconfleng - 1);
4.1236 - zconflval.string = text;
4.1237 - return T_WORD_QUOTE;
4.1238 - }
4.1239 - YY_BREAK
4.1240 -case 26:
4.1241 -YY_RULE_SETUP
4.1242 -{
4.1243 - append_string(zconftext + 1, zconfleng - 1);
4.1244 - }
4.1245 - YY_BREAK
4.1246 -case 27:
4.1247 -YY_RULE_SETUP
4.1248 -{
4.1249 - if (str == zconftext[0]) {
4.1250 - BEGIN(PARAM);
4.1251 - zconflval.string = text;
4.1252 - return T_WORD_QUOTE;
4.1253 - } else
4.1254 - append_string(zconftext, 1);
4.1255 - }
4.1256 - YY_BREAK
4.1257 -case 28:
4.1258 -/* rule 28 can match eol */
4.1259 -YY_RULE_SETUP
4.1260 -{
4.1261 - printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
4.1262 - current_file->lineno++;
4.1263 - BEGIN(INITIAL);
4.1264 - return T_EOL;
4.1265 - }
4.1266 - YY_BREAK
4.1267 -case YY_STATE_EOF(STRING):
4.1268 -{
4.1269 - BEGIN(INITIAL);
4.1270 - }
4.1271 - YY_BREAK
4.1272 -
4.1273 -case 29:
4.1274 -YY_RULE_SETUP
4.1275 -{
4.1276 - ts = 0;
4.1277 - for (i = 0; i < zconfleng; i++) {
4.1278 - if (zconftext[i] == '\t')
4.1279 - ts = (ts & ~7) + 8;
4.1280 - else
4.1281 - ts++;
4.1282 - }
4.1283 - last_ts = ts;
4.1284 - if (first_ts) {
4.1285 - if (ts < first_ts) {
4.1286 - zconf_endhelp();
4.1287 - return T_HELPTEXT;
4.1288 - }
4.1289 - ts -= first_ts;
4.1290 - while (ts > 8) {
4.1291 - append_string(" ", 8);
4.1292 - ts -= 8;
4.1293 - }
4.1294 - append_string(" ", ts);
4.1295 - }
4.1296 - }
4.1297 - YY_BREAK
4.1298 -case 30:
4.1299 -/* rule 30 can match eol */
4.1300 -*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
4.1301 -(yy_c_buf_p) = yy_cp -= 1;
4.1302 -YY_DO_BEFORE_ACTION; /* set up zconftext again */
4.1303 -YY_RULE_SETUP
4.1304 -{
4.1305 - current_file->lineno++;
4.1306 - zconf_endhelp();
4.1307 - return T_HELPTEXT;
4.1308 - }
4.1309 - YY_BREAK
4.1310 -case 31:
4.1311 -/* rule 31 can match eol */
4.1312 -YY_RULE_SETUP
4.1313 -{
4.1314 - current_file->lineno++;
4.1315 - append_string("\n", 1);
4.1316 - }
4.1317 - YY_BREAK
4.1318 -case 32:
4.1319 -YY_RULE_SETUP
4.1320 -{
4.1321 - while (zconfleng) {
4.1322 - if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
4.1323 - break;
4.1324 - zconfleng--;
4.1325 - }
4.1326 - append_string(zconftext, zconfleng);
4.1327 - if (!first_ts)
4.1328 - first_ts = last_ts;
4.1329 - }
4.1330 - YY_BREAK
4.1331 -case YY_STATE_EOF(HELP):
4.1332 -{
4.1333 - zconf_endhelp();
4.1334 - return T_HELPTEXT;
4.1335 - }
4.1336 - YY_BREAK
4.1337 -
4.1338 -case YY_STATE_EOF(INITIAL):
4.1339 -case YY_STATE_EOF(COMMAND):
4.1340 -{
4.1341 - if (current_file) {
4.1342 - zconf_endfile();
4.1343 - return T_EOL;
4.1344 - }
4.1345 - fclose(zconfin);
4.1346 - yyterminate();
4.1347 -}
4.1348 - YY_BREAK
4.1349 -case 33:
4.1350 -YY_RULE_SETUP
4.1351 -YY_FATAL_ERROR( "flex scanner jammed" );
4.1352 - YY_BREAK
4.1353 -
4.1354 - case YY_END_OF_BUFFER:
4.1355 - {
4.1356 - /* Amount of text matched not including the EOB char. */
4.1357 - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
4.1358 -
4.1359 - /* Undo the effects of YY_DO_BEFORE_ACTION. */
4.1360 - *yy_cp = (yy_hold_char);
4.1361 - YY_RESTORE_YY_MORE_OFFSET
4.1362 -
4.1363 - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
4.1364 - {
4.1365 - /* We're scanning a new file or input source. It's
4.1366 - * possible that this happened because the user
4.1367 - * just pointed zconfin at a new source and called
4.1368 - * zconflex(). If so, then we have to assure
4.1369 - * consistency between YY_CURRENT_BUFFER and our
4.1370 - * globals. Here is the right place to do so, because
4.1371 - * this is the first action (other than possibly a
4.1372 - * back-up) that will match for the new input source.
4.1373 - */
4.1374 - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
4.1375 - YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
4.1376 - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
4.1377 - }
4.1378 -
4.1379 - /* Note that here we test for yy_c_buf_p "<=" to the position
4.1380 - * of the first EOB in the buffer, since yy_c_buf_p will
4.1381 - * already have been incremented past the NUL character
4.1382 - * (since all states make transitions on EOB to the
4.1383 - * end-of-buffer state). Contrast this with the test
4.1384 - * in input().
4.1385 - */
4.1386 - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
4.1387 - { /* This was really a NUL. */
4.1388 - yy_state_type yy_next_state;
4.1389 -
4.1390 - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
4.1391 -
4.1392 - yy_current_state = yy_get_previous_state( );
4.1393 -
4.1394 - /* Okay, we're now positioned to make the NUL
4.1395 - * transition. We couldn't have
4.1396 - * yy_get_previous_state() go ahead and do it
4.1397 - * for us because it doesn't know how to deal
4.1398 - * with the possibility of jamming (and we don't
4.1399 - * want to build jamming into it because then it
4.1400 - * will run more slowly).
4.1401 - */
4.1402 -
4.1403 - yy_next_state = yy_try_NUL_trans( yy_current_state );
4.1404 -
4.1405 - yy_bp = (yytext_ptr) + YY_MORE_ADJ;
4.1406 -
4.1407 - if ( yy_next_state )
4.1408 - {
4.1409 - /* Consume the NUL. */
4.1410 - yy_cp = ++(yy_c_buf_p);
4.1411 - yy_current_state = yy_next_state;
4.1412 - goto yy_match;
4.1413 - }
4.1414 -
4.1415 - else
4.1416 - {
4.1417 - yy_cp = (yy_c_buf_p);
4.1418 - goto yy_find_action;
4.1419 - }
4.1420 - }
4.1421 -
4.1422 - else switch ( yy_get_next_buffer( ) )
4.1423 - {
4.1424 - case EOB_ACT_END_OF_FILE:
4.1425 - {
4.1426 - (yy_did_buffer_switch_on_eof) = 0;
4.1427 -
4.1428 - if ( zconfwrap( ) )
4.1429 - {
4.1430 - /* Note: because we've taken care in
4.1431 - * yy_get_next_buffer() to have set up
4.1432 - * zconftext, we can now set up
4.1433 - * yy_c_buf_p so that if some total
4.1434 - * hoser (like flex itself) wants to
4.1435 - * call the scanner after we return the
4.1436 - * YY_NULL, it'll still work - another
4.1437 - * YY_NULL will get returned.
4.1438 - */
4.1439 - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
4.1440 -
4.1441 - yy_act = YY_STATE_EOF(YY_START);
4.1442 - goto do_action;
4.1443 - }
4.1444 -
4.1445 - else
4.1446 - {
4.1447 - if ( ! (yy_did_buffer_switch_on_eof) )
4.1448 - YY_NEW_FILE;
4.1449 - }
4.1450 - break;
4.1451 - }
4.1452 -
4.1453 - case EOB_ACT_CONTINUE_SCAN:
4.1454 - (yy_c_buf_p) =
4.1455 - (yytext_ptr) + yy_amount_of_matched_text;
4.1456 -
4.1457 - yy_current_state = yy_get_previous_state( );
4.1458 -
4.1459 - yy_cp = (yy_c_buf_p);
4.1460 - yy_bp = (yytext_ptr) + YY_MORE_ADJ;
4.1461 - goto yy_match;
4.1462 -
4.1463 - case EOB_ACT_LAST_MATCH:
4.1464 - (yy_c_buf_p) =
4.1465 - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
4.1466 -
4.1467 - yy_current_state = yy_get_previous_state( );
4.1468 -
4.1469 - yy_cp = (yy_c_buf_p);
4.1470 - yy_bp = (yytext_ptr) + YY_MORE_ADJ;
4.1471 - goto yy_find_action;
4.1472 - }
4.1473 - break;
4.1474 - }
4.1475 -
4.1476 - default:
4.1477 - YY_FATAL_ERROR(
4.1478 - "fatal flex scanner internal error--no action found" );
4.1479 - } /* end of action switch */
4.1480 - } /* end of scanning one token */
4.1481 -} /* end of zconflex */
4.1482 -
4.1483 -/* yy_get_next_buffer - try to read in a new buffer
4.1484 - *
4.1485 - * Returns a code representing an action:
4.1486 - * EOB_ACT_LAST_MATCH -
4.1487 - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
4.1488 - * EOB_ACT_END_OF_FILE - end of file
4.1489 - */
4.1490 -static int yy_get_next_buffer (void)
4.1491 -{
4.1492 - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
4.1493 - register char *source = (yytext_ptr);
4.1494 - register int number_to_move, i;
4.1495 - int ret_val;
4.1496 -
4.1497 - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
4.1498 - YY_FATAL_ERROR(
4.1499 - "fatal flex scanner internal error--end of buffer missed" );
4.1500 -
4.1501 - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
4.1502 - { /* Don't try to fill the buffer, so this is an EOF. */
4.1503 - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
4.1504 - {
4.1505 - /* We matched a single character, the EOB, so
4.1506 - * treat this as a final EOF.
4.1507 - */
4.1508 - return EOB_ACT_END_OF_FILE;
4.1509 - }
4.1510 -
4.1511 - else
4.1512 - {
4.1513 - /* We matched some text prior to the EOB, first
4.1514 - * process it.
4.1515 - */
4.1516 - return EOB_ACT_LAST_MATCH;
4.1517 - }
4.1518 - }
4.1519 -
4.1520 - /* Try to read more data. */
4.1521 -
4.1522 - /* First move last chars to start of buffer. */
4.1523 - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
4.1524 -
4.1525 - for ( i = 0; i < number_to_move; ++i )
4.1526 - *(dest++) = *(source++);
4.1527 -
4.1528 - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
4.1529 - /* don't do the read, it's not guaranteed to return an EOF,
4.1530 - * just force an EOF
4.1531 - */
4.1532 - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
4.1533 -
4.1534 - else
4.1535 - {
4.1536 - int num_to_read =
4.1537 - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
4.1538 -
4.1539 - while ( num_to_read <= 0 )
4.1540 - { /* Not enough room in the buffer - grow it. */
4.1541 -
4.1542 - /* just a shorter name for the current buffer */
4.1543 - YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
4.1544 -
4.1545 - int yy_c_buf_p_offset =
4.1546 - (int) ((yy_c_buf_p) - b->yy_ch_buf);
4.1547 -
4.1548 - if ( b->yy_is_our_buffer )
4.1549 - {
4.1550 - int new_size = b->yy_buf_size * 2;
4.1551 -
4.1552 - if ( new_size <= 0 )
4.1553 - b->yy_buf_size += b->yy_buf_size / 8;
4.1554 - else
4.1555 - b->yy_buf_size *= 2;
4.1556 -
4.1557 - b->yy_ch_buf = (char *)
4.1558 - /* Include room in for 2 EOB chars. */
4.1559 - zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
4.1560 - }
4.1561 - else
4.1562 - /* Can't grow it, we don't own it. */
4.1563 - b->yy_ch_buf = 0;
4.1564 -
4.1565 - if ( ! b->yy_ch_buf )
4.1566 - YY_FATAL_ERROR(
4.1567 - "fatal error - scanner input buffer overflow" );
4.1568 -
4.1569 - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
4.1570 -
4.1571 - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
4.1572 - number_to_move - 1;
4.1573 -
4.1574 - }
4.1575 -
4.1576 - if ( num_to_read > YY_READ_BUF_SIZE )
4.1577 - num_to_read = YY_READ_BUF_SIZE;
4.1578 -
4.1579 - /* Read in more data. */
4.1580 - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
4.1581 - (yy_n_chars), (size_t) num_to_read );
4.1582 -
4.1583 - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
4.1584 - }
4.1585 -
4.1586 - if ( (yy_n_chars) == 0 )
4.1587 - {
4.1588 - if ( number_to_move == YY_MORE_ADJ )
4.1589 - {
4.1590 - ret_val = EOB_ACT_END_OF_FILE;
4.1591 - zconfrestart(zconfin );
4.1592 - }
4.1593 -
4.1594 - else
4.1595 - {
4.1596 - ret_val = EOB_ACT_LAST_MATCH;
4.1597 - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
4.1598 - YY_BUFFER_EOF_PENDING;
4.1599 - }
4.1600 - }
4.1601 -
4.1602 - else
4.1603 - ret_val = EOB_ACT_CONTINUE_SCAN;
4.1604 -
4.1605 - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
4.1606 - /* Extend the array by 50%, plus the number we really need. */
4.1607 - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
4.1608 - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
4.1609 - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
4.1610 - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
4.1611 - }
4.1612 -
4.1613 - (yy_n_chars) += number_to_move;
4.1614 - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
4.1615 - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
4.1616 -
4.1617 - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
4.1618 -
4.1619 - return ret_val;
4.1620 -}
4.1621 -
4.1622 -/* yy_get_previous_state - get the state just before the EOB char was reached */
4.1623 -
4.1624 - static yy_state_type yy_get_previous_state (void)
4.1625 -{
4.1626 - register yy_state_type yy_current_state;
4.1627 - register char *yy_cp;
4.1628 -
4.1629 - yy_current_state = (yy_start);
4.1630 -
4.1631 - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
4.1632 - {
4.1633 - yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
4.1634 - }
4.1635 -
4.1636 - return yy_current_state;
4.1637 -}
4.1638 -
4.1639 -/* yy_try_NUL_trans - try to make a transition on the NUL character
4.1640 - *
4.1641 - * synopsis
4.1642 - * next_state = yy_try_NUL_trans( current_state );
4.1643 - */
4.1644 - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
4.1645 -{
4.1646 - register int yy_is_jam;
4.1647 -
4.1648 - yy_current_state = yy_nxt[yy_current_state][1];
4.1649 - yy_is_jam = (yy_current_state <= 0);
4.1650 -
4.1651 - return yy_is_jam ? 0 : yy_current_state;
4.1652 -}
4.1653 -
4.1654 - static void yyunput (int c, register char * yy_bp )
4.1655 -{
4.1656 - register char *yy_cp;
4.1657 -
4.1658 - yy_cp = (yy_c_buf_p);
4.1659 -
4.1660 - /* undo effects of setting up zconftext */
4.1661 - *yy_cp = (yy_hold_char);
4.1662 -
4.1663 - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
4.1664 - { /* need to shift things up to make room */
4.1665 - /* +2 for EOB chars. */
4.1666 - register int number_to_move = (yy_n_chars) + 2;
4.1667 - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
4.1668 - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
4.1669 - register char *source =
4.1670 - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
4.1671 -
4.1672 - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
4.1673 - *--dest = *--source;
4.1674 -
4.1675 - yy_cp += (int) (dest - source);
4.1676 - yy_bp += (int) (dest - source);
4.1677 - YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
4.1678 - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
4.1679 -
4.1680 - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
4.1681 - YY_FATAL_ERROR( "flex scanner push-back overflow" );
4.1682 - }
4.1683 -
4.1684 - *--yy_cp = (char) c;
4.1685 -
4.1686 - (yytext_ptr) = yy_bp;
4.1687 - (yy_hold_char) = *yy_cp;
4.1688 - (yy_c_buf_p) = yy_cp;
4.1689 -}
4.1690 -
4.1691 -#ifndef YY_NO_INPUT
4.1692 -#ifdef __cplusplus
4.1693 - static int yyinput (void)
4.1694 -#else
4.1695 - static int input (void)
4.1696 -#endif
4.1697 -
4.1698 -{
4.1699 - int c;
4.1700 -
4.1701 - *(yy_c_buf_p) = (yy_hold_char);
4.1702 -
4.1703 - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
4.1704 - {
4.1705 - /* yy_c_buf_p now points to the character we want to return.
4.1706 - * If this occurs *before* the EOB characters, then it's a
4.1707 - * valid NUL; if not, then we've hit the end of the buffer.
4.1708 - */
4.1709 - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
4.1710 - /* This was really a NUL. */
4.1711 - *(yy_c_buf_p) = '\0';
4.1712 -
4.1713 - else
4.1714 - { /* need more input */
4.1715 - int offset = (yy_c_buf_p) - (yytext_ptr);
4.1716 - ++(yy_c_buf_p);
4.1717 -
4.1718 - switch ( yy_get_next_buffer( ) )
4.1719 - {
4.1720 - case EOB_ACT_LAST_MATCH:
4.1721 - /* This happens because yy_g_n_b()
4.1722 - * sees that we've accumulated a
4.1723 - * token and flags that we need to
4.1724 - * try matching the token before
4.1725 - * proceeding. But for input(),
4.1726 - * there's no matching to consider.
4.1727 - * So convert the EOB_ACT_LAST_MATCH
4.1728 - * to EOB_ACT_END_OF_FILE.
4.1729 - */
4.1730 -
4.1731 - /* Reset buffer status. */
4.1732 - zconfrestart(zconfin );
4.1733 -
4.1734 - /*FALLTHROUGH*/
4.1735 -
4.1736 - case EOB_ACT_END_OF_FILE:
4.1737 - {
4.1738 - if ( zconfwrap( ) )
4.1739 - return EOF;
4.1740 -
4.1741 - if ( ! (yy_did_buffer_switch_on_eof) )
4.1742 - YY_NEW_FILE;
4.1743 -#ifdef __cplusplus
4.1744 - return yyinput();
4.1745 -#else
4.1746 - return input();
4.1747 -#endif
4.1748 - }
4.1749 -
4.1750 - case EOB_ACT_CONTINUE_SCAN:
4.1751 - (yy_c_buf_p) = (yytext_ptr) + offset;
4.1752 - break;
4.1753 - }
4.1754 - }
4.1755 - }
4.1756 -
4.1757 - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
4.1758 - *(yy_c_buf_p) = '\0'; /* preserve zconftext */
4.1759 - (yy_hold_char) = *++(yy_c_buf_p);
4.1760 -
4.1761 - return c;
4.1762 -}
4.1763 -#endif /* ifndef YY_NO_INPUT */
4.1764 -
4.1765 -/** Immediately switch to a different input stream.
4.1766 - * @param input_file A readable stream.
4.1767 - *
4.1768 - * @note This function does not reset the start condition to @c INITIAL .
4.1769 - */
4.1770 - void zconfrestart (FILE * input_file )
4.1771 -{
4.1772 -
4.1773 - if ( ! YY_CURRENT_BUFFER ){
4.1774 - zconfensure_buffer_stack ();
4.1775 - YY_CURRENT_BUFFER_LVALUE =
4.1776 - zconf_create_buffer(zconfin,YY_BUF_SIZE );
4.1777 - }
4.1778 -
4.1779 - zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
4.1780 - zconf_load_buffer_state( );
4.1781 -}
4.1782 -
4.1783 -/** Switch to a different input buffer.
4.1784 - * @param new_buffer The new input buffer.
4.1785 - *
4.1786 - */
4.1787 - void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
4.1788 -{
4.1789 -
4.1790 - /* TODO. We should be able to replace this entire function body
4.1791 - * with
4.1792 - * zconfpop_buffer_state();
4.1793 - * zconfpush_buffer_state(new_buffer);
4.1794 - */
4.1795 - zconfensure_buffer_stack ();
4.1796 - if ( YY_CURRENT_BUFFER == new_buffer )
4.1797 - return;
4.1798 -
4.1799 - if ( YY_CURRENT_BUFFER )
4.1800 - {
4.1801 - /* Flush out information for old buffer. */
4.1802 - *(yy_c_buf_p) = (yy_hold_char);
4.1803 - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
4.1804 - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
4.1805 - }
4.1806 -
4.1807 - YY_CURRENT_BUFFER_LVALUE = new_buffer;
4.1808 - zconf_load_buffer_state( );
4.1809 -
4.1810 - /* We don't actually know whether we did this switch during
4.1811 - * EOF (zconfwrap()) processing, but the only time this flag
4.1812 - * is looked at is after zconfwrap() is called, so it's safe
4.1813 - * to go ahead and always set it.
4.1814 - */
4.1815 - (yy_did_buffer_switch_on_eof) = 1;
4.1816 -}
4.1817 -
4.1818 -static void zconf_load_buffer_state (void)
4.1819 -{
4.1820 - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
4.1821 - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
4.1822 - zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
4.1823 - (yy_hold_char) = *(yy_c_buf_p);
4.1824 -}
4.1825 -
4.1826 -/** Allocate and initialize an input buffer state.
4.1827 - * @param file A readable stream.
4.1828 - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
4.1829 - *
4.1830 - * @return the allocated buffer state.
4.1831 - */
4.1832 - YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
4.1833 -{
4.1834 - YY_BUFFER_STATE b;
4.1835 -
4.1836 - b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
4.1837 - if ( ! b )
4.1838 - YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
4.1839 -
4.1840 - b->yy_buf_size = size;
4.1841 -
4.1842 - /* yy_ch_buf has to be 2 characters longer than the size given because
4.1843 - * we need to put in 2 end-of-buffer characters.
4.1844 - */
4.1845 - b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
4.1846 - if ( ! b->yy_ch_buf )
4.1847 - YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
4.1848 -
4.1849 - b->yy_is_our_buffer = 1;
4.1850 -
4.1851 - zconf_init_buffer(b,file );
4.1852 -
4.1853 - return b;
4.1854 -}
4.1855 -
4.1856 -/** Destroy the buffer.
4.1857 - * @param b a buffer created with zconf_create_buffer()
4.1858 - *
4.1859 - */
4.1860 - void zconf_delete_buffer (YY_BUFFER_STATE b )
4.1861 -{
4.1862 -
4.1863 - if ( ! b )
4.1864 - return;
4.1865 -
4.1866 - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
4.1867 - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
4.1868 -
4.1869 - if ( b->yy_is_our_buffer )
4.1870 - zconffree((void *) b->yy_ch_buf );
4.1871 -
4.1872 - zconffree((void *) b );
4.1873 -}
4.1874 -
4.1875 -/* Initializes or reinitializes a buffer.
4.1876 - * This function is sometimes called more than once on the same buffer,
4.1877 - * such as during a zconfrestart() or at EOF.
4.1878 - */
4.1879 - static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
4.1880 -
4.1881 -{
4.1882 - int oerrno = errno;
4.1883 -
4.1884 - zconf_flush_buffer(b );
4.1885 -
4.1886 - b->yy_input_file = file;
4.1887 - b->yy_fill_buffer = 1;
4.1888 -
4.1889 - /* If b is the current buffer, then zconf_init_buffer was _probably_
4.1890 - * called from zconfrestart() or through yy_get_next_buffer.
4.1891 - * In that case, we don't want to reset the lineno or column.
4.1892 - */
4.1893 - if (b != YY_CURRENT_BUFFER){
4.1894 - b->yy_bs_lineno = 1;
4.1895 - b->yy_bs_column = 0;
4.1896 - }
4.1897 -
4.1898 - b->yy_is_interactive = 0;
4.1899 -
4.1900 - errno = oerrno;
4.1901 -}
4.1902 -
4.1903 -/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
4.1904 - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
4.1905 - *
4.1906 - */
4.1907 - void zconf_flush_buffer (YY_BUFFER_STATE b )
4.1908 -{
4.1909 - if ( ! b )
4.1910 - return;
4.1911 -
4.1912 - b->yy_n_chars = 0;
4.1913 -
4.1914 - /* We always need two end-of-buffer characters. The first causes
4.1915 - * a transition to the end-of-buffer state. The second causes
4.1916 - * a jam in that state.
4.1917 - */
4.1918 - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
4.1919 - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
4.1920 -
4.1921 - b->yy_buf_pos = &b->yy_ch_buf[0];
4.1922 -
4.1923 - b->yy_at_bol = 1;
4.1924 - b->yy_buffer_status = YY_BUFFER_NEW;
4.1925 -
4.1926 - if ( b == YY_CURRENT_BUFFER )
4.1927 - zconf_load_buffer_state( );
4.1928 -}
4.1929 -
4.1930 -/** Pushes the new state onto the stack. The new state becomes
4.1931 - * the current state. This function will allocate the stack
4.1932 - * if necessary.
4.1933 - * @param new_buffer The new state.
4.1934 - *
4.1935 - */
4.1936 -void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
4.1937 -{
4.1938 - if (new_buffer == NULL)
4.1939 - return;
4.1940 -
4.1941 - zconfensure_buffer_stack();
4.1942 -
4.1943 - /* This block is copied from zconf_switch_to_buffer. */
4.1944 - if ( YY_CURRENT_BUFFER )
4.1945 - {
4.1946 - /* Flush out information for old buffer. */
4.1947 - *(yy_c_buf_p) = (yy_hold_char);
4.1948 - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
4.1949 - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
4.1950 - }
4.1951 -
4.1952 - /* Only push if top exists. Otherwise, replace top. */
4.1953 - if (YY_CURRENT_BUFFER)
4.1954 - (yy_buffer_stack_top)++;
4.1955 - YY_CURRENT_BUFFER_LVALUE = new_buffer;
4.1956 -
4.1957 - /* copied from zconf_switch_to_buffer. */
4.1958 - zconf_load_buffer_state( );
4.1959 - (yy_did_buffer_switch_on_eof) = 1;
4.1960 -}
4.1961 -
4.1962 -/** Removes and deletes the top of the stack, if present.
4.1963 - * The next element becomes the new top.
4.1964 - *
4.1965 - */
4.1966 -void zconfpop_buffer_state (void)
4.1967 -{
4.1968 - if (!YY_CURRENT_BUFFER)
4.1969 - return;
4.1970 -
4.1971 - zconf_delete_buffer(YY_CURRENT_BUFFER );
4.1972 - YY_CURRENT_BUFFER_LVALUE = NULL;
4.1973 - if ((yy_buffer_stack_top) > 0)
4.1974 - --(yy_buffer_stack_top);
4.1975 -
4.1976 - if (YY_CURRENT_BUFFER) {
4.1977 - zconf_load_buffer_state( );
4.1978 - (yy_did_buffer_switch_on_eof) = 1;
4.1979 - }
4.1980 -}
4.1981 -
4.1982 -/* Allocates the stack if it does not exist.
4.1983 - * Guarantees space for at least one push.
4.1984 - */
4.1985 -static void zconfensure_buffer_stack (void)
4.1986 -{
4.1987 - int num_to_alloc;
4.1988 -
4.1989 - if (!(yy_buffer_stack)) {
4.1990 -
4.1991 - /* First allocation is just for 2 elements, since we don't know if this
4.1992 - * scanner will even need a stack. We use 2 instead of 1 to avoid an
4.1993 - * immediate realloc on the next call.
4.1994 - */
4.1995 - num_to_alloc = 1;
4.1996 - (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
4.1997 - (num_to_alloc * sizeof(struct yy_buffer_state*)
4.1998 - );
4.1999 - if ( ! (yy_buffer_stack) )
4.2000 - YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
4.2001 -
4.2002 - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
4.2003 -
4.2004 - (yy_buffer_stack_max) = num_to_alloc;
4.2005 - (yy_buffer_stack_top) = 0;
4.2006 - return;
4.2007 - }
4.2008 -
4.2009 - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
4.2010 -
4.2011 - /* Increase the buffer to prepare for a possible push. */
4.2012 - int grow_size = 8 /* arbitrary grow size */;
4.2013 -
4.2014 - num_to_alloc = (yy_buffer_stack_max) + grow_size;
4.2015 - (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
4.2016 - ((yy_buffer_stack),
4.2017 - num_to_alloc * sizeof(struct yy_buffer_state*)
4.2018 - );
4.2019 - if ( ! (yy_buffer_stack) )
4.2020 - YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
4.2021 -
4.2022 - /* zero only the new slots.*/
4.2023 - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
4.2024 - (yy_buffer_stack_max) = num_to_alloc;
4.2025 - }
4.2026 -}
4.2027 -
4.2028 -/** Setup the input buffer state to scan directly from a user-specified character buffer.
4.2029 - * @param base the character buffer
4.2030 - * @param size the size in bytes of the character buffer
4.2031 - *
4.2032 - * @return the newly allocated buffer state object.
4.2033 - */
4.2034 -YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
4.2035 -{
4.2036 - YY_BUFFER_STATE b;
4.2037 -
4.2038 - if ( size < 2 ||
4.2039 - base[size-2] != YY_END_OF_BUFFER_CHAR ||
4.2040 - base[size-1] != YY_END_OF_BUFFER_CHAR )
4.2041 - /* They forgot to leave room for the EOB's. */
4.2042 - return 0;
4.2043 -
4.2044 - b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
4.2045 - if ( ! b )
4.2046 - YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
4.2047 -
4.2048 - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
4.2049 - b->yy_buf_pos = b->yy_ch_buf = base;
4.2050 - b->yy_is_our_buffer = 0;
4.2051 - b->yy_input_file = 0;
4.2052 - b->yy_n_chars = b->yy_buf_size;
4.2053 - b->yy_is_interactive = 0;
4.2054 - b->yy_at_bol = 1;
4.2055 - b->yy_fill_buffer = 0;
4.2056 - b->yy_buffer_status = YY_BUFFER_NEW;
4.2057 -
4.2058 - zconf_switch_to_buffer(b );
4.2059 -
4.2060 - return b;
4.2061 -}
4.2062 -
4.2063 -/** Setup the input buffer state to scan a string. The next call to zconflex() will
4.2064 - * scan from a @e copy of @a str.
4.2065 - * @param yystr a NUL-terminated string to scan
4.2066 - *
4.2067 - * @return the newly allocated buffer state object.
4.2068 - * @note If you want to scan bytes that may contain NUL values, then use
4.2069 - * zconf_scan_bytes() instead.
4.2070 - */
4.2071 -YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
4.2072 -{
4.2073 -
4.2074 - return zconf_scan_bytes(yystr,strlen(yystr) );
4.2075 -}
4.2076 -
4.2077 -/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
4.2078 - * scan from a @e copy of @a bytes.
4.2079 - * @param yybytes the byte buffer to scan
4.2080 - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
4.2081 - *
4.2082 - * @return the newly allocated buffer state object.
4.2083 - */
4.2084 -YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
4.2085 -{
4.2086 - YY_BUFFER_STATE b;
4.2087 - char *buf;
4.2088 - yy_size_t n;
4.2089 - int i;
4.2090 -
4.2091 - /* Get memory for full buffer, including space for trailing EOB's. */
4.2092 - n = _yybytes_len + 2;
4.2093 - buf = (char *) zconfalloc(n );
4.2094 - if ( ! buf )
4.2095 - YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
4.2096 -
4.2097 - for ( i = 0; i < _yybytes_len; ++i )
4.2098 - buf[i] = yybytes[i];
4.2099 -
4.2100 - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
4.2101 -
4.2102 - b = zconf_scan_buffer(buf,n );
4.2103 - if ( ! b )
4.2104 - YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
4.2105 -
4.2106 - /* It's okay to grow etc. this buffer, and we should throw it
4.2107 - * away when we're done.
4.2108 - */
4.2109 - b->yy_is_our_buffer = 1;
4.2110 -
4.2111 - return b;
4.2112 -}
4.2113 -
4.2114 -#ifndef YY_EXIT_FAILURE
4.2115 -#define YY_EXIT_FAILURE 2
4.2116 -#endif
4.2117 -
4.2118 -static void yy_fatal_error (yyconst char* msg )
4.2119 -{
4.2120 - (void) fprintf( stderr, "%s\n", msg );
4.2121 - exit( YY_EXIT_FAILURE );
4.2122 -}
4.2123 -
4.2124 -/* Redefine yyless() so it works in section 3 code. */
4.2125 -
4.2126 -#undef yyless
4.2127 -#define yyless(n) \
4.2128 - do \
4.2129 - { \
4.2130 - /* Undo effects of setting up zconftext. */ \
4.2131 - int yyless_macro_arg = (n); \
4.2132 - YY_LESS_LINENO(yyless_macro_arg);\
4.2133 - zconftext[zconfleng] = (yy_hold_char); \
4.2134 - (yy_c_buf_p) = zconftext + yyless_macro_arg; \
4.2135 - (yy_hold_char) = *(yy_c_buf_p); \
4.2136 - *(yy_c_buf_p) = '\0'; \
4.2137 - zconfleng = yyless_macro_arg; \
4.2138 - } \
4.2139 - while ( 0 )
4.2140 -
4.2141 -/* Accessor methods (get/set functions) to struct members. */
4.2142 -
4.2143 -/** Get the current line number.
4.2144 - *
4.2145 - */
4.2146 -int zconfget_lineno (void)
4.2147 -{
4.2148 -
4.2149 - return zconflineno;
4.2150 -}
4.2151 -
4.2152 -/** Get the input stream.
4.2153 - *
4.2154 - */
4.2155 -FILE *zconfget_in (void)
4.2156 -{
4.2157 - return zconfin;
4.2158 -}
4.2159 -
4.2160 -/** Get the output stream.
4.2161 - *
4.2162 - */
4.2163 -FILE *zconfget_out (void)
4.2164 -{
4.2165 - return zconfout;
4.2166 -}
4.2167 -
4.2168 -/** Get the length of the current token.
4.2169 - *
4.2170 - */
4.2171 -int zconfget_leng (void)
4.2172 -{
4.2173 - return zconfleng;
4.2174 -}
4.2175 -
4.2176 -/** Get the current token.
4.2177 - *
4.2178 - */
4.2179 -
4.2180 -char *zconfget_text (void)
4.2181 -{
4.2182 - return zconftext;
4.2183 -}
4.2184 -
4.2185 -/** Set the current line number.
4.2186 - * @param line_number
4.2187 - *
4.2188 - */
4.2189 -void zconfset_lineno (int line_number )
4.2190 -{
4.2191 -
4.2192 - zconflineno = line_number;
4.2193 -}
4.2194 -
4.2195 -/** Set the input stream. This does not discard the current
4.2196 - * input buffer.
4.2197 - * @param in_str A readable stream.
4.2198 - *
4.2199 - * @see zconf_switch_to_buffer
4.2200 - */
4.2201 -void zconfset_in (FILE * in_str )
4.2202 -{
4.2203 - zconfin = in_str ;
4.2204 -}
4.2205 -
4.2206 -void zconfset_out (FILE * out_str )
4.2207 -{
4.2208 - zconfout = out_str ;
4.2209 -}
4.2210 -
4.2211 -int zconfget_debug (void)
4.2212 -{
4.2213 - return zconf_flex_debug;
4.2214 -}
4.2215 -
4.2216 -void zconfset_debug (int bdebug )
4.2217 -{
4.2218 - zconf_flex_debug = bdebug ;
4.2219 -}
4.2220 -
4.2221 -static int yy_init_globals (void)
4.2222 -{
4.2223 - /* Initialization is the same as for the non-reentrant scanner.
4.2224 - * This function is called from zconflex_destroy(), so don't allocate here.
4.2225 - */
4.2226 -
4.2227 - (yy_buffer_stack) = 0;
4.2228 - (yy_buffer_stack_top) = 0;
4.2229 - (yy_buffer_stack_max) = 0;
4.2230 - (yy_c_buf_p) = (char *) 0;
4.2231 - (yy_init) = 0;
4.2232 - (yy_start) = 0;
4.2233 -
4.2234 -/* Defined in main.c */
4.2235 -#ifdef YY_STDINIT
4.2236 - zconfin = stdin;
4.2237 - zconfout = stdout;
4.2238 -#else
4.2239 - zconfin = (FILE *) 0;
4.2240 - zconfout = (FILE *) 0;
4.2241 -#endif
4.2242 -
4.2243 - /* For future reference: Set errno on error, since we are called by
4.2244 - * zconflex_init()
4.2245 - */
4.2246 - return 0;
4.2247 -}
4.2248 -
4.2249 -/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
4.2250 -int zconflex_destroy (void)
4.2251 -{
4.2252 -
4.2253 - /* Pop the buffer stack, destroying each element. */
4.2254 - while(YY_CURRENT_BUFFER){
4.2255 - zconf_delete_buffer(YY_CURRENT_BUFFER );
4.2256 - YY_CURRENT_BUFFER_LVALUE = NULL;
4.2257 - zconfpop_buffer_state();
4.2258 - }
4.2259 -
4.2260 - /* Destroy the stack itself. */
4.2261 - zconffree((yy_buffer_stack) );
4.2262 - (yy_buffer_stack) = NULL;
4.2263 -
4.2264 - /* Reset the globals. This is important in a non-reentrant scanner so the next time
4.2265 - * zconflex() is called, initialization will occur. */
4.2266 - yy_init_globals( );
4.2267 -
4.2268 - return 0;
4.2269 -}
4.2270 -
4.2271 -/*
4.2272 - * Internal utility routines.
4.2273 - */
4.2274 -
4.2275 -#ifndef yytext_ptr
4.2276 -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
4.2277 -{
4.2278 - register int i;
4.2279 - for ( i = 0; i < n; ++i )
4.2280 - s1[i] = s2[i];
4.2281 -}
4.2282 -#endif
4.2283 -
4.2284 -#ifdef YY_NEED_STRLEN
4.2285 -static int yy_flex_strlen (yyconst char * s )
4.2286 -{
4.2287 - register int n;
4.2288 - for ( n = 0; s[n]; ++n )
4.2289 - ;
4.2290 -
4.2291 - return n;
4.2292 -}
4.2293 -#endif
4.2294 -
4.2295 -void *zconfalloc (yy_size_t size )
4.2296 -{
4.2297 - return (void *) malloc( size );
4.2298 -}
4.2299 -
4.2300 -void *zconfrealloc (void * ptr, yy_size_t size )
4.2301 -{
4.2302 - /* The cast to (char *) in the following accommodates both
4.2303 - * implementations that use char* generic pointers, and those
4.2304 - * that use void* generic pointers. It works with the latter
4.2305 - * because both ANSI C and C++ allow castless assignment from
4.2306 - * any pointer type to void*, and deal with argument conversions
4.2307 - * as though doing an assignment.
4.2308 - */
4.2309 - return (void *) realloc( (char *) ptr, size );
4.2310 -}
4.2311 -
4.2312 -void zconffree (void * ptr )
4.2313 -{
4.2314 - free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
4.2315 -}
4.2316 -
4.2317 -#define YYTABLES_NAME "yytables"
4.2318 -
4.2319 -void zconf_starthelp(void)
4.2320 -{
4.2321 - new_string();
4.2322 - last_ts = first_ts = 0;
4.2323 - BEGIN(HELP);
4.2324 -}
4.2325 -
4.2326 -static void zconf_endhelp(void)
4.2327 -{
4.2328 - zconflval.string = text;
4.2329 - BEGIN(INITIAL);
4.2330 -}
4.2331 -
4.2332 -/*
4.2333 - * Try to open specified file with following names:
4.2334 - * ./name
4.2335 - * $(srctree)/name
4.2336 - * The latter is used when srctree is separate from objtree
4.2337 - * when compiling the kernel.
4.2338 - * Return NULL if file is not found.
4.2339 - */
4.2340 -FILE *zconf_fopen(const char *name)
4.2341 -{
4.2342 - char *env, fullname[PATH_MAX+1];
4.2343 - FILE *f;
4.2344 -
4.2345 - f = fopen(name, "r");
4.2346 - if (!f && name != NULL && name[0] != '/') {
4.2347 - env = getenv(SRCTREE);
4.2348 - if (env) {
4.2349 - sprintf(fullname, "%s/%s", env, name);
4.2350 - f = fopen(fullname, "r");
4.2351 - }
4.2352 - }
4.2353 - return f;
4.2354 -}
4.2355 -
4.2356 -void zconf_initscan(const char *name)
4.2357 -{
4.2358 - zconfin = zconf_fopen(name);
4.2359 - if (!zconfin) {
4.2360 - printf("can't find file %s\n", name);
4.2361 - exit(1);
4.2362 - }
4.2363 -
4.2364 - current_buf = malloc(sizeof(*current_buf));
4.2365 - memset(current_buf, 0, sizeof(*current_buf));
4.2366 -
4.2367 - current_file = file_lookup(name);
4.2368 - current_file->lineno = 1;
4.2369 -}
4.2370 -
4.2371 -void zconf_nextfile(const char *name)
4.2372 -{
4.2373 - struct file *iter;
4.2374 - struct file *file = file_lookup(name);
4.2375 - struct buffer *buf = malloc(sizeof(*buf));
4.2376 - memset(buf, 0, sizeof(*buf));
4.2377 -
4.2378 - current_buf->state = YY_CURRENT_BUFFER;
4.2379 - zconfin = zconf_fopen(file->name);
4.2380 - if (!zconfin) {
4.2381 - printf("%s:%d: can't open file \"%s\"\n",
4.2382 - zconf_curname(), zconf_lineno(), file->name);
4.2383 - exit(1);
4.2384 - }
4.2385 - zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
4.2386 - buf->parent = current_buf;
4.2387 - current_buf = buf;
4.2388 -
4.2389 - for (iter = current_file->parent; iter; iter = iter->parent ) {
4.2390 - if (!strcmp(current_file->name,iter->name) ) {
4.2391 - printf("%s:%d: recursive inclusion detected. "
4.2392 - "Inclusion path:\n current file : '%s'\n",
4.2393 - zconf_curname(), zconf_lineno(),
4.2394 - zconf_curname());
4.2395 - iter = current_file->parent;
4.2396 - while (iter && \
4.2397 - strcmp(iter->name,current_file->name)) {
4.2398 - printf(" included from: '%s:%d'\n",
4.2399 - iter->name, iter->lineno-1);
4.2400 - iter = iter->parent;
4.2401 - }
4.2402 - if (iter)
4.2403 - printf(" included from: '%s:%d'\n",
4.2404 - iter->name, iter->lineno+1);
4.2405 - exit(1);
4.2406 - }
4.2407 - }
4.2408 - file->lineno = 1;
4.2409 - file->parent = current_file;
4.2410 - current_file = file;
4.2411 -}
4.2412 -
4.2413 -static void zconf_endfile(void)
4.2414 -{
4.2415 - struct buffer *parent;
4.2416 -
4.2417 - current_file = current_file->parent;
4.2418 -
4.2419 - parent = current_buf->parent;
4.2420 - if (parent) {
4.2421 - fclose(zconfin);
4.2422 - zconf_delete_buffer(YY_CURRENT_BUFFER);
4.2423 - zconf_switch_to_buffer(parent->state);
4.2424 - }
4.2425 - free(current_buf);
4.2426 - current_buf = parent;
4.2427 -}
4.2428 -
4.2429 -int zconf_lineno(void)
4.2430 -{
4.2431 - return current_pos.lineno;
4.2432 -}
4.2433 -
4.2434 -const char *zconf_curname(void)
4.2435 -{
4.2436 - return current_pos.file ? current_pos.file->name : "<none>";
4.2437 -}
4.2438 -
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/kconfig/zconf.gperf Sun Jan 15 01:04:26 2012 +0100
5.3 @@ -0,0 +1,47 @@
5.4 +%language=ANSI-C
5.5 +%define hash-function-name kconf_id_hash
5.6 +%define lookup-function-name kconf_id_lookup
5.7 +%define string-pool-name kconf_id_strings
5.8 +%compare-strncmp
5.9 +%enum
5.10 +%pic
5.11 +%struct-type
5.12 +
5.13 +struct kconf_id;
5.14 +
5.15 +static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
5.16 +
5.17 +%%
5.18 +mainmenu, T_MAINMENU, TF_COMMAND
5.19 +menu, T_MENU, TF_COMMAND
5.20 +endmenu, T_ENDMENU, TF_COMMAND
5.21 +source, T_SOURCE, TF_COMMAND
5.22 +choice, T_CHOICE, TF_COMMAND
5.23 +endchoice, T_ENDCHOICE, TF_COMMAND
5.24 +comment, T_COMMENT, TF_COMMAND
5.25 +config, T_CONFIG, TF_COMMAND
5.26 +menuconfig, T_MENUCONFIG, TF_COMMAND
5.27 +help, T_HELP, TF_COMMAND
5.28 +if, T_IF, TF_COMMAND|TF_PARAM
5.29 +endif, T_ENDIF, TF_COMMAND
5.30 +depends, T_DEPENDS, TF_COMMAND
5.31 +optional, T_OPTIONAL, TF_COMMAND
5.32 +default, T_DEFAULT, TF_COMMAND, S_UNKNOWN
5.33 +prompt, T_PROMPT, TF_COMMAND
5.34 +tristate, T_TYPE, TF_COMMAND, S_TRISTATE
5.35 +def_tristate, T_DEFAULT, TF_COMMAND, S_TRISTATE
5.36 +bool, T_TYPE, TF_COMMAND, S_BOOLEAN
5.37 +boolean, T_TYPE, TF_COMMAND, S_BOOLEAN
5.38 +def_bool, T_DEFAULT, TF_COMMAND, S_BOOLEAN
5.39 +int, T_TYPE, TF_COMMAND, S_INT
5.40 +hex, T_TYPE, TF_COMMAND, S_HEX
5.41 +string, T_TYPE, TF_COMMAND, S_STRING
5.42 +select, T_SELECT, TF_COMMAND
5.43 +range, T_RANGE, TF_COMMAND
5.44 +visible, T_VISIBLE, TF_COMMAND
5.45 +option, T_OPTION, TF_COMMAND
5.46 +on, T_ON, TF_PARAM
5.47 +modules, T_OPT_MODULES, TF_OPTION
5.48 +defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION
5.49 +env, T_OPT_ENV, TF_OPTION
5.50 +%%
6.1 --- a/kconfig/zconf.hash.c Sat Jan 14 18:22:06 2012 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,245 +0,0 @@
6.4 -/* ANSI-C code produced by gperf version 3.0.3 */
6.5 -/* Command-line: gperf */
6.6 -/* Computed positions: -k'1,3' */
6.7 -
6.8 -#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6.9 - && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6.10 - && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
6.11 - && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
6.12 - && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
6.13 - && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
6.14 - && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
6.15 - && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
6.16 - && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
6.17 - && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
6.18 - && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
6.19 - && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
6.20 - && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
6.21 - && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
6.22 - && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
6.23 - && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
6.24 - && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
6.25 - && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
6.26 - && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
6.27 - && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
6.28 - && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
6.29 - && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
6.30 - && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
6.31 -/* The character set is not based on ISO-646. */
6.32 -#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
6.33 -#endif
6.34 -
6.35 -struct kconf_id;
6.36 -
6.37 -static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
6.38 -/* maximum key range = 50, duplicates = 0 */
6.39 -
6.40 -#ifdef __GNUC__
6.41 -__inline
6.42 -#else
6.43 -#ifdef __cplusplus
6.44 -inline
6.45 -#endif
6.46 -#endif
6.47 -static unsigned int
6.48 -kconf_id_hash (register const char *str, register unsigned int len)
6.49 -{
6.50 - static unsigned char asso_values[] =
6.51 - {
6.52 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.53 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.54 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.55 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.56 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.57 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.58 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.59 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.60 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.61 - 52, 52, 52, 52, 52, 52, 52, 52, 40, 5,
6.62 - 0, 0, 5, 52, 0, 20, 52, 52, 10, 20,
6.63 - 5, 0, 35, 52, 0, 30, 0, 15, 0, 52,
6.64 - 15, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.65 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.66 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.67 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.68 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.69 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.70 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.71 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.72 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.73 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.74 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.75 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.76 - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
6.77 - 52, 52, 52, 52, 52, 52
6.78 - };
6.79 - register int hval = len;
6.80 -
6.81 - switch (hval)
6.82 - {
6.83 - default:
6.84 - hval += asso_values[(unsigned char)str[2]];
6.85 - /*FALLTHROUGH*/
6.86 - case 2:
6.87 - case 1:
6.88 - hval += asso_values[(unsigned char)str[0]];
6.89 - break;
6.90 - }
6.91 - return hval;
6.92 -}
6.93 -
6.94 -struct kconf_id_strings_t
6.95 - {
6.96 - char kconf_id_strings_str2[sizeof("on")];
6.97 - char kconf_id_strings_str3[sizeof("env")];
6.98 - char kconf_id_strings_str5[sizeof("endif")];
6.99 - char kconf_id_strings_str6[sizeof("option")];
6.100 - char kconf_id_strings_str7[sizeof("endmenu")];
6.101 - char kconf_id_strings_str8[sizeof("optional")];
6.102 - char kconf_id_strings_str9[sizeof("endchoice")];
6.103 - char kconf_id_strings_str10[sizeof("range")];
6.104 - char kconf_id_strings_str11[sizeof("choice")];
6.105 - char kconf_id_strings_str12[sizeof("default")];
6.106 - char kconf_id_strings_str13[sizeof("def_bool")];
6.107 - char kconf_id_strings_str14[sizeof("help")];
6.108 - char kconf_id_strings_str16[sizeof("config")];
6.109 - char kconf_id_strings_str17[sizeof("def_tristate")];
6.110 - char kconf_id_strings_str18[sizeof("hex")];
6.111 - char kconf_id_strings_str19[sizeof("defconfig_list")];
6.112 - char kconf_id_strings_str22[sizeof("if")];
6.113 - char kconf_id_strings_str23[sizeof("int")];
6.114 - char kconf_id_strings_str27[sizeof("modules")];
6.115 - char kconf_id_strings_str28[sizeof("tristate")];
6.116 - char kconf_id_strings_str29[sizeof("menu")];
6.117 - char kconf_id_strings_str32[sizeof("comment")];
6.118 - char kconf_id_strings_str35[sizeof("menuconfig")];
6.119 - char kconf_id_strings_str36[sizeof("string")];
6.120 - char kconf_id_strings_str37[sizeof("visible")];
6.121 - char kconf_id_strings_str41[sizeof("prompt")];
6.122 - char kconf_id_strings_str42[sizeof("depends")];
6.123 - char kconf_id_strings_str44[sizeof("bool")];
6.124 - char kconf_id_strings_str46[sizeof("select")];
6.125 - char kconf_id_strings_str47[sizeof("boolean")];
6.126 - char kconf_id_strings_str48[sizeof("mainmenu")];
6.127 - char kconf_id_strings_str51[sizeof("source")];
6.128 - };
6.129 -static struct kconf_id_strings_t kconf_id_strings_contents =
6.130 - {
6.131 - "on",
6.132 - "env",
6.133 - "endif",
6.134 - "option",
6.135 - "endmenu",
6.136 - "optional",
6.137 - "endchoice",
6.138 - "range",
6.139 - "choice",
6.140 - "default",
6.141 - "def_bool",
6.142 - "help",
6.143 - "config",
6.144 - "def_tristate",
6.145 - "hex",
6.146 - "defconfig_list",
6.147 - "if",
6.148 - "int",
6.149 - "modules",
6.150 - "tristate",
6.151 - "menu",
6.152 - "comment",
6.153 - "menuconfig",
6.154 - "string",
6.155 - "visible",
6.156 - "prompt",
6.157 - "depends",
6.158 - "bool",
6.159 - "select",
6.160 - "boolean",
6.161 - "mainmenu",
6.162 - "source"
6.163 - };
6.164 -#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
6.165 -#ifdef __GNUC__
6.166 -__inline
6.167 -#ifdef __GNUC_STDC_INLINE__
6.168 -__attribute__ ((__gnu_inline__))
6.169 -#endif
6.170 -#endif
6.171 -struct kconf_id *
6.172 -kconf_id_lookup (register const char *str, register unsigned int len)
6.173 -{
6.174 - enum
6.175 - {
6.176 - TOTAL_KEYWORDS = 32,
6.177 - MIN_WORD_LENGTH = 2,
6.178 - MAX_WORD_LENGTH = 14,
6.179 - MIN_HASH_VALUE = 2,
6.180 - MAX_HASH_VALUE = 51
6.181 - };
6.182 -
6.183 - static struct kconf_id wordlist[] =
6.184 - {
6.185 - {-1}, {-1},
6.186 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM},
6.187 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_OPT_ENV, TF_OPTION},
6.188 - {-1},
6.189 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND},
6.190 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND},
6.191 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND},
6.192 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_OPTIONAL, TF_COMMAND},
6.193 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND},
6.194 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND},
6.195 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_CHOICE, TF_COMMAND},
6.196 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
6.197 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
6.198 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
6.199 - {-1},
6.200 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
6.201 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
6.202 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX},
6.203 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
6.204 - {-1}, {-1},
6.205 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
6.206 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
6.207 - {-1}, {-1}, {-1},
6.208 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
6.209 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
6.210 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
6.211 - {-1}, {-1},
6.212 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
6.213 - {-1}, {-1},
6.214 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
6.215 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING},
6.216 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND},
6.217 - {-1}, {-1}, {-1},
6.218 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND},
6.219 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND},
6.220 - {-1},
6.221 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN},
6.222 - {-1},
6.223 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND},
6.224 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
6.225 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND},
6.226 - {-1}, {-1},
6.227 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND}
6.228 - };
6.229 -
6.230 - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
6.231 - {
6.232 - register int key = kconf_id_hash (str, len);
6.233 -
6.234 - if (key <= MAX_HASH_VALUE && key >= 0)
6.235 - {
6.236 - register int o = wordlist[key].name;
6.237 - if (o >= 0)
6.238 - {
6.239 - register const char *s = o + kconf_id_strings;
6.240 -
6.241 - if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
6.242 - return &wordlist[key];
6.243 - }
6.244 - }
6.245 - }
6.246 - return 0;
6.247 -}
6.248 -
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/kconfig/zconf.l Sun Jan 15 01:04:26 2012 +0100
7.3 @@ -0,0 +1,365 @@
7.4 +%option backup nostdinit noyywrap never-interactive full ecs
7.5 +%option 8bit backup nodefault perf-report perf-report
7.6 +%option noinput
7.7 +%x COMMAND HELP STRING PARAM
7.8 +%{
7.9 +/*
7.10 + * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
7.11 + * Released under the terms of the GNU GPL v2.0.
7.12 + */
7.13 +
7.14 +#include <limits.h>
7.15 +#include <stdio.h>
7.16 +#include <stdlib.h>
7.17 +#include <string.h>
7.18 +#include <unistd.h>
7.19 +
7.20 +#define LKC_DIRECT_LINK
7.21 +#include "lkc.h"
7.22 +
7.23 +#define START_STRSIZE 16
7.24 +
7.25 +static struct {
7.26 + struct file *file;
7.27 + int lineno;
7.28 +} current_pos;
7.29 +
7.30 +static char *text;
7.31 +static int text_size, text_asize;
7.32 +
7.33 +struct buffer {
7.34 + struct buffer *parent;
7.35 + YY_BUFFER_STATE state;
7.36 +};
7.37 +
7.38 +struct buffer *current_buf;
7.39 +
7.40 +static int last_ts, first_ts;
7.41 +
7.42 +static void zconf_endhelp(void);
7.43 +static void zconf_endfile(void);
7.44 +
7.45 +static void new_string(void)
7.46 +{
7.47 + text = malloc(START_STRSIZE);
7.48 + text_asize = START_STRSIZE;
7.49 + text_size = 0;
7.50 + *text = 0;
7.51 +}
7.52 +
7.53 +static void append_string(const char *str, int size)
7.54 +{
7.55 + int new_size = text_size + size + 1;
7.56 + if (new_size > text_asize) {
7.57 + new_size += START_STRSIZE - 1;
7.58 + new_size &= -START_STRSIZE;
7.59 + text = realloc(text, new_size);
7.60 + text_asize = new_size;
7.61 + }
7.62 + memcpy(text + text_size, str, size);
7.63 + text_size += size;
7.64 + text[text_size] = 0;
7.65 +}
7.66 +
7.67 +static void alloc_string(const char *str, int size)
7.68 +{
7.69 + text = malloc(size + 1);
7.70 + memcpy(text, str, size);
7.71 + text[size] = 0;
7.72 +}
7.73 +%}
7.74 +
7.75 +ws [ \n\t]
7.76 +n [A-Za-z0-9_]
7.77 +
7.78 +%%
7.79 + int str = 0;
7.80 + int ts, i;
7.81 +
7.82 +[ \t]*#.*\n |
7.83 +[ \t]*\n {
7.84 + current_file->lineno++;
7.85 + return T_EOL;
7.86 +}
7.87 +[ \t]*#.*
7.88 +
7.89 +
7.90 +[ \t]+ {
7.91 + BEGIN(COMMAND);
7.92 +}
7.93 +
7.94 +. {
7.95 + unput(yytext[0]);
7.96 + BEGIN(COMMAND);
7.97 +}
7.98 +
7.99 +
7.100 +<COMMAND>{
7.101 + {n}+ {
7.102 + struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
7.103 + BEGIN(PARAM);
7.104 + current_pos.file = current_file;
7.105 + current_pos.lineno = current_file->lineno;
7.106 + if (id && id->flags & TF_COMMAND) {
7.107 + zconflval.id = id;
7.108 + return id->token;
7.109 + }
7.110 + alloc_string(yytext, yyleng);
7.111 + zconflval.string = text;
7.112 + return T_WORD;
7.113 + }
7.114 + .
7.115 + \n {
7.116 + BEGIN(INITIAL);
7.117 + current_file->lineno++;
7.118 + return T_EOL;
7.119 + }
7.120 +}
7.121 +
7.122 +<PARAM>{
7.123 + "&&" return T_AND;
7.124 + "||" return T_OR;
7.125 + "(" return T_OPEN_PAREN;
7.126 + ")" return T_CLOSE_PAREN;
7.127 + "!" return T_NOT;
7.128 + "=" return T_EQUAL;
7.129 + "!=" return T_UNEQUAL;
7.130 + \"|\' {
7.131 + str = yytext[0];
7.132 + new_string();
7.133 + BEGIN(STRING);
7.134 + }
7.135 + \n BEGIN(INITIAL); current_file->lineno++; return T_EOL;
7.136 + --- /* ignore */
7.137 + ({n}|[-/.])+ {
7.138 + struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
7.139 + if (id && id->flags & TF_PARAM) {
7.140 + zconflval.id = id;
7.141 + return id->token;
7.142 + }
7.143 + alloc_string(yytext, yyleng);
7.144 + zconflval.string = text;
7.145 + return T_WORD;
7.146 + }
7.147 + #.* /* comment */
7.148 + \\\n current_file->lineno++;
7.149 + .
7.150 + <<EOF>> {
7.151 + BEGIN(INITIAL);
7.152 + }
7.153 +}
7.154 +
7.155 +<STRING>{
7.156 + [^'"\\\n]+/\n {
7.157 + append_string(yytext, yyleng);
7.158 + zconflval.string = text;
7.159 + return T_WORD_QUOTE;
7.160 + }
7.161 + [^'"\\\n]+ {
7.162 + append_string(yytext, yyleng);
7.163 + }
7.164 + \\.?/\n {
7.165 + append_string(yytext + 1, yyleng - 1);
7.166 + zconflval.string = text;
7.167 + return T_WORD_QUOTE;
7.168 + }
7.169 + \\.? {
7.170 + append_string(yytext + 1, yyleng - 1);
7.171 + }
7.172 + \'|\" {
7.173 + if (str == yytext[0]) {
7.174 + BEGIN(PARAM);
7.175 + zconflval.string = text;
7.176 + return T_WORD_QUOTE;
7.177 + } else
7.178 + append_string(yytext, 1);
7.179 + }
7.180 + \n {
7.181 + printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
7.182 + current_file->lineno++;
7.183 + BEGIN(INITIAL);
7.184 + return T_EOL;
7.185 + }
7.186 + <<EOF>> {
7.187 + BEGIN(INITIAL);
7.188 + }
7.189 +}
7.190 +
7.191 +<HELP>{
7.192 + [ \t]+ {
7.193 + ts = 0;
7.194 + for (i = 0; i < yyleng; i++) {
7.195 + if (yytext[i] == '\t')
7.196 + ts = (ts & ~7) + 8;
7.197 + else
7.198 + ts++;
7.199 + }
7.200 + last_ts = ts;
7.201 + if (first_ts) {
7.202 + if (ts < first_ts) {
7.203 + zconf_endhelp();
7.204 + return T_HELPTEXT;
7.205 + }
7.206 + ts -= first_ts;
7.207 + while (ts > 8) {
7.208 + append_string(" ", 8);
7.209 + ts -= 8;
7.210 + }
7.211 + append_string(" ", ts);
7.212 + }
7.213 + }
7.214 + [ \t]*\n/[^ \t\n] {
7.215 + current_file->lineno++;
7.216 + zconf_endhelp();
7.217 + return T_HELPTEXT;
7.218 + }
7.219 + [ \t]*\n {
7.220 + current_file->lineno++;
7.221 + append_string("\n", 1);
7.222 + }
7.223 + [^ \t\n].* {
7.224 + while (yyleng) {
7.225 + if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t'))
7.226 + break;
7.227 + yyleng--;
7.228 + }
7.229 + append_string(yytext, yyleng);
7.230 + if (!first_ts)
7.231 + first_ts = last_ts;
7.232 + }
7.233 + <<EOF>> {
7.234 + zconf_endhelp();
7.235 + return T_HELPTEXT;
7.236 + }
7.237 +}
7.238 +
7.239 +<<EOF>> {
7.240 + if (current_file) {
7.241 + zconf_endfile();
7.242 + return T_EOL;
7.243 + }
7.244 + fclose(yyin);
7.245 + yyterminate();
7.246 +}
7.247 +
7.248 +%%
7.249 +void zconf_starthelp(void)
7.250 +{
7.251 + new_string();
7.252 + last_ts = first_ts = 0;
7.253 + BEGIN(HELP);
7.254 +}
7.255 +
7.256 +static void zconf_endhelp(void)
7.257 +{
7.258 + zconflval.string = text;
7.259 + BEGIN(INITIAL);
7.260 +}
7.261 +
7.262 +
7.263 +/*
7.264 + * Try to open specified file with following names:
7.265 + * ./name
7.266 + * $(srctree)/name
7.267 + * The latter is used when srctree is separate from objtree
7.268 + * when compiling the kernel.
7.269 + * Return NULL if file is not found.
7.270 + */
7.271 +FILE *zconf_fopen(const char *name)
7.272 +{
7.273 + char *env, fullname[PATH_MAX+1];
7.274 + FILE *f;
7.275 +
7.276 + f = fopen(name, "r");
7.277 + if (!f && name != NULL && name[0] != '/') {
7.278 + env = getenv(SRCTREE);
7.279 + if (env) {
7.280 + sprintf(fullname, "%s/%s", env, name);
7.281 + f = fopen(fullname, "r");
7.282 + }
7.283 + }
7.284 + return f;
7.285 +}
7.286 +
7.287 +void zconf_initscan(const char *name)
7.288 +{
7.289 + yyin = zconf_fopen(name);
7.290 + if (!yyin) {
7.291 + printf("can't find file %s\n", name);
7.292 + exit(1);
7.293 + }
7.294 +
7.295 + current_buf = malloc(sizeof(*current_buf));
7.296 + memset(current_buf, 0, sizeof(*current_buf));
7.297 +
7.298 + current_file = file_lookup(name);
7.299 + current_file->lineno = 1;
7.300 +}
7.301 +
7.302 +void zconf_nextfile(const char *name)
7.303 +{
7.304 + struct file *iter;
7.305 + struct file *file = file_lookup(name);
7.306 + struct buffer *buf = malloc(sizeof(*buf));
7.307 + memset(buf, 0, sizeof(*buf));
7.308 +
7.309 + current_buf->state = YY_CURRENT_BUFFER;
7.310 + yyin = zconf_fopen(file->name);
7.311 + if (!yyin) {
7.312 + printf("%s:%d: can't open file \"%s\"\n",
7.313 + zconf_curname(), zconf_lineno(), file->name);
7.314 + exit(1);
7.315 + }
7.316 + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
7.317 + buf->parent = current_buf;
7.318 + current_buf = buf;
7.319 +
7.320 + for (iter = current_file->parent; iter; iter = iter->parent ) {
7.321 + if (!strcmp(current_file->name,iter->name) ) {
7.322 + printf("%s:%d: recursive inclusion detected. "
7.323 + "Inclusion path:\n current file : '%s'\n",
7.324 + zconf_curname(), zconf_lineno(),
7.325 + zconf_curname());
7.326 + iter = current_file->parent;
7.327 + while (iter && \
7.328 + strcmp(iter->name,current_file->name)) {
7.329 + printf(" included from: '%s:%d'\n",
7.330 + iter->name, iter->lineno-1);
7.331 + iter = iter->parent;
7.332 + }
7.333 + if (iter)
7.334 + printf(" included from: '%s:%d'\n",
7.335 + iter->name, iter->lineno+1);
7.336 + exit(1);
7.337 + }
7.338 + }
7.339 + file->lineno = 1;
7.340 + file->parent = current_file;
7.341 + current_file = file;
7.342 +}
7.343 +
7.344 +static void zconf_endfile(void)
7.345 +{
7.346 + struct buffer *parent;
7.347 +
7.348 + current_file = current_file->parent;
7.349 +
7.350 + parent = current_buf->parent;
7.351 + if (parent) {
7.352 + fclose(yyin);
7.353 + yy_delete_buffer(YY_CURRENT_BUFFER);
7.354 + yy_switch_to_buffer(parent->state);
7.355 + }
7.356 + free(current_buf);
7.357 + current_buf = parent;
7.358 +}
7.359 +
7.360 +int zconf_lineno(void)
7.361 +{
7.362 + return current_pos.lineno;
7.363 +}
7.364 +
7.365 +const char *zconf_curname(void)
7.366 +{
7.367 + return current_pos.file ? current_pos.file->name : "<none>";
7.368 +}
8.1 --- a/kconfig/zconf.tab.c Sat Jan 14 18:22:06 2012 +0100
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,2505 +0,0 @@
8.4 -
8.5 -/* A Bison parser, made by GNU Bison 2.4.1. */
8.6 -
8.7 -/* Skeleton implementation for Bison's Yacc-like parsers in C
8.8 -
8.9 - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
8.10 - Free Software Foundation, Inc.
8.11 -
8.12 - This program is free software: you can redistribute it and/or modify
8.13 - it under the terms of the GNU General Public License as published by
8.14 - the Free Software Foundation, either version 3 of the License, or
8.15 - (at your option) any later version.
8.16 -
8.17 - This program is distributed in the hope that it will be useful,
8.18 - but WITHOUT ANY WARRANTY; without even the implied warranty of
8.19 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.20 - GNU General Public License for more details.
8.21 -
8.22 - You should have received a copy of the GNU General Public License
8.23 - along with this program. If not, see <http://www.gnu.org/licenses/>. */
8.24 -
8.25 -/* As a special exception, you may create a larger work that contains
8.26 - part or all of the Bison parser skeleton and distribute that work
8.27 - under terms of your choice, so long as that work isn't itself a
8.28 - parser generator using the skeleton or a modified version thereof
8.29 - as a parser skeleton. Alternatively, if you modify or redistribute
8.30 - the parser skeleton itself, you may (at your option) remove this
8.31 - special exception, which will cause the skeleton and the resulting
8.32 - Bison output files to be licensed under the GNU General Public
8.33 - License without this special exception.
8.34 -
8.35 - This special exception was added by the Free Software Foundation in
8.36 - version 2.2 of Bison. */
8.37 -
8.38 -/* C LALR(1) parser skeleton written by Richard Stallman, by
8.39 - simplifying the original so-called "semantic" parser. */
8.40 -
8.41 -/* All symbols defined below should begin with yy or YY, to avoid
8.42 - infringing on user name space. This should be done even for local
8.43 - variables, as they might otherwise be expanded by user macros.
8.44 - There are some unavoidable exceptions within include files to
8.45 - define necessary library symbols; they are noted "INFRINGES ON
8.46 - USER NAME SPACE" below. */
8.47 -
8.48 -/* Identify Bison output. */
8.49 -#define YYBISON 1
8.50 -
8.51 -/* Bison version. */
8.52 -#define YYBISON_VERSION "2.4.1"
8.53 -
8.54 -/* Skeleton name. */
8.55 -#define YYSKELETON_NAME "yacc.c"
8.56 -
8.57 -/* Pure parsers. */
8.58 -#define YYPURE 0
8.59 -
8.60 -/* Push parsers. */
8.61 -#define YYPUSH 0
8.62 -
8.63 -/* Pull parsers. */
8.64 -#define YYPULL 1
8.65 -
8.66 -/* Using locations. */
8.67 -#define YYLSP_NEEDED 0
8.68 -
8.69 -/* Substitute the variable and function names. */
8.70 -#define yyparse zconfparse
8.71 -#define yylex zconflex
8.72 -#define yyerror zconferror
8.73 -#define yylval zconflval
8.74 -#define yychar zconfchar
8.75 -#define yydebug zconfdebug
8.76 -#define yynerrs zconfnerrs
8.77 -
8.78 -
8.79 -/* Copy the first part of user declarations. */
8.80 -
8.81 -
8.82 -/*
8.83 - * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
8.84 - * Released under the terms of the GNU GPL v2.0.
8.85 - */
8.86 -
8.87 -#include <ctype.h>
8.88 -#include <stdarg.h>
8.89 -#include <stdio.h>
8.90 -#include <stdlib.h>
8.91 -#include <string.h>
8.92 -#include <stdbool.h>
8.93 -
8.94 -#define LKC_DIRECT_LINK
8.95 -#include "lkc.h"
8.96 -
8.97 -#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
8.98 -
8.99 -#define PRINTD 0x0001
8.100 -#define DEBUG_PARSE 0x0002
8.101 -
8.102 -int cdebug = PRINTD;
8.103 -
8.104 -extern int zconflex(void);
8.105 -static void zconfprint(const char *err, ...);
8.106 -static void zconf_error(const char *err, ...);
8.107 -static void zconferror(const char *err);
8.108 -static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
8.109 -
8.110 -struct symbol *symbol_hash[SYMBOL_HASHSIZE];
8.111 -
8.112 -static struct menu *current_menu, *current_entry;
8.113 -
8.114 -#define YYDEBUG 0
8.115 -#if YYDEBUG
8.116 -#define YYERROR_VERBOSE
8.117 -#endif
8.118 -
8.119 -
8.120 -
8.121 -/* Enabling traces. */
8.122 -#ifndef YYDEBUG
8.123 -# define YYDEBUG 0
8.124 -#endif
8.125 -
8.126 -/* Enabling verbose error messages. */
8.127 -#ifdef YYERROR_VERBOSE
8.128 -# undef YYERROR_VERBOSE
8.129 -# define YYERROR_VERBOSE 1
8.130 -#else
8.131 -# define YYERROR_VERBOSE 0
8.132 -#endif
8.133 -
8.134 -/* Enabling the token table. */
8.135 -#ifndef YYTOKEN_TABLE
8.136 -# define YYTOKEN_TABLE 0
8.137 -#endif
8.138 -
8.139 -
8.140 -/* Tokens. */
8.141 -#ifndef YYTOKENTYPE
8.142 -# define YYTOKENTYPE
8.143 - /* Put the tokens into the symbol table, so that GDB and other debuggers
8.144 - know about them. */
8.145 - enum yytokentype {
8.146 - T_MAINMENU = 258,
8.147 - T_MENU = 259,
8.148 - T_ENDMENU = 260,
8.149 - T_SOURCE = 261,
8.150 - T_CHOICE = 262,
8.151 - T_ENDCHOICE = 263,
8.152 - T_COMMENT = 264,
8.153 - T_CONFIG = 265,
8.154 - T_MENUCONFIG = 266,
8.155 - T_HELP = 267,
8.156 - T_HELPTEXT = 268,
8.157 - T_IF = 269,
8.158 - T_ENDIF = 270,
8.159 - T_DEPENDS = 271,
8.160 - T_OPTIONAL = 272,
8.161 - T_PROMPT = 273,
8.162 - T_TYPE = 274,
8.163 - T_DEFAULT = 275,
8.164 - T_SELECT = 276,
8.165 - T_RANGE = 277,
8.166 - T_VISIBLE = 278,
8.167 - T_OPTION = 279,
8.168 - T_ON = 280,
8.169 - T_WORD = 281,
8.170 - T_WORD_QUOTE = 282,
8.171 - T_UNEQUAL = 283,
8.172 - T_CLOSE_PAREN = 284,
8.173 - T_OPEN_PAREN = 285,
8.174 - T_EOL = 286,
8.175 - T_OR = 287,
8.176 - T_AND = 288,
8.177 - T_EQUAL = 289,
8.178 - T_NOT = 290
8.179 - };
8.180 -#endif
8.181 -
8.182 -
8.183 -
8.184 -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
8.185 -typedef union YYSTYPE
8.186 -{
8.187 -
8.188 -
8.189 - char *string;
8.190 - struct file *file;
8.191 - struct symbol *symbol;
8.192 - struct expr *expr;
8.193 - struct menu *menu;
8.194 - struct kconf_id *id;
8.195 -
8.196 -
8.197 -
8.198 -} YYSTYPE;
8.199 -# define YYSTYPE_IS_TRIVIAL 1
8.200 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
8.201 -# define YYSTYPE_IS_DECLARED 1
8.202 -#endif
8.203 -
8.204 -
8.205 -/* Copy the second part of user declarations. */
8.206 -
8.207 -
8.208 -/* Include zconf.hash.c here so it can see the token constants. */
8.209 -#include "zconf.hash.c"
8.210 -
8.211 -
8.212 -
8.213 -#ifdef short
8.214 -# undef short
8.215 -#endif
8.216 -
8.217 -#ifdef YYTYPE_UINT8
8.218 -typedef YYTYPE_UINT8 yytype_uint8;
8.219 -#else
8.220 -typedef unsigned char yytype_uint8;
8.221 -#endif
8.222 -
8.223 -#ifdef YYTYPE_INT8
8.224 -typedef YYTYPE_INT8 yytype_int8;
8.225 -#elif (defined __STDC__ || defined __C99__FUNC__ \
8.226 - || defined __cplusplus || defined _MSC_VER)
8.227 -typedef signed char yytype_int8;
8.228 -#else
8.229 -typedef short int yytype_int8;
8.230 -#endif
8.231 -
8.232 -#ifdef YYTYPE_UINT16
8.233 -typedef YYTYPE_UINT16 yytype_uint16;
8.234 -#else
8.235 -typedef unsigned short int yytype_uint16;
8.236 -#endif
8.237 -
8.238 -#ifdef YYTYPE_INT16
8.239 -typedef YYTYPE_INT16 yytype_int16;
8.240 -#else
8.241 -typedef short int yytype_int16;
8.242 -#endif
8.243 -
8.244 -#ifndef YYSIZE_T
8.245 -# ifdef __SIZE_TYPE__
8.246 -# define YYSIZE_T __SIZE_TYPE__
8.247 -# elif defined size_t
8.248 -# define YYSIZE_T size_t
8.249 -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
8.250 - || defined __cplusplus || defined _MSC_VER)
8.251 -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
8.252 -# define YYSIZE_T size_t
8.253 -# else
8.254 -# define YYSIZE_T unsigned int
8.255 -# endif
8.256 -#endif
8.257 -
8.258 -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
8.259 -
8.260 -#ifndef YY_
8.261 -# if YYENABLE_NLS
8.262 -# if ENABLE_NLS
8.263 -# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
8.264 -# define YY_(msgid) dgettext ("bison-runtime", msgid)
8.265 -# endif
8.266 -# endif
8.267 -# ifndef YY_
8.268 -# define YY_(msgid) msgid
8.269 -# endif
8.270 -#endif
8.271 -
8.272 -/* Suppress unused-variable warnings by "using" E. */
8.273 -#if ! defined lint || defined __GNUC__
8.274 -# define YYUSE(e) ((void) (e))
8.275 -#else
8.276 -# define YYUSE(e) /* empty */
8.277 -#endif
8.278 -
8.279 -/* Identity function, used to suppress warnings about constant conditions. */
8.280 -#ifndef lint
8.281 -# define YYID(n) (n)
8.282 -#else
8.283 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.284 - || defined __cplusplus || defined _MSC_VER)
8.285 -static int
8.286 -YYID (int yyi)
8.287 -#else
8.288 -static int
8.289 -YYID (yyi)
8.290 - int yyi;
8.291 -#endif
8.292 -{
8.293 - return yyi;
8.294 -}
8.295 -#endif
8.296 -
8.297 -#if ! defined yyoverflow || YYERROR_VERBOSE
8.298 -
8.299 -/* The parser invokes alloca or malloc; define the necessary symbols. */
8.300 -
8.301 -# ifdef YYSTACK_USE_ALLOCA
8.302 -# if YYSTACK_USE_ALLOCA
8.303 -# ifdef __GNUC__
8.304 -# define YYSTACK_ALLOC __builtin_alloca
8.305 -# elif defined __BUILTIN_VA_ARG_INCR
8.306 -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
8.307 -# elif defined _AIX
8.308 -# define YYSTACK_ALLOC __alloca
8.309 -# elif defined _MSC_VER
8.310 -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
8.311 -# define alloca _alloca
8.312 -# else
8.313 -# define YYSTACK_ALLOC alloca
8.314 -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
8.315 - || defined __cplusplus || defined _MSC_VER)
8.316 -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
8.317 -# ifndef _STDLIB_H
8.318 -# define _STDLIB_H 1
8.319 -# endif
8.320 -# endif
8.321 -# endif
8.322 -# endif
8.323 -# endif
8.324 -
8.325 -# ifdef YYSTACK_ALLOC
8.326 - /* Pacify GCC's `empty if-body' warning. */
8.327 -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
8.328 -# ifndef YYSTACK_ALLOC_MAXIMUM
8.329 - /* The OS might guarantee only one guard page at the bottom of the stack,
8.330 - and a page size can be as small as 4096 bytes. So we cannot safely
8.331 - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
8.332 - to allow for a few compiler-allocated temporary stack slots. */
8.333 -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
8.334 -# endif
8.335 -# else
8.336 -# define YYSTACK_ALLOC YYMALLOC
8.337 -# define YYSTACK_FREE YYFREE
8.338 -# ifndef YYSTACK_ALLOC_MAXIMUM
8.339 -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
8.340 -# endif
8.341 -# if (defined __cplusplus && ! defined _STDLIB_H \
8.342 - && ! ((defined YYMALLOC || defined malloc) \
8.343 - && (defined YYFREE || defined free)))
8.344 -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
8.345 -# ifndef _STDLIB_H
8.346 -# define _STDLIB_H 1
8.347 -# endif
8.348 -# endif
8.349 -# ifndef YYMALLOC
8.350 -# define YYMALLOC malloc
8.351 -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
8.352 - || defined __cplusplus || defined _MSC_VER)
8.353 -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
8.354 -# endif
8.355 -# endif
8.356 -# ifndef YYFREE
8.357 -# define YYFREE free
8.358 -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
8.359 - || defined __cplusplus || defined _MSC_VER)
8.360 -void free (void *); /* INFRINGES ON USER NAME SPACE */
8.361 -# endif
8.362 -# endif
8.363 -# endif
8.364 -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
8.365 -
8.366 -
8.367 -#if (! defined yyoverflow \
8.368 - && (! defined __cplusplus \
8.369 - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
8.370 -
8.371 -/* A type that is properly aligned for any stack member. */
8.372 -union yyalloc
8.373 -{
8.374 - yytype_int16 yyss_alloc;
8.375 - YYSTYPE yyvs_alloc;
8.376 -};
8.377 -
8.378 -/* The size of the maximum gap between one aligned stack and the next. */
8.379 -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
8.380 -
8.381 -/* The size of an array large to enough to hold all stacks, each with
8.382 - N elements. */
8.383 -# define YYSTACK_BYTES(N) \
8.384 - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
8.385 - + YYSTACK_GAP_MAXIMUM)
8.386 -
8.387 -/* Copy COUNT objects from FROM to TO. The source and destination do
8.388 - not overlap. */
8.389 -# ifndef YYCOPY
8.390 -# if defined __GNUC__ && 1 < __GNUC__
8.391 -# define YYCOPY(To, From, Count) \
8.392 - __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
8.393 -# else
8.394 -# define YYCOPY(To, From, Count) \
8.395 - do \
8.396 - { \
8.397 - YYSIZE_T yyi; \
8.398 - for (yyi = 0; yyi < (Count); yyi++) \
8.399 - (To)[yyi] = (From)[yyi]; \
8.400 - } \
8.401 - while (YYID (0))
8.402 -# endif
8.403 -# endif
8.404 -
8.405 -/* Relocate STACK from its old location to the new one. The
8.406 - local variables YYSIZE and YYSTACKSIZE give the old and new number of
8.407 - elements in the stack, and YYPTR gives the new location of the
8.408 - stack. Advance YYPTR to a properly aligned location for the next
8.409 - stack. */
8.410 -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
8.411 - do \
8.412 - { \
8.413 - YYSIZE_T yynewbytes; \
8.414 - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
8.415 - Stack = &yyptr->Stack_alloc; \
8.416 - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
8.417 - yyptr += yynewbytes / sizeof (*yyptr); \
8.418 - } \
8.419 - while (YYID (0))
8.420 -
8.421 -#endif
8.422 -
8.423 -/* YYFINAL -- State number of the termination state. */
8.424 -#define YYFINAL 11
8.425 -/* YYLAST -- Last index in YYTABLE. */
8.426 -#define YYLAST 290
8.427 -
8.428 -/* YYNTOKENS -- Number of terminals. */
8.429 -#define YYNTOKENS 36
8.430 -/* YYNNTS -- Number of nonterminals. */
8.431 -#define YYNNTS 50
8.432 -/* YYNRULES -- Number of rules. */
8.433 -#define YYNRULES 118
8.434 -/* YYNRULES -- Number of states. */
8.435 -#define YYNSTATES 191
8.436 -
8.437 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
8.438 -#define YYUNDEFTOK 2
8.439 -#define YYMAXUTOK 290
8.440 -
8.441 -#define YYTRANSLATE(YYX) \
8.442 - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
8.443 -
8.444 -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
8.445 -static const yytype_uint8 yytranslate[] =
8.446 -{
8.447 - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.448 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.449 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.450 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.451 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.452 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.453 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.454 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.455 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.456 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.457 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.458 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.459 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.460 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.461 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.462 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.463 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.464 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.465 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.466 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.467 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.468 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.469 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.470 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.471 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8.472 - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
8.473 - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
8.474 - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
8.475 - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
8.476 - 35
8.477 -};
8.478 -
8.479 -#if YYDEBUG
8.480 -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
8.481 - YYRHS. */
8.482 -static const yytype_uint16 yyprhs[] =
8.483 -{
8.484 - 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
8.485 - 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
8.486 - 52, 54, 56, 58, 60, 62, 64, 66, 68, 72,
8.487 - 75, 79, 82, 86, 89, 90, 93, 96, 99, 102,
8.488 - 105, 108, 112, 117, 122, 127, 133, 137, 138, 142,
8.489 - 143, 146, 150, 153, 155, 159, 160, 163, 166, 169,
8.490 - 172, 175, 180, 184, 187, 192, 193, 196, 200, 202,
8.491 - 206, 207, 210, 213, 216, 220, 224, 228, 230, 234,
8.492 - 235, 238, 241, 244, 248, 252, 255, 258, 261, 262,
8.493 - 265, 268, 271, 276, 277, 280, 283, 286, 287, 290,
8.494 - 292, 294, 297, 300, 303, 305, 308, 309, 312, 314,
8.495 - 318, 322, 326, 329, 333, 337, 339, 341, 342
8.496 -};
8.497 -
8.498 -/* YYRHS -- A `-1'-separated list of the rules' RHS. */
8.499 -static const yytype_int8 yyrhs[] =
8.500 -{
8.501 - 37, 0, -1, 81, 38, -1, 38, -1, 63, 39,
8.502 - -1, 39, -1, -1, 39, 41, -1, 39, 55, -1,
8.503 - 39, 67, -1, 39, 80, -1, 39, 26, 1, 31,
8.504 - -1, 39, 40, 1, 31, -1, 39, 1, 31, -1,
8.505 - 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
8.506 - 22, -1, 20, -1, 23, -1, 31, -1, 61, -1,
8.507 - 71, -1, 44, -1, 46, -1, 69, -1, 26, 1,
8.508 - 31, -1, 1, 31, -1, 10, 26, 31, -1, 43,
8.509 - 47, -1, 11, 26, 31, -1, 45, 47, -1, -1,
8.510 - 47, 48, -1, 47, 49, -1, 47, 75, -1, 47,
8.511 - 73, -1, 47, 42, -1, 47, 31, -1, 19, 78,
8.512 - 31, -1, 18, 79, 82, 31, -1, 20, 83, 82,
8.513 - 31, -1, 21, 26, 82, 31, -1, 22, 84, 84,
8.514 - 82, 31, -1, 24, 50, 31, -1, -1, 50, 26,
8.515 - 51, -1, -1, 34, 79, -1, 7, 85, 31, -1,
8.516 - 52, 56, -1, 80, -1, 53, 58, 54, -1, -1,
8.517 - 56, 57, -1, 56, 75, -1, 56, 73, -1, 56,
8.518 - 31, -1, 56, 42, -1, 18, 79, 82, 31, -1,
8.519 - 19, 78, 31, -1, 17, 31, -1, 20, 26, 82,
8.520 - 31, -1, -1, 58, 41, -1, 14, 83, 81, -1,
8.521 - 80, -1, 59, 62, 60, -1, -1, 62, 41, -1,
8.522 - 62, 67, -1, 62, 55, -1, 3, 79, 81, -1,
8.523 - 4, 79, 31, -1, 64, 76, 74, -1, 80, -1,
8.524 - 65, 68, 66, -1, -1, 68, 41, -1, 68, 67,
8.525 - -1, 68, 55, -1, 6, 79, 31, -1, 9, 79,
8.526 - 31, -1, 70, 74, -1, 12, 31, -1, 72, 13,
8.527 - -1, -1, 74, 75, -1, 74, 31, -1, 74, 42,
8.528 - -1, 16, 25, 83, 31, -1, -1, 76, 77, -1,
8.529 - 76, 31, -1, 23, 82, -1, -1, 79, 82, -1,
8.530 - 26, -1, 27, -1, 5, 31, -1, 8, 31, -1,
8.531 - 15, 31, -1, 31, -1, 81, 31, -1, -1, 14,
8.532 - 83, -1, 84, -1, 84, 34, 84, -1, 84, 28,
8.533 - 84, -1, 30, 83, 29, -1, 35, 83, -1, 83,
8.534 - 32, 83, -1, 83, 33, 83, -1, 26, -1, 27,
8.535 - -1, -1, 26, -1
8.536 -};
8.537 -
8.538 -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
8.539 -static const yytype_uint16 yyrline[] =
8.540 -{
8.541 - 0, 108, 108, 108, 110, 110, 112, 114, 115, 116,
8.542 - 117, 118, 119, 123, 127, 127, 127, 127, 127, 127,
8.543 - 127, 127, 131, 132, 133, 134, 135, 136, 140, 141,
8.544 - 147, 155, 161, 169, 179, 181, 182, 183, 184, 185,
8.545 - 186, 189, 197, 203, 213, 219, 225, 228, 230, 241,
8.546 - 242, 247, 256, 261, 269, 272, 274, 275, 276, 277,
8.547 - 278, 281, 287, 298, 304, 314, 316, 321, 329, 337,
8.548 - 340, 342, 343, 344, 349, 356, 363, 368, 376, 379,
8.549 - 381, 382, 383, 386, 394, 401, 408, 414, 421, 423,
8.550 - 424, 425, 428, 436, 438, 439, 442, 449, 451, 456,
8.551 - 457, 460, 461, 462, 466, 467, 470, 471, 474, 475,
8.552 - 476, 477, 478, 479, 480, 483, 484, 487, 488
8.553 -};
8.554 -#endif
8.555 -
8.556 -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
8.557 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
8.558 - First, the terminals, then, starting at YYNTOKENS, nonterminals. */
8.559 -static const char *const yytname[] =
8.560 -{
8.561 - "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
8.562 - "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
8.563 - "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
8.564 - "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
8.565 - "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
8.566 - "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
8.567 - "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
8.568 - "common_stmt", "option_error", "config_entry_start", "config_stmt",
8.569 - "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
8.570 - "config_option", "symbol_option", "symbol_option_list",
8.571 - "symbol_option_arg", "choice", "choice_entry", "choice_end",
8.572 - "choice_stmt", "choice_option_list", "choice_option", "choice_block",
8.573 - "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
8.574 - "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
8.575 - "comment", "comment_stmt", "help_start", "help", "depends_list",
8.576 - "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
8.577 - "end", "nl", "if_expr", "expr", "symbol", "word_opt", 0
8.578 -};
8.579 -#endif
8.580 -
8.581 -# ifdef YYPRINT
8.582 -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
8.583 - token YYLEX-NUM. */
8.584 -static const yytype_uint16 yytoknum[] =
8.585 -{
8.586 - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
8.587 - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
8.588 - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
8.589 - 285, 286, 287, 288, 289, 290
8.590 -};
8.591 -# endif
8.592 -
8.593 -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
8.594 -static const yytype_uint8 yyr1[] =
8.595 -{
8.596 - 0, 36, 37, 37, 38, 38, 39, 39, 39, 39,
8.597 - 39, 39, 39, 39, 40, 40, 40, 40, 40, 40,
8.598 - 40, 40, 41, 41, 41, 41, 41, 41, 42, 42,
8.599 - 43, 44, 45, 46, 47, 47, 47, 47, 47, 47,
8.600 - 47, 48, 48, 48, 48, 48, 49, 50, 50, 51,
8.601 - 51, 52, 53, 54, 55, 56, 56, 56, 56, 56,
8.602 - 56, 57, 57, 57, 57, 58, 58, 59, 60, 61,
8.603 - 62, 62, 62, 62, 63, 64, 65, 66, 67, 68,
8.604 - 68, 68, 68, 69, 70, 71, 72, 73, 74, 74,
8.605 - 74, 74, 75, 76, 76, 76, 77, 78, 78, 79,
8.606 - 79, 80, 80, 80, 81, 81, 82, 82, 83, 83,
8.607 - 83, 83, 83, 83, 83, 84, 84, 85, 85
8.608 -};
8.609 -
8.610 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
8.611 -static const yytype_uint8 yyr2[] =
8.612 -{
8.613 - 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
8.614 - 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
8.615 - 1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
8.616 - 3, 2, 3, 2, 0, 2, 2, 2, 2, 2,
8.617 - 2, 3, 4, 4, 4, 5, 3, 0, 3, 0,
8.618 - 2, 3, 2, 1, 3, 0, 2, 2, 2, 2,
8.619 - 2, 4, 3, 2, 4, 0, 2, 3, 1, 3,
8.620 - 0, 2, 2, 2, 3, 3, 3, 1, 3, 0,
8.621 - 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
8.622 - 2, 2, 4, 0, 2, 2, 2, 0, 2, 1,
8.623 - 1, 2, 2, 2, 1, 2, 0, 2, 1, 3,
8.624 - 3, 3, 2, 3, 3, 1, 1, 0, 1
8.625 -};
8.626 -
8.627 -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
8.628 - STATE-NUM when YYTABLE doesn't specify something else to do. Zero
8.629 - means the default is an error. */
8.630 -static const yytype_uint8 yydefact[] =
8.631 -{
8.632 - 6, 0, 104, 0, 3, 0, 6, 6, 99, 100,
8.633 - 0, 1, 0, 0, 0, 0, 117, 0, 0, 0,
8.634 - 0, 0, 0, 14, 18, 15, 16, 20, 17, 19,
8.635 - 21, 0, 22, 0, 7, 34, 25, 34, 26, 55,
8.636 - 65, 8, 70, 23, 93, 79, 9, 27, 88, 24,
8.637 - 10, 0, 105, 2, 74, 13, 0, 101, 0, 118,
8.638 - 0, 102, 0, 0, 0, 115, 116, 0, 0, 0,
8.639 - 108, 103, 0, 0, 0, 0, 0, 0, 0, 88,
8.640 - 0, 0, 75, 83, 51, 84, 30, 32, 0, 112,
8.641 - 0, 0, 67, 0, 0, 11, 12, 0, 0, 0,
8.642 - 0, 97, 0, 0, 0, 47, 0, 40, 39, 35,
8.643 - 36, 0, 38, 37, 0, 0, 97, 0, 59, 60,
8.644 - 56, 58, 57, 66, 54, 53, 71, 73, 69, 72,
8.645 - 68, 106, 95, 0, 94, 80, 82, 78, 81, 77,
8.646 - 90, 91, 89, 111, 113, 114, 110, 109, 29, 86,
8.647 - 0, 106, 0, 106, 106, 106, 0, 0, 0, 87,
8.648 - 63, 106, 0, 106, 0, 96, 0, 0, 41, 98,
8.649 - 0, 0, 106, 49, 46, 28, 0, 62, 0, 107,
8.650 - 92, 42, 43, 44, 0, 0, 48, 61, 64, 45,
8.651 - 50
8.652 -};
8.653 -
8.654 -/* YYDEFGOTO[NTERM-NUM]. */
8.655 -static const yytype_int16 yydefgoto[] =
8.656 -{
8.657 - -1, 3, 4, 5, 33, 34, 108, 35, 36, 37,
8.658 - 38, 74, 109, 110, 157, 186, 39, 40, 124, 41,
8.659 - 76, 120, 77, 42, 128, 43, 78, 6, 44, 45,
8.660 - 137, 46, 80, 47, 48, 49, 111, 112, 81, 113,
8.661 - 79, 134, 152, 153, 50, 7, 165, 69, 70, 60
8.662 -};
8.663 -
8.664 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
8.665 - STATE-NUM. */
8.666 -#define YYPACT_NINF -90
8.667 -static const yytype_int16 yypact[] =
8.668 -{
8.669 - 4, 42, -90, 96, -90, 111, -90, 15, -90, -90,
8.670 - 75, -90, 82, 42, 104, 42, 110, 107, 42, 115,
8.671 - 125, -4, 121, -90, -90, -90, -90, -90, -90, -90,
8.672 - -90, 162, -90, 163, -90, -90, -90, -90, -90, -90,
8.673 - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
8.674 - -90, 139, -90, -90, 138, -90, 142, -90, 143, -90,
8.675 - 152, -90, 164, 167, 168, -90, -90, -4, -4, 77,
8.676 - -18, -90, 177, 185, 33, 71, 195, 247, 236, -2,
8.677 - 236, 171, -90, -90, -90, -90, -90, -90, 41, -90,
8.678 - -4, -4, 138, 97, 97, -90, -90, 186, 187, 194,
8.679 - 42, 42, -4, 196, 97, -90, 219, -90, -90, -90,
8.680 - -90, 210, -90, -90, 204, 42, 42, 199, -90, -90,
8.681 - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
8.682 - -90, 222, -90, 223, -90, -90, -90, -90, -90, -90,
8.683 - -90, -90, -90, -90, 215, -90, -90, -90, -90, -90,
8.684 - -4, 222, 228, 222, -5, 222, 97, 35, 229, -90,
8.685 - -90, 222, 232, 222, -4, -90, 135, 233, -90, -90,
8.686 - 234, 235, 222, 240, -90, -90, 237, -90, 239, -13,
8.687 - -90, -90, -90, -90, 244, 42, -90, -90, -90, -90,
8.688 - -90
8.689 -};
8.690 -
8.691 -/* YYPGOTO[NTERM-NUM]. */
8.692 -static const yytype_int16 yypgoto[] =
8.693 -{
8.694 - -90, -90, 269, 271, -90, 23, -70, -90, -90, -90,
8.695 - -90, 243, -90, -90, -90, -90, -90, -90, -90, -48,
8.696 - -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
8.697 - -90, -20, -90, -90, -90, -90, -90, 206, 205, -68,
8.698 - -90, -90, 169, -1, 27, -7, 118, -66, -89, -90
8.699 -};
8.700 -
8.701 -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
8.702 - positive, shift that token. If negative, reduce the rule which
8.703 - number is the opposite. If zero, do what YYDEFACT says.
8.704 - If YYTABLE_NINF, syntax error. */
8.705 -#define YYTABLE_NINF -86
8.706 -static const yytype_int16 yytable[] =
8.707 -{
8.708 - 10, 88, 89, 54, 146, 147, 119, 1, 122, 164,
8.709 - 93, 141, 56, 142, 58, 156, 94, 62, 1, 90,
8.710 - 91, 131, 65, 66, 144, 145, 67, 90, 91, 132,
8.711 - 127, 68, 136, -31, 97, 2, 154, -31, -31, -31,
8.712 - -31, -31, -31, -31, -31, 98, 52, -31, -31, 99,
8.713 - -31, 100, 101, 102, 103, 104, -31, 105, 129, 106,
8.714 - 138, 173, 92, 141, 107, 142, 174, 172, 8, 9,
8.715 - 143, -33, 97, 90, 91, -33, -33, -33, -33, -33,
8.716 - -33, -33, -33, 98, 166, -33, -33, 99, -33, 100,
8.717 - 101, 102, 103, 104, -33, 105, 11, 106, 179, 151,
8.718 - 123, 126, 107, 135, 125, 130, 2, 139, 2, 90,
8.719 - 91, -5, 12, 55, 161, 13, 14, 15, 16, 17,
8.720 - 18, 19, 20, 65, 66, 21, 22, 23, 24, 25,
8.721 - 26, 27, 28, 29, 30, 57, 59, 31, 61, -4,
8.722 - 12, 63, 32, 13, 14, 15, 16, 17, 18, 19,
8.723 - 20, 64, 71, 21, 22, 23, 24, 25, 26, 27,
8.724 - 28, 29, 30, 72, 73, 31, 180, 90, 91, 52,
8.725 - 32, -85, 97, 82, 83, -85, -85, -85, -85, -85,
8.726 - -85, -85, -85, 84, 190, -85, -85, 99, -85, -85,
8.727 - -85, -85, -85, -85, -85, 85, 97, 106, 86, 87,
8.728 - -52, -52, 140, -52, -52, -52, -52, 98, 95, -52,
8.729 - -52, 99, 114, 115, 116, 117, 96, 148, 149, 150,
8.730 - 158, 106, 155, 159, 97, 163, 118, -76, -76, -76,
8.731 - -76, -76, -76, -76, -76, 160, 164, -76, -76, 99,
8.732 - 13, 14, 15, 16, 17, 18, 19, 20, 91, 106,
8.733 - 21, 22, 14, 15, 140, 17, 18, 19, 20, 168,
8.734 - 175, 21, 22, 177, 181, 182, 183, 32, 187, 167,
8.735 - 188, 169, 170, 171, 185, 189, 53, 51, 32, 176,
8.736 - 75, 178, 121, 0, 133, 162, 0, 0, 0, 0,
8.737 - 184
8.738 -};
8.739 -
8.740 -static const yytype_int16 yycheck[] =
8.741 -{
8.742 - 1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
8.743 - 28, 81, 13, 81, 15, 104, 34, 18, 3, 32,
8.744 - 33, 23, 26, 27, 90, 91, 30, 32, 33, 31,
8.745 - 78, 35, 80, 0, 1, 31, 102, 4, 5, 6,
8.746 - 7, 8, 9, 10, 11, 12, 31, 14, 15, 16,
8.747 - 17, 18, 19, 20, 21, 22, 23, 24, 78, 26,
8.748 - 80, 26, 69, 133, 31, 133, 31, 156, 26, 27,
8.749 - 29, 0, 1, 32, 33, 4, 5, 6, 7, 8,
8.750 - 9, 10, 11, 12, 150, 14, 15, 16, 17, 18,
8.751 - 19, 20, 21, 22, 23, 24, 0, 26, 164, 100,
8.752 - 77, 78, 31, 80, 77, 78, 31, 80, 31, 32,
8.753 - 33, 0, 1, 31, 115, 4, 5, 6, 7, 8,
8.754 - 9, 10, 11, 26, 27, 14, 15, 16, 17, 18,
8.755 - 19, 20, 21, 22, 23, 31, 26, 26, 31, 0,
8.756 - 1, 26, 31, 4, 5, 6, 7, 8, 9, 10,
8.757 - 11, 26, 31, 14, 15, 16, 17, 18, 19, 20,
8.758 - 21, 22, 23, 1, 1, 26, 31, 32, 33, 31,
8.759 - 31, 0, 1, 31, 31, 4, 5, 6, 7, 8,
8.760 - 9, 10, 11, 31, 185, 14, 15, 16, 17, 18,
8.761 - 19, 20, 21, 22, 23, 31, 1, 26, 31, 31,
8.762 - 5, 6, 31, 8, 9, 10, 11, 12, 31, 14,
8.763 - 15, 16, 17, 18, 19, 20, 31, 31, 31, 25,
8.764 - 1, 26, 26, 13, 1, 26, 31, 4, 5, 6,
8.765 - 7, 8, 9, 10, 11, 31, 14, 14, 15, 16,
8.766 - 4, 5, 6, 7, 8, 9, 10, 11, 33, 26,
8.767 - 14, 15, 5, 6, 31, 8, 9, 10, 11, 31,
8.768 - 31, 14, 15, 31, 31, 31, 31, 31, 31, 151,
8.769 - 31, 153, 154, 155, 34, 31, 7, 6, 31, 161,
8.770 - 37, 163, 76, -1, 79, 116, -1, -1, -1, -1,
8.771 - 172
8.772 -};
8.773 -
8.774 -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
8.775 - symbol of state STATE-NUM. */
8.776 -static const yytype_uint8 yystos[] =
8.777 -{
8.778 - 0, 3, 31, 37, 38, 39, 63, 81, 26, 27,
8.779 - 79, 0, 1, 4, 5, 6, 7, 8, 9, 10,
8.780 - 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
8.781 - 23, 26, 31, 40, 41, 43, 44, 45, 46, 52,
8.782 - 53, 55, 59, 61, 64, 65, 67, 69, 70, 71,
8.783 - 80, 39, 31, 38, 81, 31, 79, 31, 79, 26,
8.784 - 85, 31, 79, 26, 26, 26, 27, 30, 35, 83,
8.785 - 84, 31, 1, 1, 47, 47, 56, 58, 62, 76,
8.786 - 68, 74, 31, 31, 31, 31, 31, 31, 83, 83,
8.787 - 32, 33, 81, 28, 34, 31, 31, 1, 12, 16,
8.788 - 18, 19, 20, 21, 22, 24, 26, 31, 42, 48,
8.789 - 49, 72, 73, 75, 17, 18, 19, 20, 31, 42,
8.790 - 57, 73, 75, 41, 54, 80, 41, 55, 60, 67,
8.791 - 80, 23, 31, 74, 77, 41, 55, 66, 67, 80,
8.792 - 31, 42, 75, 29, 83, 83, 84, 84, 31, 31,
8.793 - 25, 79, 78, 79, 83, 26, 84, 50, 1, 13,
8.794 - 31, 79, 78, 26, 14, 82, 83, 82, 31, 82,
8.795 - 82, 82, 84, 26, 31, 31, 82, 31, 82, 83,
8.796 - 31, 31, 31, 31, 82, 34, 51, 31, 31, 31,
8.797 - 79
8.798 -};
8.799 -
8.800 -#define yyerrok (yyerrstatus = 0)
8.801 -#define yyclearin (yychar = YYEMPTY)
8.802 -#define YYEMPTY (-2)
8.803 -#define YYEOF 0
8.804 -
8.805 -#define YYACCEPT goto yyacceptlab
8.806 -#define YYABORT goto yyabortlab
8.807 -#define YYERROR goto yyerrorlab
8.808 -
8.809 -
8.810 -/* Like YYERROR except do call yyerror. This remains here temporarily
8.811 - to ease the transition to the new meaning of YYERROR, for GCC.
8.812 - Once GCC version 2 has supplanted version 1, this can go. */
8.813 -
8.814 -#define YYFAIL goto yyerrlab
8.815 -
8.816 -#define YYRECOVERING() (!!yyerrstatus)
8.817 -
8.818 -#define YYBACKUP(Token, Value) \
8.819 -do \
8.820 - if (yychar == YYEMPTY && yylen == 1) \
8.821 - { \
8.822 - yychar = (Token); \
8.823 - yylval = (Value); \
8.824 - yytoken = YYTRANSLATE (yychar); \
8.825 - YYPOPSTACK (1); \
8.826 - goto yybackup; \
8.827 - } \
8.828 - else \
8.829 - { \
8.830 - yyerror (YY_("syntax error: cannot back up")); \
8.831 - YYERROR; \
8.832 - } \
8.833 -while (YYID (0))
8.834 -
8.835 -
8.836 -#define YYTERROR 1
8.837 -#define YYERRCODE 256
8.838 -
8.839 -
8.840 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
8.841 - If N is 0, then set CURRENT to the empty location which ends
8.842 - the previous symbol: RHS[0] (always defined). */
8.843 -
8.844 -#define YYRHSLOC(Rhs, K) ((Rhs)[K])
8.845 -#ifndef YYLLOC_DEFAULT
8.846 -# define YYLLOC_DEFAULT(Current, Rhs, N) \
8.847 - do \
8.848 - if (YYID (N)) \
8.849 - { \
8.850 - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
8.851 - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
8.852 - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
8.853 - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
8.854 - } \
8.855 - else \
8.856 - { \
8.857 - (Current).first_line = (Current).last_line = \
8.858 - YYRHSLOC (Rhs, 0).last_line; \
8.859 - (Current).first_column = (Current).last_column = \
8.860 - YYRHSLOC (Rhs, 0).last_column; \
8.861 - } \
8.862 - while (YYID (0))
8.863 -#endif
8.864 -
8.865 -
8.866 -/* YY_LOCATION_PRINT -- Print the location on the stream.
8.867 - This macro was not mandated originally: define only if we know
8.868 - we won't break user code: when these are the locations we know. */
8.869 -
8.870 -#ifndef YY_LOCATION_PRINT
8.871 -# if YYLTYPE_IS_TRIVIAL
8.872 -# define YY_LOCATION_PRINT(File, Loc) \
8.873 - fprintf (File, "%d.%d-%d.%d", \
8.874 - (Loc).first_line, (Loc).first_column, \
8.875 - (Loc).last_line, (Loc).last_column)
8.876 -# else
8.877 -# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
8.878 -# endif
8.879 -#endif
8.880 -
8.881 -
8.882 -/* YYLEX -- calling `yylex' with the right arguments. */
8.883 -
8.884 -#ifdef YYLEX_PARAM
8.885 -# define YYLEX yylex (YYLEX_PARAM)
8.886 -#else
8.887 -# define YYLEX yylex ()
8.888 -#endif
8.889 -
8.890 -/* Enable debugging if requested. */
8.891 -#if YYDEBUG
8.892 -
8.893 -# ifndef YYFPRINTF
8.894 -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
8.895 -# define YYFPRINTF fprintf
8.896 -# endif
8.897 -
8.898 -# define YYDPRINTF(Args) \
8.899 -do { \
8.900 - if (yydebug) \
8.901 - YYFPRINTF Args; \
8.902 -} while (YYID (0))
8.903 -
8.904 -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
8.905 -do { \
8.906 - if (yydebug) \
8.907 - { \
8.908 - YYFPRINTF (stderr, "%s ", Title); \
8.909 - yy_symbol_print (stderr, \
8.910 - Type, Value); \
8.911 - YYFPRINTF (stderr, "\n"); \
8.912 - } \
8.913 -} while (YYID (0))
8.914 -
8.915 -
8.916 -/*--------------------------------.
8.917 -| Print this symbol on YYOUTPUT. |
8.918 -`--------------------------------*/
8.919 -
8.920 -/*ARGSUSED*/
8.921 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.922 - || defined __cplusplus || defined _MSC_VER)
8.923 -static void
8.924 -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
8.925 -#else
8.926 -static void
8.927 -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
8.928 - FILE *yyoutput;
8.929 - int yytype;
8.930 - YYSTYPE const * const yyvaluep;
8.931 -#endif
8.932 -{
8.933 - if (!yyvaluep)
8.934 - return;
8.935 -# ifdef YYPRINT
8.936 - if (yytype < YYNTOKENS)
8.937 - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
8.938 -# else
8.939 - YYUSE (yyoutput);
8.940 -# endif
8.941 - switch (yytype)
8.942 - {
8.943 - default:
8.944 - break;
8.945 - }
8.946 -}
8.947 -
8.948 -
8.949 -/*--------------------------------.
8.950 -| Print this symbol on YYOUTPUT. |
8.951 -`--------------------------------*/
8.952 -
8.953 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.954 - || defined __cplusplus || defined _MSC_VER)
8.955 -static void
8.956 -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
8.957 -#else
8.958 -static void
8.959 -yy_symbol_print (yyoutput, yytype, yyvaluep)
8.960 - FILE *yyoutput;
8.961 - int yytype;
8.962 - YYSTYPE const * const yyvaluep;
8.963 -#endif
8.964 -{
8.965 - if (yytype < YYNTOKENS)
8.966 - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
8.967 - else
8.968 - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
8.969 -
8.970 - yy_symbol_value_print (yyoutput, yytype, yyvaluep);
8.971 - YYFPRINTF (yyoutput, ")");
8.972 -}
8.973 -
8.974 -/*------------------------------------------------------------------.
8.975 -| yy_stack_print -- Print the state stack from its BOTTOM up to its |
8.976 -| TOP (included). |
8.977 -`------------------------------------------------------------------*/
8.978 -
8.979 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.980 - || defined __cplusplus || defined _MSC_VER)
8.981 -static void
8.982 -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
8.983 -#else
8.984 -static void
8.985 -yy_stack_print (yybottom, yytop)
8.986 - yytype_int16 *yybottom;
8.987 - yytype_int16 *yytop;
8.988 -#endif
8.989 -{
8.990 - YYFPRINTF (stderr, "Stack now");
8.991 - for (; yybottom <= yytop; yybottom++)
8.992 - {
8.993 - int yybot = *yybottom;
8.994 - YYFPRINTF (stderr, " %d", yybot);
8.995 - }
8.996 - YYFPRINTF (stderr, "\n");
8.997 -}
8.998 -
8.999 -# define YY_STACK_PRINT(Bottom, Top) \
8.1000 -do { \
8.1001 - if (yydebug) \
8.1002 - yy_stack_print ((Bottom), (Top)); \
8.1003 -} while (YYID (0))
8.1004 -
8.1005 -
8.1006 -/*------------------------------------------------.
8.1007 -| Report that the YYRULE is going to be reduced. |
8.1008 -`------------------------------------------------*/
8.1009 -
8.1010 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.1011 - || defined __cplusplus || defined _MSC_VER)
8.1012 -static void
8.1013 -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
8.1014 -#else
8.1015 -static void
8.1016 -yy_reduce_print (yyvsp, yyrule)
8.1017 - YYSTYPE *yyvsp;
8.1018 - int yyrule;
8.1019 -#endif
8.1020 -{
8.1021 - int yynrhs = yyr2[yyrule];
8.1022 - int yyi;
8.1023 - unsigned long int yylno = yyrline[yyrule];
8.1024 - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
8.1025 - yyrule - 1, yylno);
8.1026 - /* The symbols being reduced. */
8.1027 - for (yyi = 0; yyi < yynrhs; yyi++)
8.1028 - {
8.1029 - YYFPRINTF (stderr, " $%d = ", yyi + 1);
8.1030 - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
8.1031 - &(yyvsp[(yyi + 1) - (yynrhs)])
8.1032 - );
8.1033 - YYFPRINTF (stderr, "\n");
8.1034 - }
8.1035 -}
8.1036 -
8.1037 -# define YY_REDUCE_PRINT(Rule) \
8.1038 -do { \
8.1039 - if (yydebug) \
8.1040 - yy_reduce_print (yyvsp, Rule); \
8.1041 -} while (YYID (0))
8.1042 -
8.1043 -/* Nonzero means print parse trace. It is left uninitialized so that
8.1044 - multiple parsers can coexist. */
8.1045 -int yydebug;
8.1046 -#else /* !YYDEBUG */
8.1047 -# define YYDPRINTF(Args)
8.1048 -# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
8.1049 -# define YY_STACK_PRINT(Bottom, Top)
8.1050 -# define YY_REDUCE_PRINT(Rule)
8.1051 -#endif /* !YYDEBUG */
8.1052 -
8.1053 -
8.1054 -/* YYINITDEPTH -- initial size of the parser's stacks. */
8.1055 -#ifndef YYINITDEPTH
8.1056 -# define YYINITDEPTH 200
8.1057 -#endif
8.1058 -
8.1059 -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
8.1060 - if the built-in stack extension method is used).
8.1061 -
8.1062 - Do not make this value too large; the results are undefined if
8.1063 - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
8.1064 - evaluated with infinite-precision integer arithmetic. */
8.1065 -
8.1066 -#ifndef YYMAXDEPTH
8.1067 -# define YYMAXDEPTH 10000
8.1068 -#endif
8.1069 -
8.1070 -
8.1071 -
8.1072 -#if YYERROR_VERBOSE
8.1073 -
8.1074 -# ifndef yystrlen
8.1075 -# if defined __GLIBC__ && defined _STRING_H
8.1076 -# define yystrlen strlen
8.1077 -# else
8.1078 -/* Return the length of YYSTR. */
8.1079 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.1080 - || defined __cplusplus || defined _MSC_VER)
8.1081 -static YYSIZE_T
8.1082 -yystrlen (const char *yystr)
8.1083 -#else
8.1084 -static YYSIZE_T
8.1085 -yystrlen (yystr)
8.1086 - const char *yystr;
8.1087 -#endif
8.1088 -{
8.1089 - YYSIZE_T yylen;
8.1090 - for (yylen = 0; yystr[yylen]; yylen++)
8.1091 - continue;
8.1092 - return yylen;
8.1093 -}
8.1094 -# endif
8.1095 -# endif
8.1096 -
8.1097 -# ifndef yystpcpy
8.1098 -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
8.1099 -# define yystpcpy stpcpy
8.1100 -# else
8.1101 -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
8.1102 - YYDEST. */
8.1103 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.1104 - || defined __cplusplus || defined _MSC_VER)
8.1105 -static char *
8.1106 -yystpcpy (char *yydest, const char *yysrc)
8.1107 -#else
8.1108 -static char *
8.1109 -yystpcpy (yydest, yysrc)
8.1110 - char *yydest;
8.1111 - const char *yysrc;
8.1112 -#endif
8.1113 -{
8.1114 - char *yyd = yydest;
8.1115 - const char *yys = yysrc;
8.1116 -
8.1117 - while ((*yyd++ = *yys++) != '\0')
8.1118 - continue;
8.1119 -
8.1120 - return yyd - 1;
8.1121 -}
8.1122 -# endif
8.1123 -# endif
8.1124 -
8.1125 -# ifndef yytnamerr
8.1126 -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
8.1127 - quotes and backslashes, so that it's suitable for yyerror. The
8.1128 - heuristic is that double-quoting is unnecessary unless the string
8.1129 - contains an apostrophe, a comma, or backslash (other than
8.1130 - backslash-backslash). YYSTR is taken from yytname. If YYRES is
8.1131 - null, do not copy; instead, return the length of what the result
8.1132 - would have been. */
8.1133 -static YYSIZE_T
8.1134 -yytnamerr (char *yyres, const char *yystr)
8.1135 -{
8.1136 - if (*yystr == '"')
8.1137 - {
8.1138 - YYSIZE_T yyn = 0;
8.1139 - char const *yyp = yystr;
8.1140 -
8.1141 - for (;;)
8.1142 - switch (*++yyp)
8.1143 - {
8.1144 - case '\'':
8.1145 - case ',':
8.1146 - goto do_not_strip_quotes;
8.1147 -
8.1148 - case '\\':
8.1149 - if (*++yyp != '\\')
8.1150 - goto do_not_strip_quotes;
8.1151 - /* Fall through. */
8.1152 - default:
8.1153 - if (yyres)
8.1154 - yyres[yyn] = *yyp;
8.1155 - yyn++;
8.1156 - break;
8.1157 -
8.1158 - case '"':
8.1159 - if (yyres)
8.1160 - yyres[yyn] = '\0';
8.1161 - return yyn;
8.1162 - }
8.1163 - do_not_strip_quotes: ;
8.1164 - }
8.1165 -
8.1166 - if (! yyres)
8.1167 - return yystrlen (yystr);
8.1168 -
8.1169 - return yystpcpy (yyres, yystr) - yyres;
8.1170 -}
8.1171 -# endif
8.1172 -
8.1173 -/* Copy into YYRESULT an error message about the unexpected token
8.1174 - YYCHAR while in state YYSTATE. Return the number of bytes copied,
8.1175 - including the terminating null byte. If YYRESULT is null, do not
8.1176 - copy anything; just return the number of bytes that would be
8.1177 - copied. As a special case, return 0 if an ordinary "syntax error"
8.1178 - message will do. Return YYSIZE_MAXIMUM if overflow occurs during
8.1179 - size calculation. */
8.1180 -static YYSIZE_T
8.1181 -yysyntax_error (char *yyresult, int yystate, int yychar)
8.1182 -{
8.1183 - int yyn = yypact[yystate];
8.1184 -
8.1185 - if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
8.1186 - return 0;
8.1187 - else
8.1188 - {
8.1189 - int yytype = YYTRANSLATE (yychar);
8.1190 - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
8.1191 - YYSIZE_T yysize = yysize0;
8.1192 - YYSIZE_T yysize1;
8.1193 - int yysize_overflow = 0;
8.1194 - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
8.1195 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
8.1196 - int yyx;
8.1197 -
8.1198 -# if 0
8.1199 - /* This is so xgettext sees the translatable formats that are
8.1200 - constructed on the fly. */
8.1201 - YY_("syntax error, unexpected %s");
8.1202 - YY_("syntax error, unexpected %s, expecting %s");
8.1203 - YY_("syntax error, unexpected %s, expecting %s or %s");
8.1204 - YY_("syntax error, unexpected %s, expecting %s or %s or %s");
8.1205 - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
8.1206 -# endif
8.1207 - char *yyfmt;
8.1208 - char const *yyf;
8.1209 - static char const yyunexpected[] = "syntax error, unexpected %s";
8.1210 - static char const yyexpecting[] = ", expecting %s";
8.1211 - static char const yyor[] = " or %s";
8.1212 - char yyformat[sizeof yyunexpected
8.1213 - + sizeof yyexpecting - 1
8.1214 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
8.1215 - * (sizeof yyor - 1))];
8.1216 - char const *yyprefix = yyexpecting;
8.1217 -
8.1218 - /* Start YYX at -YYN if negative to avoid negative indexes in
8.1219 - YYCHECK. */
8.1220 - int yyxbegin = yyn < 0 ? -yyn : 0;
8.1221 -
8.1222 - /* Stay within bounds of both yycheck and yytname. */
8.1223 - int yychecklim = YYLAST - yyn + 1;
8.1224 - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
8.1225 - int yycount = 1;
8.1226 -
8.1227 - yyarg[0] = yytname[yytype];
8.1228 - yyfmt = yystpcpy (yyformat, yyunexpected);
8.1229 -
8.1230 - for (yyx = yyxbegin; yyx < yyxend; ++yyx)
8.1231 - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
8.1232 - {
8.1233 - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
8.1234 - {
8.1235 - yycount = 1;
8.1236 - yysize = yysize0;
8.1237 - yyformat[sizeof yyunexpected - 1] = '\0';
8.1238 - break;
8.1239 - }
8.1240 - yyarg[yycount++] = yytname[yyx];
8.1241 - yysize1 = yysize + yytnamerr (0, yytname[yyx]);
8.1242 - yysize_overflow |= (yysize1 < yysize);
8.1243 - yysize = yysize1;
8.1244 - yyfmt = yystpcpy (yyfmt, yyprefix);
8.1245 - yyprefix = yyor;
8.1246 - }
8.1247 -
8.1248 - yyf = YY_(yyformat);
8.1249 - yysize1 = yysize + yystrlen (yyf);
8.1250 - yysize_overflow |= (yysize1 < yysize);
8.1251 - yysize = yysize1;
8.1252 -
8.1253 - if (yysize_overflow)
8.1254 - return YYSIZE_MAXIMUM;
8.1255 -
8.1256 - if (yyresult)
8.1257 - {
8.1258 - /* Avoid sprintf, as that infringes on the user's name space.
8.1259 - Don't have undefined behavior even if the translation
8.1260 - produced a string with the wrong number of "%s"s. */
8.1261 - char *yyp = yyresult;
8.1262 - int yyi = 0;
8.1263 - while ((*yyp = *yyf) != '\0')
8.1264 - {
8.1265 - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
8.1266 - {
8.1267 - yyp += yytnamerr (yyp, yyarg[yyi++]);
8.1268 - yyf += 2;
8.1269 - }
8.1270 - else
8.1271 - {
8.1272 - yyp++;
8.1273 - yyf++;
8.1274 - }
8.1275 - }
8.1276 - }
8.1277 - return yysize;
8.1278 - }
8.1279 -}
8.1280 -#endif /* YYERROR_VERBOSE */
8.1281 -
8.1282 -
8.1283 -/*-----------------------------------------------.
8.1284 -| Release the memory associated to this symbol. |
8.1285 -`-----------------------------------------------*/
8.1286 -
8.1287 -/*ARGSUSED*/
8.1288 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.1289 - || defined __cplusplus || defined _MSC_VER)
8.1290 -static void
8.1291 -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
8.1292 -#else
8.1293 -static void
8.1294 -yydestruct (yymsg, yytype, yyvaluep)
8.1295 - const char *yymsg;
8.1296 - int yytype;
8.1297 - YYSTYPE *yyvaluep;
8.1298 -#endif
8.1299 -{
8.1300 - YYUSE (yyvaluep);
8.1301 -
8.1302 - if (!yymsg)
8.1303 - yymsg = "Deleting";
8.1304 - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
8.1305 -
8.1306 - switch (yytype)
8.1307 - {
8.1308 - case 53: /* "choice_entry" */
8.1309 -
8.1310 - {
8.1311 - fprintf(stderr, "%s:%d: missing end statement for this entry\n",
8.1312 - (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
8.1313 - if (current_menu == (yyvaluep->menu))
8.1314 - menu_end_menu();
8.1315 -};
8.1316 -
8.1317 - break;
8.1318 - case 59: /* "if_entry" */
8.1319 -
8.1320 - {
8.1321 - fprintf(stderr, "%s:%d: missing end statement for this entry\n",
8.1322 - (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
8.1323 - if (current_menu == (yyvaluep->menu))
8.1324 - menu_end_menu();
8.1325 -};
8.1326 -
8.1327 - break;
8.1328 - case 65: /* "menu_entry" */
8.1329 -
8.1330 - {
8.1331 - fprintf(stderr, "%s:%d: missing end statement for this entry\n",
8.1332 - (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
8.1333 - if (current_menu == (yyvaluep->menu))
8.1334 - menu_end_menu();
8.1335 -};
8.1336 -
8.1337 - break;
8.1338 -
8.1339 - default:
8.1340 - break;
8.1341 - }
8.1342 -}
8.1343 -
8.1344 -/* Prevent warnings from -Wmissing-prototypes. */
8.1345 -#ifdef YYPARSE_PARAM
8.1346 -#if defined __STDC__ || defined __cplusplus
8.1347 -int yyparse (void *YYPARSE_PARAM);
8.1348 -#else
8.1349 -int yyparse ();
8.1350 -#endif
8.1351 -#else /* ! YYPARSE_PARAM */
8.1352 -#if defined __STDC__ || defined __cplusplus
8.1353 -int yyparse (void);
8.1354 -#else
8.1355 -int yyparse ();
8.1356 -#endif
8.1357 -#endif /* ! YYPARSE_PARAM */
8.1358 -
8.1359 -
8.1360 -/* The lookahead symbol. */
8.1361 -int yychar;
8.1362 -
8.1363 -/* The semantic value of the lookahead symbol. */
8.1364 -YYSTYPE yylval;
8.1365 -
8.1366 -/* Number of syntax errors so far. */
8.1367 -int yynerrs;
8.1368 -
8.1369 -
8.1370 -
8.1371 -/*-------------------------.
8.1372 -| yyparse or yypush_parse. |
8.1373 -`-------------------------*/
8.1374 -
8.1375 -#ifdef YYPARSE_PARAM
8.1376 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.1377 - || defined __cplusplus || defined _MSC_VER)
8.1378 -int
8.1379 -yyparse (void *YYPARSE_PARAM)
8.1380 -#else
8.1381 -int
8.1382 -yyparse (YYPARSE_PARAM)
8.1383 - void *YYPARSE_PARAM;
8.1384 -#endif
8.1385 -#else /* ! YYPARSE_PARAM */
8.1386 -#if (defined __STDC__ || defined __C99__FUNC__ \
8.1387 - || defined __cplusplus || defined _MSC_VER)
8.1388 -int
8.1389 -yyparse (void)
8.1390 -#else
8.1391 -int
8.1392 -yyparse ()
8.1393 -
8.1394 -#endif
8.1395 -#endif
8.1396 -{
8.1397 -
8.1398 -
8.1399 - int yystate;
8.1400 - /* Number of tokens to shift before error messages enabled. */
8.1401 - int yyerrstatus;
8.1402 -
8.1403 - /* The stacks and their tools:
8.1404 - `yyss': related to states.
8.1405 - `yyvs': related to semantic values.
8.1406 -
8.1407 - Refer to the stacks thru separate pointers, to allow yyoverflow
8.1408 - to reallocate them elsewhere. */
8.1409 -
8.1410 - /* The state stack. */
8.1411 - yytype_int16 yyssa[YYINITDEPTH];
8.1412 - yytype_int16 *yyss;
8.1413 - yytype_int16 *yyssp;
8.1414 -
8.1415 - /* The semantic value stack. */
8.1416 - YYSTYPE yyvsa[YYINITDEPTH];
8.1417 - YYSTYPE *yyvs;
8.1418 - YYSTYPE *yyvsp;
8.1419 -
8.1420 - YYSIZE_T yystacksize;
8.1421 -
8.1422 - int yyn;
8.1423 - int yyresult;
8.1424 - /* Lookahead token as an internal (translated) token number. */
8.1425 - int yytoken;
8.1426 - /* The variables used to return semantic value and location from the
8.1427 - action routines. */
8.1428 - YYSTYPE yyval;
8.1429 -
8.1430 -#if YYERROR_VERBOSE
8.1431 - /* Buffer for error messages, and its allocated size. */
8.1432 - char yymsgbuf[128];
8.1433 - char *yymsg = yymsgbuf;
8.1434 - YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
8.1435 -#endif
8.1436 -
8.1437 -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
8.1438 -
8.1439 - /* The number of symbols on the RHS of the reduced rule.
8.1440 - Keep to zero when no symbol should be popped. */
8.1441 - int yylen = 0;
8.1442 -
8.1443 - yytoken = 0;
8.1444 - yyss = yyssa;
8.1445 - yyvs = yyvsa;
8.1446 - yystacksize = YYINITDEPTH;
8.1447 -
8.1448 - YYDPRINTF ((stderr, "Starting parse\n"));
8.1449 -
8.1450 - yystate = 0;
8.1451 - yyerrstatus = 0;
8.1452 - yynerrs = 0;
8.1453 - yychar = YYEMPTY; /* Cause a token to be read. */
8.1454 -
8.1455 - /* Initialize stack pointers.
8.1456 - Waste one element of value and location stack
8.1457 - so that they stay on the same level as the state stack.
8.1458 - The wasted elements are never initialized. */
8.1459 - yyssp = yyss;
8.1460 - yyvsp = yyvs;
8.1461 -
8.1462 - goto yysetstate;
8.1463 -
8.1464 -/*------------------------------------------------------------.
8.1465 -| yynewstate -- Push a new state, which is found in yystate. |
8.1466 -`------------------------------------------------------------*/
8.1467 - yynewstate:
8.1468 - /* In all cases, when you get here, the value and location stacks
8.1469 - have just been pushed. So pushing a state here evens the stacks. */
8.1470 - yyssp++;
8.1471 -
8.1472 - yysetstate:
8.1473 - *yyssp = yystate;
8.1474 -
8.1475 - if (yyss + yystacksize - 1 <= yyssp)
8.1476 - {
8.1477 - /* Get the current used size of the three stacks, in elements. */
8.1478 - YYSIZE_T yysize = yyssp - yyss + 1;
8.1479 -
8.1480 -#ifdef yyoverflow
8.1481 - {
8.1482 - /* Give user a chance to reallocate the stack. Use copies of
8.1483 - these so that the &'s don't force the real ones into
8.1484 - memory. */
8.1485 - YYSTYPE *yyvs1 = yyvs;
8.1486 - yytype_int16 *yyss1 = yyss;
8.1487 -
8.1488 - /* Each stack pointer address is followed by the size of the
8.1489 - data in use in that stack, in bytes. This used to be a
8.1490 - conditional around just the two extra args, but that might
8.1491 - be undefined if yyoverflow is a macro. */
8.1492 - yyoverflow (YY_("memory exhausted"),
8.1493 - &yyss1, yysize * sizeof (*yyssp),
8.1494 - &yyvs1, yysize * sizeof (*yyvsp),
8.1495 - &yystacksize);
8.1496 -
8.1497 - yyss = yyss1;
8.1498 - yyvs = yyvs1;
8.1499 - }
8.1500 -#else /* no yyoverflow */
8.1501 -# ifndef YYSTACK_RELOCATE
8.1502 - goto yyexhaustedlab;
8.1503 -# else
8.1504 - /* Extend the stack our own way. */
8.1505 - if (YYMAXDEPTH <= yystacksize)
8.1506 - goto yyexhaustedlab;
8.1507 - yystacksize *= 2;
8.1508 - if (YYMAXDEPTH < yystacksize)
8.1509 - yystacksize = YYMAXDEPTH;
8.1510 -
8.1511 - {
8.1512 - yytype_int16 *yyss1 = yyss;
8.1513 - union yyalloc *yyptr =
8.1514 - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
8.1515 - if (! yyptr)
8.1516 - goto yyexhaustedlab;
8.1517 - YYSTACK_RELOCATE (yyss_alloc, yyss);
8.1518 - YYSTACK_RELOCATE (yyvs_alloc, yyvs);
8.1519 -# undef YYSTACK_RELOCATE
8.1520 - if (yyss1 != yyssa)
8.1521 - YYSTACK_FREE (yyss1);
8.1522 - }
8.1523 -# endif
8.1524 -#endif /* no yyoverflow */
8.1525 -
8.1526 - yyssp = yyss + yysize - 1;
8.1527 - yyvsp = yyvs + yysize - 1;
8.1528 -
8.1529 - YYDPRINTF ((stderr, "Stack size increased to %lu\n",
8.1530 - (unsigned long int) yystacksize));
8.1531 -
8.1532 - if (yyss + yystacksize - 1 <= yyssp)
8.1533 - YYABORT;
8.1534 - }
8.1535 -
8.1536 - YYDPRINTF ((stderr, "Entering state %d\n", yystate));
8.1537 -
8.1538 - if (yystate == YYFINAL)
8.1539 - YYACCEPT;
8.1540 -
8.1541 - goto yybackup;
8.1542 -
8.1543 -/*-----------.
8.1544 -| yybackup. |
8.1545 -`-----------*/
8.1546 -yybackup:
8.1547 -
8.1548 - /* Do appropriate processing given the current state. Read a
8.1549 - lookahead token if we need one and don't already have one. */
8.1550 -
8.1551 - /* First try to decide what to do without reference to lookahead token. */
8.1552 - yyn = yypact[yystate];
8.1553 - if (yyn == YYPACT_NINF)
8.1554 - goto yydefault;
8.1555 -
8.1556 - /* Not known => get a lookahead token if don't already have one. */
8.1557 -
8.1558 - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
8.1559 - if (yychar == YYEMPTY)
8.1560 - {
8.1561 - YYDPRINTF ((stderr, "Reading a token: "));
8.1562 - yychar = YYLEX;
8.1563 - }
8.1564 -
8.1565 - if (yychar <= YYEOF)
8.1566 - {
8.1567 - yychar = yytoken = YYEOF;
8.1568 - YYDPRINTF ((stderr, "Now at end of input.\n"));
8.1569 - }
8.1570 - else
8.1571 - {
8.1572 - yytoken = YYTRANSLATE (yychar);
8.1573 - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
8.1574 - }
8.1575 -
8.1576 - /* If the proper action on seeing token YYTOKEN is to reduce or to
8.1577 - detect an error, take that action. */
8.1578 - yyn += yytoken;
8.1579 - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
8.1580 - goto yydefault;
8.1581 - yyn = yytable[yyn];
8.1582 - if (yyn <= 0)
8.1583 - {
8.1584 - if (yyn == 0 || yyn == YYTABLE_NINF)
8.1585 - goto yyerrlab;
8.1586 - yyn = -yyn;
8.1587 - goto yyreduce;
8.1588 - }
8.1589 -
8.1590 - /* Count tokens shifted since error; after three, turn off error
8.1591 - status. */
8.1592 - if (yyerrstatus)
8.1593 - yyerrstatus--;
8.1594 -
8.1595 - /* Shift the lookahead token. */
8.1596 - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
8.1597 -
8.1598 - /* Discard the shifted token. */
8.1599 - yychar = YYEMPTY;
8.1600 -
8.1601 - yystate = yyn;
8.1602 - *++yyvsp = yylval;
8.1603 -
8.1604 - goto yynewstate;
8.1605 -
8.1606 -
8.1607 -/*-----------------------------------------------------------.
8.1608 -| yydefault -- do the default action for the current state. |
8.1609 -`-----------------------------------------------------------*/
8.1610 -yydefault:
8.1611 - yyn = yydefact[yystate];
8.1612 - if (yyn == 0)
8.1613 - goto yyerrlab;
8.1614 - goto yyreduce;
8.1615 -
8.1616 -
8.1617 -/*-----------------------------.
8.1618 -| yyreduce -- Do a reduction. |
8.1619 -`-----------------------------*/
8.1620 -yyreduce:
8.1621 - /* yyn is the number of a rule to reduce with. */
8.1622 - yylen = yyr2[yyn];
8.1623 -
8.1624 - /* If YYLEN is nonzero, implement the default value of the action:
8.1625 - `$$ = $1'.
8.1626 -
8.1627 - Otherwise, the following line sets YYVAL to garbage.
8.1628 - This behavior is undocumented and Bison
8.1629 - users should not rely upon it. Assigning to YYVAL
8.1630 - unconditionally makes the parser a bit smaller, and it avoids a
8.1631 - GCC warning that YYVAL may be used uninitialized. */
8.1632 - yyval = yyvsp[1-yylen];
8.1633 -
8.1634 -
8.1635 - YY_REDUCE_PRINT (yyn);
8.1636 - switch (yyn)
8.1637 - {
8.1638 - case 10:
8.1639 -
8.1640 - { zconf_error("unexpected end statement"); ;}
8.1641 - break;
8.1642 -
8.1643 - case 11:
8.1644 -
8.1645 - { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;}
8.1646 - break;
8.1647 -
8.1648 - case 12:
8.1649 -
8.1650 - {
8.1651 - zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
8.1652 -;}
8.1653 - break;
8.1654 -
8.1655 - case 13:
8.1656 -
8.1657 - { zconf_error("invalid statement"); ;}
8.1658 - break;
8.1659 -
8.1660 - case 28:
8.1661 -
8.1662 - { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
8.1663 - break;
8.1664 -
8.1665 - case 29:
8.1666 -
8.1667 - { zconf_error("invalid option"); ;}
8.1668 - break;
8.1669 -
8.1670 - case 30:
8.1671 -
8.1672 - {
8.1673 - struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
8.1674 - sym->flags |= SYMBOL_OPTIONAL;
8.1675 - menu_add_entry(sym);
8.1676 - printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
8.1677 -;}
8.1678 - break;
8.1679 -
8.1680 - case 31:
8.1681 -
8.1682 - {
8.1683 - menu_end_entry();
8.1684 - printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
8.1685 -;}
8.1686 - break;
8.1687 -
8.1688 - case 32:
8.1689 -
8.1690 - {
8.1691 - struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
8.1692 - sym->flags |= SYMBOL_OPTIONAL;
8.1693 - menu_add_entry(sym);
8.1694 - printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
8.1695 -;}
8.1696 - break;
8.1697 -
8.1698 - case 33:
8.1699 -
8.1700 - {
8.1701 - if (current_entry->prompt)
8.1702 - current_entry->prompt->type = P_MENU;
8.1703 - else
8.1704 - zconfprint("warning: menuconfig statement without prompt");
8.1705 - menu_end_entry();
8.1706 - printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
8.1707 -;}
8.1708 - break;
8.1709 -
8.1710 - case 41:
8.1711 -
8.1712 - {
8.1713 - menu_set_type((yyvsp[(1) - (3)].id)->stype);
8.1714 - printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
8.1715 - zconf_curname(), zconf_lineno(),
8.1716 - (yyvsp[(1) - (3)].id)->stype);
8.1717 -;}
8.1718 - break;
8.1719 -
8.1720 - case 42:
8.1721 -
8.1722 - {
8.1723 - menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
8.1724 - printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
8.1725 -;}
8.1726 - break;
8.1727 -
8.1728 - case 43:
8.1729 -
8.1730 - {
8.1731 - menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
8.1732 - if ((yyvsp[(1) - (4)].id)->stype != S_UNKNOWN)
8.1733 - menu_set_type((yyvsp[(1) - (4)].id)->stype);
8.1734 - printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
8.1735 - zconf_curname(), zconf_lineno(),
8.1736 - (yyvsp[(1) - (4)].id)->stype);
8.1737 -;}
8.1738 - break;
8.1739 -
8.1740 - case 44:
8.1741 -
8.1742 - {
8.1743 - menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
8.1744 - printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
8.1745 -;}
8.1746 - break;
8.1747 -
8.1748 - case 45:
8.1749 -
8.1750 - {
8.1751 - menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
8.1752 - printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
8.1753 -;}
8.1754 - break;
8.1755 -
8.1756 - case 48:
8.1757 -
8.1758 - {
8.1759 - struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
8.1760 - if (id && id->flags & TF_OPTION)
8.1761 - menu_add_option(id->token, (yyvsp[(3) - (3)].string));
8.1762 - else
8.1763 - zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string));
8.1764 - free((yyvsp[(2) - (3)].string));
8.1765 -;}
8.1766 - break;
8.1767 -
8.1768 - case 49:
8.1769 -
8.1770 - { (yyval.string) = NULL; ;}
8.1771 - break;
8.1772 -
8.1773 - case 50:
8.1774 -
8.1775 - { (yyval.string) = (yyvsp[(2) - (2)].string); ;}
8.1776 - break;
8.1777 -
8.1778 - case 51:
8.1779 -
8.1780 - {
8.1781 - struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
8.1782 - sym->flags |= SYMBOL_AUTO;
8.1783 - menu_add_entry(sym);
8.1784 - menu_add_expr(P_CHOICE, NULL, NULL);
8.1785 - printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
8.1786 -;}
8.1787 - break;
8.1788 -
8.1789 - case 52:
8.1790 -
8.1791 - {
8.1792 - (yyval.menu) = menu_add_menu();
8.1793 -;}
8.1794 - break;
8.1795 -
8.1796 - case 53:
8.1797 -
8.1798 - {
8.1799 - if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
8.1800 - menu_end_menu();
8.1801 - printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
8.1802 - }
8.1803 -;}
8.1804 - break;
8.1805 -
8.1806 - case 61:
8.1807 -
8.1808 - {
8.1809 - menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
8.1810 - printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
8.1811 -;}
8.1812 - break;
8.1813 -
8.1814 - case 62:
8.1815 -
8.1816 - {
8.1817 - if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
8.1818 - menu_set_type((yyvsp[(1) - (3)].id)->stype);
8.1819 - printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
8.1820 - zconf_curname(), zconf_lineno(),
8.1821 - (yyvsp[(1) - (3)].id)->stype);
8.1822 - } else
8.1823 - YYERROR;
8.1824 -;}
8.1825 - break;
8.1826 -
8.1827 - case 63:
8.1828 -
8.1829 - {
8.1830 - current_entry->sym->flags |= SYMBOL_OPTIONAL;
8.1831 - printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
8.1832 -;}
8.1833 - break;
8.1834 -
8.1835 - case 64:
8.1836 -
8.1837 - {
8.1838 - if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
8.1839 - menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
8.1840 - printd(DEBUG_PARSE, "%s:%d:default\n",
8.1841 - zconf_curname(), zconf_lineno());
8.1842 - } else
8.1843 - YYERROR;
8.1844 -;}
8.1845 - break;
8.1846 -
8.1847 - case 67:
8.1848 -
8.1849 - {
8.1850 - printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
8.1851 - menu_add_entry(NULL);
8.1852 - menu_add_dep((yyvsp[(2) - (3)].expr));
8.1853 - (yyval.menu) = menu_add_menu();
8.1854 -;}
8.1855 - break;
8.1856 -
8.1857 - case 68:
8.1858 -
8.1859 - {
8.1860 - if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
8.1861 - menu_end_menu();
8.1862 - printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
8.1863 - }
8.1864 -;}
8.1865 - break;
8.1866 -
8.1867 - case 74:
8.1868 -
8.1869 - {
8.1870 - menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
8.1871 -;}
8.1872 - break;
8.1873 -
8.1874 - case 75:
8.1875 -
8.1876 - {
8.1877 - menu_add_entry(NULL);
8.1878 - menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
8.1879 - printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
8.1880 -;}
8.1881 - break;
8.1882 -
8.1883 - case 76:
8.1884 -
8.1885 - {
8.1886 - (yyval.menu) = menu_add_menu();
8.1887 -;}
8.1888 - break;
8.1889 -
8.1890 - case 77:
8.1891 -
8.1892 - {
8.1893 - if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
8.1894 - menu_end_menu();
8.1895 - printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
8.1896 - }
8.1897 -;}
8.1898 - break;
8.1899 -
8.1900 - case 83:
8.1901 -
8.1902 - {
8.1903 - printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
8.1904 - zconf_nextfile((yyvsp[(2) - (3)].string));
8.1905 -;}
8.1906 - break;
8.1907 -
8.1908 - case 84:
8.1909 -
8.1910 - {
8.1911 - menu_add_entry(NULL);
8.1912 - menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL);
8.1913 - printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
8.1914 -;}
8.1915 - break;
8.1916 -
8.1917 - case 85:
8.1918 -
8.1919 - {
8.1920 - menu_end_entry();
8.1921 -;}
8.1922 - break;
8.1923 -
8.1924 - case 86:
8.1925 -
8.1926 - {
8.1927 - printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
8.1928 - zconf_starthelp();
8.1929 -;}
8.1930 - break;
8.1931 -
8.1932 - case 87:
8.1933 -
8.1934 - {
8.1935 - current_entry->help = (yyvsp[(2) - (2)].string);
8.1936 -;}
8.1937 - break;
8.1938 -
8.1939 - case 92:
8.1940 -
8.1941 - {
8.1942 - menu_add_dep((yyvsp[(3) - (4)].expr));
8.1943 - printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
8.1944 -;}
8.1945 - break;
8.1946 -
8.1947 - case 96:
8.1948 -
8.1949 - {
8.1950 - menu_add_visibility((yyvsp[(2) - (2)].expr));
8.1951 -;}
8.1952 - break;
8.1953 -
8.1954 - case 98:
8.1955 -
8.1956 - {
8.1957 - menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
8.1958 -;}
8.1959 - break;
8.1960 -
8.1961 - case 101:
8.1962 -
8.1963 - { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
8.1964 - break;
8.1965 -
8.1966 - case 102:
8.1967 -
8.1968 - { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
8.1969 - break;
8.1970 -
8.1971 - case 103:
8.1972 -
8.1973 - { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
8.1974 - break;
8.1975 -
8.1976 - case 106:
8.1977 -
8.1978 - { (yyval.expr) = NULL; ;}
8.1979 - break;
8.1980 -
8.1981 - case 107:
8.1982 -
8.1983 - { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
8.1984 - break;
8.1985 -
8.1986 - case 108:
8.1987 -
8.1988 - { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
8.1989 - break;
8.1990 -
8.1991 - case 109:
8.1992 -
8.1993 - { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
8.1994 - break;
8.1995 -
8.1996 - case 110:
8.1997 -
8.1998 - { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
8.1999 - break;
8.2000 -
8.2001 - case 111:
8.2002 -
8.2003 - { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
8.2004 - break;
8.2005 -
8.2006 - case 112:
8.2007 -
8.2008 - { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
8.2009 - break;
8.2010 -
8.2011 - case 113:
8.2012 -
8.2013 - { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
8.2014 - break;
8.2015 -
8.2016 - case 114:
8.2017 -
8.2018 - { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
8.2019 - break;
8.2020 -
8.2021 - case 115:
8.2022 -
8.2023 - { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
8.2024 - break;
8.2025 -
8.2026 - case 116:
8.2027 -
8.2028 - { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
8.2029 - break;
8.2030 -
8.2031 - case 117:
8.2032 -
8.2033 - { (yyval.string) = NULL; ;}
8.2034 - break;
8.2035 -
8.2036 -
8.2037 -
8.2038 - default: break;
8.2039 - }
8.2040 - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
8.2041 -
8.2042 - YYPOPSTACK (yylen);
8.2043 - yylen = 0;
8.2044 - YY_STACK_PRINT (yyss, yyssp);
8.2045 -
8.2046 - *++yyvsp = yyval;
8.2047 -
8.2048 - /* Now `shift' the result of the reduction. Determine what state
8.2049 - that goes to, based on the state we popped back to and the rule
8.2050 - number reduced by. */
8.2051 -
8.2052 - yyn = yyr1[yyn];
8.2053 -
8.2054 - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
8.2055 - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
8.2056 - yystate = yytable[yystate];
8.2057 - else
8.2058 - yystate = yydefgoto[yyn - YYNTOKENS];
8.2059 -
8.2060 - goto yynewstate;
8.2061 -
8.2062 -
8.2063 -/*------------------------------------.
8.2064 -| yyerrlab -- here on detecting error |
8.2065 -`------------------------------------*/
8.2066 -yyerrlab:
8.2067 - /* If not already recovering from an error, report this error. */
8.2068 - if (!yyerrstatus)
8.2069 - {
8.2070 - ++yynerrs;
8.2071 -#if ! YYERROR_VERBOSE
8.2072 - yyerror (YY_("syntax error"));
8.2073 -#else
8.2074 - {
8.2075 - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
8.2076 - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
8.2077 - {
8.2078 - YYSIZE_T yyalloc = 2 * yysize;
8.2079 - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
8.2080 - yyalloc = YYSTACK_ALLOC_MAXIMUM;
8.2081 - if (yymsg != yymsgbuf)
8.2082 - YYSTACK_FREE (yymsg);
8.2083 - yymsg = (char *) YYSTACK_ALLOC (yyalloc);
8.2084 - if (yymsg)
8.2085 - yymsg_alloc = yyalloc;
8.2086 - else
8.2087 - {
8.2088 - yymsg = yymsgbuf;
8.2089 - yymsg_alloc = sizeof yymsgbuf;
8.2090 - }
8.2091 - }
8.2092 -
8.2093 - if (0 < yysize && yysize <= yymsg_alloc)
8.2094 - {
8.2095 - (void) yysyntax_error (yymsg, yystate, yychar);
8.2096 - yyerror (yymsg);
8.2097 - }
8.2098 - else
8.2099 - {
8.2100 - yyerror (YY_("syntax error"));
8.2101 - if (yysize != 0)
8.2102 - goto yyexhaustedlab;
8.2103 - }
8.2104 - }
8.2105 -#endif
8.2106 - }
8.2107 -
8.2108 -
8.2109 -
8.2110 - if (yyerrstatus == 3)
8.2111 - {
8.2112 - /* If just tried and failed to reuse lookahead token after an
8.2113 - error, discard it. */
8.2114 -
8.2115 - if (yychar <= YYEOF)
8.2116 - {
8.2117 - /* Return failure if at end of input. */
8.2118 - if (yychar == YYEOF)
8.2119 - YYABORT;
8.2120 - }
8.2121 - else
8.2122 - {
8.2123 - yydestruct ("Error: discarding",
8.2124 - yytoken, &yylval);
8.2125 - yychar = YYEMPTY;
8.2126 - }
8.2127 - }
8.2128 -
8.2129 - /* Else will try to reuse lookahead token after shifting the error
8.2130 - token. */
8.2131 - goto yyerrlab1;
8.2132 -
8.2133 -
8.2134 -/*---------------------------------------------------.
8.2135 -| yyerrorlab -- error raised explicitly by YYERROR. |
8.2136 -`---------------------------------------------------*/
8.2137 -yyerrorlab:
8.2138 -
8.2139 - /* Pacify compilers like GCC when the user code never invokes
8.2140 - YYERROR and the label yyerrorlab therefore never appears in user
8.2141 - code. */
8.2142 - if (/*CONSTCOND*/ 0)
8.2143 - goto yyerrorlab;
8.2144 -
8.2145 - /* Do not reclaim the symbols of the rule which action triggered
8.2146 - this YYERROR. */
8.2147 - YYPOPSTACK (yylen);
8.2148 - yylen = 0;
8.2149 - YY_STACK_PRINT (yyss, yyssp);
8.2150 - yystate = *yyssp;
8.2151 - goto yyerrlab1;
8.2152 -
8.2153 -
8.2154 -/*-------------------------------------------------------------.
8.2155 -| yyerrlab1 -- common code for both syntax error and YYERROR. |
8.2156 -`-------------------------------------------------------------*/
8.2157 -yyerrlab1:
8.2158 - yyerrstatus = 3; /* Each real token shifted decrements this. */
8.2159 -
8.2160 - for (;;)
8.2161 - {
8.2162 - yyn = yypact[yystate];
8.2163 - if (yyn != YYPACT_NINF)
8.2164 - {
8.2165 - yyn += YYTERROR;
8.2166 - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
8.2167 - {
8.2168 - yyn = yytable[yyn];
8.2169 - if (0 < yyn)
8.2170 - break;
8.2171 - }
8.2172 - }
8.2173 -
8.2174 - /* Pop the current state because it cannot handle the error token. */
8.2175 - if (yyssp == yyss)
8.2176 - YYABORT;
8.2177 -
8.2178 -
8.2179 - yydestruct ("Error: popping",
8.2180 - yystos[yystate], yyvsp);
8.2181 - YYPOPSTACK (1);
8.2182 - yystate = *yyssp;
8.2183 - YY_STACK_PRINT (yyss, yyssp);
8.2184 - }
8.2185 -
8.2186 - *++yyvsp = yylval;
8.2187 -
8.2188 -
8.2189 - /* Shift the error token. */
8.2190 - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
8.2191 -
8.2192 - yystate = yyn;
8.2193 - goto yynewstate;
8.2194 -
8.2195 -
8.2196 -/*-------------------------------------.
8.2197 -| yyacceptlab -- YYACCEPT comes here. |
8.2198 -`-------------------------------------*/
8.2199 -yyacceptlab:
8.2200 - yyresult = 0;
8.2201 - goto yyreturn;
8.2202 -
8.2203 -/*-----------------------------------.
8.2204 -| yyabortlab -- YYABORT comes here. |
8.2205 -`-----------------------------------*/
8.2206 -yyabortlab:
8.2207 - yyresult = 1;
8.2208 - goto yyreturn;
8.2209 -
8.2210 -#if !defined(yyoverflow) || YYERROR_VERBOSE
8.2211 -/*-------------------------------------------------.
8.2212 -| yyexhaustedlab -- memory exhaustion comes here. |
8.2213 -`-------------------------------------------------*/
8.2214 -yyexhaustedlab:
8.2215 - yyerror (YY_("memory exhausted"));
8.2216 - yyresult = 2;
8.2217 - /* Fall through. */
8.2218 -#endif
8.2219 -
8.2220 -yyreturn:
8.2221 - if (yychar != YYEMPTY)
8.2222 - yydestruct ("Cleanup: discarding lookahead",
8.2223 - yytoken, &yylval);
8.2224 - /* Do not reclaim the symbols of the rule which action triggered
8.2225 - this YYABORT or YYACCEPT. */
8.2226 - YYPOPSTACK (yylen);
8.2227 - YY_STACK_PRINT (yyss, yyssp);
8.2228 - while (yyssp != yyss)
8.2229 - {
8.2230 - yydestruct ("Cleanup: popping",
8.2231 - yystos[*yyssp], yyvsp);
8.2232 - YYPOPSTACK (1);
8.2233 - }
8.2234 -#ifndef yyoverflow
8.2235 - if (yyss != yyssa)
8.2236 - YYSTACK_FREE (yyss);
8.2237 -#endif
8.2238 -#if YYERROR_VERBOSE
8.2239 - if (yymsg != yymsgbuf)
8.2240 - YYSTACK_FREE (yymsg);
8.2241 -#endif
8.2242 - /* Make sure YYID is used. */
8.2243 - return YYID (yyresult);
8.2244 -}
8.2245 -
8.2246 -
8.2247 -
8.2248 -
8.2249 -
8.2250 -void conf_parse(const char *name)
8.2251 -{
8.2252 - struct symbol *sym;
8.2253 - int i;
8.2254 -
8.2255 - zconf_initscan(name);
8.2256 -
8.2257 - sym_init();
8.2258 - _menu_init();
8.2259 - modules_sym = sym_lookup(NULL, 0);
8.2260 - modules_sym->type = S_BOOLEAN;
8.2261 - modules_sym->flags |= SYMBOL_AUTO;
8.2262 - rootmenu.prompt = menu_add_prompt(P_MENU, PACKAGE " Configuration", NULL);
8.2263 -
8.2264 -#if YYDEBUG
8.2265 - if (getenv("ZCONF_DEBUG"))
8.2266 - zconfdebug = 1;
8.2267 -#endif
8.2268 - zconfparse();
8.2269 - if (zconfnerrs)
8.2270 - exit(1);
8.2271 - if (!modules_sym->prop) {
8.2272 - struct property *prop;
8.2273 -
8.2274 - prop = prop_alloc(P_DEFAULT, modules_sym);
8.2275 - prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
8.2276 - }
8.2277 -
8.2278 - rootmenu.prompt->text = _(rootmenu.prompt->text);
8.2279 - rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
8.2280 -
8.2281 - menu_finalize(&rootmenu);
8.2282 - for_all_symbols(i, sym) {
8.2283 - if (sym_check_deps(sym))
8.2284 - zconfnerrs++;
8.2285 - }
8.2286 - if (zconfnerrs)
8.2287 - exit(1);
8.2288 - sym_set_change_count(1);
8.2289 -}
8.2290 -
8.2291 -static const char *zconf_tokenname(int token)
8.2292 -{
8.2293 - switch (token) {
8.2294 - case T_MENU: return "menu";
8.2295 - case T_ENDMENU: return "endmenu";
8.2296 - case T_CHOICE: return "choice";
8.2297 - case T_ENDCHOICE: return "endchoice";
8.2298 - case T_IF: return "if";
8.2299 - case T_ENDIF: return "endif";
8.2300 - case T_DEPENDS: return "depends";
8.2301 - case T_VISIBLE: return "visible";
8.2302 - }
8.2303 - return "<token>";
8.2304 -}
8.2305 -
8.2306 -static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
8.2307 -{
8.2308 - if (id->token != endtoken) {
8.2309 - zconf_error("unexpected '%s' within %s block",
8.2310 - kconf_id_strings + id->name, zconf_tokenname(starttoken));
8.2311 - zconfnerrs++;
8.2312 - return false;
8.2313 - }
8.2314 - if (current_menu->file != current_file) {
8.2315 - zconf_error("'%s' in different file than '%s'",
8.2316 - kconf_id_strings + id->name, zconf_tokenname(starttoken));
8.2317 - fprintf(stderr, "%s:%d: location of the '%s'\n",
8.2318 - current_menu->file->name, current_menu->lineno,
8.2319 - zconf_tokenname(starttoken));
8.2320 - zconfnerrs++;
8.2321 - return false;
8.2322 - }
8.2323 - return true;
8.2324 -}
8.2325 -
8.2326 -static void zconfprint(const char *err, ...)
8.2327 -{
8.2328 - va_list ap;
8.2329 -
8.2330 - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
8.2331 - va_start(ap, err);
8.2332 - vfprintf(stderr, err, ap);
8.2333 - va_end(ap);
8.2334 - fprintf(stderr, "\n");
8.2335 -}
8.2336 -
8.2337 -static void zconf_error(const char *err, ...)
8.2338 -{
8.2339 - va_list ap;
8.2340 -
8.2341 - zconfnerrs++;
8.2342 - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
8.2343 - va_start(ap, err);
8.2344 - vfprintf(stderr, err, ap);
8.2345 - va_end(ap);
8.2346 - fprintf(stderr, "\n");
8.2347 -}
8.2348 -
8.2349 -static void zconferror(const char *err)
8.2350 -{
8.2351 -#if YYDEBUG
8.2352 - fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
8.2353 -#endif
8.2354 -}
8.2355 -
8.2356 -static void print_quoted_string(FILE *out, const char *str)
8.2357 -{
8.2358 - const char *p;
8.2359 - int len;
8.2360 -
8.2361 - putc('"', out);
8.2362 - while ((p = strchr(str, '"'))) {
8.2363 - len = p - str;
8.2364 - if (len)
8.2365 - fprintf(out, "%.*s", len, str);
8.2366 - fputs("\\\"", out);
8.2367 - str = p + 1;
8.2368 - }
8.2369 - fputs(str, out);
8.2370 - putc('"', out);
8.2371 -}
8.2372 -
8.2373 -static void print_symbol(FILE *out, struct menu *menu)
8.2374 -{
8.2375 - struct symbol *sym = menu->sym;
8.2376 - struct property *prop;
8.2377 -
8.2378 - if (sym_is_choice(sym))
8.2379 - fprintf(out, "\nchoice\n");
8.2380 - else
8.2381 - fprintf(out, "\nconfig %s\n", sym->name);
8.2382 - switch (sym->type) {
8.2383 - case S_BOOLEAN:
8.2384 - fputs(" boolean\n", out);
8.2385 - break;
8.2386 - case S_TRISTATE:
8.2387 - fputs(" tristate\n", out);
8.2388 - break;
8.2389 - case S_STRING:
8.2390 - fputs(" string\n", out);
8.2391 - break;
8.2392 - case S_INT:
8.2393 - fputs(" integer\n", out);
8.2394 - break;
8.2395 - case S_HEX:
8.2396 - fputs(" hex\n", out);
8.2397 - break;
8.2398 - default:
8.2399 - fputs(" ???\n", out);
8.2400 - break;
8.2401 - }
8.2402 - for (prop = sym->prop; prop; prop = prop->next) {
8.2403 - if (prop->menu != menu)
8.2404 - continue;
8.2405 - switch (prop->type) {
8.2406 - case P_PROMPT:
8.2407 - fputs(" prompt ", out);
8.2408 - print_quoted_string(out, prop->text);
8.2409 - if (!expr_is_yes(prop->visible.expr)) {
8.2410 - fputs(" if ", out);
8.2411 - expr_fprint(prop->visible.expr, out);
8.2412 - }
8.2413 - fputc('\n', out);
8.2414 - break;
8.2415 - case P_DEFAULT:
8.2416 - fputs( " default ", out);
8.2417 - expr_fprint(prop->expr, out);
8.2418 - if (!expr_is_yes(prop->visible.expr)) {
8.2419 - fputs(" if ", out);
8.2420 - expr_fprint(prop->visible.expr, out);
8.2421 - }
8.2422 - fputc('\n', out);
8.2423 - break;
8.2424 - case P_CHOICE:
8.2425 - fputs(" #choice value\n", out);
8.2426 - break;
8.2427 - case P_SELECT:
8.2428 - fputs( " select ", out);
8.2429 - expr_fprint(prop->expr, out);
8.2430 - fputc('\n', out);
8.2431 - break;
8.2432 - case P_RANGE:
8.2433 - fputs( " range ", out);
8.2434 - expr_fprint(prop->expr, out);
8.2435 - fputc('\n', out);
8.2436 - break;
8.2437 - case P_MENU:
8.2438 - fputs( " menu ", out);
8.2439 - print_quoted_string(out, prop->text);
8.2440 - fputc('\n', out);
8.2441 - break;
8.2442 - default:
8.2443 - fprintf(out, " unknown prop %d!\n", prop->type);
8.2444 - break;
8.2445 - }
8.2446 - }
8.2447 - if (menu->help) {
8.2448 - int len = strlen(menu->help);
8.2449 - while (menu->help[--len] == '\n')
8.2450 - menu->help[len] = 0;
8.2451 - fprintf(out, " help\n%s\n", menu->help);
8.2452 - }
8.2453 -}
8.2454 -
8.2455 -void zconfdump(FILE *out)
8.2456 -{
8.2457 - struct property *prop;
8.2458 - struct symbol *sym;
8.2459 - struct menu *menu;
8.2460 -
8.2461 - menu = rootmenu.list;
8.2462 - while (menu) {
8.2463 - if ((sym = menu->sym))
8.2464 - print_symbol(out, menu);
8.2465 - else if ((prop = menu->prompt)) {
8.2466 - switch (prop->type) {
8.2467 - case P_COMMENT:
8.2468 - fputs("\ncomment ", out);
8.2469 - print_quoted_string(out, prop->text);
8.2470 - fputs("\n", out);
8.2471 - break;
8.2472 - case P_MENU:
8.2473 - fputs("\nmenu ", out);
8.2474 - print_quoted_string(out, prop->text);
8.2475 - fputs("\n", out);
8.2476 - break;
8.2477 - default:
8.2478 - ;
8.2479 - }
8.2480 - if (!expr_is_yes(prop->visible.expr)) {
8.2481 - fputs(" depends ", out);
8.2482 - expr_fprint(prop->visible.expr, out);
8.2483 - fputc('\n', out);
8.2484 - }
8.2485 - }
8.2486 -
8.2487 - if (menu->list)
8.2488 - menu = menu->list;
8.2489 - else if (menu->next)
8.2490 - menu = menu->next;
8.2491 - else while ((menu = menu->parent)) {
8.2492 - if (menu->prompt && menu->prompt->type == P_MENU)
8.2493 - fputs("\nendmenu\n", out);
8.2494 - if (menu->next) {
8.2495 - menu = menu->next;
8.2496 - break;
8.2497 - }
8.2498 - }
8.2499 - }
8.2500 -}
8.2501 -
8.2502 -#include "lex.zconf.c"
8.2503 -#include "util.c"
8.2504 -#include "confdata.c"
8.2505 -#include "expr.c"
8.2506 -#include "symbol.c"
8.2507 -#include "menu.c"
8.2508 -
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/kconfig/zconf.y Sun Jan 15 01:04:26 2012 +0100
9.3 @@ -0,0 +1,749 @@
9.4 +%{
9.5 +/*
9.6 + * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
9.7 + * Released under the terms of the GNU GPL v2.0.
9.8 + */
9.9 +
9.10 +#include <ctype.h>
9.11 +#include <stdarg.h>
9.12 +#include <stdio.h>
9.13 +#include <stdlib.h>
9.14 +#include <string.h>
9.15 +#include <stdbool.h>
9.16 +
9.17 +#define LKC_DIRECT_LINK
9.18 +#include "lkc.h"
9.19 +
9.20 +#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
9.21 +
9.22 +#define PRINTD 0x0001
9.23 +#define DEBUG_PARSE 0x0002
9.24 +
9.25 +int cdebug = PRINTD;
9.26 +
9.27 +extern int zconflex(void);
9.28 +static void zconfprint(const char *err, ...);
9.29 +static void zconf_error(const char *err, ...);
9.30 +static void zconferror(const char *err);
9.31 +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
9.32 +
9.33 +struct symbol *symbol_hash[SYMBOL_HASHSIZE];
9.34 +
9.35 +static struct menu *current_menu, *current_entry;
9.36 +
9.37 +#define YYDEBUG 0
9.38 +#if YYDEBUG
9.39 +#define YYERROR_VERBOSE
9.40 +#endif
9.41 +%}
9.42 +%expect 30
9.43 +
9.44 +%union
9.45 +{
9.46 + char *string;
9.47 + struct file *file;
9.48 + struct symbol *symbol;
9.49 + struct expr *expr;
9.50 + struct menu *menu;
9.51 + struct kconf_id *id;
9.52 +}
9.53 +
9.54 +%token <id>T_MAINMENU
9.55 +%token <id>T_MENU
9.56 +%token <id>T_ENDMENU
9.57 +%token <id>T_SOURCE
9.58 +%token <id>T_CHOICE
9.59 +%token <id>T_ENDCHOICE
9.60 +%token <id>T_COMMENT
9.61 +%token <id>T_CONFIG
9.62 +%token <id>T_MENUCONFIG
9.63 +%token <id>T_HELP
9.64 +%token <string> T_HELPTEXT
9.65 +%token <id>T_IF
9.66 +%token <id>T_ENDIF
9.67 +%token <id>T_DEPENDS
9.68 +%token <id>T_OPTIONAL
9.69 +%token <id>T_PROMPT
9.70 +%token <id>T_TYPE
9.71 +%token <id>T_DEFAULT
9.72 +%token <id>T_SELECT
9.73 +%token <id>T_RANGE
9.74 +%token <id>T_VISIBLE
9.75 +%token <id>T_OPTION
9.76 +%token <id>T_ON
9.77 +%token <string> T_WORD
9.78 +%token <string> T_WORD_QUOTE
9.79 +%token T_UNEQUAL
9.80 +%token T_CLOSE_PAREN
9.81 +%token T_OPEN_PAREN
9.82 +%token T_EOL
9.83 +
9.84 +%left T_OR
9.85 +%left T_AND
9.86 +%left T_EQUAL T_UNEQUAL
9.87 +%nonassoc T_NOT
9.88 +
9.89 +%type <string> prompt
9.90 +%type <symbol> symbol
9.91 +%type <expr> expr
9.92 +%type <expr> if_expr
9.93 +%type <id> end
9.94 +%type <id> option_name
9.95 +%type <menu> if_entry menu_entry choice_entry
9.96 +%type <string> symbol_option_arg word_opt
9.97 +
9.98 +%destructor {
9.99 + fprintf(stderr, "%s:%d: missing end statement for this entry\n",
9.100 + $$->file->name, $$->lineno);
9.101 + if (current_menu == $$)
9.102 + menu_end_menu();
9.103 +} if_entry menu_entry choice_entry
9.104 +
9.105 +%{
9.106 +/* Include zconf.hash.c here so it can see the token constants. */
9.107 +#include "zconf.hash.c"
9.108 +%}
9.109 +
9.110 +%%
9.111 +input: nl start | start;
9.112 +
9.113 +start: mainmenu_stmt stmt_list | stmt_list;
9.114 +
9.115 +stmt_list:
9.116 + /* empty */
9.117 + | stmt_list common_stmt
9.118 + | stmt_list choice_stmt
9.119 + | stmt_list menu_stmt
9.120 + | stmt_list end { zconf_error("unexpected end statement"); }
9.121 + | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
9.122 + | stmt_list option_name error T_EOL
9.123 +{
9.124 + zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
9.125 +}
9.126 + | stmt_list error T_EOL { zconf_error("invalid statement"); }
9.127 +;
9.128 +
9.129 +option_name:
9.130 + T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
9.131 +;
9.132 +
9.133 +common_stmt:
9.134 + T_EOL
9.135 + | if_stmt
9.136 + | comment_stmt
9.137 + | config_stmt
9.138 + | menuconfig_stmt
9.139 + | source_stmt
9.140 +;
9.141 +
9.142 +option_error:
9.143 + T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); }
9.144 + | error T_EOL { zconf_error("invalid option"); }
9.145 +;
9.146 +
9.147 +
9.148 +/* config/menuconfig entry */
9.149 +
9.150 +config_entry_start: T_CONFIG T_WORD T_EOL
9.151 +{
9.152 + struct symbol *sym = sym_lookup($2, 0);
9.153 + sym->flags |= SYMBOL_OPTIONAL;
9.154 + menu_add_entry(sym);
9.155 + printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2);
9.156 +};
9.157 +
9.158 +config_stmt: config_entry_start config_option_list
9.159 +{
9.160 + menu_end_entry();
9.161 + printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
9.162 +};
9.163 +
9.164 +menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL
9.165 +{
9.166 + struct symbol *sym = sym_lookup($2, 0);
9.167 + sym->flags |= SYMBOL_OPTIONAL;
9.168 + menu_add_entry(sym);
9.169 + printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
9.170 +};
9.171 +
9.172 +menuconfig_stmt: menuconfig_entry_start config_option_list
9.173 +{
9.174 + if (current_entry->prompt)
9.175 + current_entry->prompt->type = P_MENU;
9.176 + else
9.177 + zconfprint("warning: menuconfig statement without prompt");
9.178 + menu_end_entry();
9.179 + printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
9.180 +};
9.181 +
9.182 +config_option_list:
9.183 + /* empty */
9.184 + | config_option_list config_option
9.185 + | config_option_list symbol_option
9.186 + | config_option_list depends
9.187 + | config_option_list help
9.188 + | config_option_list option_error
9.189 + | config_option_list T_EOL
9.190 +;
9.191 +
9.192 +config_option: T_TYPE prompt_stmt_opt T_EOL
9.193 +{
9.194 + menu_set_type($1->stype);
9.195 + printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
9.196 + zconf_curname(), zconf_lineno(),
9.197 + $1->stype);
9.198 +};
9.199 +
9.200 +config_option: T_PROMPT prompt if_expr T_EOL
9.201 +{
9.202 + menu_add_prompt(P_PROMPT, $2, $3);
9.203 + printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
9.204 +};
9.205 +
9.206 +config_option: T_DEFAULT expr if_expr T_EOL
9.207 +{
9.208 + menu_add_expr(P_DEFAULT, $2, $3);
9.209 + if ($1->stype != S_UNKNOWN)
9.210 + menu_set_type($1->stype);
9.211 + printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
9.212 + zconf_curname(), zconf_lineno(),
9.213 + $1->stype);
9.214 +};
9.215 +
9.216 +config_option: T_SELECT T_WORD if_expr T_EOL
9.217 +{
9.218 + menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3);
9.219 + printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
9.220 +};
9.221 +
9.222 +config_option: T_RANGE symbol symbol if_expr T_EOL
9.223 +{
9.224 + menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
9.225 + printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
9.226 +};
9.227 +
9.228 +symbol_option: T_OPTION symbol_option_list T_EOL
9.229 +;
9.230 +
9.231 +symbol_option_list:
9.232 + /* empty */
9.233 + | symbol_option_list T_WORD symbol_option_arg
9.234 +{
9.235 + struct kconf_id *id = kconf_id_lookup($2, strlen($2));
9.236 + if (id && id->flags & TF_OPTION)
9.237 + menu_add_option(id->token, $3);
9.238 + else
9.239 + zconfprint("warning: ignoring unknown option %s", $2);
9.240 + free($2);
9.241 +};
9.242 +
9.243 +symbol_option_arg:
9.244 + /* empty */ { $$ = NULL; }
9.245 + | T_EQUAL prompt { $$ = $2; }
9.246 +;
9.247 +
9.248 +/* choice entry */
9.249 +
9.250 +choice: T_CHOICE word_opt T_EOL
9.251 +{
9.252 + struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
9.253 + sym->flags |= SYMBOL_AUTO;
9.254 + menu_add_entry(sym);
9.255 + menu_add_expr(P_CHOICE, NULL, NULL);
9.256 + printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
9.257 +};
9.258 +
9.259 +choice_entry: choice choice_option_list
9.260 +{
9.261 + $$ = menu_add_menu();
9.262 +};
9.263 +
9.264 +choice_end: end
9.265 +{
9.266 + if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) {
9.267 + menu_end_menu();
9.268 + printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
9.269 + }
9.270 +};
9.271 +
9.272 +choice_stmt: choice_entry choice_block choice_end
9.273 +;
9.274 +
9.275 +choice_option_list:
9.276 + /* empty */
9.277 + | choice_option_list choice_option
9.278 + | choice_option_list depends
9.279 + | choice_option_list help
9.280 + | choice_option_list T_EOL
9.281 + | choice_option_list option_error
9.282 +;
9.283 +
9.284 +choice_option: T_PROMPT prompt if_expr T_EOL
9.285 +{
9.286 + menu_add_prompt(P_PROMPT, $2, $3);
9.287 + printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
9.288 +};
9.289 +
9.290 +choice_option: T_TYPE prompt_stmt_opt T_EOL
9.291 +{
9.292 + if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) {
9.293 + menu_set_type($1->stype);
9.294 + printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
9.295 + zconf_curname(), zconf_lineno(),
9.296 + $1->stype);
9.297 + } else
9.298 + YYERROR;
9.299 +};
9.300 +
9.301 +choice_option: T_OPTIONAL T_EOL
9.302 +{
9.303 + current_entry->sym->flags |= SYMBOL_OPTIONAL;
9.304 + printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
9.305 +};
9.306 +
9.307 +choice_option: T_DEFAULT T_WORD if_expr T_EOL
9.308 +{
9.309 + if ($1->stype == S_UNKNOWN) {
9.310 + menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3);
9.311 + printd(DEBUG_PARSE, "%s:%d:default\n",
9.312 + zconf_curname(), zconf_lineno());
9.313 + } else
9.314 + YYERROR;
9.315 +};
9.316 +
9.317 +choice_block:
9.318 + /* empty */
9.319 + | choice_block common_stmt
9.320 +;
9.321 +
9.322 +/* if entry */
9.323 +
9.324 +if_entry: T_IF expr nl
9.325 +{
9.326 + printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
9.327 + menu_add_entry(NULL);
9.328 + menu_add_dep($2);
9.329 + $$ = menu_add_menu();
9.330 +};
9.331 +
9.332 +if_end: end
9.333 +{
9.334 + if (zconf_endtoken($1, T_IF, T_ENDIF)) {
9.335 + menu_end_menu();
9.336 + printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
9.337 + }
9.338 +};
9.339 +
9.340 +if_stmt: if_entry if_block if_end
9.341 +;
9.342 +
9.343 +if_block:
9.344 + /* empty */
9.345 + | if_block common_stmt
9.346 + | if_block menu_stmt
9.347 + | if_block choice_stmt
9.348 +;
9.349 +
9.350 +/* mainmenu entry */
9.351 +
9.352 +mainmenu_stmt: T_MAINMENU prompt nl
9.353 +{
9.354 + menu_add_prompt(P_MENU, $2, NULL);
9.355 +};
9.356 +
9.357 +/* menu entry */
9.358 +
9.359 +menu: T_MENU prompt T_EOL
9.360 +{
9.361 + menu_add_entry(NULL);
9.362 + menu_add_prompt(P_MENU, $2, NULL);
9.363 + printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
9.364 +};
9.365 +
9.366 +menu_entry: menu visibility_list depends_list
9.367 +{
9.368 + $$ = menu_add_menu();
9.369 +};
9.370 +
9.371 +menu_end: end
9.372 +{
9.373 + if (zconf_endtoken($1, T_MENU, T_ENDMENU)) {
9.374 + menu_end_menu();
9.375 + printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
9.376 + }
9.377 +};
9.378 +
9.379 +menu_stmt: menu_entry menu_block menu_end
9.380 +;
9.381 +
9.382 +menu_block:
9.383 + /* empty */
9.384 + | menu_block common_stmt
9.385 + | menu_block menu_stmt
9.386 + | menu_block choice_stmt
9.387 +;
9.388 +
9.389 +source_stmt: T_SOURCE prompt T_EOL
9.390 +{
9.391 + printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
9.392 + zconf_nextfile($2);
9.393 +};
9.394 +
9.395 +/* comment entry */
9.396 +
9.397 +comment: T_COMMENT prompt T_EOL
9.398 +{
9.399 + menu_add_entry(NULL);
9.400 + menu_add_prompt(P_COMMENT, $2, NULL);
9.401 + printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
9.402 +};
9.403 +
9.404 +comment_stmt: comment depends_list
9.405 +{
9.406 + menu_end_entry();
9.407 +};
9.408 +
9.409 +/* help option */
9.410 +
9.411 +help_start: T_HELP T_EOL
9.412 +{
9.413 + printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
9.414 + zconf_starthelp();
9.415 +};
9.416 +
9.417 +help: help_start T_HELPTEXT
9.418 +{
9.419 + current_entry->help = $2;
9.420 +};
9.421 +
9.422 +/* depends option */
9.423 +
9.424 +depends_list:
9.425 + /* empty */
9.426 + | depends_list depends
9.427 + | depends_list T_EOL
9.428 + | depends_list option_error
9.429 +;
9.430 +
9.431 +depends: T_DEPENDS T_ON expr T_EOL
9.432 +{
9.433 + menu_add_dep($3);
9.434 + printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
9.435 +};
9.436 +
9.437 +/* visibility option */
9.438 +
9.439 +visibility_list:
9.440 + /* empty */
9.441 + | visibility_list visible
9.442 + | visibility_list T_EOL
9.443 +;
9.444 +
9.445 +visible: T_VISIBLE if_expr
9.446 +{
9.447 + menu_add_visibility($2);
9.448 +};
9.449 +
9.450 +/* prompt statement */
9.451 +
9.452 +prompt_stmt_opt:
9.453 + /* empty */
9.454 + | prompt if_expr
9.455 +{
9.456 + menu_add_prompt(P_PROMPT, $1, $2);
9.457 +};
9.458 +
9.459 +prompt: T_WORD
9.460 + | T_WORD_QUOTE
9.461 +;
9.462 +
9.463 +end: T_ENDMENU T_EOL { $$ = $1; }
9.464 + | T_ENDCHOICE T_EOL { $$ = $1; }
9.465 + | T_ENDIF T_EOL { $$ = $1; }
9.466 +;
9.467 +
9.468 +nl:
9.469 + T_EOL
9.470 + | nl T_EOL
9.471 +;
9.472 +
9.473 +if_expr: /* empty */ { $$ = NULL; }
9.474 + | T_IF expr { $$ = $2; }
9.475 +;
9.476 +
9.477 +expr: symbol { $$ = expr_alloc_symbol($1); }
9.478 + | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); }
9.479 + | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); }
9.480 + | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; }
9.481 + | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); }
9.482 + | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); }
9.483 + | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); }
9.484 +;
9.485 +
9.486 +symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); }
9.487 + | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
9.488 +;
9.489 +
9.490 +word_opt: /* empty */ { $$ = NULL; }
9.491 + | T_WORD
9.492 +
9.493 +%%
9.494 +
9.495 +void conf_parse(const char *name)
9.496 +{
9.497 + struct symbol *sym;
9.498 + int i;
9.499 +
9.500 + zconf_initscan(name);
9.501 +
9.502 + sym_init();
9.503 + _menu_init();
9.504 + modules_sym = sym_lookup(NULL, 0);
9.505 + modules_sym->type = S_BOOLEAN;
9.506 + modules_sym->flags |= SYMBOL_AUTO;
9.507 + rootmenu.prompt = menu_add_prompt(P_MENU, PACKAGE " Configuration", NULL);
9.508 +
9.509 +#if YYDEBUG
9.510 + if (getenv("ZCONF_DEBUG"))
9.511 + zconfdebug = 1;
9.512 +#endif
9.513 + zconfparse();
9.514 + if (zconfnerrs)
9.515 + exit(1);
9.516 + if (!modules_sym->prop) {
9.517 + struct property *prop;
9.518 +
9.519 + prop = prop_alloc(P_DEFAULT, modules_sym);
9.520 + prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
9.521 + }
9.522 +
9.523 + rootmenu.prompt->text = _(rootmenu.prompt->text);
9.524 + rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
9.525 +
9.526 + menu_finalize(&rootmenu);
9.527 + for_all_symbols(i, sym) {
9.528 + if (sym_check_deps(sym))
9.529 + zconfnerrs++;
9.530 + }
9.531 + if (zconfnerrs)
9.532 + exit(1);
9.533 + sym_set_change_count(1);
9.534 +}
9.535 +
9.536 +static const char *zconf_tokenname(int token)
9.537 +{
9.538 + switch (token) {
9.539 + case T_MENU: return "menu";
9.540 + case T_ENDMENU: return "endmenu";
9.541 + case T_CHOICE: return "choice";
9.542 + case T_ENDCHOICE: return "endchoice";
9.543 + case T_IF: return "if";
9.544 + case T_ENDIF: return "endif";
9.545 + case T_DEPENDS: return "depends";
9.546 + case T_VISIBLE: return "visible";
9.547 + }
9.548 + return "<token>";
9.549 +}
9.550 +
9.551 +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
9.552 +{
9.553 + if (id->token != endtoken) {
9.554 + zconf_error("unexpected '%s' within %s block",
9.555 + kconf_id_strings + id->name, zconf_tokenname(starttoken));
9.556 + zconfnerrs++;
9.557 + return false;
9.558 + }
9.559 + if (current_menu->file != current_file) {
9.560 + zconf_error("'%s' in different file than '%s'",
9.561 + kconf_id_strings + id->name, zconf_tokenname(starttoken));
9.562 + fprintf(stderr, "%s:%d: location of the '%s'\n",
9.563 + current_menu->file->name, current_menu->lineno,
9.564 + zconf_tokenname(starttoken));
9.565 + zconfnerrs++;
9.566 + return false;
9.567 + }
9.568 + return true;
9.569 +}
9.570 +
9.571 +static void zconfprint(const char *err, ...)
9.572 +{
9.573 + va_list ap;
9.574 +
9.575 + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
9.576 + va_start(ap, err);
9.577 + vfprintf(stderr, err, ap);
9.578 + va_end(ap);
9.579 + fprintf(stderr, "\n");
9.580 +}
9.581 +
9.582 +static void zconf_error(const char *err, ...)
9.583 +{
9.584 + va_list ap;
9.585 +
9.586 + zconfnerrs++;
9.587 + fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
9.588 + va_start(ap, err);
9.589 + vfprintf(stderr, err, ap);
9.590 + va_end(ap);
9.591 + fprintf(stderr, "\n");
9.592 +}
9.593 +
9.594 +static void zconferror(const char *err)
9.595 +{
9.596 +#if YYDEBUG
9.597 + fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
9.598 +#endif
9.599 +}
9.600 +
9.601 +static void print_quoted_string(FILE *out, const char *str)
9.602 +{
9.603 + const char *p;
9.604 + int len;
9.605 +
9.606 + putc('"', out);
9.607 + while ((p = strchr(str, '"'))) {
9.608 + len = p - str;
9.609 + if (len)
9.610 + fprintf(out, "%.*s", len, str);
9.611 + fputs("\\\"", out);
9.612 + str = p + 1;
9.613 + }
9.614 + fputs(str, out);
9.615 + putc('"', out);
9.616 +}
9.617 +
9.618 +static void print_symbol(FILE *out, struct menu *menu)
9.619 +{
9.620 + struct symbol *sym = menu->sym;
9.621 + struct property *prop;
9.622 +
9.623 + if (sym_is_choice(sym))
9.624 + fprintf(out, "\nchoice\n");
9.625 + else
9.626 + fprintf(out, "\nconfig %s\n", sym->name);
9.627 + switch (sym->type) {
9.628 + case S_BOOLEAN:
9.629 + fputs(" boolean\n", out);
9.630 + break;
9.631 + case S_TRISTATE:
9.632 + fputs(" tristate\n", out);
9.633 + break;
9.634 + case S_STRING:
9.635 + fputs(" string\n", out);
9.636 + break;
9.637 + case S_INT:
9.638 + fputs(" integer\n", out);
9.639 + break;
9.640 + case S_HEX:
9.641 + fputs(" hex\n", out);
9.642 + break;
9.643 + default:
9.644 + fputs(" ???\n", out);
9.645 + break;
9.646 + }
9.647 + for (prop = sym->prop; prop; prop = prop->next) {
9.648 + if (prop->menu != menu)
9.649 + continue;
9.650 + switch (prop->type) {
9.651 + case P_PROMPT:
9.652 + fputs(" prompt ", out);
9.653 + print_quoted_string(out, prop->text);
9.654 + if (!expr_is_yes(prop->visible.expr)) {
9.655 + fputs(" if ", out);
9.656 + expr_fprint(prop->visible.expr, out);
9.657 + }
9.658 + fputc('\n', out);
9.659 + break;
9.660 + case P_DEFAULT:
9.661 + fputs( " default ", out);
9.662 + expr_fprint(prop->expr, out);
9.663 + if (!expr_is_yes(prop->visible.expr)) {
9.664 + fputs(" if ", out);
9.665 + expr_fprint(prop->visible.expr, out);
9.666 + }
9.667 + fputc('\n', out);
9.668 + break;
9.669 + case P_CHOICE:
9.670 + fputs(" #choice value\n", out);
9.671 + break;
9.672 + case P_SELECT:
9.673 + fputs( " select ", out);
9.674 + expr_fprint(prop->expr, out);
9.675 + fputc('\n', out);
9.676 + break;
9.677 + case P_RANGE:
9.678 + fputs( " range ", out);
9.679 + expr_fprint(prop->expr, out);
9.680 + fputc('\n', out);
9.681 + break;
9.682 + case P_MENU:
9.683 + fputs( " menu ", out);
9.684 + print_quoted_string(out, prop->text);
9.685 + fputc('\n', out);
9.686 + break;
9.687 + default:
9.688 + fprintf(out, " unknown prop %d!\n", prop->type);
9.689 + break;
9.690 + }
9.691 + }
9.692 + if (menu->help) {
9.693 + int len = strlen(menu->help);
9.694 + while (menu->help[--len] == '\n')
9.695 + menu->help[len] = 0;
9.696 + fprintf(out, " help\n%s\n", menu->help);
9.697 + }
9.698 +}
9.699 +
9.700 +void zconfdump(FILE *out)
9.701 +{
9.702 + struct property *prop;
9.703 + struct symbol *sym;
9.704 + struct menu *menu;
9.705 +
9.706 + menu = rootmenu.list;
9.707 + while (menu) {
9.708 + if ((sym = menu->sym))
9.709 + print_symbol(out, menu);
9.710 + else if ((prop = menu->prompt)) {
9.711 + switch (prop->type) {
9.712 + case P_COMMENT:
9.713 + fputs("\ncomment ", out);
9.714 + print_quoted_string(out, prop->text);
9.715 + fputs("\n", out);
9.716 + break;
9.717 + case P_MENU:
9.718 + fputs("\nmenu ", out);
9.719 + print_quoted_string(out, prop->text);
9.720 + fputs("\n", out);
9.721 + break;
9.722 + default:
9.723 + ;
9.724 + }
9.725 + if (!expr_is_yes(prop->visible.expr)) {
9.726 + fputs(" depends ", out);
9.727 + expr_fprint(prop->visible.expr, out);
9.728 + fputc('\n', out);
9.729 + }
9.730 + }
9.731 +
9.732 + if (menu->list)
9.733 + menu = menu->list;
9.734 + else if (menu->next)
9.735 + menu = menu->next;
9.736 + else while ((menu = menu->parent)) {
9.737 + if (menu->prompt && menu->prompt->type == P_MENU)
9.738 + fputs("\nendmenu\n", out);
9.739 + if (menu->next) {
9.740 + menu = menu->next;
9.741 + break;
9.742 + }
9.743 + }
9.744 + }
9.745 +}
9.746 +
9.747 +#include "lex.zconf.c"
9.748 +#include "util.c"
9.749 +#include "confdata.c"
9.750 +#include "expr.c"
9.751 +#include "symbol.c"
9.752 +#include "menu.c"