Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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