source: menu/zconf.tab.c_shipped@ 1d4eebf

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 1d4eebf was a705708, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Merged menuconfig code from experimental.
Added clfs2 symlink (required by menuconfig)

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