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