source: MondoRescue/branches/2.2.5/mindi-busybox/scripts/kconfig/zconf.tab.c_shipped@ 1765

Last change on this file since 1765 was 1765, checked in by Bruno Cornec, 16 years ago

Update to busybox 1.7.2

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
885#if YYERROR_VERBOSE
886
887# ifndef yystrlen
888# if defined (__GLIBC__) && defined (_STRING_H)
889# define yystrlen strlen
890# else
891/* Return the length of YYSTR. */
892static YYSIZE_T
893# if defined (__STDC__) || defined (__cplusplus)
894yystrlen (const char *yystr)
895# else
896yystrlen (yystr)
897 const char *yystr;
898# endif
899{
900 register const char *yys = yystr;
901
902 while (*yys++ != '\0')
903 continue;
904
905 return yys - yystr - 1;
906}
907# endif
908# endif
909
910# ifndef yystpcpy
911# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
912# define yystpcpy stpcpy
913# else
914/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
915 YYDEST. */
916static char *
917# if defined (__STDC__) || defined (__cplusplus)
918yystpcpy (char *yydest, const char *yysrc)
919# else
920yystpcpy (yydest, yysrc)
921 char *yydest;
922 const char *yysrc;
923# endif
924{
925 register char *yyd = yydest;
926 register const char *yys = yysrc;
927
928 while ((*yyd++ = *yys++) != '\0')
929 continue;
930
931 return yyd - 1;
932}
933# endif
934# endif
935
936#endif /* !YYERROR_VERBOSE */
937
938
939
940
941#if YYDEBUG
942/*--------------------------------.
943| Print this symbol on YYOUTPUT. |
944`--------------------------------*/
945
946#if defined (__STDC__) || defined (__cplusplus)
947static void
948yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
949#else
950static void
951yysymprint (yyoutput, yytype, yyvaluep)
952 FILE *yyoutput;
953 int yytype;
954 YYSTYPE *yyvaluep;
955#endif
956{
957 /* Pacify ``unused variable'' warnings. */
958 (void) yyvaluep;
959
960 if (yytype < YYNTOKENS)
961 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
962 else
963 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
964
965
966# ifdef YYPRINT
967 if (yytype < YYNTOKENS)
968 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
969# endif
970 switch (yytype)
971 {
972 default:
973 break;
974 }
975 YYFPRINTF (yyoutput, ")");
976}
977
978#endif /* ! YYDEBUG */
979/*-----------------------------------------------.
980| Release the memory associated to this symbol. |
981`-----------------------------------------------*/
982
983#if defined (__STDC__) || defined (__cplusplus)
984static void
985yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
986#else
987static void
988yydestruct (yymsg, yytype, yyvaluep)
989 const char *yymsg;
990 int yytype;
991 YYSTYPE *yyvaluep;
992#endif
993{
994 /* Pacify ``unused variable'' warnings. */
995 (void) yyvaluep;
996
997 if (!yymsg)
998 yymsg = "Deleting";
999 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1000
1001 switch (yytype)
1002 {
1003 case 48: /* choice_entry */
1004
1005 {
1006 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1007 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1008 if (current_menu == (yyvaluep->menu))
1009 menu_end_menu();
1010};
1011
1012 break;
1013 case 54: /* if_entry */
1014
1015 {
1016 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1017 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1018 if (current_menu == (yyvaluep->menu))
1019 menu_end_menu();
1020};
1021
1022 break;
1023 case 59: /* menu_entry */
1024
1025 {
1026 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1027 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1028 if (current_menu == (yyvaluep->menu))
1029 menu_end_menu();
1030};
1031
1032 break;
1033
1034 default:
1035 break;
1036 }
1037}
1038
1039
1040
1041/* Prevent warnings from -Wmissing-prototypes. */
1042
1043#ifdef YYPARSE_PARAM
1044# if defined (__STDC__) || defined (__cplusplus)
1045int yyparse (void *YYPARSE_PARAM);
1046# else
1047int yyparse ();
1048# endif
1049#else /* ! YYPARSE_PARAM */
1050#if defined (__STDC__) || defined (__cplusplus)
1051int yyparse (void);
1052#else
1053int yyparse ();
1054#endif
1055#endif /* ! YYPARSE_PARAM */
1056
1057
1058
1059/* The look-ahead symbol. */
1060int yychar;
1061
1062/* The semantic value of the look-ahead symbol. */
1063YYSTYPE yylval;
1064
1065/* Number of syntax errors so far. */
1066int yynerrs;
1067
1068
1069
1070/*----------.
1071| yyparse. |
1072`----------*/
1073
1074#ifdef YYPARSE_PARAM
1075# if defined (__STDC__) || defined (__cplusplus)
1076int yyparse (void *YYPARSE_PARAM)
1077# else
1078int yyparse (YYPARSE_PARAM)
1079 void *YYPARSE_PARAM;
1080# endif
1081#else /* ! YYPARSE_PARAM */
1082#if defined (__STDC__) || defined (__cplusplus)
1083int
1084yyparse (void)
1085#else
1086int
1087yyparse ()
1088
1089#endif
1090#endif
1091{
1092
1093 register int yystate;
1094 register int yyn;
1095 int yyresult;
1096 /* Number of tokens to shift before error messages enabled. */
1097 int yyerrstatus;
1098 /* Look-ahead token as an internal (translated) token number. */
1099 int yytoken = 0;
1100
1101 /* Three stacks and their tools:
1102 `yyss': related to states,
1103 `yyvs': related to semantic values,
1104 `yyls': related to locations.
1105
1106 Refer to the stacks thru separate pointers, to allow yyoverflow
1107 to reallocate them elsewhere. */
1108
1109 /* The state stack. */
1110 short int yyssa[YYINITDEPTH];
1111 short int *yyss = yyssa;
1112 register short int *yyssp;
1113
1114 /* The semantic value stack. */
1115 YYSTYPE yyvsa[YYINITDEPTH];
1116 YYSTYPE *yyvs = yyvsa;
1117 register YYSTYPE *yyvsp;
1118
1119
1120
1121#define YYPOPSTACK (yyvsp--, yyssp--)
1122
1123 YYSIZE_T yystacksize = YYINITDEPTH;
1124
1125 /* The variables used to return semantic value and location from the
1126 action routines. */
1127 YYSTYPE yyval;
1128
1129
1130 /* When reducing, the number of symbols on the RHS of the reduced
1131 rule. */
1132 int yylen;
1133
1134 YYDPRINTF ((stderr, "Starting parse\n"));
1135
1136 yystate = 0;
1137 yyerrstatus = 0;
1138 yynerrs = 0;
1139 yychar = YYEMPTY; /* Cause a token to be read. */
1140
1141 /* Initialize stack pointers.
1142 Waste one element of value and location stack
1143 so that they stay on the same level as the state stack.
1144 The wasted elements are never initialized. */
1145
1146 yyssp = yyss;
1147 yyvsp = yyvs;
1148
1149
1150 yyvsp[0] = yylval;
1151
1152 goto yysetstate;
1153
1154/*------------------------------------------------------------.
1155| yynewstate -- Push a new state, which is found in yystate. |
1156`------------------------------------------------------------*/
1157 yynewstate:
1158 /* In all cases, when you get here, the value and location stacks
1159 have just been pushed. so pushing a state here evens the stacks.
1160 */
1161 yyssp++;
1162
1163 yysetstate:
1164 *yyssp = yystate;
1165
1166 if (yyss + yystacksize - 1 <= yyssp)
1167 {
1168 /* Get the current used size of the three stacks, in elements. */
1169 YYSIZE_T yysize = yyssp - yyss + 1;
1170
1171#ifdef yyoverflow
1172 {
1173 /* Give user a chance to reallocate the stack. Use copies of
1174 these so that the &'s don't force the real ones into
1175 memory. */
1176 YYSTYPE *yyvs1 = yyvs;
1177 short int *yyss1 = yyss;
1178
1179
1180 /* Each stack pointer address is followed by the size of the
1181 data in use in that stack, in bytes. This used to be a
1182 conditional around just the two extra args, but that might
1183 be undefined if yyoverflow is a macro. */
1184 yyoverflow ("parser stack overflow",
1185 &yyss1, yysize * sizeof (*yyssp),
1186 &yyvs1, yysize * sizeof (*yyvsp),
1187
1188 &yystacksize);
1189
1190 yyss = yyss1;
1191 yyvs = yyvs1;
1192 }
1193#else /* no yyoverflow */
1194# ifndef YYSTACK_RELOCATE
1195 goto yyoverflowlab;
1196# else
1197 /* Extend the stack our own way. */
1198 if (YYMAXDEPTH <= yystacksize)
1199 goto yyoverflowlab;
1200 yystacksize *= 2;
1201 if (YYMAXDEPTH < yystacksize)
1202 yystacksize = YYMAXDEPTH;
1203
1204 {
1205 short int *yyss1 = yyss;
1206 union yyalloc *yyptr =
1207 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1208 if (! yyptr)
1209 goto yyoverflowlab;
1210 YYSTACK_RELOCATE (yyss);
1211 YYSTACK_RELOCATE (yyvs);
1212
1213# undef YYSTACK_RELOCATE
1214 if (yyss1 != yyssa)
1215 YYSTACK_FREE (yyss1);
1216 }
1217# endif
1218#endif /* no yyoverflow */
1219
1220 yyssp = yyss + yysize - 1;
1221 yyvsp = yyvs + yysize - 1;
1222
1223
1224 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1225 (unsigned long) yystacksize));
1226
1227 if (yyss + yystacksize - 1 <= yyssp)
1228 YYABORT;
1229 }
1230
1231 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1232
1233 goto yybackup;
1234
1235/*-----------.
1236| yybackup. |
1237`-----------*/
1238yybackup:
1239
1240/* Do appropriate processing given the current state. */
1241/* Read a look-ahead token if we need one and don't already have one. */
1242/* yyresume: */
1243
1244 /* First try to decide what to do without reference to look-ahead token. */
1245
1246 yyn = yypact[yystate];
1247 if (yyn == YYPACT_NINF)
1248 goto yydefault;
1249
1250 /* Not known => get a look-ahead token if don't already have one. */
1251
1252 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1253 if (yychar == YYEMPTY)
1254 {
1255 YYDPRINTF ((stderr, "Reading a token: "));
1256 yychar = YYLEX;
1257 }
1258
1259 if (yychar <= YYEOF)
1260 {
1261 yychar = yytoken = YYEOF;
1262 YYDPRINTF ((stderr, "Now at end of input.\n"));
1263 }
1264 else
1265 {
1266 yytoken = YYTRANSLATE (yychar);
1267 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1268 }
1269
1270 /* If the proper action on seeing token YYTOKEN is to reduce or to
1271 detect an error, take that action. */
1272 yyn += yytoken;
1273 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1274 goto yydefault;
1275 yyn = yytable[yyn];
1276 if (yyn <= 0)
1277 {
1278 if (yyn == 0 || yyn == YYTABLE_NINF)
1279 goto yyerrlab;
1280 yyn = -yyn;
1281 goto yyreduce;
1282 }
1283
1284 if (yyn == YYFINAL)
1285 YYACCEPT;
1286
1287 /* Shift the look-ahead token. */
1288 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1289
1290 /* Discard the token being shifted unless it is eof. */
1291 if (yychar != YYEOF)
1292 yychar = YYEMPTY;
1293
1294 *++yyvsp = yylval;
1295
1296
1297 /* Count tokens shifted since error; after three, turn off error
1298 status. */
1299 if (yyerrstatus)
1300 yyerrstatus--;
1301
1302 yystate = yyn;
1303 goto yynewstate;
1304
1305
1306/*-----------------------------------------------------------.
1307| yydefault -- do the default action for the current state. |
1308`-----------------------------------------------------------*/
1309yydefault:
1310 yyn = yydefact[yystate];
1311 if (yyn == 0)
1312 goto yyerrlab;
1313 goto yyreduce;
1314
1315
1316/*-----------------------------.
1317| yyreduce -- Do a reduction. |
1318`-----------------------------*/
1319yyreduce:
1320 /* yyn is the number of a rule to reduce with. */
1321 yylen = yyr2[yyn];
1322
1323 /* If YYLEN is nonzero, implement the default value of the action:
1324 `$$ = $1'.
1325
1326 Otherwise, the following line sets YYVAL to garbage.
1327 This behavior is undocumented and Bison
1328 users should not rely upon it. Assigning to YYVAL
1329 unconditionally makes the parser a bit smaller, and it avoids a
1330 GCC warning that YYVAL may be used uninitialized. */
1331 yyval = yyvsp[1-yylen];
1332
1333
1334 YY_REDUCE_PRINT (yyn);
1335 switch (yyn)
1336 {
1337 case 8:
1338
1339 { zconf_error("unexpected end statement"); ;}
1340 break;
1341
1342 case 9:
1343
1344 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
1345 break;
1346
1347 case 10:
1348
1349 {
1350 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1351;}
1352 break;
1353
1354 case 11:
1355
1356 { zconf_error("invalid statement"); ;}
1357 break;
1358
1359 case 25:
1360
1361 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1362 break;
1363
1364 case 26:
1365
1366 { zconf_error("invalid option"); ;}
1367 break;
1368
1369 case 27:
1370
1371 {
1372 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1373 sym->flags |= SYMBOL_OPTIONAL;
1374 menu_add_entry(sym);
1375 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1376;}
1377 break;
1378
1379 case 28:
1380
1381 {
1382 menu_end_entry();
1383 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1384;}
1385 break;
1386
1387 case 29:
1388
1389 {
1390 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1391 sym->flags |= SYMBOL_OPTIONAL;
1392 menu_add_entry(sym);
1393 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1394;}
1395 break;
1396
1397 case 30:
1398
1399 {
1400 if (current_entry->prompt)
1401 current_entry->prompt->type = P_MENU;
1402 else
1403 zconfprint("warning: menuconfig statement without prompt");
1404 menu_end_entry();
1405 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1406;}
1407 break;
1408
1409 case 37:
1410
1411 {
1412 menu_set_type((yyvsp[-2].id)->stype);
1413 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1414 zconf_curname(), zconf_lineno(),
1415 (yyvsp[-2].id)->stype);
1416;}
1417 break;
1418
1419 case 38:
1420
1421 {
1422 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1423 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1424;}
1425 break;
1426
1427 case 39:
1428
1429 {
1430 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1431 if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1432 menu_set_type((yyvsp[-3].id)->stype);
1433 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1434 zconf_curname(), zconf_lineno(),
1435 (yyvsp[-3].id)->stype);
1436;}
1437 break;
1438
1439 case 40:
1440
1441 {
1442 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1443 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1444;}
1445 break;
1446
1447 case 41:
1448
1449 {
1450 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1451 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1452;}
1453 break;
1454
1455 case 42:
1456
1457 {
1458 struct symbol *sym = sym_lookup(NULL, 0);
1459 sym->flags |= SYMBOL_CHOICE;
1460 menu_add_entry(sym);
1461 menu_add_expr(P_CHOICE, NULL, NULL);
1462 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1463;}
1464 break;
1465
1466 case 43:
1467
1468 {
1469 (yyval.menu) = menu_add_menu();
1470;}
1471 break;
1472
1473 case 44:
1474
1475 {
1476 if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1477 menu_end_menu();
1478 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1479 }
1480;}
1481 break;
1482
1483 case 52:
1484
1485 {
1486 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1487 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1488;}
1489 break;
1490
1491 case 53:
1492
1493 {
1494 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1495 menu_set_type((yyvsp[-2].id)->stype);
1496 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1497 zconf_curname(), zconf_lineno(),
1498 (yyvsp[-2].id)->stype);
1499 } else
1500 YYERROR;
1501;}
1502 break;
1503
1504 case 54:
1505
1506 {
1507 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1508 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1509;}
1510 break;
1511
1512 case 55:
1513
1514 {
1515 if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1516 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1517 printd(DEBUG_PARSE, "%s:%d:default\n",
1518 zconf_curname(), zconf_lineno());
1519 } else
1520 YYERROR;
1521;}
1522 break;
1523
1524 case 58:
1525
1526 {
1527 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1528 menu_add_entry(NULL);
1529 menu_add_dep((yyvsp[-1].expr));
1530 (yyval.menu) = menu_add_menu();
1531;}
1532 break;
1533
1534 case 59:
1535
1536 {
1537 if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1538 menu_end_menu();
1539 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1540 }
1541;}
1542 break;
1543
1544 case 65:
1545
1546 {
1547 menu_add_entry(NULL);
1548 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1549 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1550;}
1551 break;
1552
1553 case 66:
1554
1555 {
1556 (yyval.menu) = menu_add_menu();
1557;}
1558 break;
1559
1560 case 67:
1561
1562 {
1563 if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1564 menu_end_menu();
1565 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1566 }
1567;}
1568 break;
1569
1570 case 73:
1571
1572 {
1573 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1574 zconf_nextfile((yyvsp[-1].string));
1575;}
1576 break;
1577
1578 case 74:
1579
1580 {
1581 menu_add_entry(NULL);
1582 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1583 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1584;}
1585 break;
1586
1587 case 75:
1588
1589 {
1590 menu_end_entry();
1591;}
1592 break;
1593
1594 case 76:
1595
1596 {
1597 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1598 zconf_starthelp();
1599;}
1600 break;
1601
1602 case 77:
1603
1604 {
1605 current_entry->sym->help = (yyvsp[0].string);
1606;}
1607 break;
1608
1609 case 82:
1610
1611 {
1612 menu_add_dep((yyvsp[-1].expr));
1613 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1614;}
1615 break;
1616
1617 case 83:
1618
1619 {
1620 menu_add_dep((yyvsp[-1].expr));
1621 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
1622;}
1623 break;
1624
1625 case 84:
1626
1627 {
1628 menu_add_dep((yyvsp[-1].expr));
1629 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
1630;}
1631 break;
1632
1633 case 86:
1634
1635 {
1636 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1637;}
1638 break;
1639
1640 case 89:
1641
1642 { (yyval.id) = (yyvsp[-1].id); ;}
1643 break;
1644
1645 case 90:
1646
1647 { (yyval.id) = (yyvsp[-1].id); ;}
1648 break;
1649
1650 case 91:
1651
1652 { (yyval.id) = (yyvsp[-1].id); ;}
1653 break;
1654
1655 case 94:
1656
1657 { (yyval.expr) = NULL; ;}
1658 break;
1659
1660 case 95:
1661
1662 { (yyval.expr) = (yyvsp[0].expr); ;}
1663 break;
1664
1665 case 96:
1666
1667 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1668 break;
1669
1670 case 97:
1671
1672 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1673 break;
1674
1675 case 98:
1676
1677 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1678 break;
1679
1680 case 99:
1681
1682 { (yyval.expr) = (yyvsp[-1].expr); ;}
1683 break;
1684
1685 case 100:
1686
1687 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1688 break;
1689
1690 case 101:
1691
1692 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1693 break;
1694
1695 case 102:
1696
1697 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1698 break;
1699
1700 case 103:
1701
1702 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1703 break;
1704
1705 case 104:
1706
1707 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1708 break;
1709
1710
1711 }
1712
1713/* Line 1037 of yacc.c. */
1714
1715
1716
1717 yyvsp -= yylen;
1718 yyssp -= yylen;
1719
1720
1721 YY_STACK_PRINT (yyss, yyssp);
1722
1723 *++yyvsp = yyval;
1724
1725
1726 /* Now `shift' the result of the reduction. Determine what state
1727 that goes to, based on the state we popped back to and the rule
1728 number reduced by. */
1729
1730 yyn = yyr1[yyn];
1731
1732 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1733 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1734 yystate = yytable[yystate];
1735 else
1736 yystate = yydefgoto[yyn - YYNTOKENS];
1737
1738 goto yynewstate;
1739
1740
1741/*------------------------------------.
1742| yyerrlab -- here on detecting error |
1743`------------------------------------*/
1744yyerrlab:
1745 /* If not already recovering from an error, report this error. */
1746 if (!yyerrstatus)
1747 {
1748 ++yynerrs;
1749#if YYERROR_VERBOSE
1750 yyn = yypact[yystate];
1751
1752 if (YYPACT_NINF < yyn && yyn < YYLAST)
1753 {
1754 YYSIZE_T yysize = 0;
1755 int yytype = YYTRANSLATE (yychar);
1756 const char* yyprefix;
1757 char *yymsg;
1758 int yyx;
1759
1760 /* Start YYX at -YYN if negative to avoid negative indexes in
1761 YYCHECK. */
1762 int yyxbegin = yyn < 0 ? -yyn : 0;
1763
1764 /* Stay within bounds of both yycheck and yytname. */
1765 int yychecklim = YYLAST - yyn;
1766 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1767 int yycount = 0;
1768
1769 yyprefix = ", expecting ";
1770 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1771 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1772 {
1773 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1774 yycount += 1;
1775 if (yycount == 5)
1776 {
1777 yysize = 0;
1778 break;
1779 }
1780 }
1781 yysize += (sizeof ("syntax error, unexpected ")
1782 + yystrlen (yytname[yytype]));
1783 yymsg = (char *) YYSTACK_ALLOC (yysize);
1784 if (yymsg != 0)
1785 {
1786 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1787 yyp = yystpcpy (yyp, yytname[yytype]);
1788
1789 if (yycount < 5)
1790 {
1791 yyprefix = ", expecting ";
1792 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1793 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1794 {
1795 yyp = yystpcpy (yyp, yyprefix);
1796 yyp = yystpcpy (yyp, yytname[yyx]);
1797 yyprefix = " or ";
1798 }
1799 }
1800 yyerror (yymsg);
1801 YYSTACK_FREE (yymsg);
1802 }
1803 else
1804 yyerror ("syntax error; also virtual memory exhausted");
1805 }
1806 else
1807#endif /* YYERROR_VERBOSE */
1808 yyerror ("syntax error");
1809 }
1810
1811
1812
1813 if (yyerrstatus == 3)
1814 {
1815 /* If just tried and failed to reuse look-ahead token after an
1816 error, discard it. */
1817
1818 if (yychar <= YYEOF)
1819 {
1820 /* If at end of input, pop the error token,
1821 then the rest of the stack, then return failure. */
1822 if (yychar == YYEOF)
1823 for (;;)
1824 {
1825
1826 YYPOPSTACK;
1827 if (yyssp == yyss)
1828 YYABORT;
1829 yydestruct ("Error: popping",
1830 yystos[*yyssp], yyvsp);
1831 }
1832 }
1833 else
1834 {
1835 yydestruct ("Error: discarding", yytoken, &yylval);
1836 yychar = YYEMPTY;
1837 }
1838 }
1839
1840 /* Else will try to reuse look-ahead token after shifting the error
1841 token. */
1842 goto yyerrlab1;
1843
1844
1845/*---------------------------------------------------.
1846| yyerrorlab -- error raised explicitly by YYERROR. |
1847`---------------------------------------------------*/
1848yyerrorlab:
1849
1850#ifdef __GNUC__
1851 /* Pacify GCC when the user code never invokes YYERROR and the label
1852 yyerrorlab therefore never appears in user code. */
1853 if (0)
1854 goto yyerrorlab;
1855#endif
1856
1857yyvsp -= yylen;
1858 yyssp -= yylen;
1859 yystate = *yyssp;
1860 goto yyerrlab1;
1861
1862
1863/*-------------------------------------------------------------.
1864| yyerrlab1 -- common code for both syntax error and YYERROR. |
1865`-------------------------------------------------------------*/
1866yyerrlab1:
1867 yyerrstatus = 3; /* Each real token shifted decrements this. */
1868
1869 for (;;)
1870 {
1871 yyn = yypact[yystate];
1872 if (yyn != YYPACT_NINF)
1873 {
1874 yyn += YYTERROR;
1875 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1876 {
1877 yyn = yytable[yyn];
1878 if (0 < yyn)
1879 break;
1880 }
1881 }
1882
1883 /* Pop the current state because it cannot handle the error token. */
1884 if (yyssp == yyss)
1885 YYABORT;
1886
1887
1888 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1889 YYPOPSTACK;
1890 yystate = *yyssp;
1891 YY_STACK_PRINT (yyss, yyssp);
1892 }
1893
1894 if (yyn == YYFINAL)
1895 YYACCEPT;
1896
1897 *++yyvsp = yylval;
1898
1899
1900 /* Shift the error token. */
1901 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1902
1903 yystate = yyn;
1904 goto yynewstate;
1905
1906
1907/*-------------------------------------.
1908| yyacceptlab -- YYACCEPT comes here. |
1909`-------------------------------------*/
1910yyacceptlab:
1911 yyresult = 0;
1912 goto yyreturn;
1913
1914/*-----------------------------------.
1915| yyabortlab -- YYABORT comes here. |
1916`-----------------------------------*/
1917yyabortlab:
1918 yydestruct ("Error: discarding lookahead",
1919 yytoken, &yylval);
1920 yychar = YYEMPTY;
1921 yyresult = 1;
1922 goto yyreturn;
1923
1924#ifndef yyoverflow
1925/*----------------------------------------------.
1926| yyoverflowlab -- parser overflow comes here. |
1927`----------------------------------------------*/
1928yyoverflowlab:
1929 yyerror ("parser stack overflow");
1930 yyresult = 2;
1931 /* Fall through. */
1932#endif
1933
1934yyreturn:
1935#ifndef yyoverflow
1936 if (yyss != yyssa)
1937 YYSTACK_FREE (yyss);
1938#endif
1939 return yyresult;
1940}
1941
1942
1943
1944
1945
1946void conf_parse(const char *name)
1947{
1948 struct symbol *sym;
1949 int i;
1950
1951 zconf_initscan(name);
1952
1953 sym_init();
1954 menu_init();
1955 modules_sym = sym_lookup("MODULES", 0);
1956 rootmenu.prompt = menu_add_prompt(P_MENU, "Busybox Configuration", NULL);
1957
1958#if YYDEBUG
1959 if (getenv("ZCONF_DEBUG"))
1960 zconfdebug = 1;
1961#endif
1962 zconfparse();
1963 if (zconfnerrs)
1964 exit(1);
1965 menu_finalize(&rootmenu);
1966 for_all_symbols(i, sym) {
1967 sym_check_deps(sym);
1968 }
1969
1970 sym_change_count = 1;
1971}
1972
1973const char *zconf_tokenname(int token)
1974{
1975 switch (token) {
1976 case T_MENU: return "menu";
1977 case T_ENDMENU: return "endmenu";
1978 case T_CHOICE: return "choice";
1979 case T_ENDCHOICE: return "endchoice";
1980 case T_IF: return "if";
1981 case T_ENDIF: return "endif";
1982 case T_DEPENDS: return "depends";
1983 }
1984 return "<token>";
1985}
1986
1987static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1988{
1989 if (id->token != endtoken) {
1990 zconf_error("unexpected '%s' within %s block",
1991 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1992 zconfnerrs++;
1993 return false;
1994 }
1995 if (current_menu->file != current_file) {
1996 zconf_error("'%s' in different file than '%s'",
1997 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1998 fprintf(stderr, "%s:%d: location of the '%s'\n",
1999 current_menu->file->name, current_menu->lineno,
2000 zconf_tokenname(starttoken));
2001 zconfnerrs++;
2002 return false;
2003 }
2004 return true;
2005}
2006
2007static void zconfprint(const char *err, ...)
2008{
2009 va_list ap;
2010
2011 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2012 va_start(ap, err);
2013 vfprintf(stderr, err, ap);
2014 va_end(ap);
2015 fprintf(stderr, "\n");
2016}
2017
2018static void zconf_error(const char *err, ...)
2019{
2020 va_list ap;
2021
2022 zconfnerrs++;
2023 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2024 va_start(ap, err);
2025 vfprintf(stderr, err, ap);
2026 va_end(ap);
2027 fprintf(stderr, "\n");
2028}
2029
2030static void zconferror(const char *err)
2031{
2032#if YYDEBUG
2033 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2034#endif
2035}
2036
2037void print_quoted_string(FILE *out, const char *str)
2038{
2039 const char *p;
2040 int len;
2041
2042 putc('"', out);
2043 while ((p = strchr(str, '"'))) {
2044 len = p - str;
2045 if (len)
2046 fprintf(out, "%.*s", len, str);
2047 fputs("\\\"", out);
2048 str = p + 1;
2049 }
2050 fputs(str, out);
2051 putc('"', out);
2052}
2053
2054void print_symbol(FILE *out, struct menu *menu)
2055{
2056 struct symbol *sym = menu->sym;
2057 struct property *prop;
2058
2059 if (sym_is_choice(sym))
2060 fprintf(out, "choice\n");
2061 else
2062 fprintf(out, "config %s\n", sym->name);
2063 switch (sym->type) {
2064 case S_BOOLEAN:
2065 fputs(" boolean\n", out);
2066 break;
2067 case S_TRISTATE:
2068 fputs(" tristate\n", out);
2069 break;
2070 case S_STRING:
2071 fputs(" string\n", out);
2072 break;
2073 case S_INT:
2074 fputs(" integer\n", out);
2075 break;
2076 case S_HEX:
2077 fputs(" hex\n", out);
2078 break;
2079 default:
2080 fputs(" ???\n", out);
2081 break;
2082 }
2083 for (prop = sym->prop; prop; prop = prop->next) {
2084 if (prop->menu != menu)
2085 continue;
2086 switch (prop->type) {
2087 case P_PROMPT:
2088 fputs(" prompt ", out);
2089 print_quoted_string(out, prop->text);
2090 if (!expr_is_yes(prop->visible.expr)) {
2091 fputs(" if ", out);
2092 expr_fprint(prop->visible.expr, out);
2093 }
2094 fputc('\n', out);
2095 break;
2096 case P_DEFAULT:
2097 fputs( " default ", out);
2098 expr_fprint(prop->expr, out);
2099 if (!expr_is_yes(prop->visible.expr)) {
2100 fputs(" if ", out);
2101 expr_fprint(prop->visible.expr, out);
2102 }
2103 fputc('\n', out);
2104 break;
2105 case P_CHOICE:
2106 fputs(" #choice value\n", out);
2107 break;
2108 default:
2109 fprintf(out, " unknown prop %d!\n", prop->type);
2110 break;
2111 }
2112 }
2113 if (sym->help) {
2114 int len = strlen(sym->help);
2115 while (sym->help[--len] == '\n')
2116 sym->help[len] = 0;
2117 fprintf(out, " help\n%s\n", sym->help);
2118 }
2119 fputc('\n', out);
2120}
2121
2122void zconfdump(FILE *out)
2123{
2124 struct property *prop;
2125 struct symbol *sym;
2126 struct menu *menu;
2127
2128 menu = rootmenu.list;
2129 while (menu) {
2130 if ((sym = menu->sym))
2131 print_symbol(out, menu);
2132 else if ((prop = menu->prompt)) {
2133 switch (prop->type) {
2134 case P_COMMENT:
2135 fputs("\ncomment ", out);
2136 print_quoted_string(out, prop->text);
2137 fputs("\n", out);
2138 break;
2139 case P_MENU:
2140 fputs("\nmenu ", out);
2141 print_quoted_string(out, prop->text);
2142 fputs("\n", out);
2143 break;
2144 default:
2145 ;
2146 }
2147 if (!expr_is_yes(prop->visible.expr)) {
2148 fputs(" depends ", out);
2149 expr_fprint(prop->visible.expr, out);
2150 fputc('\n', out);
2151 }
2152 fputs("\n", out);
2153 }
2154
2155 if (menu->list)
2156 menu = menu->list;
2157 else if (menu->next)
2158 menu = menu->next;
2159 else while ((menu = menu->parent)) {
2160 if (menu->prompt && menu->prompt->type == P_MENU)
2161 fputs("\nendmenu\n", out);
2162 if (menu->next) {
2163 menu = menu->next;
2164 break;
2165 }
2166 }
2167 }
2168}
2169
2170#include "lex.zconf.c"
2171#include "util.c"
2172#include "confdata.c"
2173#include "expr.c"
2174#include "symbol.c"
2175#include "menu.c"
2176
2177
Note: See TracBrowser for help on using the repository browser.