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