Initial commit
[xorg_rtime.git] / xorg-server-1.4 / hw / xwin / winprefsyacc.c
blobc5e593d64a01dcbc3cfd9f065a2d418b683d2669
1 /* A Bison parser, made from /home/anholt/xserver-stable/hw/xwin/winprefsyacc.y, by GNU bison 1.75. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
37 #define YYBISON 1
39 /* Pure parsers. */
40 #define YYPURE 0
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
47 /* Tokens. */
48 #ifndef YYTOKENTYPE
49 # define YYTOKENTYPE
50 /* Put the tokens into the symbol table, so that GDB and other debuggers
51 know about them. */
52 enum yytokentype {
53 NEWLINE = 258,
54 MENU = 259,
55 LB = 260,
56 RB = 261,
57 ICONDIRECTORY = 262,
58 DEFAULTICON = 263,
59 ICONS = 264,
60 DEFAULTSYSMENU = 265,
61 SYSMENU = 266,
62 ROOTMENU = 267,
63 SEPARATOR = 268,
64 ATSTART = 269,
65 ATEND = 270,
66 EXEC = 271,
67 ALWAYSONTOP = 272,
68 DEBUG = 273,
69 RELOAD = 274,
70 TRAYICON = 275,
71 SILENTEXIT = 276,
72 STRING = 277
74 #endif
75 #define NEWLINE 258
76 #define MENU 259
77 #define LB 260
78 #define RB 261
79 #define ICONDIRECTORY 262
80 #define DEFAULTICON 263
81 #define ICONS 264
82 #define DEFAULTSYSMENU 265
83 #define SYSMENU 266
84 #define ROOTMENU 267
85 #define SEPARATOR 268
86 #define ATSTART 269
87 #define ATEND 270
88 #define EXEC 271
89 #define ALWAYSONTOP 272
90 #define DEBUG 273
91 #define RELOAD 274
92 #define TRAYICON 275
93 #define SILENTEXIT 276
94 #define STRING 277
99 /* Copy the first part of user declarations. */
100 #line 1 "winprefsyacc.y"
103 * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
105 * Permission is hereby granted, free of charge, to any person obtaining
106 * a copy of this software and associated documentation files (the
107 * "Software"), to deal in the Software without restriction, including
108 * without limitation the rights to use, copy, modify, merge, publish,
109 * distribute, sublicense, and/or sell copies of the Software, and to
110 * permit persons to whom the Software is furnished to do so, subject to
111 * the following conditions:
113 * The above copyright notice and this permission notice shall be
114 * included in all copies or substantial portions of the Software.
116 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
117 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
118 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
119 * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
120 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
121 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
122 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
124 * Except as contained in this notice, the name of the XFree86 Project
125 * shall not be used in advertising or otherwise to promote the sale, use
126 * or other dealings in this Software without prior written authorization
127 * from the XFree86 Project.
129 * Authors: Earle F. Philhower, III
131 /* $XFree86: $ */
133 #ifdef HAVE_XWIN_CONFIG_H
134 #include <xwin-config.h>
135 #endif
136 #include <stdio.h>
137 #include <stdlib.h>
138 #include <string.h>
139 #include "winprefs.h"
141 /* The following give better error messages in bison at the cost of a few KB */
142 #define YYERROR_VERBOSE 1
144 /* The global pref settings */
145 WINPREFS pref;
147 /* The working menu */
148 static MENUPARSED menu;
150 /* Functions for parsing the tokens into out structure */
151 /* Defined at the end section of this file */
153 static void SetIconDirectory (char *path);
154 static void SetDefaultIcon (char *fname);
155 static void SetRootMenu (char *menu);
156 static void SetDefaultSysMenu (char *menu, int pos);
157 static void SetTrayIcon (char *fname);
159 static void OpenMenu(char *menuname);
160 static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
161 static void CloseMenu(void);
163 static void OpenIcons(void);
164 static void AddIconLine(char *matchstr, char *iconfile);
165 static void CloseIcons(void);
167 static void OpenSysMenu(void);
168 static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
169 static void CloseSysMenu(void);
171 static int yyerror (char *s);
173 extern void ErrorF (const char* /*f*/, ...);
174 extern char *yytext;
175 extern int yylex(void);
179 /* Enabling traces. */
180 #ifndef YYDEBUG
181 # define YYDEBUG 0
182 #endif
184 /* Enabling verbose error messages. */
185 #ifdef YYERROR_VERBOSE
186 # undef YYERROR_VERBOSE
187 # define YYERROR_VERBOSE 1
188 #else
189 # define YYERROR_VERBOSE 0
190 #endif
192 #ifndef YYSTYPE
193 #line 79 "winprefsyacc.y"
194 typedef union {
195 char *sVal;
196 int iVal;
197 } yystype;
198 /* Line 188 of /usr/local/share/bison/yacc.c. */
199 #line 200 "winprefsyacc.c"
200 # define YYSTYPE yystype
201 # define YYSTYPE_IS_TRIVIAL 1
202 #endif
204 #ifndef YYLTYPE
205 typedef struct yyltype
207 int first_line;
208 int first_column;
209 int last_line;
210 int last_column;
211 } yyltype;
212 # define YYLTYPE yyltype
213 # define YYLTYPE_IS_TRIVIAL 1
214 #endif
216 /* Copy the second part of user declarations. */
219 /* Line 213 of /usr/local/share/bison/yacc.c. */
220 #line 221 "winprefsyacc.c"
222 #if ! defined (yyoverflow) || YYERROR_VERBOSE
224 /* The parser invokes alloca or malloc; define the necessary symbols. */
226 # if YYSTACK_USE_ALLOCA
227 # define YYSTACK_ALLOC alloca
228 # else
229 # ifndef YYSTACK_USE_ALLOCA
230 # if defined (alloca) || defined (_ALLOCA_H)
231 # define YYSTACK_ALLOC alloca
232 # else
233 # ifdef __GNUC__
234 # define YYSTACK_ALLOC __builtin_alloca
235 # endif
236 # endif
237 # endif
238 # endif
240 # ifdef YYSTACK_ALLOC
241 /* Pacify GCC's `empty if-body' warning. */
242 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
243 # else
244 # if defined (__STDC__) || defined (__cplusplus)
245 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
246 # define YYSIZE_T size_t
247 # endif
248 # define YYSTACK_ALLOC malloc
249 # define YYSTACK_FREE free
250 # endif
251 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
254 #if (! defined (yyoverflow) \
255 && (! defined (__cplusplus) \
256 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
258 /* A type that is properly aligned for any stack member. */
259 union yyalloc
261 short yyss;
262 YYSTYPE yyvs;
265 /* The size of the maximum gap between one aligned stack and the next. */
266 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
268 /* The size of an array large to enough to hold all stacks, each with
269 N elements. */
270 # define YYSTACK_BYTES(N) \
271 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
272 + YYSTACK_GAP_MAX)
274 /* Copy COUNT objects from FROM to TO. The source and destination do
275 not overlap. */
276 # ifndef YYCOPY
277 # if 1 < __GNUC__
278 # define YYCOPY(To, From, Count) \
279 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
280 # else
281 # define YYCOPY(To, From, Count) \
282 do \
284 register YYSIZE_T yyi; \
285 for (yyi = 0; yyi < (Count); yyi++) \
286 (To)[yyi] = (From)[yyi]; \
288 while (0)
289 # endif
290 # endif
292 /* Relocate STACK from its old location to the new one. The
293 local variables YYSIZE and YYSTACKSIZE give the old and new number of
294 elements in the stack, and YYPTR gives the new location of the
295 stack. Advance YYPTR to a properly aligned location for the next
296 stack. */
297 # define YYSTACK_RELOCATE(Stack) \
298 do \
300 YYSIZE_T yynewbytes; \
301 YYCOPY (&yyptr->Stack, Stack, yysize); \
302 Stack = &yyptr->Stack; \
303 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
304 yyptr += yynewbytes / sizeof (*yyptr); \
306 while (0)
308 #endif
310 #if defined (__STDC__) || defined (__cplusplus)
311 typedef signed char yysigned_char;
312 #else
313 typedef short yysigned_char;
314 #endif
316 /* YYFINAL -- State number of the termination state. */
317 #define YYFINAL 2
318 #define YYLAST 68
320 /* YYNTOKENS -- Number of terminals. */
321 #define YYNTOKENS 23
322 /* YYNNTS -- Number of nonterminals. */
323 #define YYNNTS 25
324 /* YYNRULES -- Number of rules. */
325 #define YYNRULES 46
326 /* YYNRULES -- Number of states. */
327 #define YYNSTATES 94
329 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
330 #define YYUNDEFTOK 2
331 #define YYMAXUTOK 277
333 #define YYTRANSLATE(X) \
334 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
336 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
337 static const unsigned char yytranslate[] =
339 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
365 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
366 15, 16, 17, 18, 19, 20, 21, 22
369 #if YYDEBUG
370 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
371 YYRHS. */
372 static const unsigned char yyprhs[] =
374 0, 0, 3, 4, 7, 9, 11, 12, 15, 17,
375 19, 21, 23, 25, 27, 29, 31, 33, 35, 39,
376 43, 48, 52, 56, 60, 65, 71, 77, 82, 84,
377 87, 88, 96, 101, 103, 106, 107, 114, 115, 117,
378 119, 125, 127, 130, 131, 139, 142
381 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
382 static const yysigned_char yyrhs[] =
384 24, 0, -1, -1, 24, 25, -1, 3, -1, 27,
385 -1, -1, 3, 26, -1, 31, -1, 32, -1, 35,
386 -1, 39, -1, 44, -1, 29, -1, 30, -1, 47,
387 -1, 28, -1, 46, -1, 20, 22, 3, -1, 12,
388 22, 3, -1, 10, 22, 41, 3, -1, 8, 22,
389 3, -1, 7, 22, 3, -1, 13, 3, 26, -1,
390 22, 17, 3, 26, -1, 22, 16, 22, 3, 26,
391 -1, 22, 4, 22, 3, 26, -1, 22, 19, 3,
392 26, -1, 33, -1, 33, 34, -1, -1, 4, 22,
393 5, 36, 26, 34, 6, -1, 22, 22, 3, 26,
394 -1, 37, -1, 37, 38, -1, -1, 9, 5, 40,
395 26, 38, 6, -1, -1, 14, -1, 15, -1, 22,
396 22, 41, 3, 26, -1, 42, -1, 42, 43, -1,
397 -1, 11, 5, 3, 45, 26, 43, 6, -1, 21,
398 3, -1, 18, 22, 3, -1
401 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
402 static const unsigned char yyrline[] =
404 0, 93, 93, 94, 97, 98, 102, 103, 106, 107,
405 108, 109, 110, 111, 112, 113, 114, 115, 118, 121,
406 124, 127, 130, 133, 134, 135, 136, 137, 140, 141,
407 144, 144, 147, 150, 151, 154, 154, 157, 158, 159,
408 162, 165, 166, 169, 169, 172, 175
410 #endif
412 #if YYDEBUG || YYERROR_VERBOSE
413 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
414 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
415 static const char *const yytname[] =
417 "$end", "error", "$undefined", "NEWLINE", "MENU", "LB", "RB",
418 "ICONDIRECTORY", "DEFAULTICON", "ICONS", "DEFAULTSYSMENU", "SYSMENU",
419 "ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", "ALWAYSONTOP",
420 "DEBUG", "RELOAD", "TRAYICON", "SILENTEXIT", "STRING", "$accept",
421 "input", "line", "newline_or_nada", "command", "trayicon", "rootmenu",
422 "defaultsysmenu", "defaulticon", "icondirectory", "menuline",
423 "menulist", "menu", "@1", "iconline", "iconlist", "icons", "@2",
424 "atspot", "sysmenuline", "sysmenulist", "sysmenu", "@3", "silentexit",
425 "debug", 0
427 #endif
429 # ifdef YYPRINT
430 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
431 token YYLEX-NUM. */
432 static const unsigned short yytoknum[] =
434 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
435 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
436 275, 276, 277
438 # endif
440 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
441 static const unsigned char yyr1[] =
443 0, 23, 24, 24, 25, 25, 26, 26, 27, 27,
444 27, 27, 27, 27, 27, 27, 27, 27, 28, 29,
445 30, 31, 32, 33, 33, 33, 33, 33, 34, 34,
446 36, 35, 37, 38, 38, 40, 39, 41, 41, 41,
447 42, 43, 43, 45, 44, 46, 47
450 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
451 static const unsigned char yyr2[] =
453 0, 2, 0, 2, 1, 1, 0, 2, 1, 1,
454 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
455 4, 3, 3, 3, 4, 5, 5, 4, 1, 2,
456 0, 7, 4, 1, 2, 0, 6, 0, 1, 1,
457 5, 1, 2, 0, 7, 2, 3
460 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
461 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
462 means the default is an error. */
463 static const unsigned char yydefact[] =
465 2, 0, 1, 4, 0, 0, 0, 0, 0, 0,
466 0, 0, 0, 0, 3, 5, 16, 13, 14, 8,
467 9, 10, 11, 12, 17, 15, 0, 0, 0, 35,
468 37, 0, 0, 0, 0, 45, 30, 22, 21, 6,
469 38, 39, 0, 43, 19, 46, 18, 6, 6, 0,
470 20, 6, 0, 7, 0, 33, 0, 0, 0, 0,
471 28, 0, 0, 34, 36, 0, 41, 0, 6, 0,
472 0, 0, 0, 29, 31, 6, 37, 42, 44, 23,
473 0, 0, 6, 6, 32, 0, 6, 6, 24, 27,
474 6, 26, 25, 40
477 /* YYDEFGOTO[NTERM-NUM]. */
478 static const yysigned_char yydefgoto[] =
480 -1, 1, 14, 49, 15, 16, 17, 18, 19, 20,
481 60, 61, 21, 47, 55, 56, 22, 39, 42, 66,
482 67, 23, 51, 24, 25
485 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
486 STATE-NUM. */
487 #define YYPACT_NINF -48
488 static const yysigned_char yypact[] =
490 -48, 2, -48, -48, -15, -3, 4, 22, 7, 25,
491 9, 11, 12, 29, -48, -48, -48, -48, -48, -48,
492 -48, -48, -48, -48, -48, -48, 32, 35, 38, -48,
493 10, 39, 41, 42, 43, -48, -48, -48, -48, 44,
494 -48, -48, 45, -48, -48, -48, -48, 44, 44, 27,
495 -48, 44, -5, -48, 28, 27, 46, 31, 48, -1,
496 -5, 49, 51, -48, -48, 34, 31, 52, 44, 37,
497 40, 54, 57, -48, -48, 44, 10, -48, -48, -48,
498 58, 60, 44, 44, -48, 61, 44, 44, -48, -48,
499 44, -48, -48, -48
502 /* YYPGOTO[NTERM-NUM]. */
503 static const yysigned_char yypgoto[] =
505 -48, -48, -48, -47, -48, -48, -48, -48, -48, -48,
506 -48, 5, -48, -48, -48, 13, -48, -48, -10, -48,
507 1, -48, -48, -48, -48
510 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
511 positive, shift that token. If negative, reduce the rule which
512 number is the opposite. If zero, do what YYDEFACT says.
513 If YYTABLE_NINF, parse error. */
514 #define YYTABLE_NINF -1
515 static const unsigned char yytable[] =
517 52, 53, 2, 69, 57, 3, 4, 26, 58, 5,
518 6, 7, 8, 9, 10, 70, 71, 59, 72, 27,
519 11, 79, 12, 13, 40, 41, 28, 29, 84, 30,
520 31, 32, 35, 33, 34, 88, 89, 36, 37, 91,
521 92, 38, 43, 93, 44, 45, 46, 48, 50, 54,
522 62, 68, 64, 65, 75, 74, 76, 82, 78, 80,
523 83, 86, 81, 87, 90, 73, 85, 77, 63
526 static const unsigned char yycheck[] =
528 47, 48, 0, 4, 51, 3, 4, 22, 13, 7,
529 8, 9, 10, 11, 12, 16, 17, 22, 19, 22,
530 18, 68, 20, 21, 14, 15, 22, 5, 75, 22,
531 5, 22, 3, 22, 22, 82, 83, 5, 3, 86,
532 87, 3, 3, 90, 3, 3, 3, 3, 3, 22,
533 22, 3, 6, 22, 3, 6, 22, 3, 6, 22,
534 3, 3, 22, 3, 3, 60, 76, 66, 55
537 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
538 symbol of state STATE-NUM. */
539 static const unsigned char yystos[] =
541 0, 24, 0, 3, 4, 7, 8, 9, 10, 11,
542 12, 18, 20, 21, 25, 27, 28, 29, 30, 31,
543 32, 35, 39, 44, 46, 47, 22, 22, 22, 5,
544 22, 5, 22, 22, 22, 3, 5, 3, 3, 40,
545 14, 15, 41, 3, 3, 3, 3, 36, 3, 26,
546 3, 45, 26, 26, 22, 37, 38, 26, 13, 22,
547 33, 34, 22, 38, 6, 22, 42, 43, 3, 4,
548 16, 17, 19, 34, 6, 3, 22, 43, 6, 26,
549 22, 22, 3, 3, 26, 41, 3, 3, 26, 26,
550 3, 26, 26, 26
553 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
554 # define YYSIZE_T __SIZE_TYPE__
555 #endif
556 #if ! defined (YYSIZE_T) && defined (size_t)
557 # define YYSIZE_T size_t
558 #endif
559 #if ! defined (YYSIZE_T)
560 # if defined (__STDC__) || defined (__cplusplus)
561 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
562 # define YYSIZE_T size_t
563 # endif
564 #endif
565 #if ! defined (YYSIZE_T)
566 # define YYSIZE_T unsigned int
567 #endif
569 #define yyerrok (yyerrstatus = 0)
570 #define yyclearin (yychar = YYEMPTY)
571 #define YYEMPTY -2
572 #define YYEOF 0
574 #define YYACCEPT goto yyacceptlab
575 #define YYABORT goto yyabortlab
576 #define YYERROR goto yyerrlab1
578 /* Like YYERROR except do call yyerror. This remains here temporarily
579 to ease the transition to the new meaning of YYERROR, for GCC.
580 Once GCC version 2 has supplanted version 1, this can go. */
582 #define YYFAIL goto yyerrlab
584 #define YYRECOVERING() (!!yyerrstatus)
586 #define YYBACKUP(Token, Value) \
587 do \
588 if (yychar == YYEMPTY && yylen == 1) \
590 yychar = (Token); \
591 yylval = (Value); \
592 yychar1 = YYTRANSLATE (yychar); \
593 YYPOPSTACK; \
594 goto yybackup; \
596 else \
598 yyerror ("syntax error: cannot back up"); \
599 YYERROR; \
601 while (0)
603 #define YYTERROR 1
604 #define YYERRCODE 256
606 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
607 are run). */
609 #ifndef YYLLOC_DEFAULT
610 # define YYLLOC_DEFAULT(Current, Rhs, N) \
611 Current.first_line = Rhs[1].first_line; \
612 Current.first_column = Rhs[1].first_column; \
613 Current.last_line = Rhs[N].last_line; \
614 Current.last_column = Rhs[N].last_column;
615 #endif
617 /* YYLEX -- calling `yylex' with the right arguments. */
619 #define YYLEX yylex ()
621 /* Enable debugging if requested. */
622 #if YYDEBUG
624 # ifndef YYFPRINTF
625 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
626 # define YYFPRINTF fprintf
627 # endif
629 # define YYDPRINTF(Args) \
630 do { \
631 if (yydebug) \
632 YYFPRINTF Args; \
633 } while (0)
634 # define YYDSYMPRINT(Args) \
635 do { \
636 if (yydebug) \
637 yysymprint Args; \
638 } while (0)
639 /* Nonzero means print parse trace. It is left uninitialized so that
640 multiple parsers can coexist. */
641 int yydebug;
642 #else /* !YYDEBUG */
643 # define YYDPRINTF(Args)
644 # define YYDSYMPRINT(Args)
645 #endif /* !YYDEBUG */
647 /* YYINITDEPTH -- initial size of the parser's stacks. */
648 #ifndef YYINITDEPTH
649 # define YYINITDEPTH 200
650 #endif
652 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
653 if the built-in stack extension method is used).
655 Do not make this value too large; the results are undefined if
656 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
657 evaluated with infinite-precision integer arithmetic. */
659 #if YYMAXDEPTH == 0
660 # undef YYMAXDEPTH
661 #endif
663 #ifndef YYMAXDEPTH
664 # define YYMAXDEPTH 10000
665 #endif
669 #if YYERROR_VERBOSE
671 # ifndef yystrlen
672 # if defined (__GLIBC__) && defined (_STRING_H)
673 # define yystrlen strlen
674 # else
675 /* Return the length of YYSTR. */
676 static YYSIZE_T
677 # if defined (__STDC__) || defined (__cplusplus)
678 yystrlen (const char *yystr)
679 # else
680 yystrlen (yystr)
681 const char *yystr;
682 # endif
684 register const char *yys = yystr;
686 while (*yys++ != '\0')
687 continue;
689 return yys - yystr - 1;
691 # endif
692 # endif
694 # ifndef yystpcpy
695 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
696 # define yystpcpy stpcpy
697 # else
698 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
699 YYDEST. */
700 static char *
701 # if defined (__STDC__) || defined (__cplusplus)
702 yystpcpy (char *yydest, const char *yysrc)
703 # else
704 yystpcpy (yydest, yysrc)
705 char *yydest;
706 const char *yysrc;
707 # endif
709 register char *yyd = yydest;
710 register const char *yys = yysrc;
712 while ((*yyd++ = *yys++) != '\0')
713 continue;
715 return yyd - 1;
717 # endif
718 # endif
720 #endif /* !YYERROR_VERBOSE */
724 #if YYDEBUG
725 /*-----------------------------.
726 | Print this symbol on YYOUT. |
727 `-----------------------------*/
729 static void
730 #if defined (__STDC__) || defined (__cplusplus)
731 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
732 #else
733 yysymprint (yyout, yytype, yyvalue)
734 FILE* yyout;
735 int yytype;
736 YYSTYPE yyvalue;
737 #endif
739 /* Pacify ``unused variable'' warnings. */
740 (void) yyvalue;
742 if (yytype < YYNTOKENS)
744 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
745 # ifdef YYPRINT
746 YYPRINT (yyout, yytoknum[yytype], yyvalue);
747 # endif
749 else
750 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
752 switch (yytype)
754 default:
755 break;
757 YYFPRINTF (yyout, ")");
759 #endif /* YYDEBUG. */
762 /*-----------------------------------------------.
763 | Release the memory associated to this symbol. |
764 `-----------------------------------------------*/
766 static void
767 #if defined (__STDC__) || defined (__cplusplus)
768 yydestruct (int yytype, YYSTYPE yyvalue)
769 #else
770 yydestruct (yytype, yyvalue)
771 int yytype;
772 YYSTYPE yyvalue;
773 #endif
775 /* Pacify ``unused variable'' warnings. */
776 (void) yyvalue;
778 switch (yytype)
780 default:
781 break;
787 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
788 into yyparse. The argument should have type void *.
789 It should actually point to an object.
790 Grammar actions can access the variable by casting it
791 to the proper pointer type. */
793 #ifdef YYPARSE_PARAM
794 # if defined (__STDC__) || defined (__cplusplus)
795 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
796 # define YYPARSE_PARAM_DECL
797 # else
798 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
799 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
800 # endif
801 #else /* !YYPARSE_PARAM */
802 # define YYPARSE_PARAM_ARG
803 # define YYPARSE_PARAM_DECL
804 #endif /* !YYPARSE_PARAM */
806 /* Prevent warning if -Wstrict-prototypes. */
807 #ifdef __GNUC__
808 # ifdef YYPARSE_PARAM
809 int yyparse (void *);
810 # else
811 int yyparse (void);
812 # endif
813 #endif
816 /* The lookahead symbol. */
817 int yychar;
819 /* The semantic value of the lookahead symbol. */
820 YYSTYPE yylval;
822 /* Number of parse errors so far. */
823 int yynerrs;
827 yyparse (YYPARSE_PARAM_ARG)
828 YYPARSE_PARAM_DECL
831 register int yystate;
832 register int yyn;
833 int yyresult;
834 /* Number of tokens to shift before error messages enabled. */
835 int yyerrstatus;
836 /* Lookahead token as an internal (translated) token number. */
837 int yychar1 = 0;
839 /* Three stacks and their tools:
840 `yyss': related to states,
841 `yyvs': related to semantic values,
842 `yyls': related to locations.
844 Refer to the stacks thru separate pointers, to allow yyoverflow
845 to reallocate them elsewhere. */
847 /* The state stack. */
848 short yyssa[YYINITDEPTH];
849 short *yyss = yyssa;
850 register short *yyssp;
852 /* The semantic value stack. */
853 YYSTYPE yyvsa[YYINITDEPTH];
854 YYSTYPE *yyvs = yyvsa;
855 register YYSTYPE *yyvsp;
859 #define YYPOPSTACK (yyvsp--, yyssp--)
861 YYSIZE_T yystacksize = YYINITDEPTH;
863 /* The variables used to return semantic value and location from the
864 action routines. */
865 YYSTYPE yyval;
868 /* When reducing, the number of symbols on the RHS of the reduced
869 rule. */
870 int yylen;
872 YYDPRINTF ((stderr, "Starting parse\n"));
874 yystate = 0;
875 yyerrstatus = 0;
876 yynerrs = 0;
877 yychar = YYEMPTY; /* Cause a token to be read. */
879 /* Initialize stack pointers.
880 Waste one element of value and location stack
881 so that they stay on the same level as the state stack.
882 The wasted elements are never initialized. */
884 yyssp = yyss;
885 yyvsp = yyvs;
887 goto yysetstate;
889 /*------------------------------------------------------------.
890 | yynewstate -- Push a new state, which is found in yystate. |
891 `------------------------------------------------------------*/
892 yynewstate:
893 /* In all cases, when you get here, the value and location stacks
894 have just been pushed. so pushing a state here evens the stacks.
896 yyssp++;
898 yysetstate:
899 *yyssp = yystate;
901 if (yyssp >= yyss + yystacksize - 1)
903 /* Get the current used size of the three stacks, in elements. */
904 YYSIZE_T yysize = yyssp - yyss + 1;
906 #ifdef yyoverflow
908 /* Give user a chance to reallocate the stack. Use copies of
909 these so that the &'s don't force the real ones into
910 memory. */
911 YYSTYPE *yyvs1 = yyvs;
912 short *yyss1 = yyss;
915 /* Each stack pointer address is followed by the size of the
916 data in use in that stack, in bytes. This used to be a
917 conditional around just the two extra args, but that might
918 be undefined if yyoverflow is a macro. */
919 yyoverflow ("parser stack overflow",
920 &yyss1, yysize * sizeof (*yyssp),
921 &yyvs1, yysize * sizeof (*yyvsp),
923 &yystacksize);
925 yyss = yyss1;
926 yyvs = yyvs1;
928 #else /* no yyoverflow */
929 # ifndef YYSTACK_RELOCATE
930 goto yyoverflowlab;
931 # else
932 /* Extend the stack our own way. */
933 if (yystacksize >= YYMAXDEPTH)
934 goto yyoverflowlab;
935 yystacksize *= 2;
936 if (yystacksize > YYMAXDEPTH)
937 yystacksize = YYMAXDEPTH;
940 short *yyss1 = yyss;
941 union yyalloc *yyptr =
942 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
943 if (! yyptr)
944 goto yyoverflowlab;
945 YYSTACK_RELOCATE (yyss);
946 YYSTACK_RELOCATE (yyvs);
948 # undef YYSTACK_RELOCATE
949 if (yyss1 != yyssa)
950 YYSTACK_FREE (yyss1);
952 # endif
953 #endif /* no yyoverflow */
955 yyssp = yyss + yysize - 1;
956 yyvsp = yyvs + yysize - 1;
959 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
960 (unsigned long int) yystacksize));
962 if (yyssp >= yyss + yystacksize - 1)
963 YYABORT;
966 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
968 goto yybackup;
970 /*-----------.
971 | yybackup. |
972 `-----------*/
973 yybackup:
975 /* Do appropriate processing given the current state. */
976 /* Read a lookahead token if we need one and don't already have one. */
977 /* yyresume: */
979 /* First try to decide what to do without reference to lookahead token. */
981 yyn = yypact[yystate];
982 if (yyn == YYPACT_NINF)
983 goto yydefault;
985 /* Not known => get a lookahead token if don't already have one. */
987 /* yychar is either YYEMPTY or YYEOF
988 or a valid token in external form. */
990 if (yychar == YYEMPTY)
992 YYDPRINTF ((stderr, "Reading a token: "));
993 yychar = YYLEX;
996 /* Convert token to internal form (in yychar1) for indexing tables with. */
998 if (yychar <= 0) /* This means end of input. */
1000 yychar1 = 0;
1001 yychar = YYEOF; /* Don't call YYLEX any more. */
1003 YYDPRINTF ((stderr, "Now at end of input.\n"));
1005 else
1007 yychar1 = YYTRANSLATE (yychar);
1009 /* We have to keep this `#if YYDEBUG', since we use variables
1010 which are defined only if `YYDEBUG' is set. */
1011 YYDPRINTF ((stderr, "Next token is "));
1012 YYDSYMPRINT ((stderr, yychar1, yylval));
1013 YYDPRINTF ((stderr, "\n"));
1016 /* If the proper action on seeing token YYCHAR1 is to reduce or to
1017 detect an error, take that action. */
1018 yyn += yychar1;
1019 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
1020 goto yydefault;
1021 yyn = yytable[yyn];
1022 if (yyn <= 0)
1024 if (yyn == 0 || yyn == YYTABLE_NINF)
1025 goto yyerrlab;
1026 yyn = -yyn;
1027 goto yyreduce;
1030 if (yyn == YYFINAL)
1031 YYACCEPT;
1033 /* Shift the lookahead token. */
1034 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1035 yychar, yytname[yychar1]));
1037 /* Discard the token being shifted unless it is eof. */
1038 if (yychar != YYEOF)
1039 yychar = YYEMPTY;
1041 *++yyvsp = yylval;
1044 /* Count tokens shifted since error; after three, turn off error
1045 status. */
1046 if (yyerrstatus)
1047 yyerrstatus--;
1049 yystate = yyn;
1050 goto yynewstate;
1053 /*-----------------------------------------------------------.
1054 | yydefault -- do the default action for the current state. |
1055 `-----------------------------------------------------------*/
1056 yydefault:
1057 yyn = yydefact[yystate];
1058 if (yyn == 0)
1059 goto yyerrlab;
1060 goto yyreduce;
1063 /*-----------------------------.
1064 | yyreduce -- Do a reduction. |
1065 `-----------------------------*/
1066 yyreduce:
1067 /* yyn is the number of a rule to reduce with. */
1068 yylen = yyr2[yyn];
1070 /* If YYLEN is nonzero, implement the default value of the action:
1071 `$$ = $1'.
1073 Otherwise, the following line sets YYVAL to garbage.
1074 This behavior is undocumented and Bison
1075 users should not rely upon it. Assigning to YYVAL
1076 unconditionally makes the parser a bit smaller, and it avoids a
1077 GCC warning that YYVAL may be used uninitialized. */
1078 yyval = yyvsp[1-yylen];
1082 #if YYDEBUG
1083 /* We have to keep this `#if YYDEBUG', since we use variables which
1084 are defined only if `YYDEBUG' is set. */
1085 if (yydebug)
1087 int yyi;
1089 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1090 yyn - 1, yyrline[yyn]);
1092 /* Print the symbols being reduced, and their result. */
1093 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
1094 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1095 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1097 #endif
1098 switch (yyn)
1100 case 18:
1101 #line 118 "winprefsyacc.y"
1102 { SetTrayIcon(yyvsp[-1].sVal); free(yyvsp[-1].sVal); }
1103 break;
1105 case 19:
1106 #line 121 "winprefsyacc.y"
1107 { SetRootMenu(yyvsp[-1].sVal); free(yyvsp[-1].sVal); }
1108 break;
1110 case 20:
1111 #line 124 "winprefsyacc.y"
1112 { SetDefaultSysMenu(yyvsp[-2].sVal, yyvsp[-1].iVal); free(yyvsp[-2].sVal); }
1113 break;
1115 case 21:
1116 #line 127 "winprefsyacc.y"
1117 { SetDefaultIcon(yyvsp[-1].sVal); free(yyvsp[-1].sVal); }
1118 break;
1120 case 22:
1121 #line 130 "winprefsyacc.y"
1122 { SetIconDirectory(yyvsp[-1].sVal); free(yyvsp[-1].sVal); }
1123 break;
1125 case 23:
1126 #line 133 "winprefsyacc.y"
1127 { AddMenuLine("-", CMD_SEPARATOR, ""); }
1128 break;
1130 case 24:
1131 #line 134 "winprefsyacc.y"
1132 { AddMenuLine(yyvsp[-3].sVal, CMD_ALWAYSONTOP, ""); free(yyvsp[-3].sVal); }
1133 break;
1135 case 25:
1136 #line 135 "winprefsyacc.y"
1137 { AddMenuLine(yyvsp[-4].sVal, CMD_EXEC, yyvsp[-2].sVal); free(yyvsp[-4].sVal); free(yyvsp[-2].sVal); }
1138 break;
1140 case 26:
1141 #line 136 "winprefsyacc.y"
1142 { AddMenuLine(yyvsp[-4].sVal, CMD_MENU, yyvsp[-2].sVal); free(yyvsp[-4].sVal); free(yyvsp[-2].sVal); }
1143 break;
1145 case 27:
1146 #line 137 "winprefsyacc.y"
1147 { AddMenuLine(yyvsp[-3].sVal, CMD_RELOAD, ""); free(yyvsp[-3].sVal); }
1148 break;
1150 case 30:
1151 #line 144 "winprefsyacc.y"
1152 { OpenMenu(yyvsp[-1].sVal); free(yyvsp[-1].sVal); }
1153 break;
1155 case 31:
1156 #line 144 "winprefsyacc.y"
1157 {CloseMenu();}
1158 break;
1160 case 32:
1161 #line 147 "winprefsyacc.y"
1162 { AddIconLine(yyvsp[-3].sVal, yyvsp[-2].sVal); free(yyvsp[-3].sVal); free(yyvsp[-2].sVal); }
1163 break;
1165 case 35:
1166 #line 154 "winprefsyacc.y"
1167 {OpenIcons();}
1168 break;
1170 case 36:
1171 #line 154 "winprefsyacc.y"
1172 {CloseIcons();}
1173 break;
1175 case 37:
1176 #line 157 "winprefsyacc.y"
1177 { yyval.iVal=AT_END; }
1178 break;
1180 case 38:
1181 #line 158 "winprefsyacc.y"
1182 { yyval.iVal=AT_START; }
1183 break;
1185 case 39:
1186 #line 159 "winprefsyacc.y"
1187 { yyval.iVal=AT_END; }
1188 break;
1190 case 40:
1191 #line 162 "winprefsyacc.y"
1192 { AddSysMenuLine(yyvsp[-4].sVal, yyvsp[-3].sVal, yyvsp[-2].iVal); free(yyvsp[-4].sVal); free(yyvsp[-3].sVal); }
1193 break;
1195 case 43:
1196 #line 169 "winprefsyacc.y"
1197 {OpenSysMenu();}
1198 break;
1200 case 44:
1201 #line 169 "winprefsyacc.y"
1202 {CloseSysMenu();}
1203 break;
1205 case 45:
1206 #line 172 "winprefsyacc.y"
1207 { pref.fSilentExit = TRUE; }
1208 break;
1210 case 46:
1211 #line 175 "winprefsyacc.y"
1212 { ErrorF("LoadPreferences: %s\n", yyvsp[-1].sVal); free(yyvsp[-1].sVal); }
1213 break;
1218 /* Line 1016 of /usr/local/share/bison/yacc.c. */
1219 #line 1220 "winprefsyacc.c"
1221 yyvsp -= yylen;
1222 yyssp -= yylen;
1225 #if YYDEBUG
1226 if (yydebug)
1228 short *yyssp1 = yyss - 1;
1229 YYFPRINTF (stderr, "state stack now");
1230 while (yyssp1 != yyssp)
1231 YYFPRINTF (stderr, " %d", *++yyssp1);
1232 YYFPRINTF (stderr, "\n");
1234 #endif
1236 *++yyvsp = yyval;
1239 /* Now `shift' the result of the reduction. Determine what state
1240 that goes to, based on the state we popped back to and the rule
1241 number reduced by. */
1243 yyn = yyr1[yyn];
1245 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1246 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1247 yystate = yytable[yystate];
1248 else
1249 yystate = yydefgoto[yyn - YYNTOKENS];
1251 goto yynewstate;
1254 /*------------------------------------.
1255 | yyerrlab -- here on detecting error |
1256 `------------------------------------*/
1257 yyerrlab:
1258 /* If not already recovering from an error, report this error. */
1259 if (!yyerrstatus)
1261 ++yynerrs;
1262 #if YYERROR_VERBOSE
1263 yyn = yypact[yystate];
1265 if (YYPACT_NINF < yyn && yyn < YYLAST)
1267 YYSIZE_T yysize = 0;
1268 int yytype = YYTRANSLATE (yychar);
1269 char *yymsg;
1270 int yyx, yycount;
1272 yycount = 0;
1273 /* Start YYX at -YYN if negative to avoid negative indexes in
1274 YYCHECK. */
1275 for (yyx = yyn < 0 ? -yyn : 0;
1276 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1277 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1278 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1279 yysize += yystrlen ("parse error, unexpected ") + 1;
1280 yysize += yystrlen (yytname[yytype]);
1281 yymsg = (char *) YYSTACK_ALLOC (yysize);
1282 if (yymsg != 0)
1284 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1285 yyp = yystpcpy (yyp, yytname[yytype]);
1287 if (yycount < 5)
1289 yycount = 0;
1290 for (yyx = yyn < 0 ? -yyn : 0;
1291 yyx < (int) (sizeof (yytname) / sizeof (char *));
1292 yyx++)
1293 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1295 const char *yyq = ! yycount ? ", expecting " : " or ";
1296 yyp = yystpcpy (yyp, yyq);
1297 yyp = yystpcpy (yyp, yytname[yyx]);
1298 yycount++;
1301 yyerror (yymsg);
1302 YYSTACK_FREE (yymsg);
1304 else
1305 yyerror ("parse error; also virtual memory exhausted");
1307 else
1308 #endif /* YYERROR_VERBOSE */
1309 yyerror ("parse error");
1311 goto yyerrlab1;
1314 /*----------------------------------------------------.
1315 | yyerrlab1 -- error raised explicitly by an action. |
1316 `----------------------------------------------------*/
1317 yyerrlab1:
1318 if (yyerrstatus == 3)
1320 /* If just tried and failed to reuse lookahead token after an
1321 error, discard it. */
1323 /* Return failure if at end of input. */
1324 if (yychar == YYEOF)
1326 /* Pop the error token. */
1327 YYPOPSTACK;
1328 /* Pop the rest of the stack. */
1329 while (yyssp > yyss)
1331 YYDPRINTF ((stderr, "Error: popping "));
1332 YYDSYMPRINT ((stderr,
1333 yystos[*yyssp],
1334 *yyvsp));
1335 YYDPRINTF ((stderr, "\n"));
1336 yydestruct (yystos[*yyssp], *yyvsp);
1337 YYPOPSTACK;
1339 YYABORT;
1342 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1343 yychar, yytname[yychar1]));
1344 yydestruct (yychar1, yylval);
1345 yychar = YYEMPTY;
1348 /* Else will try to reuse lookahead token after shifting the error
1349 token. */
1351 yyerrstatus = 3; /* Each real token shifted decrements this. */
1353 for (;;)
1355 yyn = yypact[yystate];
1356 if (yyn != YYPACT_NINF)
1358 yyn += YYTERROR;
1359 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1361 yyn = yytable[yyn];
1362 if (0 < yyn)
1363 break;
1367 /* Pop the current state because it cannot handle the error token. */
1368 if (yyssp == yyss)
1369 YYABORT;
1371 YYDPRINTF ((stderr, "Error: popping "));
1372 YYDSYMPRINT ((stderr,
1373 yystos[*yyssp], *yyvsp));
1374 YYDPRINTF ((stderr, "\n"));
1376 yydestruct (yystos[yystate], *yyvsp);
1377 yyvsp--;
1378 yystate = *--yyssp;
1381 #if YYDEBUG
1382 if (yydebug)
1384 short *yyssp1 = yyss - 1;
1385 YYFPRINTF (stderr, "Error: state stack now");
1386 while (yyssp1 != yyssp)
1387 YYFPRINTF (stderr, " %d", *++yyssp1);
1388 YYFPRINTF (stderr, "\n");
1390 #endif
1393 if (yyn == YYFINAL)
1394 YYACCEPT;
1396 YYDPRINTF ((stderr, "Shifting error token, "));
1398 *++yyvsp = yylval;
1401 yystate = yyn;
1402 goto yynewstate;
1405 /*-------------------------------------.
1406 | yyacceptlab -- YYACCEPT comes here. |
1407 `-------------------------------------*/
1408 yyacceptlab:
1409 yyresult = 0;
1410 goto yyreturn;
1412 /*-----------------------------------.
1413 | yyabortlab -- YYABORT comes here. |
1414 `-----------------------------------*/
1415 yyabortlab:
1416 yyresult = 1;
1417 goto yyreturn;
1419 #ifndef yyoverflow
1420 /*----------------------------------------------.
1421 | yyoverflowlab -- parser overflow comes here. |
1422 `----------------------------------------------*/
1423 yyoverflowlab:
1424 yyerror ("parser stack overflow");
1425 yyresult = 2;
1426 /* Fall through. */
1427 #endif
1429 yyreturn:
1430 #ifndef yyoverflow
1431 if (yyss != yyssa)
1432 YYSTACK_FREE (yyss);
1433 #endif
1434 return yyresult;
1438 #line 179 "winprefsyacc.y"
1441 * Errors in parsing abort and print log messages
1443 static int
1444 yyerror (char *s)
1446 extern int yylineno; /* Handled by flex internally */
1448 ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
1449 return 1;
1452 /* Miscellaneous functions to store TOKENs into the structure */
1453 static void
1454 SetIconDirectory (char *path)
1456 strncpy (pref.iconDirectory, path, PATH_MAX);
1457 pref.iconDirectory[PATH_MAX] = 0;
1460 static void
1461 SetDefaultIcon (char *fname)
1463 strncpy (pref.defaultIconName, fname, NAME_MAX);
1464 pref.defaultIconName[NAME_MAX] = 0;
1467 static void
1468 SetTrayIcon (char *fname)
1470 strncpy (pref.trayIconName, fname, NAME_MAX);
1471 pref.trayIconName[NAME_MAX] = 0;
1474 static void
1475 SetRootMenu (char *menu)
1477 strncpy (pref.rootMenuName, menu, MENU_MAX);
1478 pref.rootMenuName[MENU_MAX] = 0;
1481 static void
1482 SetDefaultSysMenu (char *menu, int pos)
1484 strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
1485 pref.defaultSysMenuName[MENU_MAX] = 0;
1486 pref.defaultSysMenuPos = pos;
1489 static void
1490 OpenMenu (char *menuname)
1492 if (menu.menuItem) free(menu.menuItem);
1493 menu.menuItem = NULL;
1494 strncpy(menu.menuName, menuname, MENU_MAX);
1495 menu.menuName[MENU_MAX] = 0;
1496 menu.menuItems = 0;
1499 static void
1500 AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
1502 if (menu.menuItem==NULL)
1503 menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
1504 else
1505 menu.menuItem = (MENUITEM*)
1506 realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
1508 strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
1509 menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
1511 menu.menuItem[menu.menuItems].cmd = cmd;
1513 strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
1514 menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
1516 menu.menuItem[menu.menuItems].commandID = 0;
1518 menu.menuItems++;
1521 static void
1522 CloseMenu (void)
1524 if (menu.menuItem==NULL || menu.menuItems==0)
1526 ErrorF("LoadPreferences: Empty menu detected\n");
1527 return;
1530 if (pref.menuItems)
1531 pref.menu = (MENUPARSED*)
1532 realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
1533 else
1534 pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
1536 memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
1537 pref.menuItems++;
1539 memset (&menu, 0, sizeof(MENUPARSED));
1542 static void
1543 OpenIcons (void)
1545 if (pref.icon != NULL) {
1546 ErrorF("LoadPreferences: Redefining icon mappings\n");
1547 free(pref.icon);
1548 pref.icon = NULL;
1550 pref.iconItems = 0;
1553 static void
1554 AddIconLine (char *matchstr, char *iconfile)
1556 if (pref.icon==NULL)
1557 pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
1558 else
1559 pref.icon = (ICONITEM*)
1560 realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
1562 strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
1563 pref.icon[pref.iconItems].match[MENU_MAX] = 0;
1565 strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
1566 pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
1568 pref.icon[pref.iconItems].hicon = 0;
1570 pref.iconItems++;
1573 static void
1574 CloseIcons (void)
1578 static void
1579 OpenSysMenu (void)
1581 if (pref.sysMenu != NULL) {
1582 ErrorF("LoadPreferences: Redefining system menu\n");
1583 free(pref.sysMenu);
1584 pref.sysMenu = NULL;
1586 pref.sysMenuItems = 0;
1589 static void
1590 AddSysMenuLine (char *matchstr, char *menuname, int pos)
1592 if (pref.sysMenu==NULL)
1593 pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
1594 else
1595 pref.sysMenu = (SYSMENUITEM*)
1596 realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
1598 strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
1599 pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
1601 strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
1602 pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
1604 pref.sysMenu[pref.sysMenuItems].menuPos = pos;
1606 pref.sysMenuItems++;
1609 static void
1610 CloseSysMenu (void)