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