winprefsyacc.c revision 35c4bbdf
1/* A Bison parser, made by GNU Bison 3.0.4. */ 2 3/* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 6 7 This program is free software: you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation, either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20/* As a special exception, you may create a larger work that contains 21 part or all of the Bison parser skeleton and distribute that work 22 under terms of your choice, so long as that work isn't itself a 23 parser generator using the skeleton or a modified version thereof 24 as a parser skeleton. Alternatively, if you modify or redistribute 25 the parser skeleton itself, you may (at your option) remove this 26 special exception, which will cause the skeleton and the resulting 27 Bison output files to be licensed under the GNU General Public 28 License without this special exception. 29 30 This special exception was added by the Free Software Foundation in 31 version 2.2 of Bison. */ 32 33/* C LALR(1) parser skeleton written by Richard Stallman, by 34 simplifying the original so-called "semantic" parser. */ 35 36/* All symbols defined below should begin with yy or YY, to avoid 37 infringing on user name space. This should be done even for local 38 variables, as they might otherwise be expanded by user macros. 39 There are some unavoidable exceptions within include files to 40 define necessary library symbols; they are noted "INFRINGES ON 41 USER NAME SPACE" below. */ 42 43/* Identify Bison output. */ 44#define YYBISON 1 45 46/* Bison version. */ 47#define YYBISON_VERSION "3.0.4" 48 49/* Skeleton name. */ 50#define YYSKELETON_NAME "yacc.c" 51 52/* Pure parsers. */ 53#define YYPURE 0 54 55/* Push parsers. */ 56#define YYPUSH 0 57 58/* Pull parsers. */ 59#define YYPULL 1 60 61 62 63 64/* Copy the first part of user declarations. */ 65#line 1 "winprefsyacc.y" /* yacc.c:339 */ 66 67/* 68 * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. 69 * Copyright (C) Colin Harrison 2005-2008 70 * 71 * Permission is hereby granted, free of charge, to any person obtaining 72 * a copy of this software and associated documentation files (the 73 * "Software"), to deal in the Software without restriction, including 74 * without limitation the rights to use, copy, modify, merge, publish, 75 * distribute, sublicense, and/or sell copies of the Software, and to 76 * permit persons to whom the Software is furnished to do so, subject to 77 * the following conditions: 78 * 79 * The above copyright notice and this permission notice shall be 80 * included in all copies or substantial portions of the Software. 81 * 82 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 83 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 84 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 85 * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR 86 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 87 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 88 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 89 * 90 * Except as contained in this notice, the name of the XFree86 Project 91 * shall not be used in advertising or otherwise to promote the sale, use 92 * or other dealings in this Software without prior written authorization 93 * from the XFree86 Project. 94 * 95 * Authors: Earle F. Philhower, III 96 * Colin Harrison 97 */ 98/* $XFree86: $ */ 99 100#ifdef HAVE_XWIN_CONFIG_H 101#include <xwin-config.h> 102#endif 103#include <stdio.h> 104#include <stdlib.h> 105#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */ 106#include <string.h> 107#include "winprefs.h" 108 109/* The following give better error messages in bison at the cost of a few KB */ 110#define YYERROR_VERBOSE 1 111 112/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ 113#define YYLTYPE_IS_TRIVIAL 1 114#define YYENABLE_NLS 0 115 116/* The global pref settings */ 117WINPREFS pref; 118 119/* The working menu */ 120static MENUPARSED menu; 121 122/* Functions for parsing the tokens into out structure */ 123/* Defined at the end section of this file */ 124 125static void SetIconDirectory (char *path); 126static void SetDefaultIcon (char *fname); 127static void SetRootMenu (char *menu); 128static void SetDefaultSysMenu (char *menu, int pos); 129static void SetTrayIcon (char *fname); 130 131static void OpenMenu(char *menuname); 132static void AddMenuLine(const char *name, MENUCOMMANDTYPE cmd, const char *param); 133static void CloseMenu(void); 134 135static void OpenIcons(void); 136static void AddIconLine(char *matchstr, char *iconfile); 137static void CloseIcons(void); 138 139static void OpenStyles(void); 140static void AddStyleLine(char *matchstr, unsigned long style); 141static void CloseStyles(void); 142 143static void OpenSysMenu(void); 144static void AddSysMenuLine(char *matchstr, char *menuname, int pos); 145static void CloseSysMenu(void); 146 147static int yyerror (const char *s); 148 149extern char *yytext; 150extern int yylineno; 151extern int yylex(void); 152 153 154#line 155 "winprefsyacc.c" /* yacc.c:339 */ 155 156# ifndef YY_NULLPTR 157# if defined __cplusplus && 201103L <= __cplusplus 158# define YY_NULLPTR nullptr 159# else 160# define YY_NULLPTR 0 161# endif 162# endif 163 164/* Enabling verbose error messages. */ 165#ifdef YYERROR_VERBOSE 166# undef YYERROR_VERBOSE 167# define YYERROR_VERBOSE 1 168#else 169# define YYERROR_VERBOSE 0 170#endif 171 172/* In a future release of Bison, this section will be replaced 173 by #include "y.tab.h". */ 174#ifndef YY_YY_WINPREFSYACC_H_INCLUDED 175# define YY_YY_WINPREFSYACC_H_INCLUDED 176/* Debug traces. */ 177#ifndef YYDEBUG 178# define YYDEBUG 0 179#endif 180#if YYDEBUG 181extern int yydebug; 182#endif 183 184/* Token type. */ 185#ifndef YYTOKENTYPE 186# define YYTOKENTYPE 187 enum yytokentype 188 { 189 NEWLINE = 258, 190 MENU = 259, 191 LB = 260, 192 RB = 261, 193 ICONDIRECTORY = 262, 194 DEFAULTICON = 263, 195 ICONS = 264, 196 STYLES = 265, 197 TOPMOST = 266, 198 MAXIMIZE = 267, 199 MINIMIZE = 268, 200 BOTTOM = 269, 201 NOTITLE = 270, 202 OUTLINE = 271, 203 NOFRAME = 272, 204 DEFAULTSYSMENU = 273, 205 SYSMENU = 274, 206 ROOTMENU = 275, 207 SEPARATOR = 276, 208 ATSTART = 277, 209 ATEND = 278, 210 EXEC = 279, 211 ALWAYSONTOP = 280, 212 DEBUGOUTPUT = 281, 213 RELOAD = 282, 214 TRAYICON = 283, 215 FORCEEXIT = 284, 216 SILENTEXIT = 285, 217 STRING = 286 218 }; 219#endif 220/* Tokens. */ 221#define NEWLINE 258 222#define MENU 259 223#define LB 260 224#define RB 261 225#define ICONDIRECTORY 262 226#define DEFAULTICON 263 227#define ICONS 264 228#define STYLES 265 229#define TOPMOST 266 230#define MAXIMIZE 267 231#define MINIMIZE 268 232#define BOTTOM 269 233#define NOTITLE 270 234#define OUTLINE 271 235#define NOFRAME 272 236#define DEFAULTSYSMENU 273 237#define SYSMENU 274 238#define ROOTMENU 275 239#define SEPARATOR 276 240#define ATSTART 277 241#define ATEND 278 242#define EXEC 279 243#define ALWAYSONTOP 280 244#define DEBUGOUTPUT 281 245#define RELOAD 282 246#define TRAYICON 283 247#define FORCEEXIT 284 248#define SILENTEXIT 285 249#define STRING 286 250 251/* Value type. */ 252#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 253 254union YYSTYPE 255{ 256#line 90 "winprefsyacc.y" /* yacc.c:355 */ 257 258 char *sVal; 259 unsigned long uVal; 260 int iVal; 261 262#line 263 "winprefsyacc.c" /* yacc.c:355 */ 263}; 264 265typedef union YYSTYPE YYSTYPE; 266# define YYSTYPE_IS_TRIVIAL 1 267# define YYSTYPE_IS_DECLARED 1 268#endif 269 270 271extern YYSTYPE yylval; 272 273int yyparse (void); 274 275#endif /* !YY_YY_WINPREFSYACC_H_INCLUDED */ 276 277/* Copy the second part of user declarations. */ 278 279#line 280 "winprefsyacc.c" /* yacc.c:358 */ 280 281#ifdef short 282# undef short 283#endif 284 285#ifdef YYTYPE_UINT8 286typedef YYTYPE_UINT8 yytype_uint8; 287#else 288typedef unsigned char yytype_uint8; 289#endif 290 291#ifdef YYTYPE_INT8 292typedef YYTYPE_INT8 yytype_int8; 293#else 294typedef signed char yytype_int8; 295#endif 296 297#ifdef YYTYPE_UINT16 298typedef YYTYPE_UINT16 yytype_uint16; 299#else 300typedef unsigned short int yytype_uint16; 301#endif 302 303#ifdef YYTYPE_INT16 304typedef YYTYPE_INT16 yytype_int16; 305#else 306typedef short int yytype_int16; 307#endif 308 309#ifndef YYSIZE_T 310# ifdef __SIZE_TYPE__ 311# define YYSIZE_T __SIZE_TYPE__ 312# elif defined size_t 313# define YYSIZE_T size_t 314# elif ! defined YYSIZE_T 315# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 316# define YYSIZE_T size_t 317# else 318# define YYSIZE_T unsigned int 319# endif 320#endif 321 322#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 323 324#ifndef YY_ 325# if defined YYENABLE_NLS && YYENABLE_NLS 326# if ENABLE_NLS 327# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 328# define YY_(Msgid) dgettext ("bison-runtime", Msgid) 329# endif 330# endif 331# ifndef YY_ 332# define YY_(Msgid) Msgid 333# endif 334#endif 335 336#ifndef YY_ATTRIBUTE 337# if (defined __GNUC__ \ 338 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 339 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 340# define YY_ATTRIBUTE(Spec) __attribute__(Spec) 341# else 342# define YY_ATTRIBUTE(Spec) /* empty */ 343# endif 344#endif 345 346#ifndef YY_ATTRIBUTE_PURE 347# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 348#endif 349 350#ifndef YY_ATTRIBUTE_UNUSED 351# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 352#endif 353 354#if !defined _Noreturn \ 355 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 356# if defined _MSC_VER && 1200 <= _MSC_VER 357# define _Noreturn __declspec (noreturn) 358# else 359# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 360# endif 361#endif 362 363/* Suppress unused-variable warnings by "using" E. */ 364#if ! defined lint || defined __GNUC__ 365# define YYUSE(E) ((void) (E)) 366#else 367# define YYUSE(E) /* empty */ 368#endif 369 370#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 371/* Suppress an incorrect diagnostic about yylval being uninitialized. */ 372# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 373 _Pragma ("GCC diagnostic push") \ 374 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 375 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 376# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 377 _Pragma ("GCC diagnostic pop") 378#else 379# define YY_INITIAL_VALUE(Value) Value 380#endif 381#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 382# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 383# define YY_IGNORE_MAYBE_UNINITIALIZED_END 384#endif 385#ifndef YY_INITIAL_VALUE 386# define YY_INITIAL_VALUE(Value) /* Nothing. */ 387#endif 388 389 390#if ! defined yyoverflow || YYERROR_VERBOSE 391 392/* The parser invokes alloca or malloc; define the necessary symbols. */ 393 394# ifdef YYSTACK_USE_ALLOCA 395# if YYSTACK_USE_ALLOCA 396# ifdef __GNUC__ 397# define YYSTACK_ALLOC __builtin_alloca 398# elif defined __BUILTIN_VA_ARG_INCR 399# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 400# elif defined _AIX 401# define YYSTACK_ALLOC __alloca 402# elif defined _MSC_VER 403# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 404# define alloca _alloca 405# else 406# define YYSTACK_ALLOC alloca 407# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 408# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 409 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 410# ifndef EXIT_SUCCESS 411# define EXIT_SUCCESS 0 412# endif 413# endif 414# endif 415# endif 416# endif 417 418# ifdef YYSTACK_ALLOC 419 /* Pacify GCC's 'empty if-body' warning. */ 420# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 421# ifndef YYSTACK_ALLOC_MAXIMUM 422 /* The OS might guarantee only one guard page at the bottom of the stack, 423 and a page size can be as small as 4096 bytes. So we cannot safely 424 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 425 to allow for a few compiler-allocated temporary stack slots. */ 426# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 427# endif 428# else 429# define YYSTACK_ALLOC YYMALLOC 430# define YYSTACK_FREE YYFREE 431# ifndef YYSTACK_ALLOC_MAXIMUM 432# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 433# endif 434# if (defined __cplusplus && ! defined EXIT_SUCCESS \ 435 && ! ((defined YYMALLOC || defined malloc) \ 436 && (defined YYFREE || defined free))) 437# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 438# ifndef EXIT_SUCCESS 439# define EXIT_SUCCESS 0 440# endif 441# endif 442# ifndef YYMALLOC 443# define YYMALLOC malloc 444# if ! defined malloc && ! defined EXIT_SUCCESS 445void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 446# endif 447# endif 448# ifndef YYFREE 449# define YYFREE free 450# if ! defined free && ! defined EXIT_SUCCESS 451void free (void *); /* INFRINGES ON USER NAME SPACE */ 452# endif 453# endif 454# endif 455#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 456 457 458#if (! defined yyoverflow \ 459 && (! defined __cplusplus \ 460 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 461 462/* A type that is properly aligned for any stack member. */ 463union yyalloc 464{ 465 yytype_int16 yyss_alloc; 466 YYSTYPE yyvs_alloc; 467}; 468 469/* The size of the maximum gap between one aligned stack and the next. */ 470# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 471 472/* The size of an array large to enough to hold all stacks, each with 473 N elements. */ 474# define YYSTACK_BYTES(N) \ 475 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 476 + YYSTACK_GAP_MAXIMUM) 477 478# define YYCOPY_NEEDED 1 479 480/* Relocate STACK from its old location to the new one. The 481 local variables YYSIZE and YYSTACKSIZE give the old and new number of 482 elements in the stack, and YYPTR gives the new location of the 483 stack. Advance YYPTR to a properly aligned location for the next 484 stack. */ 485# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 486 do \ 487 { \ 488 YYSIZE_T yynewbytes; \ 489 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 490 Stack = &yyptr->Stack_alloc; \ 491 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 492 yyptr += yynewbytes / sizeof (*yyptr); \ 493 } \ 494 while (0) 495 496#endif 497 498#if defined YYCOPY_NEEDED && YYCOPY_NEEDED 499/* Copy COUNT objects from SRC to DST. The source and destination do 500 not overlap. */ 501# ifndef YYCOPY 502# if defined __GNUC__ && 1 < __GNUC__ 503# define YYCOPY(Dst, Src, Count) \ 504 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 505# else 506# define YYCOPY(Dst, Src, Count) \ 507 do \ 508 { \ 509 YYSIZE_T yyi; \ 510 for (yyi = 0; yyi < (Count); yyi++) \ 511 (Dst)[yyi] = (Src)[yyi]; \ 512 } \ 513 while (0) 514# endif 515# endif 516#endif /* !YYCOPY_NEEDED */ 517 518/* YYFINAL -- State number of the termination state. */ 519#define YYFINAL 2 520/* YYLAST -- Last index in YYTABLE. */ 521#define YYLAST 98 522 523/* YYNTOKENS -- Number of terminals. */ 524#define YYNTOKENS 32 525/* YYNNTS -- Number of nonterminals. */ 526#define YYNNTS 33 527/* YYNRULES -- Number of rules. */ 528#define YYNRULES 65 529/* YYNSTATES -- Number of states. */ 530#define YYNSTATES 121 531 532/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 533 by yylex, with out-of-bounds checking. */ 534#define YYUNDEFTOK 2 535#define YYMAXUTOK 286 536 537#define YYTRANSLATE(YYX) \ 538 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 539 540/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 541 as returned by yylex, without out-of-bounds checking. */ 542static const yytype_uint8 yytranslate[] = 543{ 544 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 569 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 570 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 571 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 572 25, 26, 27, 28, 29, 30, 31 573}; 574 575#if YYDEBUG 576 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 577static const yytype_uint8 yyrline[] = 578{ 579 0, 133, 133, 134, 137, 138, 142, 143, 146, 147, 580 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 581 160, 163, 166, 169, 172, 175, 176, 177, 178, 179, 582 182, 183, 186, 186, 189, 192, 193, 196, 196, 199, 583 200, 201, 202, 205, 206, 207, 210, 211, 212, 213, 584 216, 219, 220, 223, 223, 226, 227, 228, 231, 234, 585 235, 238, 238, 241, 244, 247 586}; 587#endif 588 589#if YYDEBUG || YYERROR_VERBOSE || 0 590/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 591 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 592static const char *const yytname[] = 593{ 594 "$end", "error", "$undefined", "NEWLINE", "MENU", "LB", "RB", 595 "ICONDIRECTORY", "DEFAULTICON", "ICONS", "STYLES", "TOPMOST", "MAXIMIZE", 596 "MINIMIZE", "BOTTOM", "NOTITLE", "OUTLINE", "NOFRAME", "DEFAULTSYSMENU", 597 "SYSMENU", "ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", 598 "ALWAYSONTOP", "\"DEBUG\"", "RELOAD", "TRAYICON", "FORCEEXIT", 599 "SILENTEXIT", "STRING", "$accept", "input", "line", "newline_or_nada", 600 "command", "trayicon", "rootmenu", "defaultsysmenu", "defaulticon", 601 "icondirectory", "menuline", "menulist", "menu", "$@1", "iconline", 602 "iconlist", "icons", "$@2", "group1", "group2", "stylecombo", 603 "styleline", "stylelist", "styles", "$@3", "atspot", "sysmenuline", 604 "sysmenulist", "sysmenu", "$@4", "forceexit", "silentexit", "debug", YY_NULLPTR 605}; 606#endif 607 608# ifdef YYPRINT 609/* YYTOKNUM[NUM] -- (External) token number corresponding to the 610 (internal) symbol number NUM (which must be that of a token). */ 611static const yytype_uint16 yytoknum[] = 612{ 613 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 614 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 615 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 616 285, 286 617}; 618# endif 619 620#define YYPACT_NINF -47 621 622#define yypact_value_is_default(Yystate) \ 623 (!!((Yystate) == (-47))) 624 625#define YYTABLE_NINF -1 626 627#define yytable_value_is_error(Yytable_value) \ 628 0 629 630 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 631 STATE-NUM. */ 632static const yytype_int8 yypact[] = 633{ 634 -47, 7, -47, -47, -1, 0, 1, 18, 29, 15, 635 42, 17, 19, 20, 46, 50, -47, -47, -47, -47, 636 -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, 637 49, 53, 54, -47, -47, 6, 55, 56, 57, 58, 638 -47, -47, -47, -47, -47, 61, 61, -47, -47, 62, 639 -47, -47, -47, -47, 61, 61, 35, 38, -47, 61, 640 -19, -47, 39, 35, 66, 27, 38, 67, 43, 72, 641 -3, -19, 70, 74, -47, -47, -47, -47, -47, -47, 642 -47, -47, -47, 3, -8, 75, -47, -47, 48, 43, 643 76, 61, 52, 59, 77, 78, -47, -47, 61, -47, 644 -47, 61, 6, -47, -47, -47, 81, 82, 61, 61, 645 -47, -47, 83, 61, 61, -47, -47, 61, -47, -47, 646 -47 647}; 648 649 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 650 Performed when YYTABLE does not specify something else to do. Zero 651 means the default is an error. */ 652static const yytype_uint8 yydefact[] = 653{ 654 2, 0, 1, 4, 0, 0, 0, 0, 0, 0, 655 0, 0, 0, 0, 0, 0, 3, 5, 17, 14, 656 15, 8, 9, 10, 11, 12, 13, 18, 19, 16, 657 0, 0, 0, 37, 53, 55, 0, 0, 0, 0, 658 63, 64, 32, 24, 23, 6, 6, 56, 57, 0, 659 61, 21, 65, 20, 6, 6, 0, 0, 22, 6, 660 0, 7, 0, 35, 0, 0, 51, 0, 0, 0, 661 0, 30, 0, 0, 36, 38, 39, 40, 41, 42, 662 43, 44, 45, 46, 47, 0, 52, 54, 0, 59, 663 0, 6, 0, 0, 0, 0, 31, 33, 6, 48, 664 49, 6, 55, 60, 62, 25, 0, 0, 6, 6, 665 34, 50, 0, 6, 6, 26, 29, 6, 28, 27, 666 58 667}; 668 669 /* YYPGOTO[NTERM-NUM]. */ 670static const yytype_int8 yypgoto[] = 671{ 672 -47, -47, -47, -46, -47, -47, -47, -47, -47, -47, 673 -47, 16, -47, -47, -47, 25, -47, -47, 5, 8, 674 -47, -47, 26, -47, -47, -9, -47, 9, -47, -47, 675 -47, -47, -47 676}; 677 678 /* YYDEFGOTO[NTERM-NUM]. */ 679static const yytype_int8 yydefgoto[] = 680{ 681 -1, 1, 16, 56, 17, 18, 19, 20, 21, 22, 682 71, 72, 23, 54, 63, 64, 24, 45, 83, 84, 683 85, 66, 67, 25, 46, 49, 89, 90, 26, 59, 684 27, 28, 29 685}; 686 687 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 688 positive, shift that token. If negative, reduce the rule whose 689 number is the opposite. If YYTABLE_NINF, syntax error. */ 690static const yytype_uint8 yytable[] = 691{ 692 57, 92, 69, 76, 77, 78, 79, 2, 60, 61, 693 3, 4, 70, 68, 5, 6, 7, 8, 80, 81, 694 82, 93, 94, 33, 95, 9, 10, 11, 47, 48, 695 30, 31, 32, 12, 34, 13, 14, 15, 76, 77, 696 78, 79, 80, 81, 82, 105, 35, 36, 37, 40, 697 38, 39, 110, 41, 42, 111, 43, 44, 50, 51, 698 52, 53, 115, 116, 55, 58, 62, 118, 119, 65, 699 73, 120, 75, 87, 88, 91, 97, 98, 101, 102, 700 108, 109, 104, 106, 113, 114, 117, 96, 74, 100, 701 107, 99, 86, 112, 0, 0, 0, 0, 103 702}; 703 704static const yytype_int8 yycheck[] = 705{ 706 46, 4, 21, 11, 12, 13, 14, 0, 54, 55, 707 3, 4, 31, 59, 7, 8, 9, 10, 15, 16, 708 17, 24, 25, 5, 27, 18, 19, 20, 22, 23, 709 31, 31, 31, 26, 5, 28, 29, 30, 11, 12, 710 13, 14, 15, 16, 17, 91, 31, 5, 31, 3, 711 31, 31, 98, 3, 5, 101, 3, 3, 3, 3, 712 3, 3, 108, 109, 3, 3, 31, 113, 114, 31, 713 31, 117, 6, 6, 31, 3, 6, 3, 3, 31, 714 3, 3, 6, 31, 3, 3, 3, 71, 63, 84, 715 31, 83, 66, 102, -1, -1, -1, -1, 89 716}; 717 718 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 719 symbol of state STATE-NUM. */ 720static const yytype_uint8 yystos[] = 721{ 722 0, 33, 0, 3, 4, 7, 8, 9, 10, 18, 723 19, 20, 26, 28, 29, 30, 34, 36, 37, 38, 724 39, 40, 41, 44, 48, 55, 60, 62, 63, 64, 725 31, 31, 31, 5, 5, 31, 5, 31, 31, 31, 726 3, 3, 5, 3, 3, 49, 56, 22, 23, 57, 727 3, 3, 3, 3, 45, 3, 35, 35, 3, 61, 728 35, 35, 31, 46, 47, 31, 53, 54, 35, 21, 729 31, 42, 43, 31, 47, 6, 11, 12, 13, 14, 730 15, 16, 17, 50, 51, 52, 54, 6, 31, 58, 731 59, 3, 4, 24, 25, 27, 43, 6, 3, 51, 732 50, 3, 31, 59, 6, 35, 31, 31, 3, 3, 733 35, 35, 57, 3, 3, 35, 35, 3, 35, 35, 734 35 735}; 736 737 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 738static const yytype_uint8 yyr1[] = 739{ 740 0, 32, 33, 33, 34, 34, 35, 35, 36, 36, 741 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 742 37, 38, 39, 40, 41, 42, 42, 42, 42, 42, 743 43, 43, 45, 44, 46, 47, 47, 49, 48, 50, 744 50, 50, 50, 51, 51, 51, 52, 52, 52, 52, 745 53, 54, 54, 56, 55, 57, 57, 57, 58, 59, 746 59, 61, 60, 62, 63, 64 747}; 748 749 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 750static const yytype_uint8 yyr2[] = 751{ 752 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 753 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 754 3, 3, 4, 3, 3, 3, 4, 5, 5, 4, 755 1, 2, 0, 7, 4, 1, 2, 0, 6, 1, 756 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 757 4, 1, 2, 0, 6, 0, 1, 1, 5, 1, 758 2, 0, 7, 2, 2, 3 759}; 760 761 762#define yyerrok (yyerrstatus = 0) 763#define yyclearin (yychar = YYEMPTY) 764#define YYEMPTY (-2) 765#define YYEOF 0 766 767#define YYACCEPT goto yyacceptlab 768#define YYABORT goto yyabortlab 769#define YYERROR goto yyerrorlab 770 771 772#define YYRECOVERING() (!!yyerrstatus) 773 774#define YYBACKUP(Token, Value) \ 775do \ 776 if (yychar == YYEMPTY) \ 777 { \ 778 yychar = (Token); \ 779 yylval = (Value); \ 780 YYPOPSTACK (yylen); \ 781 yystate = *yyssp; \ 782 goto yybackup; \ 783 } \ 784 else \ 785 { \ 786 yyerror (YY_("syntax error: cannot back up")); \ 787 YYERROR; \ 788 } \ 789while (0) 790 791/* Error token number */ 792#define YYTERROR 1 793#define YYERRCODE 256 794 795 796 797/* Enable debugging if requested. */ 798#if YYDEBUG 799 800# ifndef YYFPRINTF 801# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 802# define YYFPRINTF fprintf 803# endif 804 805# define YYDPRINTF(Args) \ 806do { \ 807 if (yydebug) \ 808 YYFPRINTF Args; \ 809} while (0) 810 811/* This macro is provided for backward compatibility. */ 812#ifndef YY_LOCATION_PRINT 813# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 814#endif 815 816 817# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 818do { \ 819 if (yydebug) \ 820 { \ 821 YYFPRINTF (stderr, "%s ", Title); \ 822 yy_symbol_print (stderr, \ 823 Type, Value); \ 824 YYFPRINTF (stderr, "\n"); \ 825 } \ 826} while (0) 827 828 829/*----------------------------------------. 830| Print this symbol's value on YYOUTPUT. | 831`----------------------------------------*/ 832 833static void 834yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 835{ 836 FILE *yyo = yyoutput; 837 YYUSE (yyo); 838 if (!yyvaluep) 839 return; 840# ifdef YYPRINT 841 if (yytype < YYNTOKENS) 842 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 843# endif 844 YYUSE (yytype); 845} 846 847 848/*--------------------------------. 849| Print this symbol on YYOUTPUT. | 850`--------------------------------*/ 851 852static void 853yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 854{ 855 YYFPRINTF (yyoutput, "%s %s (", 856 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 857 858 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 859 YYFPRINTF (yyoutput, ")"); 860} 861 862/*------------------------------------------------------------------. 863| yy_stack_print -- Print the state stack from its BOTTOM up to its | 864| TOP (included). | 865`------------------------------------------------------------------*/ 866 867static void 868yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 869{ 870 YYFPRINTF (stderr, "Stack now"); 871 for (; yybottom <= yytop; yybottom++) 872 { 873 int yybot = *yybottom; 874 YYFPRINTF (stderr, " %d", yybot); 875 } 876 YYFPRINTF (stderr, "\n"); 877} 878 879# define YY_STACK_PRINT(Bottom, Top) \ 880do { \ 881 if (yydebug) \ 882 yy_stack_print ((Bottom), (Top)); \ 883} while (0) 884 885 886/*------------------------------------------------. 887| Report that the YYRULE is going to be reduced. | 888`------------------------------------------------*/ 889 890static void 891yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) 892{ 893 unsigned long int yylno = yyrline[yyrule]; 894 int yynrhs = yyr2[yyrule]; 895 int yyi; 896 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 897 yyrule - 1, yylno); 898 /* The symbols being reduced. */ 899 for (yyi = 0; yyi < yynrhs; yyi++) 900 { 901 YYFPRINTF (stderr, " $%d = ", yyi + 1); 902 yy_symbol_print (stderr, 903 yystos[yyssp[yyi + 1 - yynrhs]], 904 &(yyvsp[(yyi + 1) - (yynrhs)]) 905 ); 906 YYFPRINTF (stderr, "\n"); 907 } 908} 909 910# define YY_REDUCE_PRINT(Rule) \ 911do { \ 912 if (yydebug) \ 913 yy_reduce_print (yyssp, yyvsp, Rule); \ 914} while (0) 915 916/* Nonzero means print parse trace. It is left uninitialized so that 917 multiple parsers can coexist. */ 918int yydebug; 919#else /* !YYDEBUG */ 920# define YYDPRINTF(Args) 921# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 922# define YY_STACK_PRINT(Bottom, Top) 923# define YY_REDUCE_PRINT(Rule) 924#endif /* !YYDEBUG */ 925 926 927/* YYINITDEPTH -- initial size of the parser's stacks. */ 928#ifndef YYINITDEPTH 929# define YYINITDEPTH 200 930#endif 931 932/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 933 if the built-in stack extension method is used). 934 935 Do not make this value too large; the results are undefined if 936 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 937 evaluated with infinite-precision integer arithmetic. */ 938 939#ifndef YYMAXDEPTH 940# define YYMAXDEPTH 10000 941#endif 942 943 944#if YYERROR_VERBOSE 945 946# ifndef yystrlen 947# if defined __GLIBC__ && defined _STRING_H 948# define yystrlen strlen 949# else 950/* Return the length of YYSTR. */ 951static YYSIZE_T 952yystrlen (const char *yystr) 953{ 954 YYSIZE_T yylen; 955 for (yylen = 0; yystr[yylen]; yylen++) 956 continue; 957 return yylen; 958} 959# endif 960# endif 961 962# ifndef yystpcpy 963# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 964# define yystpcpy stpcpy 965# else 966/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 967 YYDEST. */ 968static char * 969yystpcpy (char *yydest, const char *yysrc) 970{ 971 char *yyd = yydest; 972 const char *yys = yysrc; 973 974 while ((*yyd++ = *yys++) != '\0') 975 continue; 976 977 return yyd - 1; 978} 979# endif 980# endif 981 982# ifndef yytnamerr 983/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 984 quotes and backslashes, so that it's suitable for yyerror. The 985 heuristic is that double-quoting is unnecessary unless the string 986 contains an apostrophe, a comma, or backslash (other than 987 backslash-backslash). YYSTR is taken from yytname. If YYRES is 988 null, do not copy; instead, return the length of what the result 989 would have been. */ 990static YYSIZE_T 991yytnamerr (char *yyres, const char *yystr) 992{ 993 if (*yystr == '"') 994 { 995 YYSIZE_T yyn = 0; 996 char const *yyp = yystr; 997 998 for (;;) 999 switch (*++yyp) 1000 { 1001 case '\'': 1002 case ',': 1003 goto do_not_strip_quotes; 1004 1005 case '\\': 1006 if (*++yyp != '\\') 1007 goto do_not_strip_quotes; 1008 /* Fall through. */ 1009 default: 1010 if (yyres) 1011 yyres[yyn] = *yyp; 1012 yyn++; 1013 break; 1014 1015 case '"': 1016 if (yyres) 1017 yyres[yyn] = '\0'; 1018 return yyn; 1019 } 1020 do_not_strip_quotes: ; 1021 } 1022 1023 if (! yyres) 1024 return yystrlen (yystr); 1025 1026 return yystpcpy (yyres, yystr) - yyres; 1027} 1028# endif 1029 1030/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 1031 about the unexpected token YYTOKEN for the state stack whose top is 1032 YYSSP. 1033 1034 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 1035 not large enough to hold the message. In that case, also set 1036 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 1037 required number of bytes is too large to store. */ 1038static int 1039yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1040 yytype_int16 *yyssp, int yytoken) 1041{ 1042 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 1043 YYSIZE_T yysize = yysize0; 1044 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1045 /* Internationalized format string. */ 1046 const char *yyformat = YY_NULLPTR; 1047 /* Arguments of yyformat. */ 1048 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1049 /* Number of reported tokens (one for the "unexpected", one per 1050 "expected"). */ 1051 int yycount = 0; 1052 1053 /* There are many possibilities here to consider: 1054 - If this state is a consistent state with a default action, then 1055 the only way this function was invoked is if the default action 1056 is an error action. In that case, don't check for expected 1057 tokens because there are none. 1058 - The only way there can be no lookahead present (in yychar) is if 1059 this state is a consistent state with a default action. Thus, 1060 detecting the absence of a lookahead is sufficient to determine 1061 that there is no unexpected or expected token to report. In that 1062 case, just report a simple "syntax error". 1063 - Don't assume there isn't a lookahead just because this state is a 1064 consistent state with a default action. There might have been a 1065 previous inconsistent state, consistent state with a non-default 1066 action, or user semantic action that manipulated yychar. 1067 - Of course, the expected token list depends on states to have 1068 correct lookahead information, and it depends on the parser not 1069 to perform extra reductions after fetching a lookahead from the 1070 scanner and before detecting a syntax error. Thus, state merging 1071 (from LALR or IELR) and default reductions corrupt the expected 1072 token list. However, the list is correct for canonical LR with 1073 one exception: it will still contain any token that will not be 1074 accepted due to an error action in a later state. 1075 */ 1076 if (yytoken != YYEMPTY) 1077 { 1078 int yyn = yypact[*yyssp]; 1079 yyarg[yycount++] = yytname[yytoken]; 1080 if (!yypact_value_is_default (yyn)) 1081 { 1082 /* Start YYX at -YYN if negative to avoid negative indexes in 1083 YYCHECK. In other words, skip the first -YYN actions for 1084 this state because they are default actions. */ 1085 int yyxbegin = yyn < 0 ? -yyn : 0; 1086 /* Stay within bounds of both yycheck and yytname. */ 1087 int yychecklim = YYLAST - yyn + 1; 1088 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1089 int yyx; 1090 1091 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1092 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1093 && !yytable_value_is_error (yytable[yyx + yyn])) 1094 { 1095 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1096 { 1097 yycount = 1; 1098 yysize = yysize0; 1099 break; 1100 } 1101 yyarg[yycount++] = yytname[yyx]; 1102 { 1103 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 1104 if (! (yysize <= yysize1 1105 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1106 return 2; 1107 yysize = yysize1; 1108 } 1109 } 1110 } 1111 } 1112 1113 switch (yycount) 1114 { 1115# define YYCASE_(N, S) \ 1116 case N: \ 1117 yyformat = S; \ 1118 break 1119 YYCASE_(0, YY_("syntax error")); 1120 YYCASE_(1, YY_("syntax error, unexpected %s")); 1121 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1122 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1123 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1124 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1125# undef YYCASE_ 1126 } 1127 1128 { 1129 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1130 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1131 return 2; 1132 yysize = yysize1; 1133 } 1134 1135 if (*yymsg_alloc < yysize) 1136 { 1137 *yymsg_alloc = 2 * yysize; 1138 if (! (yysize <= *yymsg_alloc 1139 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1140 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1141 return 1; 1142 } 1143 1144 /* Avoid sprintf, as that infringes on the user's name space. 1145 Don't have undefined behavior even if the translation 1146 produced a string with the wrong number of "%s"s. */ 1147 { 1148 char *yyp = *yymsg; 1149 int yyi = 0; 1150 while ((*yyp = *yyformat) != '\0') 1151 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1152 { 1153 yyp += yytnamerr (yyp, yyarg[yyi++]); 1154 yyformat += 2; 1155 } 1156 else 1157 { 1158 yyp++; 1159 yyformat++; 1160 } 1161 } 1162 return 0; 1163} 1164#endif /* YYERROR_VERBOSE */ 1165 1166/*-----------------------------------------------. 1167| Release the memory associated to this symbol. | 1168`-----------------------------------------------*/ 1169 1170static void 1171yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1172{ 1173 YYUSE (yyvaluep); 1174 if (!yymsg) 1175 yymsg = "Deleting"; 1176 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1177 1178 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1179 YYUSE (yytype); 1180 YY_IGNORE_MAYBE_UNINITIALIZED_END 1181} 1182 1183 1184 1185 1186/* The lookahead symbol. */ 1187int yychar; 1188 1189/* The semantic value of the lookahead symbol. */ 1190YYSTYPE yylval; 1191/* Number of syntax errors so far. */ 1192int yynerrs; 1193 1194 1195/*----------. 1196| yyparse. | 1197`----------*/ 1198 1199int 1200yyparse (void) 1201{ 1202 int yystate; 1203 /* Number of tokens to shift before error messages enabled. */ 1204 int yyerrstatus; 1205 1206 /* The stacks and their tools: 1207 'yyss': related to states. 1208 'yyvs': related to semantic values. 1209 1210 Refer to the stacks through separate pointers, to allow yyoverflow 1211 to reallocate them elsewhere. */ 1212 1213 /* The state stack. */ 1214 yytype_int16 yyssa[YYINITDEPTH]; 1215 yytype_int16 *yyss; 1216 yytype_int16 *yyssp; 1217 1218 /* The semantic value stack. */ 1219 YYSTYPE yyvsa[YYINITDEPTH]; 1220 YYSTYPE *yyvs; 1221 YYSTYPE *yyvsp; 1222 1223 YYSIZE_T yystacksize; 1224 1225 int yyn; 1226 int yyresult; 1227 /* Lookahead token as an internal (translated) token number. */ 1228 int yytoken = 0; 1229 /* The variables used to return semantic value and location from the 1230 action routines. */ 1231 YYSTYPE yyval; 1232 1233#if YYERROR_VERBOSE 1234 /* Buffer for error messages, and its allocated size. */ 1235 char yymsgbuf[128]; 1236 char *yymsg = yymsgbuf; 1237 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1238#endif 1239 1240#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1241 1242 /* The number of symbols on the RHS of the reduced rule. 1243 Keep to zero when no symbol should be popped. */ 1244 int yylen = 0; 1245 1246 yyssp = yyss = yyssa; 1247 yyvsp = yyvs = yyvsa; 1248 yystacksize = YYINITDEPTH; 1249 1250 YYDPRINTF ((stderr, "Starting parse\n")); 1251 1252 yystate = 0; 1253 yyerrstatus = 0; 1254 yynerrs = 0; 1255 yychar = YYEMPTY; /* Cause a token to be read. */ 1256 goto yysetstate; 1257 1258/*------------------------------------------------------------. 1259| yynewstate -- Push a new state, which is found in yystate. | 1260`------------------------------------------------------------*/ 1261 yynewstate: 1262 /* In all cases, when you get here, the value and location stacks 1263 have just been pushed. So pushing a state here evens the stacks. */ 1264 yyssp++; 1265 1266 yysetstate: 1267 *yyssp = yystate; 1268 1269 if (yyss + yystacksize - 1 <= yyssp) 1270 { 1271 /* Get the current used size of the three stacks, in elements. */ 1272 YYSIZE_T yysize = yyssp - yyss + 1; 1273 1274#ifdef yyoverflow 1275 { 1276 /* Give user a chance to reallocate the stack. Use copies of 1277 these so that the &'s don't force the real ones into 1278 memory. */ 1279 YYSTYPE *yyvs1 = yyvs; 1280 yytype_int16 *yyss1 = yyss; 1281 1282 /* Each stack pointer address is followed by the size of the 1283 data in use in that stack, in bytes. This used to be a 1284 conditional around just the two extra args, but that might 1285 be undefined if yyoverflow is a macro. */ 1286 yyoverflow (YY_("memory exhausted"), 1287 &yyss1, yysize * sizeof (*yyssp), 1288 &yyvs1, yysize * sizeof (*yyvsp), 1289 &yystacksize); 1290 1291 yyss = yyss1; 1292 yyvs = yyvs1; 1293 } 1294#else /* no yyoverflow */ 1295# ifndef YYSTACK_RELOCATE 1296 goto yyexhaustedlab; 1297# else 1298 /* Extend the stack our own way. */ 1299 if (YYMAXDEPTH <= yystacksize) 1300 goto yyexhaustedlab; 1301 yystacksize *= 2; 1302 if (YYMAXDEPTH < yystacksize) 1303 yystacksize = YYMAXDEPTH; 1304 1305 { 1306 yytype_int16 *yyss1 = yyss; 1307 union yyalloc *yyptr = 1308 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1309 if (! yyptr) 1310 goto yyexhaustedlab; 1311 YYSTACK_RELOCATE (yyss_alloc, yyss); 1312 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1313# undef YYSTACK_RELOCATE 1314 if (yyss1 != yyssa) 1315 YYSTACK_FREE (yyss1); 1316 } 1317# endif 1318#endif /* no yyoverflow */ 1319 1320 yyssp = yyss + yysize - 1; 1321 yyvsp = yyvs + yysize - 1; 1322 1323 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1324 (unsigned long int) yystacksize)); 1325 1326 if (yyss + yystacksize - 1 <= yyssp) 1327 YYABORT; 1328 } 1329 1330 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1331 1332 if (yystate == YYFINAL) 1333 YYACCEPT; 1334 1335 goto yybackup; 1336 1337/*-----------. 1338| yybackup. | 1339`-----------*/ 1340yybackup: 1341 1342 /* Do appropriate processing given the current state. Read a 1343 lookahead token if we need one and don't already have one. */ 1344 1345 /* First try to decide what to do without reference to lookahead token. */ 1346 yyn = yypact[yystate]; 1347 if (yypact_value_is_default (yyn)) 1348 goto yydefault; 1349 1350 /* Not known => get a lookahead token if don't already have one. */ 1351 1352 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1353 if (yychar == YYEMPTY) 1354 { 1355 YYDPRINTF ((stderr, "Reading a token: ")); 1356 yychar = yylex (); 1357 } 1358 1359 if (yychar <= YYEOF) 1360 { 1361 yychar = yytoken = YYEOF; 1362 YYDPRINTF ((stderr, "Now at end of input.\n")); 1363 } 1364 else 1365 { 1366 yytoken = YYTRANSLATE (yychar); 1367 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1368 } 1369 1370 /* If the proper action on seeing token YYTOKEN is to reduce or to 1371 detect an error, take that action. */ 1372 yyn += yytoken; 1373 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1374 goto yydefault; 1375 yyn = yytable[yyn]; 1376 if (yyn <= 0) 1377 { 1378 if (yytable_value_is_error (yyn)) 1379 goto yyerrlab; 1380 yyn = -yyn; 1381 goto yyreduce; 1382 } 1383 1384 /* Count tokens shifted since error; after three, turn off error 1385 status. */ 1386 if (yyerrstatus) 1387 yyerrstatus--; 1388 1389 /* Shift the lookahead token. */ 1390 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1391 1392 /* Discard the shifted token. */ 1393 yychar = YYEMPTY; 1394 1395 yystate = yyn; 1396 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1397 *++yyvsp = yylval; 1398 YY_IGNORE_MAYBE_UNINITIALIZED_END 1399 1400 goto yynewstate; 1401 1402 1403/*-----------------------------------------------------------. 1404| yydefault -- do the default action for the current state. | 1405`-----------------------------------------------------------*/ 1406yydefault: 1407 yyn = yydefact[yystate]; 1408 if (yyn == 0) 1409 goto yyerrlab; 1410 goto yyreduce; 1411 1412 1413/*-----------------------------. 1414| yyreduce -- Do a reduction. | 1415`-----------------------------*/ 1416yyreduce: 1417 /* yyn is the number of a rule to reduce with. */ 1418 yylen = yyr2[yyn]; 1419 1420 /* If YYLEN is nonzero, implement the default value of the action: 1421 '$$ = $1'. 1422 1423 Otherwise, the following line sets YYVAL to garbage. 1424 This behavior is undocumented and Bison 1425 users should not rely upon it. Assigning to YYVAL 1426 unconditionally makes the parser a bit smaller, and it avoids a 1427 GCC warning that YYVAL may be used uninitialized. */ 1428 yyval = yyvsp[1-yylen]; 1429 1430 1431 YY_REDUCE_PRINT (yyn); 1432 switch (yyn) 1433 { 1434 case 20: 1435#line 160 "winprefsyacc.y" /* yacc.c:1646 */ 1436 { SetTrayIcon((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } 1437#line 1438 "winprefsyacc.c" /* yacc.c:1646 */ 1438 break; 1439 1440 case 21: 1441#line 163 "winprefsyacc.y" /* yacc.c:1646 */ 1442 { SetRootMenu((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } 1443#line 1444 "winprefsyacc.c" /* yacc.c:1646 */ 1444 break; 1445 1446 case 22: 1447#line 166 "winprefsyacc.y" /* yacc.c:1646 */ 1448 { SetDefaultSysMenu((yyvsp[-2].sVal), (yyvsp[-1].iVal)); free((yyvsp[-2].sVal)); } 1449#line 1450 "winprefsyacc.c" /* yacc.c:1646 */ 1450 break; 1451 1452 case 23: 1453#line 169 "winprefsyacc.y" /* yacc.c:1646 */ 1454 { SetDefaultIcon((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } 1455#line 1456 "winprefsyacc.c" /* yacc.c:1646 */ 1456 break; 1457 1458 case 24: 1459#line 172 "winprefsyacc.y" /* yacc.c:1646 */ 1460 { SetIconDirectory((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } 1461#line 1462 "winprefsyacc.c" /* yacc.c:1646 */ 1462 break; 1463 1464 case 25: 1465#line 175 "winprefsyacc.y" /* yacc.c:1646 */ 1466 { AddMenuLine("-", CMD_SEPARATOR, ""); } 1467#line 1468 "winprefsyacc.c" /* yacc.c:1646 */ 1468 break; 1469 1470 case 26: 1471#line 176 "winprefsyacc.y" /* yacc.c:1646 */ 1472 { AddMenuLine((yyvsp[-3].sVal), CMD_ALWAYSONTOP, ""); free((yyvsp[-3].sVal)); } 1473#line 1474 "winprefsyacc.c" /* yacc.c:1646 */ 1474 break; 1475 1476 case 27: 1477#line 177 "winprefsyacc.y" /* yacc.c:1646 */ 1478 { AddMenuLine((yyvsp[-4].sVal), CMD_EXEC, (yyvsp[-2].sVal)); free((yyvsp[-4].sVal)); free((yyvsp[-2].sVal)); } 1479#line 1480 "winprefsyacc.c" /* yacc.c:1646 */ 1480 break; 1481 1482 case 28: 1483#line 178 "winprefsyacc.y" /* yacc.c:1646 */ 1484 { AddMenuLine((yyvsp[-4].sVal), CMD_MENU, (yyvsp[-2].sVal)); free((yyvsp[-4].sVal)); free((yyvsp[-2].sVal)); } 1485#line 1486 "winprefsyacc.c" /* yacc.c:1646 */ 1486 break; 1487 1488 case 29: 1489#line 179 "winprefsyacc.y" /* yacc.c:1646 */ 1490 { AddMenuLine((yyvsp[-3].sVal), CMD_RELOAD, ""); free((yyvsp[-3].sVal)); } 1491#line 1492 "winprefsyacc.c" /* yacc.c:1646 */ 1492 break; 1493 1494 case 32: 1495#line 186 "winprefsyacc.y" /* yacc.c:1646 */ 1496 { OpenMenu((yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } 1497#line 1498 "winprefsyacc.c" /* yacc.c:1646 */ 1498 break; 1499 1500 case 33: 1501#line 186 "winprefsyacc.y" /* yacc.c:1646 */ 1502 {CloseMenu();} 1503#line 1504 "winprefsyacc.c" /* yacc.c:1646 */ 1504 break; 1505 1506 case 34: 1507#line 189 "winprefsyacc.y" /* yacc.c:1646 */ 1508 { AddIconLine((yyvsp[-3].sVal), (yyvsp[-2].sVal)); free((yyvsp[-3].sVal)); free((yyvsp[-2].sVal)); } 1509#line 1510 "winprefsyacc.c" /* yacc.c:1646 */ 1510 break; 1511 1512 case 37: 1513#line 196 "winprefsyacc.y" /* yacc.c:1646 */ 1514 {OpenIcons();} 1515#line 1516 "winprefsyacc.c" /* yacc.c:1646 */ 1516 break; 1517 1518 case 38: 1519#line 196 "winprefsyacc.y" /* yacc.c:1646 */ 1520 {CloseIcons();} 1521#line 1522 "winprefsyacc.c" /* yacc.c:1646 */ 1522 break; 1523 1524 case 39: 1525#line 199 "winprefsyacc.y" /* yacc.c:1646 */ 1526 { (yyval.uVal)=STYLE_TOPMOST; } 1527#line 1528 "winprefsyacc.c" /* yacc.c:1646 */ 1528 break; 1529 1530 case 40: 1531#line 200 "winprefsyacc.y" /* yacc.c:1646 */ 1532 { (yyval.uVal)=STYLE_MAXIMIZE; } 1533#line 1534 "winprefsyacc.c" /* yacc.c:1646 */ 1534 break; 1535 1536 case 41: 1537#line 201 "winprefsyacc.y" /* yacc.c:1646 */ 1538 { (yyval.uVal)=STYLE_MINIMIZE; } 1539#line 1540 "winprefsyacc.c" /* yacc.c:1646 */ 1540 break; 1541 1542 case 42: 1543#line 202 "winprefsyacc.y" /* yacc.c:1646 */ 1544 { (yyval.uVal)=STYLE_BOTTOM; } 1545#line 1546 "winprefsyacc.c" /* yacc.c:1646 */ 1546 break; 1547 1548 case 43: 1549#line 205 "winprefsyacc.y" /* yacc.c:1646 */ 1550 { (yyval.uVal)=STYLE_NOTITLE; } 1551#line 1552 "winprefsyacc.c" /* yacc.c:1646 */ 1552 break; 1553 1554 case 44: 1555#line 206 "winprefsyacc.y" /* yacc.c:1646 */ 1556 { (yyval.uVal)=STYLE_OUTLINE; } 1557#line 1558 "winprefsyacc.c" /* yacc.c:1646 */ 1558 break; 1559 1560 case 45: 1561#line 207 "winprefsyacc.y" /* yacc.c:1646 */ 1562 { (yyval.uVal)=STYLE_NOFRAME; } 1563#line 1564 "winprefsyacc.c" /* yacc.c:1646 */ 1564 break; 1565 1566 case 46: 1567#line 210 "winprefsyacc.y" /* yacc.c:1646 */ 1568 { (yyval.uVal)=(yyvsp[0].uVal); } 1569#line 1570 "winprefsyacc.c" /* yacc.c:1646 */ 1570 break; 1571 1572 case 47: 1573#line 211 "winprefsyacc.y" /* yacc.c:1646 */ 1574 { (yyval.uVal)=(yyvsp[0].uVal); } 1575#line 1576 "winprefsyacc.c" /* yacc.c:1646 */ 1576 break; 1577 1578 case 48: 1579#line 212 "winprefsyacc.y" /* yacc.c:1646 */ 1580 { (yyval.uVal)=(yyvsp[-1].uVal)|(yyvsp[0].uVal); } 1581#line 1582 "winprefsyacc.c" /* yacc.c:1646 */ 1582 break; 1583 1584 case 49: 1585#line 213 "winprefsyacc.y" /* yacc.c:1646 */ 1586 { (yyval.uVal)=(yyvsp[-1].uVal)|(yyvsp[0].uVal); } 1587#line 1588 "winprefsyacc.c" /* yacc.c:1646 */ 1588 break; 1589 1590 case 50: 1591#line 216 "winprefsyacc.y" /* yacc.c:1646 */ 1592 { AddStyleLine((yyvsp[-3].sVal), (yyvsp[-2].uVal)); free((yyvsp[-3].sVal)); } 1593#line 1594 "winprefsyacc.c" /* yacc.c:1646 */ 1594 break; 1595 1596 case 53: 1597#line 223 "winprefsyacc.y" /* yacc.c:1646 */ 1598 {OpenStyles();} 1599#line 1600 "winprefsyacc.c" /* yacc.c:1646 */ 1600 break; 1601 1602 case 54: 1603#line 223 "winprefsyacc.y" /* yacc.c:1646 */ 1604 {CloseStyles();} 1605#line 1606 "winprefsyacc.c" /* yacc.c:1646 */ 1606 break; 1607 1608 case 55: 1609#line 226 "winprefsyacc.y" /* yacc.c:1646 */ 1610 { (yyval.iVal)=AT_END; } 1611#line 1612 "winprefsyacc.c" /* yacc.c:1646 */ 1612 break; 1613 1614 case 56: 1615#line 227 "winprefsyacc.y" /* yacc.c:1646 */ 1616 { (yyval.iVal)=AT_START; } 1617#line 1618 "winprefsyacc.c" /* yacc.c:1646 */ 1618 break; 1619 1620 case 57: 1621#line 228 "winprefsyacc.y" /* yacc.c:1646 */ 1622 { (yyval.iVal)=AT_END; } 1623#line 1624 "winprefsyacc.c" /* yacc.c:1646 */ 1624 break; 1625 1626 case 58: 1627#line 231 "winprefsyacc.y" /* yacc.c:1646 */ 1628 { AddSysMenuLine((yyvsp[-4].sVal), (yyvsp[-3].sVal), (yyvsp[-2].iVal)); free((yyvsp[-4].sVal)); free((yyvsp[-3].sVal)); } 1629#line 1630 "winprefsyacc.c" /* yacc.c:1646 */ 1630 break; 1631 1632 case 61: 1633#line 238 "winprefsyacc.y" /* yacc.c:1646 */ 1634 {OpenSysMenu();} 1635#line 1636 "winprefsyacc.c" /* yacc.c:1646 */ 1636 break; 1637 1638 case 62: 1639#line 238 "winprefsyacc.y" /* yacc.c:1646 */ 1640 {CloseSysMenu();} 1641#line 1642 "winprefsyacc.c" /* yacc.c:1646 */ 1642 break; 1643 1644 case 63: 1645#line 241 "winprefsyacc.y" /* yacc.c:1646 */ 1646 { pref.fForceExit = TRUE; } 1647#line 1648 "winprefsyacc.c" /* yacc.c:1646 */ 1648 break; 1649 1650 case 64: 1651#line 244 "winprefsyacc.y" /* yacc.c:1646 */ 1652 { pref.fSilentExit = TRUE; } 1653#line 1654 "winprefsyacc.c" /* yacc.c:1646 */ 1654 break; 1655 1656 case 65: 1657#line 247 "winprefsyacc.y" /* yacc.c:1646 */ 1658 { ErrorF("LoadPreferences: %s\n", (yyvsp[-1].sVal)); free((yyvsp[-1].sVal)); } 1659#line 1660 "winprefsyacc.c" /* yacc.c:1646 */ 1660 break; 1661 1662 1663#line 1664 "winprefsyacc.c" /* yacc.c:1646 */ 1664 default: break; 1665 } 1666 /* User semantic actions sometimes alter yychar, and that requires 1667 that yytoken be updated with the new translation. We take the 1668 approach of translating immediately before every use of yytoken. 1669 One alternative is translating here after every semantic action, 1670 but that translation would be missed if the semantic action invokes 1671 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1672 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1673 incorrect destructor might then be invoked immediately. In the 1674 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1675 to an incorrect destructor call or verbose syntax error message 1676 before the lookahead is translated. */ 1677 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1678 1679 YYPOPSTACK (yylen); 1680 yylen = 0; 1681 YY_STACK_PRINT (yyss, yyssp); 1682 1683 *++yyvsp = yyval; 1684 1685 /* Now 'shift' the result of the reduction. Determine what state 1686 that goes to, based on the state we popped back to and the rule 1687 number reduced by. */ 1688 1689 yyn = yyr1[yyn]; 1690 1691 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1692 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1693 yystate = yytable[yystate]; 1694 else 1695 yystate = yydefgoto[yyn - YYNTOKENS]; 1696 1697 goto yynewstate; 1698 1699 1700/*--------------------------------------. 1701| yyerrlab -- here on detecting error. | 1702`--------------------------------------*/ 1703yyerrlab: 1704 /* Make sure we have latest lookahead translation. See comments at 1705 user semantic actions for why this is necessary. */ 1706 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 1707 1708 /* If not already recovering from an error, report this error. */ 1709 if (!yyerrstatus) 1710 { 1711 ++yynerrs; 1712#if ! YYERROR_VERBOSE 1713 yyerror (YY_("syntax error")); 1714#else 1715# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1716 yyssp, yytoken) 1717 { 1718 char const *yymsgp = YY_("syntax error"); 1719 int yysyntax_error_status; 1720 yysyntax_error_status = YYSYNTAX_ERROR; 1721 if (yysyntax_error_status == 0) 1722 yymsgp = yymsg; 1723 else if (yysyntax_error_status == 1) 1724 { 1725 if (yymsg != yymsgbuf) 1726 YYSTACK_FREE (yymsg); 1727 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 1728 if (!yymsg) 1729 { 1730 yymsg = yymsgbuf; 1731 yymsg_alloc = sizeof yymsgbuf; 1732 yysyntax_error_status = 2; 1733 } 1734 else 1735 { 1736 yysyntax_error_status = YYSYNTAX_ERROR; 1737 yymsgp = yymsg; 1738 } 1739 } 1740 yyerror (yymsgp); 1741 if (yysyntax_error_status == 2) 1742 goto yyexhaustedlab; 1743 } 1744# undef YYSYNTAX_ERROR 1745#endif 1746 } 1747 1748 1749 1750 if (yyerrstatus == 3) 1751 { 1752 /* If just tried and failed to reuse lookahead token after an 1753 error, discard it. */ 1754 1755 if (yychar <= YYEOF) 1756 { 1757 /* Return failure if at end of input. */ 1758 if (yychar == YYEOF) 1759 YYABORT; 1760 } 1761 else 1762 { 1763 yydestruct ("Error: discarding", 1764 yytoken, &yylval); 1765 yychar = YYEMPTY; 1766 } 1767 } 1768 1769 /* Else will try to reuse lookahead token after shifting the error 1770 token. */ 1771 goto yyerrlab1; 1772 1773 1774/*---------------------------------------------------. 1775| yyerrorlab -- error raised explicitly by YYERROR. | 1776`---------------------------------------------------*/ 1777yyerrorlab: 1778 1779 /* Pacify compilers like GCC when the user code never invokes 1780 YYERROR and the label yyerrorlab therefore never appears in user 1781 code. */ 1782 if (/*CONSTCOND*/ 0) 1783 goto yyerrorlab; 1784 1785 /* Do not reclaim the symbols of the rule whose action triggered 1786 this YYERROR. */ 1787 YYPOPSTACK (yylen); 1788 yylen = 0; 1789 YY_STACK_PRINT (yyss, yyssp); 1790 yystate = *yyssp; 1791 goto yyerrlab1; 1792 1793 1794/*-------------------------------------------------------------. 1795| yyerrlab1 -- common code for both syntax error and YYERROR. | 1796`-------------------------------------------------------------*/ 1797yyerrlab1: 1798 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1799 1800 for (;;) 1801 { 1802 yyn = yypact[yystate]; 1803 if (!yypact_value_is_default (yyn)) 1804 { 1805 yyn += YYTERROR; 1806 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1807 { 1808 yyn = yytable[yyn]; 1809 if (0 < yyn) 1810 break; 1811 } 1812 } 1813 1814 /* Pop the current state because it cannot handle the error token. */ 1815 if (yyssp == yyss) 1816 YYABORT; 1817 1818 1819 yydestruct ("Error: popping", 1820 yystos[yystate], yyvsp); 1821 YYPOPSTACK (1); 1822 yystate = *yyssp; 1823 YY_STACK_PRINT (yyss, yyssp); 1824 } 1825 1826 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1827 *++yyvsp = yylval; 1828 YY_IGNORE_MAYBE_UNINITIALIZED_END 1829 1830 1831 /* Shift the error token. */ 1832 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1833 1834 yystate = yyn; 1835 goto yynewstate; 1836 1837 1838/*-------------------------------------. 1839| yyacceptlab -- YYACCEPT comes here. | 1840`-------------------------------------*/ 1841yyacceptlab: 1842 yyresult = 0; 1843 goto yyreturn; 1844 1845/*-----------------------------------. 1846| yyabortlab -- YYABORT comes here. | 1847`-----------------------------------*/ 1848yyabortlab: 1849 yyresult = 1; 1850 goto yyreturn; 1851 1852#if !defined yyoverflow || YYERROR_VERBOSE 1853/*-------------------------------------------------. 1854| yyexhaustedlab -- memory exhaustion comes here. | 1855`-------------------------------------------------*/ 1856yyexhaustedlab: 1857 yyerror (YY_("memory exhausted")); 1858 yyresult = 2; 1859 /* Fall through. */ 1860#endif 1861 1862yyreturn: 1863 if (yychar != YYEMPTY) 1864 { 1865 /* Make sure we have latest lookahead translation. See comments at 1866 user semantic actions for why this is necessary. */ 1867 yytoken = YYTRANSLATE (yychar); 1868 yydestruct ("Cleanup: discarding lookahead", 1869 yytoken, &yylval); 1870 } 1871 /* Do not reclaim the symbols of the rule whose action triggered 1872 this YYABORT or YYACCEPT. */ 1873 YYPOPSTACK (yylen); 1874 YY_STACK_PRINT (yyss, yyssp); 1875 while (yyssp != yyss) 1876 { 1877 yydestruct ("Cleanup: popping", 1878 yystos[*yyssp], yyvsp); 1879 YYPOPSTACK (1); 1880 } 1881#ifndef yyoverflow 1882 if (yyss != yyssa) 1883 YYSTACK_FREE (yyss); 1884#endif 1885#if YYERROR_VERBOSE 1886 if (yymsg != yymsgbuf) 1887 YYSTACK_FREE (yymsg); 1888#endif 1889 return yyresult; 1890} 1891#line 251 "winprefsyacc.y" /* yacc.c:1906 */ 1892 1893/* 1894 * Errors in parsing abort and print log messages 1895 */ 1896static int 1897yyerror (const char *s) 1898{ 1899 ErrorF("LoadPreferences: %s line %d\n", s, yylineno); 1900 return 1; 1901} 1902 1903/* Miscellaneous functions to store TOKENs into the structure */ 1904static void 1905SetIconDirectory (char *path) 1906{ 1907 strncpy (pref.iconDirectory, path, PATH_MAX); 1908 pref.iconDirectory[PATH_MAX] = 0; 1909} 1910 1911static void 1912SetDefaultIcon (char *fname) 1913{ 1914 strncpy (pref.defaultIconName, fname, NAME_MAX); 1915 pref.defaultIconName[NAME_MAX] = 0; 1916} 1917 1918static void 1919SetTrayIcon (char *fname) 1920{ 1921 strncpy (pref.trayIconName, fname, NAME_MAX); 1922 pref.trayIconName[NAME_MAX] = 0; 1923} 1924 1925static void 1926SetRootMenu (char *menuname) 1927{ 1928 strncpy (pref.rootMenuName, menuname, MENU_MAX); 1929 pref.rootMenuName[MENU_MAX] = 0; 1930} 1931 1932static void 1933SetDefaultSysMenu (char *menuname, int pos) 1934{ 1935 strncpy (pref.defaultSysMenuName, menuname, MENU_MAX); 1936 pref.defaultSysMenuName[MENU_MAX] = 0; 1937 pref.defaultSysMenuPos = pos; 1938} 1939 1940static void 1941OpenMenu (char *menuname) 1942{ 1943 if (menu.menuItem) free(menu.menuItem); 1944 menu.menuItem = NULL; 1945 strncpy(menu.menuName, menuname, MENU_MAX); 1946 menu.menuName[MENU_MAX] = 0; 1947 menu.menuItems = 0; 1948} 1949 1950static void 1951AddMenuLine (const char *text, MENUCOMMANDTYPE cmd, const char *param) 1952{ 1953 if (menu.menuItem==NULL) 1954 menu.menuItem = malloc(sizeof(MENUITEM)); 1955 else 1956 menu.menuItem = realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); 1957 1958 strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX); 1959 menu.menuItem[menu.menuItems].text[MENU_MAX] = 0; 1960 1961 menu.menuItem[menu.menuItems].cmd = cmd; 1962 1963 strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX); 1964 menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0; 1965 1966 menu.menuItem[menu.menuItems].commandID = 0; 1967 1968 menu.menuItems++; 1969} 1970 1971static void 1972CloseMenu (void) 1973{ 1974 if (menu.menuItem==NULL || menu.menuItems==0) 1975 { 1976 ErrorF("LoadPreferences: Empty menu detected\n"); 1977 return; 1978 } 1979 1980 if (pref.menuItems) 1981 pref.menu = realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); 1982 else 1983 pref.menu = malloc (sizeof(MENUPARSED)); 1984 1985 memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED)); 1986 pref.menuItems++; 1987 1988 memset (&menu, 0, sizeof(MENUPARSED)); 1989} 1990 1991static void 1992OpenIcons (void) 1993{ 1994 if (pref.icon != NULL) { 1995 ErrorF("LoadPreferences: Redefining icon mappings\n"); 1996 free(pref.icon); 1997 pref.icon = NULL; 1998 } 1999 pref.iconItems = 0; 2000} 2001 2002static void 2003AddIconLine (char *matchstr, char *iconfile) 2004{ 2005 if (pref.icon==NULL) 2006 pref.icon = malloc(sizeof(ICONITEM)); 2007 else 2008 pref.icon = realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); 2009 2010 strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX); 2011 pref.icon[pref.iconItems].match[MENU_MAX] = 0; 2012 2013 strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1); 2014 pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0; 2015 2016 pref.icon[pref.iconItems].hicon = 0; 2017 2018 pref.iconItems++; 2019} 2020 2021static void 2022CloseIcons (void) 2023{ 2024} 2025 2026static void 2027OpenStyles (void) 2028{ 2029 if (pref.style != NULL) { 2030 ErrorF("LoadPreferences: Redefining window style\n"); 2031 free(pref.style); 2032 pref.style = NULL; 2033 } 2034 pref.styleItems = 0; 2035} 2036 2037static void 2038AddStyleLine (char *matchstr, unsigned long style) 2039{ 2040 if (pref.style==NULL) 2041 pref.style = malloc(sizeof(STYLEITEM)); 2042 else 2043 pref.style = realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); 2044 2045 strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); 2046 pref.style[pref.styleItems].match[MENU_MAX] = 0; 2047 2048 pref.style[pref.styleItems].type = style; 2049 2050 pref.styleItems++; 2051} 2052 2053static void 2054CloseStyles (void) 2055{ 2056} 2057 2058static void 2059OpenSysMenu (void) 2060{ 2061 if (pref.sysMenu != NULL) { 2062 ErrorF("LoadPreferences: Redefining system menu\n"); 2063 free(pref.sysMenu); 2064 pref.sysMenu = NULL; 2065 } 2066 pref.sysMenuItems = 0; 2067} 2068 2069static void 2070AddSysMenuLine (char *matchstr, char *menuname, int pos) 2071{ 2072 if (pref.sysMenu==NULL) 2073 pref.sysMenu = malloc(sizeof(SYSMENUITEM)); 2074 else 2075 pref.sysMenu = realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); 2076 2077 strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX); 2078 pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0; 2079 2080 strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX); 2081 pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0; 2082 2083 pref.sysMenu[pref.sysMenuItems].menuPos = pos; 2084 2085 pref.sysMenuItems++; 2086} 2087 2088static void 2089CloseSysMenu (void) 2090{ 2091} 2092 2093