source: drbl_ui/backup/test_busybox/busybox-1.7.2/scripts/kconfig/zconf.tab.c_shipped @ 20

Last change on this file since 20 was 20, checked in by chris, 16 years ago
File size: 58.9 KB
Line 
1/* A Bison parser, made by GNU Bison 2.0.  */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place - Suite 330,
19   Boston, MA 02111-1307, USA.  */
20
21/* As a special exception, when this file is copied by Bison into a
22   Bison output file, you may use that output file without restriction.
23   This special exception was added by the Free Software Foundation
24   in version 1.24 of Bison.  */
25
26/* Written by Richard Stallman by simplifying the original so called
27   ``semantic'' parser.  */
28
29/* All symbols defined below should begin with yy or YY, to avoid
30   infringing on user name space.  This should be done even for local
31   variables, as they might otherwise be expanded by user macros.
32   There are some unavoidable exceptions within include files to
33   define necessary library symbols; they are noted "INFRINGES ON
34   USER NAME SPACE" below.  */
35
36/* Identify Bison output.  */
37#define YYBISON 1
38
39/* Skeleton name.  */
40#define YYSKELETON_NAME "yacc.c"
41
42/* Pure parsers.  */
43#define YYPURE 0
44
45/* Using locations.  */
46#define YYLSP_NEEDED 0
47
48/* Substitute the variable and function names.  */
49#define yyparse zconfparse
50#define yylex   zconflex
51#define yyerror zconferror
52#define yylval  zconflval
53#define yychar  zconfchar
54#define yydebug zconfdebug
55#define yynerrs zconfnerrs
56
57
58/* Tokens.  */
59#ifndef YYTOKENTYPE
60# define YYTOKENTYPE
61   /* Put the tokens into the symbol table, so that GDB and other debuggers
62      know about them.  */
63   enum yytokentype {
64     T_MAINMENU = 258,
65     T_MENU = 259,
66     T_ENDMENU = 260,
67     T_SOURCE = 261,
68     T_CHOICE = 262,
69     T_ENDCHOICE = 263,
70     T_COMMENT = 264,
71     T_CONFIG = 265,
72     T_MENUCONFIG = 266,
73     T_HELP = 267,
74     T_HELPTEXT = 268,
75     T_IF = 269,
76     T_ENDIF = 270,
77     T_DEPENDS = 271,
78     T_REQUIRES = 272,
79     T_OPTIONAL = 273,
80     T_PROMPT = 274,
81     T_TYPE = 275,
82     T_DEFAULT = 276,
83     T_SELECT = 277,
84     T_RANGE = 278,
85     T_ON = 279,
86     T_WORD = 280,
87     T_WORD_QUOTE = 281,
88     T_UNEQUAL = 282,
89     T_CLOSE_PAREN = 283,
90     T_OPEN_PAREN = 284,
91     T_EOL = 285,
92     T_OR = 286,
93     T_AND = 287,
94     T_EQUAL = 288,
95     T_NOT = 289
96   };
97#endif
98#define T_MAINMENU 258
99#define T_MENU 259
100#define T_ENDMENU 260
101#define T_SOURCE 261
102#define T_CHOICE 262
103#define T_ENDCHOICE 263
104#define T_COMMENT 264
105#define T_CONFIG 265
106#define T_MENUCONFIG 266
107#define T_HELP 267
108#define T_HELPTEXT 268
109#define T_IF 269
110#define T_ENDIF 270
111#define T_DEPENDS 271
112#define T_REQUIRES 272
113#define T_OPTIONAL 273
114#define T_PROMPT 274
115#define T_TYPE 275
116#define T_DEFAULT 276
117#define T_SELECT 277
118#define T_RANGE 278
119#define T_ON 279
120#define T_WORD 280
121#define T_WORD_QUOTE 281
122#define T_UNEQUAL 282
123#define T_CLOSE_PAREN 283
124#define T_OPEN_PAREN 284
125#define T_EOL 285
126#define T_OR 286
127#define T_AND 287
128#define T_EQUAL 288
129#define T_NOT 289
130
131
132
133
134/* Copy the first part of user declarations.  */
135
136
137/*
138 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
139 * Released under the terms of the GNU GPL v2.0.
140 */
141
142#include <ctype.h>
143#include <stdarg.h>
144#include <stdio.h>
145#include <stdlib.h>
146#include <string.h>
147#include <stdbool.h>
148
149#define LKC_DIRECT_LINK
150#include "lkc.h"
151
152#include "zconf.hash.c"
153
154#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
155
156#define PRINTD    0x0001
157#define DEBUG_PARSE 0x0002
158
159int cdebug = PRINTD;
160
161extern int zconflex(void);
162static void zconfprint(const char *err, ...);
163static void zconf_error(const char *err, ...);
164static void zconferror(const char *err);
165static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
166
167struct symbol *symbol_hash[257];
168
169static struct menu *current_menu, *current_entry;
170
171#define YYDEBUG 0
172#if YYDEBUG
173#define YYERROR_VERBOSE
174#endif
175
176
177/* Enabling traces.  */
178#ifndef YYDEBUG
179# define YYDEBUG 0
180#endif
181
182/* Enabling verbose error messages.  */
183#ifdef YYERROR_VERBOSE
184# undef YYERROR_VERBOSE
185# define YYERROR_VERBOSE 1
186#else
187# define YYERROR_VERBOSE 0
188#endif
189
190#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
191
192typedef union YYSTYPE {
193  char *string;
194  struct file *file;
195  struct symbol *symbol;
196  struct expr *expr;
197  struct menu *menu;
198  struct kconf_id *id;
199} YYSTYPE;
200/* Line 190 of yacc.c.  */
201
202# define yystype YYSTYPE /* obsolescent; will be withdrawn */
203# define YYSTYPE_IS_DECLARED 1
204# define YYSTYPE_IS_TRIVIAL 1
205#endif
206
207
208
209/* Copy the second part of user declarations.  */
210
211
212/* Line 213 of yacc.c.  */
213
214
215#if ! defined (yyoverflow) || YYERROR_VERBOSE
216
217# ifndef YYFREE
218#  define YYFREE free
219# endif
220# ifndef YYMALLOC
221#  define YYMALLOC malloc
222# endif
223
224/* The parser invokes alloca or malloc; define the necessary symbols.  */
225
226# ifdef YYSTACK_USE_ALLOCA
227#  if YYSTACK_USE_ALLOCA
228#   ifdef __GNUC__
229#    define YYSTACK_ALLOC __builtin_alloca
230#   else
231#    define YYSTACK_ALLOC alloca
232#   endif
233#  endif
234# endif
235
236# ifdef YYSTACK_ALLOC
237   /* Pacify GCC's `empty if-body' warning. */
238#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
239# else
240#  if defined (__STDC__) || defined (__cplusplus)
241#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
242#   define YYSIZE_T size_t
243#  endif
244#  define YYSTACK_ALLOC YYMALLOC
245#  define YYSTACK_FREE YYFREE
246# endif
247#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
248
249
250#if (! defined (yyoverflow) \
251     && (! defined (__cplusplus) \
252   || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
253
254/* A type that is properly aligned for any stack member.  */
255union yyalloc
256{
257  short int yyss;
258  YYSTYPE yyvs;
259  };
260
261/* The size of the maximum gap between one aligned stack and the next.  */
262# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
263
264/* The size of an array large to enough to hold all stacks, each with
265   N elements.  */
266# define YYSTACK_BYTES(N) \
267     ((N) * (sizeof (short int) + sizeof (YYSTYPE))     \
268      + YYSTACK_GAP_MAXIMUM)
269
270/* Copy COUNT objects from FROM to TO.  The source and destination do
271   not overlap.  */
272# ifndef YYCOPY
273#  if defined (__GNUC__) && 1 < __GNUC__
274#   define YYCOPY(To, From, Count) \
275      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
276#  else
277#   define YYCOPY(To, From, Count)    \
278      do          \
279  {         \
280    register YYSIZE_T yyi;    \
281    for (yyi = 0; yyi < (Count); yyi++) \
282      (To)[yyi] = (From)[yyi];    \
283  }         \
284      while (0)
285#  endif
286# endif
287
288/* Relocate STACK from its old location to the new one.  The
289   local variables YYSIZE and YYSTACKSIZE give the old and new number of
290   elements in the stack, and YYPTR gives the new location of the
291   stack.  Advance YYPTR to a properly aligned location for the next
292   stack.  */
293# define YYSTACK_RELOCATE(Stack)          \
294    do                  \
295      {                 \
296  YYSIZE_T yynewbytes;            \
297  YYCOPY (&yyptr->Stack, Stack, yysize);        \
298  Stack = &yyptr->Stack;            \
299  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
300  yyptr += yynewbytes / sizeof (*yyptr);        \
301      }                 \
302    while (0)
303
304#endif
305
306#if defined (__STDC__) || defined (__cplusplus)
307   typedef signed char yysigned_char;
308#else
309   typedef short int yysigned_char;
310#endif
311
312/* YYFINAL -- State number of the termination state. */
313#define YYFINAL  3
314/* YYLAST -- Last index in YYTABLE.  */
315#define YYLAST   264
316
317/* YYNTOKENS -- Number of terminals. */
318#define YYNTOKENS  35
319/* YYNNTS -- Number of nonterminals. */
320#define YYNNTS  42
321/* YYNRULES -- Number of rules. */
322#define YYNRULES  104
323/* YYNRULES -- Number of states. */
324#define YYNSTATES  175
325
326/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
327#define YYUNDEFTOK  2
328#define YYMAXUTOK   289
329
330#define YYTRANSLATE(YYX)            \
331  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
332
333/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
334static const unsigned char yytranslate[] =
335{
336       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
337       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
338       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
339       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
340       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
341       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
342       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
343       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
344       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
345       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
346       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
347       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
348       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
349       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
350       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
351       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
352       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
353       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
354       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
355       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
356       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
357       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
358       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
359       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
360       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
361       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
362       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
363      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
364      25,    26,    27,    28,    29,    30,    31,    32,    33,    34
365};
366
367#if YYDEBUG
368/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
369   YYRHS.  */
370static const unsigned short int yyprhs[] =
371{
372       0,     0,     3,     5,     6,     9,    12,    15,    20,    23,
373      28,    33,    37,    39,    41,    43,    45,    47,    49,    51,
374      53,    55,    57,    59,    61,    63,    67,    70,    74,    77,
375      81,    84,    85,    88,    91,    94,    97,   100,   104,   109,
376     114,   119,   125,   128,   131,   133,   137,   138,   141,   144,
377     147,   150,   153,   158,   162,   165,   170,   171,   174,   178,
378     180,   184,   185,   188,   191,   194,   198,   201,   203,   207,
379     208,   211,   214,   217,   221,   225,   228,   231,   234,   235,
380     238,   241,   244,   249,   253,   257,   258,   261,   263,   265,
381     268,   271,   274,   276,   279,   280,   283,   285,   289,   293,
382     297,   300,   304,   308,   310
383};
384
385/* YYRHS -- A `-1'-separated list of the rules' RHS. */
386static const yysigned_char yyrhs[] =
387{
388      36,     0,    -1,    37,    -1,    -1,    37,    39,    -1,    37,
389      50,    -1,    37,    61,    -1,    37,     3,    71,    73,    -1,
390      37,    72,    -1,    37,    25,     1,    30,    -1,    37,    38,
391       1,    30,    -1,    37,     1,    30,    -1,    16,    -1,    19,
392      -1,    20,    -1,    22,    -1,    18,    -1,    23,    -1,    21,
393      -1,    30,    -1,    56,    -1,    65,    -1,    42,    -1,    44,
394      -1,    63,    -1,    25,     1,    30,    -1,     1,    30,    -1,
395      10,    25,    30,    -1,    41,    45,    -1,    11,    25,    30,
396      -1,    43,    45,    -1,    -1,    45,    46,    -1,    45,    69,
397      -1,    45,    67,    -1,    45,    40,    -1,    45,    30,    -1,
398      20,    70,    30,    -1,    19,    71,    74,    30,    -1,    21,
399      75,    74,    30,    -1,    22,    25,    74,    30,    -1,    23,
400      76,    76,    74,    30,    -1,     7,    30,    -1,    47,    51,
401      -1,    72,    -1,    48,    53,    49,    -1,    -1,    51,    52,
402      -1,    51,    69,    -1,    51,    67,    -1,    51,    30,    -1,
403      51,    40,    -1,    19,    71,    74,    30,    -1,    20,    70,
404      30,    -1,    18,    30,    -1,    21,    25,    74,    30,    -1,
405      -1,    53,    39,    -1,    14,    75,    73,    -1,    72,    -1,
406      54,    57,    55,    -1,    -1,    57,    39,    -1,    57,    61,
407      -1,    57,    50,    -1,     4,    71,    30,    -1,    58,    68,
408      -1,    72,    -1,    59,    62,    60,    -1,    -1,    62,    39,
409      -1,    62,    61,    -1,    62,    50,    -1,     6,    71,    30,
410      -1,     9,    71,    30,    -1,    64,    68,    -1,    12,    30,
411      -1,    66,    13,    -1,    -1,    68,    69,    -1,    68,    30,
412      -1,    68,    40,    -1,    16,    24,    75,    30,    -1,    16,
413      75,    30,    -1,    17,    75,    30,    -1,    -1,    71,    74,
414      -1,    25,    -1,    26,    -1,     5,    30,    -1,     8,    30,
415      -1,    15,    30,    -1,    30,    -1,    73,    30,    -1,    -1,
416      14,    75,    -1,    76,    -1,    76,    33,    76,    -1,    76,
417      27,    76,    -1,    29,    75,    28,    -1,    34,    75,    -1,
418      75,    31,    75,    -1,    75,    32,    75,    -1,    25,    -1,
419      26,    -1
420};
421
422/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
423static const unsigned short int yyrline[] =
424{
425       0,   103,   103,   105,   107,   108,   109,   110,   111,   112,
426     113,   117,   121,   121,   121,   121,   121,   121,   121,   125,
427     126,   127,   128,   129,   130,   134,   135,   141,   149,   155,
428     163,   173,   175,   176,   177,   178,   179,   182,   190,   196,
429     206,   212,   220,   229,   234,   242,   245,   247,   248,   249,
430     250,   251,   254,   260,   271,   277,   287,   289,   294,   302,
431     310,   313,   315,   316,   317,   322,   329,   334,   342,   345,
432     347,   348,   349,   352,   360,   367,   374,   380,   387,   389,
433     390,   391,   394,   399,   404,   412,   414,   419,   420,   423,
434     424,   425,   429,   430,   433,   434,   437,   438,   439,   440,
435     441,   442,   443,   446,   447
436};
437#endif
438
439#if YYDEBUG || YYERROR_VERBOSE
440/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
441   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
442static const char *const yytname[] =
443{
444  "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
445  "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
446  "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
447  "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
448  "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
449  "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
450  "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt",
451  "option_error", "config_entry_start", "config_stmt",
452  "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
453  "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
454  "choice_option_list", "choice_option", "choice_block", "if_entry",
455  "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end",
456  "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt",
457  "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
458  "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
459};
460#endif
461
462# ifdef YYPRINT
463/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
464   token YYLEX-NUM.  */
465static const unsigned short int yytoknum[] =
466{
467       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
468     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
469     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
470     285,   286,   287,   288,   289
471};
472# endif
473
474/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
475static const unsigned char yyr1[] =
476{
477       0,    35,    36,    37,    37,    37,    37,    37,    37,    37,
478      37,    37,    38,    38,    38,    38,    38,    38,    38,    39,
479      39,    39,    39,    39,    39,    40,    40,    41,    42,    43,
480      44,    45,    45,    45,    45,    45,    45,    46,    46,    46,
481      46,    46,    47,    48,    49,    50,    51,    51,    51,    51,
482      51,    51,    52,    52,    52,    52,    53,    53,    54,    55,
483      56,    57,    57,    57,    57,    58,    59,    60,    61,    62,
484      62,    62,    62,    63,    64,    65,    66,    67,    68,    68,
485      68,    68,    69,    69,    69,    70,    70,    71,    71,    72,
486      72,    72,    73,    73,    74,    74,    75,    75,    75,    75,
487      75,    75,    75,    76,    76
488};
489
490/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
491static const unsigned char yyr2[] =
492{
493       0,     2,     1,     0,     2,     2,     2,     4,     2,     4,
494       4,     3,     1,     1,     1,     1,     1,     1,     1,     1,
495       1,     1,     1,     1,     1,     3,     2,     3,     2,     3,
496       2,     0,     2,     2,     2,     2,     2,     3,     4,     4,
497       4,     5,     2,     2,     1,     3,     0,     2,     2,     2,
498       2,     2,     4,     3,     2,     4,     0,     2,     3,     1,
499       3,     0,     2,     2,     2,     3,     2,     1,     3,     0,
500       2,     2,     2,     3,     3,     2,     2,     2,     0,     2,
501       2,     2,     4,     3,     3,     0,     2,     1,     1,     2,
502       2,     2,     1,     2,     0,     2,     1,     3,     3,     3,
503       2,     3,     3,     1,     1
504};
505
506/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
507   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
508   means the default is an error.  */
509static const unsigned char yydefact[] =
510{
511       3,     0,     0,     1,     0,     0,     0,     0,     0,     0,
512       0,     0,     0,     0,     0,     0,    12,    16,    13,    14,
513      18,    15,    17,     0,    19,     0,     4,    31,    22,    31,
514      23,    46,    56,     5,    61,    20,    78,    69,     6,    24,
515      78,    21,     8,    11,    87,    88,     0,     0,    89,     0,
516      42,    90,     0,     0,     0,   103,   104,     0,     0,     0,
517      96,    91,     0,     0,     0,     0,     0,     0,     0,     0,
518       0,     0,    92,     7,    65,    73,    74,    27,    29,     0,
519     100,     0,     0,    58,     0,     0,     9,    10,     0,     0,
520       0,     0,     0,    85,     0,     0,     0,     0,    36,    35,
521      32,     0,    34,    33,     0,     0,    85,     0,    50,    51,
522      47,    49,    48,    57,    45,    44,    62,    64,    60,    63,
523      59,    80,    81,    79,    70,    72,    68,    71,    67,    93,
524      99,   101,   102,    98,    97,    26,    76,     0,     0,     0,
525      94,     0,    94,    94,    94,     0,     0,    77,    54,    94,
526       0,    94,     0,    83,    84,     0,     0,    37,    86,     0,
527       0,    94,    25,     0,    53,     0,    82,    95,    38,    39,
528      40,     0,    52,    55,    41
529};
530
531/* YYDEFGOTO[NTERM-NUM]. */
532static const short int yydefgoto[] =
533{
534      -1,     1,     2,    25,    26,    99,    27,    28,    29,    30,
535      64,   100,    31,    32,   114,    33,    66,   110,    67,    34,
536     118,    35,    68,    36,    37,   126,    38,    70,    39,    40,
537      41,   101,   102,    69,   103,   141,   142,    42,    73,   156,
538      59,    60
539};
540
541/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
542   STATE-NUM.  */
543#define YYPACT_NINF -78
544static const short int yypact[] =
545{
546     -78,     2,   159,   -78,   -21,     0,     0,   -12,     0,     1,
547       4,     0,    27,    38,    60,    58,   -78,   -78,   -78,   -78,
548     -78,   -78,   -78,   100,   -78,   104,   -78,   -78,   -78,   -78,
549     -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,
550     -78,   -78,   -78,   -78,   -78,   -78,    86,   113,   -78,   114,
551     -78,   -78,   125,   127,   128,   -78,   -78,    60,    60,   210,
552      65,   -78,   141,   142,    39,   103,   182,   200,     6,    66,
553       6,   131,   -78,   146,   -78,   -78,   -78,   -78,   -78,   196,
554     -78,    60,    60,   146,    40,    40,   -78,   -78,   155,   156,
555      -2,    60,     0,     0,    60,   105,    40,   194,   -78,   -78,
556     -78,   206,   -78,   -78,   183,     0,     0,   195,   -78,   -78,
557     -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,
558     -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,   -78,
559     -78,   197,   -78,   -78,   -78,   -78,   -78,    60,   213,   216,
560     212,   203,   212,   190,   212,    40,   208,   -78,   -78,   212,
561     222,   212,   219,   -78,   -78,    60,   223,   -78,   -78,   224,
562     225,   212,   -78,   226,   -78,   227,   -78,    47,   -78,   -78,
563     -78,   228,   -78,   -78,   -78
564};
565
566/* YYPGOTO[NTERM-NUM].  */
567static const short int yypgoto[] =
568{
569     -78,   -78,   -78,   -78,   164,   -36,   -78,   -78,   -78,   -78,
570     230,   -78,   -78,   -78,   -78,    29,   -78,   -78,   -78,   -78,
571     -78,   -78,   -78,   -78,   -78,   -78,    59,   -78,   -78,   -78,
572     -78,   -78,   198,   220,    24,   157,    -5,   169,   202,    74,
573     -53,   -77
574};
575
576/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
577   positive, shift that token.  If negative, reduce the rule which
578   number is the opposite.  If zero, do what YYDEFACT says.
579   If YYTABLE_NINF, syntax error.  */
580#define YYTABLE_NINF -76
581static const short int yytable[] =
582{
583      46,    47,     3,    49,    79,    80,    52,   133,   134,    43,
584       6,     7,     8,     9,    10,    11,    12,    13,    48,   145,
585      14,    15,   137,    55,    56,    44,    45,    57,   131,   132,
586     109,    50,    58,   122,    51,   122,    24,   138,   139,   -28,
587      88,   143,   -28,   -28,   -28,   -28,   -28,   -28,   -28,   -28,
588     -28,    89,    53,   -28,   -28,    90,    91,   -28,    92,    93,
589      94,    95,    96,    54,    97,    55,    56,    88,   161,    98,
590     -66,   -66,   -66,   -66,   -66,   -66,   -66,   -66,    81,    82,
591     -66,   -66,    90,    91,   152,    55,    56,   140,    61,    57,
592     112,    97,    84,   123,    58,   123,   121,   117,    85,   125,
593     149,    62,   167,   -30,    88,    63,   -30,   -30,   -30,   -30,
594     -30,   -30,   -30,   -30,   -30,    89,    72,   -30,   -30,    90,
595      91,   -30,    92,    93,    94,    95,    96,   119,    97,   127,
596     144,   -75,    88,    98,   -75,   -75,   -75,   -75,   -75,   -75,
597     -75,   -75,   -75,    74,    75,   -75,   -75,    90,    91,   -75,
598     -75,   -75,   -75,   -75,   -75,    76,    97,    77,    78,    -2,
599       4,   121,     5,     6,     7,     8,     9,    10,    11,    12,
600      13,    86,    87,    14,    15,    16,   129,    17,    18,    19,
601      20,    21,    22,    88,    23,   135,   136,   -43,   -43,    24,
602     -43,   -43,   -43,   -43,    89,   146,   -43,   -43,    90,    91,
603     104,   105,   106,   107,   155,     7,     8,    97,    10,    11,
604      12,    13,   108,   148,    14,    15,   158,   159,   160,   147,
605     151,    81,    82,   163,   130,   165,   155,    81,    82,    82,
606      24,   113,   116,   157,   124,   171,   115,   120,   162,   128,
607      72,    81,    82,   153,    81,    82,   154,    81,    82,   166,
608      81,    82,   164,   168,   169,   170,   172,   173,   174,    65,
609      71,    83,     0,   150,   111
610};
611
612static const short int yycheck[] =
613{
614       5,     6,     0,     8,    57,    58,    11,    84,    85,    30,
615       4,     5,     6,     7,     8,     9,    10,    11,    30,    96,
616      14,    15,    24,    25,    26,    25,    26,    29,    81,    82,
617      66,    30,    34,    69,    30,    71,    30,    90,    91,     0,
618       1,    94,     3,     4,     5,     6,     7,     8,     9,    10,
619      11,    12,    25,    14,    15,    16,    17,    18,    19,    20,
620      21,    22,    23,    25,    25,    25,    26,     1,   145,    30,
621       4,     5,     6,     7,     8,     9,    10,    11,    31,    32,
622      14,    15,    16,    17,   137,    25,    26,    92,    30,    29,
623      66,    25,    27,    69,    34,    71,    30,    68,    33,    70,
624     105,     1,   155,     0,     1,     1,     3,     4,     5,     6,
625       7,     8,     9,    10,    11,    12,    30,    14,    15,    16,
626      17,    18,    19,    20,    21,    22,    23,    68,    25,    70,
627      25,     0,     1,    30,     3,     4,     5,     6,     7,     8,
628       9,    10,    11,    30,    30,    14,    15,    16,    17,    18,
629      19,    20,    21,    22,    23,    30,    25,    30,    30,     0,
630       1,    30,     3,     4,     5,     6,     7,     8,     9,    10,
631      11,    30,    30,    14,    15,    16,    30,    18,    19,    20,
632      21,    22,    23,     1,    25,    30,    30,     5,     6,    30,
633       8,     9,    10,    11,    12,     1,    14,    15,    16,    17,
634      18,    19,    20,    21,    14,     5,     6,    25,     8,     9,
635      10,    11,    30,    30,    14,    15,   142,   143,   144,    13,
636      25,    31,    32,   149,    28,   151,    14,    31,    32,    32,
637      30,    67,    68,    30,    70,   161,    67,    68,    30,    70,
638      30,    31,    32,    30,    31,    32,    30,    31,    32,    30,
639      31,    32,    30,    30,    30,    30,    30,    30,    30,    29,
640      40,    59,    -1,   106,    66
641};
642
643/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
644   symbol of state STATE-NUM.  */
645static const unsigned char yystos[] =
646{
647       0,    36,    37,     0,     1,     3,     4,     5,     6,     7,
648       8,     9,    10,    11,    14,    15,    16,    18,    19,    20,
649      21,    22,    23,    25,    30,    38,    39,    41,    42,    43,
650      44,    47,    48,    50,    54,    56,    58,    59,    61,    63,
651      64,    65,    72,    30,    25,    26,    71,    71,    30,    71,
652      30,    30,    71,    25,    25,    25,    26,    29,    34,    75,
653      76,    30,     1,     1,    45,    45,    51,    53,    57,    68,
654      62,    68,    30,    73,    30,    30,    30,    30,    30,    75,
655      75,    31,    32,    73,    27,    33,    30,    30,     1,    12,
656      16,    17,    19,    20,    21,    22,    23,    25,    30,    40,
657      46,    66,    67,    69,    18,    19,    20,    21,    30,    40,
658      52,    67,    69,    39,    49,    72,    39,    50,    55,    61,
659      72,    30,    40,    69,    39,    50,    60,    61,    72,    30,
660      28,    75,    75,    76,    76,    30,    30,    24,    75,    75,
661      71,    70,    71,    75,    25,    76,     1,    13,    30,    71,
662      70,    25,    75,    30,    30,    14,    74,    30,    74,    74,
663      74,    76,    30,    74,    30,    74,    30,    75,    30,    30,
664      30,    74,    30,    30,    30
665};
666
667#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
668# define YYSIZE_T __SIZE_TYPE__
669#endif
670#if ! defined (YYSIZE_T) && defined (size_t)
671# define YYSIZE_T size_t
672#endif
673#if ! defined (YYSIZE_T)
674# if defined (__STDC__) || defined (__cplusplus)
675#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
676#  define YYSIZE_T size_t
677# endif
678#endif
679#if ! defined (YYSIZE_T)
680# define YYSIZE_T unsigned int
681#endif
682
683#define yyerrok   (yyerrstatus = 0)
684#define yyclearin (yychar = YYEMPTY)
685#define YYEMPTY   (-2)
686#define YYEOF   0
687
688#define YYACCEPT  goto yyacceptlab
689#define YYABORT   goto yyabortlab
690#define YYERROR   goto yyerrorlab
691
692
693/* Like YYERROR except do call yyerror.  This remains here temporarily
694   to ease the transition to the new meaning of YYERROR, for GCC.
695   Once GCC version 2 has supplanted version 1, this can go.  */
696
697#define YYFAIL    goto yyerrlab
698
699#define YYRECOVERING()  (!!yyerrstatus)
700
701#define YYBACKUP(Token, Value)          \
702do                \
703  if (yychar == YYEMPTY && yylen == 1)        \
704    {               \
705      yychar = (Token);           \
706      yylval = (Value);           \
707      yytoken = YYTRANSLATE (yychar);       \
708      YYPOPSTACK;           \
709      goto yybackup;            \
710    }               \
711  else                \
712    {                 \
713      yyerror ("syntax error: cannot back up");\
714      YYERROR;              \
715    }               \
716while (0)
717
718
719#define YYTERROR  1
720#define YYERRCODE 256
721
722
723/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
724   If N is 0, then set CURRENT to the empty location which ends
725   the previous symbol: RHS[0] (always defined).  */
726
727#define YYRHSLOC(Rhs, K) ((Rhs)[K])
728#ifndef YYLLOC_DEFAULT
729# define YYLLOC_DEFAULT(Current, Rhs, N)        \
730    do                  \
731      if (N)                \
732  {               \
733    (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;  \
734    (Current).first_column = YYRHSLOC (Rhs, 1).first_column;  \
735    (Current).last_line    = YYRHSLOC (Rhs, N).last_line;   \
736    (Current).last_column  = YYRHSLOC (Rhs, N).last_column; \
737  }               \
738      else                \
739  {               \
740    (Current).first_line   = (Current).last_line   =    \
741      YYRHSLOC (Rhs, 0).last_line;        \
742    (Current).first_column = (Current).last_column =    \
743      YYRHSLOC (Rhs, 0).last_column;        \
744  }               \
745    while (0)
746#endif
747
748
749/* YY_LOCATION_PRINT -- Print the location on the stream.
750   This macro was not mandated originally: define only if we know
751   we won't break user code: when these are the locations we know.  */
752
753#ifndef YY_LOCATION_PRINT
754# if YYLTYPE_IS_TRIVIAL
755#  define YY_LOCATION_PRINT(File, Loc)      \
756     fprintf (File, "%d.%d-%d.%d",      \
757              (Loc).first_line, (Loc).first_column, \
758              (Loc).last_line,  (Loc).last_column)
759# else
760#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
761# endif
762#endif
763
764
765/* YYLEX -- calling `yylex' with the right arguments.  */
766
767#ifdef YYLEX_PARAM
768# define YYLEX yylex (YYLEX_PARAM)
769#else
770# define YYLEX yylex ()
771#endif
772
773/* Enable debugging if requested.  */
774#if YYDEBUG
775
776# ifndef YYFPRINTF
777#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
778#  define YYFPRINTF fprintf
779# endif
780
781# define YYDPRINTF(Args)      \
782do {            \
783  if (yydebug)          \
784    YYFPRINTF Args;       \
785} while (0)
786
787# define YY_SYMBOL_PRINT(Title, Type, Value, Location)    \
788do {                \
789  if (yydebug)              \
790    {               \
791      YYFPRINTF (stderr, "%s ", Title);       \
792      yysymprint (stderr,           \
793                  Type, Value); \
794      YYFPRINTF (stderr, "\n");         \
795    }               \
796} while (0)
797
798/*------------------------------------------------------------------.
799| yy_stack_print -- Print the state stack from its BOTTOM up to its |
800| TOP (included).                                                   |
801`------------------------------------------------------------------*/
802
803#if defined (__STDC__) || defined (__cplusplus)
804static void
805yy_stack_print (short int *bottom, short int *top)
806#else
807static void
808yy_stack_print (bottom, top)
809    short int *bottom;
810    short int *top;
811#endif
812{
813  YYFPRINTF (stderr, "Stack now");
814  for (/* Nothing. */; bottom <= top; ++bottom)
815    YYFPRINTF (stderr, " %d", *bottom);
816  YYFPRINTF (stderr, "\n");
817}
818
819# define YY_STACK_PRINT(Bottom, Top)        \
820do {                \
821  if (yydebug)              \
822    yy_stack_print ((Bottom), (Top));       \
823} while (0)
824
825
826/*------------------------------------------------.
827| Report that the YYRULE is going to be reduced.  |
828`------------------------------------------------*/
829
830#if defined (__STDC__) || defined (__cplusplus)
831static void
832yy_reduce_print (int yyrule)
833#else
834static void
835yy_reduce_print (yyrule)
836    int yyrule;
837#endif
838{
839  int yyi;
840  unsigned int yylno = yyrline[yyrule];
841  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
842             yyrule - 1, yylno);
843  /* Print the symbols being reduced, and their result.  */
844  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
845    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
846  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
847}
848
849# define YY_REDUCE_PRINT(Rule)    \
850do {          \
851  if (yydebug)        \
852    yy_reduce_print (Rule);   \
853} while (0)
854
855/* Nonzero means print parse trace.  It is left uninitialized so that
856   multiple parsers can coexist.  */
857int yydebug;
858#else /* !YYDEBUG */
859# define YYDPRINTF(Args)
860# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
861# define YY_STACK_PRINT(Bottom, Top)
862# define YY_REDUCE_PRINT(Rule)
863#endif /* !YYDEBUG */
864
865
866/* YYINITDEPTH -- initial size of the parser's stacks.  */
867#ifndef YYINITDEPTH
868# define YYINITDEPTH 200
869#endif
870
871/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
872   if the built-in stack extension method is used).
873
874   Do not make this value too large; the results are undefined if
875   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
876   evaluated with infinite-precision integer arithmetic.  */
877
878#ifndef YYMAXDEPTH
879# define YYMAXDEPTH 10000
880#endif
881
882
883
884#if YYERROR_VERBOSE
885
886# ifndef yystrlen
887#  if defined (__GLIBC__) && defined (_STRING_H)
888#   define yystrlen strlen
889#  else
890/* Return the length of YYSTR.  */
891static YYSIZE_T
892#   if defined (__STDC__) || defined (__cplusplus)
893yystrlen (const char *yystr)
894#   else
895yystrlen (yystr)
896     const char *yystr;
897#   endif
898{
899  register const char *yys = yystr;
900
901  while (*yys++ != '\0')
902    continue;
903
904  return yys - yystr - 1;
905}
906#  endif
907# endif
908
909# ifndef yystpcpy
910#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
911#   define yystpcpy stpcpy
912#  else
913/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
914   YYDEST.  */
915static char *
916#   if defined (__STDC__) || defined (__cplusplus)
917yystpcpy (char *yydest, const char *yysrc)
918#   else
919yystpcpy (yydest, yysrc)
920     char *yydest;
921     const char *yysrc;
922#   endif
923{
924  register char *yyd = yydest;
925  register const char *yys = yysrc;
926
927  while ((*yyd++ = *yys++) != '\0')
928    continue;
929
930  return yyd - 1;
931}
932#  endif
933# endif
934
935#endif /* !YYERROR_VERBOSE */
936
937
938
939#if YYDEBUG
940/*--------------------------------.
941| Print this symbol on YYOUTPUT.  |
942`--------------------------------*/
943
944#if defined (__STDC__) || defined (__cplusplus)
945static void
946yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
947#else
948static void
949yysymprint (yyoutput, yytype, yyvaluep)
950    FILE *yyoutput;
951    int yytype;
952    YYSTYPE *yyvaluep;
953#endif
954{
955  /* Pacify ``unused variable'' warnings.  */
956  (void) yyvaluep;
957
958  if (yytype < YYNTOKENS)
959    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
960  else
961    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
962
963
964# ifdef YYPRINT
965  if (yytype < YYNTOKENS)
966    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
967# endif
968  switch (yytype)
969    {
970      default:
971        break;
972    }
973  YYFPRINTF (yyoutput, ")");
974}
975
976#endif /* ! YYDEBUG */
977/*-----------------------------------------------.
978| Release the memory associated to this symbol.  |
979`-----------------------------------------------*/
980
981#if defined (__STDC__) || defined (__cplusplus)
982static void
983yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
984#else
985static void
986yydestruct (yymsg, yytype, yyvaluep)
987    const char *yymsg;
988    int yytype;
989    YYSTYPE *yyvaluep;
990#endif
991{
992  /* Pacify ``unused variable'' warnings.  */
993  (void) yyvaluep;
994
995  if (!yymsg)
996    yymsg = "Deleting";
997  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
998
999  switch (yytype)
1000    {
1001      case 48: /* choice_entry */
1002
1003        {
1004  fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1005    (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1006  if (current_menu == (yyvaluep->menu))
1007    menu_end_menu();
1008};
1009
1010        break;
1011      case 54: /* if_entry */
1012
1013        {
1014  fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1015    (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1016  if (current_menu == (yyvaluep->menu))
1017    menu_end_menu();
1018};
1019
1020        break;
1021      case 59: /* menu_entry */
1022
1023        {
1024  fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1025    (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1026  if (current_menu == (yyvaluep->menu))
1027    menu_end_menu();
1028};
1029
1030        break;
1031
1032      default:
1033        break;
1034    }
1035}
1036
1037
1038/* Prevent warnings from -Wmissing-prototypes.  */
1039
1040#ifdef YYPARSE_PARAM
1041# if defined (__STDC__) || defined (__cplusplus)
1042int yyparse (void *YYPARSE_PARAM);
1043# else
1044int yyparse ();
1045# endif
1046#else /* ! YYPARSE_PARAM */
1047#if defined (__STDC__) || defined (__cplusplus)
1048int yyparse (void);
1049#else
1050int yyparse ();
1051#endif
1052#endif /* ! YYPARSE_PARAM */
1053
1054
1055
1056/* The look-ahead symbol.  */
1057int yychar;
1058
1059/* The semantic value of the look-ahead symbol.  */
1060YYSTYPE yylval;
1061
1062/* Number of syntax errors so far.  */
1063int yynerrs;
1064
1065
1066
1067/*----------.
1068| yyparse.  |
1069`----------*/
1070
1071#ifdef YYPARSE_PARAM
1072# if defined (__STDC__) || defined (__cplusplus)
1073int yyparse (void *YYPARSE_PARAM)
1074# else
1075int yyparse (YYPARSE_PARAM)
1076  void *YYPARSE_PARAM;
1077# endif
1078#else /* ! YYPARSE_PARAM */
1079#if defined (__STDC__) || defined (__cplusplus)
1080int
1081yyparse (void)
1082#else
1083int
1084yyparse ()
1085
1086#endif
1087#endif
1088{
1089
1090  register int yystate;
1091  register int yyn;
1092  int yyresult;
1093  /* Number of tokens to shift before error messages enabled.  */
1094  int yyerrstatus;
1095  /* Look-ahead token as an internal (translated) token number.  */
1096  int yytoken = 0;
1097
1098  /* Three stacks and their tools:
1099     `yyss': related to states,
1100     `yyvs': related to semantic values,
1101     `yyls': related to locations.
1102
1103     Refer to the stacks thru separate pointers, to allow yyoverflow
1104     to reallocate them elsewhere.  */
1105
1106  /* The state stack.  */
1107  short int yyssa[YYINITDEPTH];
1108  short int *yyss = yyssa;
1109  register short int *yyssp;
1110
1111  /* The semantic value stack.  */
1112  YYSTYPE yyvsa[YYINITDEPTH];
1113  YYSTYPE *yyvs = yyvsa;
1114  register YYSTYPE *yyvsp;
1115
1116
1117
1118#define YYPOPSTACK   (yyvsp--, yyssp--)
1119
1120  YYSIZE_T yystacksize = YYINITDEPTH;
1121
1122  /* The variables used to return semantic value and location from the
1123     action routines.  */
1124  YYSTYPE yyval;
1125
1126
1127  /* When reducing, the number of symbols on the RHS of the reduced
1128     rule.  */
1129  int yylen;
1130
1131  YYDPRINTF ((stderr, "Starting parse\n"));
1132
1133  yystate = 0;
1134  yyerrstatus = 0;
1135  yynerrs = 0;
1136  yychar = YYEMPTY;   /* Cause a token to be read.  */
1137
1138  /* Initialize stack pointers.
1139     Waste one element of value and location stack
1140     so that they stay on the same level as the state stack.
1141     The wasted elements are never initialized.  */
1142
1143  yyssp = yyss;
1144  yyvsp = yyvs;
1145
1146
1147  yyvsp[0] = yylval;
1148
1149  goto yysetstate;
1150
1151/*------------------------------------------------------------.
1152| yynewstate -- Push a new state, which is found in yystate.  |
1153`------------------------------------------------------------*/
1154 yynewstate:
1155  /* In all cases, when you get here, the value and location stacks
1156     have just been pushed. so pushing a state here evens the stacks.
1157     */
1158  yyssp++;
1159
1160 yysetstate:
1161  *yyssp = yystate;
1162
1163  if (yyss + yystacksize - 1 <= yyssp)
1164    {
1165      /* Get the current used size of the three stacks, in elements.  */
1166      YYSIZE_T yysize = yyssp - yyss + 1;
1167
1168#ifdef yyoverflow
1169      {
1170  /* Give user a chance to reallocate the stack. Use copies of
1171     these so that the &'s don't force the real ones into
1172     memory.  */
1173  YYSTYPE *yyvs1 = yyvs;
1174  short int *yyss1 = yyss;
1175
1176
1177  /* Each stack pointer address is followed by the size of the
1178     data in use in that stack, in bytes.  This used to be a
1179     conditional around just the two extra args, but that might
1180     be undefined if yyoverflow is a macro.  */
1181  yyoverflow ("parser stack overflow",
1182        &yyss1, yysize * sizeof (*yyssp),
1183        &yyvs1, yysize * sizeof (*yyvsp),
1184
1185        &yystacksize);
1186
1187  yyss = yyss1;
1188  yyvs = yyvs1;
1189      }
1190#else /* no yyoverflow */
1191# ifndef YYSTACK_RELOCATE
1192      goto yyoverflowlab;
1193# else
1194      /* Extend the stack our own way.  */
1195      if (YYMAXDEPTH <= yystacksize)
1196  goto yyoverflowlab;
1197      yystacksize *= 2;
1198      if (YYMAXDEPTH < yystacksize)
1199  yystacksize = YYMAXDEPTH;
1200
1201      {
1202  short int *yyss1 = yyss;
1203  union yyalloc *yyptr =
1204    (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1205  if (! yyptr)
1206    goto yyoverflowlab;
1207  YYSTACK_RELOCATE (yyss);
1208  YYSTACK_RELOCATE (yyvs);
1209
1210#  undef YYSTACK_RELOCATE
1211  if (yyss1 != yyssa)
1212    YYSTACK_FREE (yyss1);
1213      }
1214# endif
1215#endif /* no yyoverflow */
1216
1217      yyssp = yyss + yysize - 1;
1218      yyvsp = yyvs + yysize - 1;
1219
1220
1221      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1222      (unsigned long) yystacksize));
1223
1224      if (yyss + yystacksize - 1 <= yyssp)
1225  YYABORT;
1226    }
1227
1228  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1229
1230  goto yybackup;
1231
1232/*-----------.
1233| yybackup.  |
1234`-----------*/
1235yybackup:
1236
1237/* Do appropriate processing given the current state.  */
1238/* Read a look-ahead token if we need one and don't already have one.  */
1239/* yyresume: */
1240
1241  /* First try to decide what to do without reference to look-ahead token.  */
1242
1243  yyn = yypact[yystate];
1244  if (yyn == YYPACT_NINF)
1245    goto yydefault;
1246
1247  /* Not known => get a look-ahead token if don't already have one.  */
1248
1249  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1250  if (yychar == YYEMPTY)
1251    {
1252      YYDPRINTF ((stderr, "Reading a token: "));
1253      yychar = YYLEX;
1254    }
1255
1256  if (yychar <= YYEOF)
1257    {
1258      yychar = yytoken = YYEOF;
1259      YYDPRINTF ((stderr, "Now at end of input.\n"));
1260    }
1261  else
1262    {
1263      yytoken = YYTRANSLATE (yychar);
1264      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1265    }
1266
1267  /* If the proper action on seeing token YYTOKEN is to reduce or to
1268     detect an error, take that action.  */
1269  yyn += yytoken;
1270  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1271    goto yydefault;
1272  yyn = yytable[yyn];
1273  if (yyn <= 0)
1274    {
1275      if (yyn == 0 || yyn == YYTABLE_NINF)
1276  goto yyerrlab;
1277      yyn = -yyn;
1278      goto yyreduce;
1279    }
1280
1281  if (yyn == YYFINAL)
1282    YYACCEPT;
1283
1284  /* Shift the look-ahead token.  */
1285  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1286
1287  /* Discard the token being shifted unless it is eof.  */
1288  if (yychar != YYEOF)
1289    yychar = YYEMPTY;
1290
1291  *++yyvsp = yylval;
1292
1293
1294  /* Count tokens shifted since error; after three, turn off error
1295     status.  */
1296  if (yyerrstatus)
1297    yyerrstatus--;
1298
1299  yystate = yyn;
1300  goto yynewstate;
1301
1302
1303/*-----------------------------------------------------------.
1304| yydefault -- do the default action for the current state.  |
1305`-----------------------------------------------------------*/
1306yydefault:
1307  yyn = yydefact[yystate];
1308  if (yyn == 0)
1309    goto yyerrlab;
1310  goto yyreduce;
1311
1312
1313/*-----------------------------.
1314| yyreduce -- Do a reduction.  |
1315`-----------------------------*/
1316yyreduce:
1317  /* yyn is the number of a rule to reduce with.  */
1318  yylen = yyr2[yyn];
1319
1320  /* If YYLEN is nonzero, implement the default value of the action:
1321     `$$ = $1'.
1322
1323     Otherwise, the following line sets YYVAL to garbage.
1324     This behavior is undocumented and Bison
1325     users should not rely upon it.  Assigning to YYVAL
1326     unconditionally makes the parser a bit smaller, and it avoids a
1327     GCC warning that YYVAL may be used uninitialized.  */
1328  yyval = yyvsp[1-yylen];
1329
1330
1331  YY_REDUCE_PRINT (yyn);
1332  switch (yyn)
1333    {
1334        case 8:
1335
1336    { zconf_error("unexpected end statement"); ;}
1337    break;
1338
1339  case 9:
1340
1341    { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
1342    break;
1343
1344  case 10:
1345
1346    {
1347  zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1348;}
1349    break;
1350
1351  case 11:
1352
1353    { zconf_error("invalid statement"); ;}
1354    break;
1355
1356  case 25:
1357
1358    { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1359    break;
1360
1361  case 26:
1362
1363    { zconf_error("invalid option"); ;}
1364    break;
1365
1366  case 27:
1367
1368    {
1369  struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1370  sym->flags |= SYMBOL_OPTIONAL;
1371  menu_add_entry(sym);
1372  printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1373;}
1374    break;
1375
1376  case 28:
1377
1378    {
1379  menu_end_entry();
1380  printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1381;}
1382    break;
1383
1384  case 29:
1385
1386    {
1387  struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1388  sym->flags |= SYMBOL_OPTIONAL;
1389  menu_add_entry(sym);
1390  printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1391;}
1392    break;
1393
1394  case 30:
1395
1396    {
1397  if (current_entry->prompt)
1398    current_entry->prompt->type = P_MENU;
1399  else
1400    zconfprint("warning: menuconfig statement without prompt");
1401  menu_end_entry();
1402  printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1403;}
1404    break;
1405
1406  case 37:
1407
1408    {
1409  menu_set_type((yyvsp[-2].id)->stype);
1410  printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1411    zconf_curname(), zconf_lineno(),
1412    (yyvsp[-2].id)->stype);
1413;}
1414    break;
1415
1416  case 38:
1417
1418    {
1419  menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1420  printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1421;}
1422    break;
1423
1424  case 39:
1425
1426    {
1427  menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1428  if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1429    menu_set_type((yyvsp[-3].id)->stype);
1430  printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1431    zconf_curname(), zconf_lineno(),
1432    (yyvsp[-3].id)->stype);
1433;}
1434    break;
1435
1436  case 40:
1437
1438    {
1439  menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1440  printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1441;}
1442    break;
1443
1444  case 41:
1445
1446    {
1447  menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1448  printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1449;}
1450    break;
1451
1452  case 42:
1453
1454    {
1455  struct symbol *sym = sym_lookup(NULL, 0);
1456  sym->flags |= SYMBOL_CHOICE;
1457  menu_add_entry(sym);
1458  menu_add_expr(P_CHOICE, NULL, NULL);
1459  printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1460;}
1461    break;
1462
1463  case 43:
1464
1465    {
1466  (yyval.menu) = menu_add_menu();
1467;}
1468    break;
1469
1470  case 44:
1471
1472    {
1473  if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1474    menu_end_menu();
1475    printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1476  }
1477;}
1478    break;
1479
1480  case 52:
1481
1482    {
1483  menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1484  printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1485;}
1486    break;
1487
1488  case 53:
1489
1490    {
1491  if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1492    menu_set_type((yyvsp[-2].id)->stype);
1493    printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1494      zconf_curname(), zconf_lineno(),
1495      (yyvsp[-2].id)->stype);
1496  } else
1497    YYERROR;
1498;}
1499    break;
1500
1501  case 54:
1502
1503    {
1504  current_entry->sym->flags |= SYMBOL_OPTIONAL;
1505  printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1506;}
1507    break;
1508
1509  case 55:
1510
1511    {
1512  if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1513    menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1514    printd(DEBUG_PARSE, "%s:%d:default\n",
1515      zconf_curname(), zconf_lineno());
1516  } else
1517    YYERROR;
1518;}
1519    break;
1520
1521  case 58:
1522
1523    {
1524  printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1525  menu_add_entry(NULL);
1526  menu_add_dep((yyvsp[-1].expr));
1527  (yyval.menu) = menu_add_menu();
1528;}
1529    break;
1530
1531  case 59:
1532
1533    {
1534  if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1535    menu_end_menu();
1536    printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1537  }
1538;}
1539    break;
1540
1541  case 65:
1542
1543    {
1544  menu_add_entry(NULL);
1545  menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1546  printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1547;}
1548    break;
1549
1550  case 66:
1551
1552    {
1553  (yyval.menu) = menu_add_menu();
1554;}
1555    break;
1556
1557  case 67:
1558
1559    {
1560  if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1561    menu_end_menu();
1562    printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1563  }
1564;}
1565    break;
1566
1567  case 73:
1568
1569    {
1570  printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1571  zconf_nextfile((yyvsp[-1].string));
1572;}
1573    break;
1574
1575  case 74:
1576
1577    {
1578  menu_add_entry(NULL);
1579  menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1580  printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1581;}
1582    break;
1583
1584  case 75:
1585
1586    {
1587  menu_end_entry();
1588;}
1589    break;
1590
1591  case 76:
1592
1593    {
1594  printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1595  zconf_starthelp();
1596;}
1597    break;
1598
1599  case 77:
1600
1601    {
1602  current_entry->sym->help = (yyvsp[0].string);
1603;}
1604    break;
1605
1606  case 82:
1607
1608    {
1609  menu_add_dep((yyvsp[-1].expr));
1610  printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1611;}
1612    break;
1613
1614  case 83:
1615
1616    {
1617  menu_add_dep((yyvsp[-1].expr));
1618  printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1619;}
1620    break;
1621
1622  case 84:
1623
1624    {
1625  menu_add_dep((yyvsp[-1].expr));
1626  printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1627;}
1628    break;
1629
1630  case 86:
1631
1632    {
1633  menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1634;}
1635    break;
1636
1637  case 89:
1638
1639    { (yyval.id) = (yyvsp[-1].id); ;}
1640    break;
1641
1642  case 90:
1643
1644    { (yyval.id) = (yyvsp[-1].id); ;}
1645    break;
1646
1647  case 91:
1648
1649    { (yyval.id) = (yyvsp[-1].id); ;}
1650    break;
1651
1652  case 94:
1653
1654    { (yyval.expr) = NULL; ;}
1655    break;
1656
1657  case 95:
1658
1659    { (yyval.expr) = (yyvsp[0].expr); ;}
1660    break;
1661
1662  case 96:
1663
1664    { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1665    break;
1666
1667  case 97:
1668
1669    { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1670    break;
1671
1672  case 98:
1673
1674    { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1675    break;
1676
1677  case 99:
1678
1679    { (yyval.expr) = (yyvsp[-1].expr); ;}
1680    break;
1681
1682  case 100:
1683
1684    { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1685    break;
1686
1687  case 101:
1688
1689    { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1690    break;
1691
1692  case 102:
1693
1694    { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1695    break;
1696
1697  case 103:
1698
1699    { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1700    break;
1701
1702  case 104:
1703
1704    { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1705    break;
1706
1707
1708    }
1709
1710/* Line 1037 of yacc.c.  */
1711
1712
1713  yyvsp -= yylen;
1714  yyssp -= yylen;
1715
1716
1717  YY_STACK_PRINT (yyss, yyssp);
1718
1719  *++yyvsp = yyval;
1720
1721
1722  /* Now `shift' the result of the reduction.  Determine what state
1723     that goes to, based on the state we popped back to and the rule
1724     number reduced by.  */
1725
1726  yyn = yyr1[yyn];
1727
1728  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1729  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1730    yystate = yytable[yystate];
1731  else
1732    yystate = yydefgoto[yyn - YYNTOKENS];
1733
1734  goto yynewstate;
1735
1736
1737/*------------------------------------.
1738| yyerrlab -- here on detecting error |
1739`------------------------------------*/
1740yyerrlab:
1741  /* If not already recovering from an error, report this error.  */
1742  if (!yyerrstatus)
1743    {
1744      ++yynerrs;
1745#if YYERROR_VERBOSE
1746      yyn = yypact[yystate];
1747
1748      if (YYPACT_NINF < yyn && yyn < YYLAST)
1749  {
1750    YYSIZE_T yysize = 0;
1751    int yytype = YYTRANSLATE (yychar);
1752    const char* yyprefix;
1753    char *yymsg;
1754    int yyx;
1755
1756    /* Start YYX at -YYN if negative to avoid negative indexes in
1757       YYCHECK.  */
1758    int yyxbegin = yyn < 0 ? -yyn : 0;
1759
1760    /* Stay within bounds of both yycheck and yytname.  */
1761    int yychecklim = YYLAST - yyn;
1762    int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1763    int yycount = 0;
1764
1765    yyprefix = ", expecting ";
1766    for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1767      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1768        {
1769    yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1770    yycount += 1;
1771    if (yycount == 5)
1772      {
1773        yysize = 0;
1774        break;
1775      }
1776        }
1777    yysize += (sizeof ("syntax error, unexpected ")
1778         + yystrlen (yytname[yytype]));
1779    yymsg = (char *) YYSTACK_ALLOC (yysize);
1780    if (yymsg != 0)
1781      {
1782        char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1783        yyp = yystpcpy (yyp, yytname[yytype]);
1784
1785        if (yycount < 5)
1786    {
1787      yyprefix = ", expecting ";
1788      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1789        if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1790          {
1791      yyp = yystpcpy (yyp, yyprefix);
1792      yyp = yystpcpy (yyp, yytname[yyx]);
1793      yyprefix = " or ";
1794          }
1795    }
1796        yyerror (yymsg);
1797        YYSTACK_FREE (yymsg);
1798      }
1799    else
1800      yyerror ("syntax error; also virtual memory exhausted");
1801  }
1802      else
1803#endif /* YYERROR_VERBOSE */
1804  yyerror ("syntax error");
1805    }
1806
1807
1808
1809  if (yyerrstatus == 3)
1810    {
1811      /* If just tried and failed to reuse look-ahead token after an
1812   error, discard it.  */
1813
1814      if (yychar <= YYEOF)
1815        {
1816          /* If at end of input, pop the error token,
1817       then the rest of the stack, then return failure.  */
1818    if (yychar == YYEOF)
1819       for (;;)
1820         {
1821
1822     YYPOPSTACK;
1823     if (yyssp == yyss)
1824       YYABORT;
1825     yydestruct ("Error: popping",
1826                             yystos[*yyssp], yyvsp);
1827         }
1828        }
1829      else
1830  {
1831    yydestruct ("Error: discarding", yytoken, &yylval);
1832    yychar = YYEMPTY;
1833  }
1834    }
1835
1836  /* Else will try to reuse look-ahead token after shifting the error
1837     token.  */
1838  goto yyerrlab1;
1839
1840
1841/*---------------------------------------------------.
1842| yyerrorlab -- error raised explicitly by YYERROR.  |
1843`---------------------------------------------------*/
1844yyerrorlab:
1845
1846#ifdef __GNUC__
1847  /* Pacify GCC when the user code never invokes YYERROR and the label
1848     yyerrorlab therefore never appears in user code.  */
1849  if (0)
1850     goto yyerrorlab;
1851#endif
1852
1853yyvsp -= yylen;
1854  yyssp -= yylen;
1855  yystate = *yyssp;
1856  goto yyerrlab1;
1857
1858
1859/*-------------------------------------------------------------.
1860| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1861`-------------------------------------------------------------*/
1862yyerrlab1:
1863  yyerrstatus = 3;  /* Each real token shifted decrements this.  */
1864
1865  for (;;)
1866    {
1867      yyn = yypact[yystate];
1868      if (yyn != YYPACT_NINF)
1869  {
1870    yyn += YYTERROR;
1871    if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1872      {
1873        yyn = yytable[yyn];
1874        if (0 < yyn)
1875    break;
1876      }
1877  }
1878
1879      /* Pop the current state because it cannot handle the error token.  */
1880      if (yyssp == yyss)
1881  YYABORT;
1882
1883
1884      yydestruct ("Error: popping", yystos[yystate], yyvsp);
1885      YYPOPSTACK;
1886      yystate = *yyssp;
1887      YY_STACK_PRINT (yyss, yyssp);
1888    }
1889
1890  if (yyn == YYFINAL)
1891    YYACCEPT;
1892
1893  *++yyvsp = yylval;
1894
1895
1896  /* Shift the error token. */
1897  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1898
1899  yystate = yyn;
1900  goto yynewstate;
1901
1902
1903/*-------------------------------------.
1904| yyacceptlab -- YYACCEPT comes here.  |
1905`-------------------------------------*/
1906yyacceptlab:
1907  yyresult = 0;
1908  goto yyreturn;
1909
1910/*-----------------------------------.
1911| yyabortlab -- YYABORT comes here.  |
1912`-----------------------------------*/
1913yyabortlab:
1914  yydestruct ("Error: discarding lookahead",
1915              yytoken, &yylval);
1916  yychar = YYEMPTY;
1917  yyresult = 1;
1918  goto yyreturn;
1919
1920#ifndef yyoverflow
1921/*----------------------------------------------.
1922| yyoverflowlab -- parser overflow comes here.  |
1923`----------------------------------------------*/
1924yyoverflowlab:
1925  yyerror ("parser stack overflow");
1926  yyresult = 2;
1927  /* Fall through.  */
1928#endif
1929
1930yyreturn:
1931#ifndef yyoverflow
1932  if (yyss != yyssa)
1933    YYSTACK_FREE (yyss);
1934#endif
1935  return yyresult;
1936}
1937
1938
1939
1940
1941
1942void conf_parse(const char *name)
1943{
1944  struct symbol *sym;
1945  int i;
1946
1947  zconf_initscan(name);
1948
1949  sym_init();
1950  menu_init();
1951  modules_sym = sym_lookup("MODULES", 0);
1952  rootmenu.prompt = menu_add_prompt(P_MENU, "Busybox Configuration", NULL);
1953
1954#if YYDEBUG
1955  if (getenv("ZCONF_DEBUG"))
1956    zconfdebug = 1;
1957#endif
1958  zconfparse();
1959  if (zconfnerrs)
1960    exit(1);
1961  menu_finalize(&rootmenu);
1962  for_all_symbols(i, sym) {
1963    sym_check_deps(sym);
1964        }
1965
1966  sym_change_count = 1;
1967}
1968
1969const char *zconf_tokenname(int token)
1970{
1971  switch (token) {
1972  case T_MENU:    return "menu";
1973  case T_ENDMENU:   return "endmenu";
1974  case T_CHOICE:    return "choice";
1975  case T_ENDCHOICE: return "endchoice";
1976  case T_IF:    return "if";
1977  case T_ENDIF:   return "endif";
1978  case T_DEPENDS:   return "depends";
1979  }
1980  return "<token>";
1981}
1982
1983static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1984{
1985  if (id->token != endtoken) {
1986    zconf_error("unexpected '%s' within %s block",
1987      kconf_id_strings + id->name, zconf_tokenname(starttoken));
1988    zconfnerrs++;
1989    return false;
1990  }
1991  if (current_menu->file != current_file) {
1992    zconf_error("'%s' in different file than '%s'",
1993      kconf_id_strings + id->name, zconf_tokenname(starttoken));
1994    fprintf(stderr, "%s:%d: location of the '%s'\n",
1995      current_menu->file->name, current_menu->lineno,
1996      zconf_tokenname(starttoken));
1997    zconfnerrs++;
1998    return false;
1999  }
2000  return true;
2001}
2002
2003static void zconfprint(const char *err, ...)
2004{
2005  va_list ap;
2006
2007  fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2008  va_start(ap, err);
2009  vfprintf(stderr, err, ap);
2010  va_end(ap);
2011  fprintf(stderr, "\n");
2012}
2013
2014static void zconf_error(const char *err, ...)
2015{
2016  va_list ap;
2017
2018  zconfnerrs++;
2019  fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2020  va_start(ap, err);
2021  vfprintf(stderr, err, ap);
2022  va_end(ap);
2023  fprintf(stderr, "\n");
2024}
2025
2026static void zconferror(const char *err)
2027{
2028#if YYDEBUG
2029  fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2030#endif
2031}
2032
2033void print_quoted_string(FILE *out, const char *str)
2034{
2035  const char *p;
2036  int len;
2037
2038  putc('"', out);
2039  while ((p = strchr(str, '"'))) {
2040    len = p - str;
2041    if (len)
2042      fprintf(out, "%.*s", len, str);
2043    fputs("\\\"", out);
2044    str = p + 1;
2045  }
2046  fputs(str, out);
2047  putc('"', out);
2048}
2049
2050void print_symbol(FILE *out, struct menu *menu)
2051{
2052  struct symbol *sym = menu->sym;
2053  struct property *prop;
2054
2055  if (sym_is_choice(sym))
2056    fprintf(out, "choice\n");
2057  else
2058    fprintf(out, "config %s\n", sym->name);
2059  switch (sym->type) {
2060  case S_BOOLEAN:
2061    fputs("  boolean\n", out);
2062    break;
2063  case S_TRISTATE:
2064    fputs("  tristate\n", out);
2065    break;
2066  case S_STRING:
2067    fputs("  string\n", out);
2068    break;
2069  case S_INT:
2070    fputs("  integer\n", out);
2071    break;
2072  case S_HEX:
2073    fputs("  hex\n", out);
2074    break;
2075  default:
2076    fputs("  ???\n", out);
2077    break;
2078  }
2079  for (prop = sym->prop; prop; prop = prop->next) {
2080    if (prop->menu != menu)
2081      continue;
2082    switch (prop->type) {
2083    case P_PROMPT:
2084      fputs("  prompt ", out);
2085      print_quoted_string(out, prop->text);
2086      if (!expr_is_yes(prop->visible.expr)) {
2087        fputs(" if ", out);
2088        expr_fprint(prop->visible.expr, out);
2089      }
2090      fputc('\n', out);
2091      break;
2092    case P_DEFAULT:
2093      fputs( "  default ", out);
2094      expr_fprint(prop->expr, out);
2095      if (!expr_is_yes(prop->visible.expr)) {
2096        fputs(" if ", out);
2097        expr_fprint(prop->visible.expr, out);
2098      }
2099      fputc('\n', out);
2100      break;
2101    case P_CHOICE:
2102      fputs("  #choice value\n", out);
2103      break;
2104    default:
2105      fprintf(out, "  unknown prop %d!\n", prop->type);
2106      break;
2107    }
2108  }
2109  if (sym->help) {
2110    int len = strlen(sym->help);
2111    while (sym->help[--len] == '\n')
2112      sym->help[len] = 0;
2113    fprintf(out, "  help\n%s\n", sym->help);
2114  }
2115  fputc('\n', out);
2116}
2117
2118void zconfdump(FILE *out)
2119{
2120  struct property *prop;
2121  struct symbol *sym;
2122  struct menu *menu;
2123
2124  menu = rootmenu.list;
2125  while (menu) {
2126    if ((sym = menu->sym))
2127      print_symbol(out, menu);
2128    else if ((prop = menu->prompt)) {
2129      switch (prop->type) {
2130      case P_COMMENT:
2131        fputs("\ncomment ", out);
2132        print_quoted_string(out, prop->text);
2133        fputs("\n", out);
2134        break;
2135      case P_MENU:
2136        fputs("\nmenu ", out);
2137        print_quoted_string(out, prop->text);
2138        fputs("\n", out);
2139        break;
2140      default:
2141        ;
2142      }
2143      if (!expr_is_yes(prop->visible.expr)) {
2144        fputs("  depends ", out);
2145        expr_fprint(prop->visible.expr, out);
2146        fputc('\n', out);
2147      }
2148      fputs("\n", out);
2149    }
2150
2151    if (menu->list)
2152      menu = menu->list;
2153    else if (menu->next)
2154      menu = menu->next;
2155    else while ((menu = menu->parent)) {
2156      if (menu->prompt && menu->prompt->type == P_MENU)
2157        fputs("\nendmenu\n", out);
2158      if (menu->next) {
2159        menu = menu->next;
2160        break;
2161      }
2162    }
2163  }
2164}
2165
2166#include "lex.zconf.c"
2167#include "util.c"
2168#include "confdata.c"
2169#include "expr.c"
2170#include "symbol.c"
2171#include "menu.c"
2172
2173
Note: See TracBrowser for help on using the repository browser.