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