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)
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. */
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
50 /* Put the tokens into the symbol table, so that GDB and other debuggers
79 #define ICONDIRECTORY 262
80 #define DEFAULTICON 263
82 #define DEFAULTSYSMENU 265
89 #define ALWAYSONTOP 272
93 #define SILENTEXIT 276
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
133 #ifdef HAVE_XWIN_CONFIG_H
134 #include <xwin-config.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 */
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*/, ...);
175 extern int yylex(void);
179 /* Enabling traces. */
184 /* Enabling verbose error messages. */
185 #ifdef YYERROR_VERBOSE
186 # undef YYERROR_VERBOSE
187 # define YYERROR_VERBOSE 1
189 # define YYERROR_VERBOSE 0
193 #line 79 "winprefsyacc.y"
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
205 typedef struct yyltype
212 # define YYLTYPE yyltype
213 # define YYLTYPE_IS_TRIVIAL 1
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
229 # ifndef YYSTACK_USE_ALLOCA
230 # if defined (alloca) || defined (_ALLOCA_H)
231 # define YYSTACK_ALLOC alloca
234 # define YYSTACK_ALLOC __builtin_alloca
240 # ifdef YYSTACK_ALLOC
241 /* Pacify GCC's `empty if-body' warning. */
242 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
244 # if defined (__STDC__) || defined (__cplusplus)
245 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
246 # define YYSIZE_T size_t
248 # define YYSTACK_ALLOC malloc
249 # define YYSTACK_FREE free
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. */
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
270 # define YYSTACK_BYTES(N) \
271 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
274 /* Copy COUNT objects from FROM to TO. The source and destination do
278 # define YYCOPY(To, From, Count) \
279 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
281 # define YYCOPY(To, From, Count) \
284 register YYSIZE_T yyi; \
285 for (yyi = 0; yyi < (Count); yyi++) \
286 (To)[yyi] = (From)[yyi]; \
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
297 # define YYSTACK_RELOCATE(Stack) \
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); \
310 #if defined (__STDC__) || defined (__cplusplus)
311 typedef signed char yysigned_char
;
313 typedef short yysigned_char
;
316 /* YYFINAL -- State number of the termination state. */
320 /* YYNTOKENS -- Number of terminals. */
322 /* YYNNTS -- Number of nonterminals. */
324 /* YYNRULES -- Number of rules. */
326 /* YYNRULES -- Number of states. */
329 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
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
370 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
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,
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
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",
430 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
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,
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,
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,
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,
485 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
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,
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,
553 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
554 # define YYSIZE_T __SIZE_TYPE__
556 #if ! defined (YYSIZE_T) && defined (size_t)
557 # define YYSIZE_T size_t
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
565 #if ! defined (YYSIZE_T)
566 # define YYSIZE_T unsigned int
569 #define yyerrok (yyerrstatus = 0)
570 #define yyclearin (yychar = YYEMPTY)
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) \
588 if (yychar == YYEMPTY && yylen == 1) \
592 yychar1 = YYTRANSLATE (yychar); \
598 yyerror ("syntax error: cannot back up"); \
604 #define YYERRCODE 256
606 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
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;
617 /* YYLEX -- calling `yylex' with the right arguments. */
619 #define YYLEX yylex ()
621 /* Enable debugging if requested. */
625 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
626 # define YYFPRINTF fprintf
629 # define YYDPRINTF(Args) \
634 # define YYDSYMPRINT(Args) \
639 /* Nonzero means print parse trace. It is left uninitialized so that
640 multiple parsers can coexist. */
643 # define YYDPRINTF(Args)
644 # define YYDSYMPRINT(Args)
645 #endif /* !YYDEBUG */
647 /* YYINITDEPTH -- initial size of the parser's stacks. */
649 # define YYINITDEPTH 200
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. */
664 # define YYMAXDEPTH 10000
672 # if defined (__GLIBC__) && defined (_STRING_H)
673 # define yystrlen strlen
675 /* Return the length of YYSTR. */
677 # if defined (__STDC__) || defined (__cplusplus)
678 yystrlen (const char *yystr
)
684 register const char *yys
= yystr
;
686 while (*yys
++ != '\0')
689 return yys
- yystr
- 1;
695 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
696 # define yystpcpy stpcpy
698 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
701 # if defined (__STDC__) || defined (__cplusplus)
702 yystpcpy (char *yydest
, const char *yysrc
)
704 yystpcpy (yydest
, yysrc
)
709 register char *yyd
= yydest
;
710 register const char *yys
= yysrc
;
712 while ((*yyd
++ = *yys
++) != '\0')
720 #endif /* !YYERROR_VERBOSE */
725 /*-----------------------------.
726 | Print this symbol on YYOUT. |
727 `-----------------------------*/
730 #if defined (__STDC__) || defined (__cplusplus)
731 yysymprint (FILE* yyout
, int yytype
, YYSTYPE yyvalue
)
733 yysymprint (yyout
, yytype
, yyvalue
)
739 /* Pacify ``unused variable'' warnings. */
742 if (yytype
< YYNTOKENS
)
744 YYFPRINTF (yyout
, "token %s (", yytname
[yytype
]);
746 YYPRINT (yyout
, yytoknum
[yytype
], yyvalue
);
750 YYFPRINTF (yyout
, "nterm %s (", yytname
[yytype
]);
757 YYFPRINTF (yyout
, ")");
759 #endif /* YYDEBUG. */
762 /*-----------------------------------------------.
763 | Release the memory associated to this symbol. |
764 `-----------------------------------------------*/
767 #if defined (__STDC__) || defined (__cplusplus)
768 yydestruct (int yytype
, YYSTYPE yyvalue
)
770 yydestruct (yytype
, yyvalue
)
775 /* Pacify ``unused variable'' warnings. */
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. */
794 # if defined (__STDC__) || defined (__cplusplus)
795 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
796 # define YYPARSE_PARAM_DECL
798 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
799 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
801 #else /* !YYPARSE_PARAM */
802 # define YYPARSE_PARAM_ARG
803 # define YYPARSE_PARAM_DECL
804 #endif /* !YYPARSE_PARAM */
806 /* Prevent warning if -Wstrict-prototypes. */
808 # ifdef YYPARSE_PARAM
809 int yyparse (void *);
816 /* The lookahead symbol. */
819 /* The semantic value of the lookahead symbol. */
822 /* Number of parse errors so far. */
827 yyparse (YYPARSE_PARAM_ARG
)
831 register int yystate
;
834 /* Number of tokens to shift before error messages enabled. */
836 /* Lookahead token as an internal (translated) token number. */
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
];
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
868 /* When reducing, the number of symbols on the RHS of the reduced
872 YYDPRINTF ((stderr
, "Starting parse\n"));
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. */
889 /*------------------------------------------------------------.
890 | yynewstate -- Push a new state, which is found in yystate. |
891 `------------------------------------------------------------*/
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.
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;
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
911 YYSTYPE
*yyvs1
= yyvs
;
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
),
928 #else /* no yyoverflow */
929 # ifndef YYSTACK_RELOCATE
932 /* Extend the stack our own way. */
933 if (yystacksize
>= YYMAXDEPTH
)
936 if (yystacksize
> YYMAXDEPTH
)
937 yystacksize
= YYMAXDEPTH
;
941 union yyalloc
*yyptr
=
942 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
945 YYSTACK_RELOCATE (yyss
);
946 YYSTACK_RELOCATE (yyvs
);
948 # undef YYSTACK_RELOCATE
950 YYSTACK_FREE (yyss1
);
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)
966 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
975 /* Do appropriate processing given the current state. */
976 /* Read a lookahead token if we need one and don't already have one. */
979 /* First try to decide what to do without reference to lookahead token. */
981 yyn
= yypact
[yystate
];
982 if (yyn
== YYPACT_NINF
)
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: "));
996 /* Convert token to internal form (in yychar1) for indexing tables with. */
998 if (yychar
<= 0) /* This means end of input. */
1001 yychar
= YYEOF
; /* Don't call YYLEX any more. */
1003 YYDPRINTF ((stderr
, "Now at end of input.\n"));
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. */
1019 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
1024 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
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
)
1044 /* Count tokens shifted since error; after three, turn off error
1053 /*-----------------------------------------------------------.
1054 | yydefault -- do the default action for the current state. |
1055 `-----------------------------------------------------------*/
1057 yyn
= yydefact
[yystate
];
1063 /*-----------------------------.
1064 | yyreduce -- Do a reduction. |
1065 `-----------------------------*/
1067 /* yyn is the number of a rule to reduce with. */
1070 /* If YYLEN is nonzero, implement the default value of the action:
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
];
1083 /* We have to keep this `#if YYDEBUG', since we use variables which
1084 are defined only if `YYDEBUG' is set. */
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
]]);
1101 #line 118 "winprefsyacc.y"
1102 { SetTrayIcon(yyvsp
[-1].sVal
); free(yyvsp
[-1].sVal
); }
1106 #line 121 "winprefsyacc.y"
1107 { SetRootMenu(yyvsp
[-1].sVal
); free(yyvsp
[-1].sVal
); }
1111 #line 124 "winprefsyacc.y"
1112 { SetDefaultSysMenu(yyvsp
[-2].sVal
, yyvsp
[-1].iVal
); free(yyvsp
[-2].sVal
); }
1116 #line 127 "winprefsyacc.y"
1117 { SetDefaultIcon(yyvsp
[-1].sVal
); free(yyvsp
[-1].sVal
); }
1121 #line 130 "winprefsyacc.y"
1122 { SetIconDirectory(yyvsp
[-1].sVal
); free(yyvsp
[-1].sVal
); }
1126 #line 133 "winprefsyacc.y"
1127 { AddMenuLine("-", CMD_SEPARATOR
, ""); }
1131 #line 134 "winprefsyacc.y"
1132 { AddMenuLine(yyvsp
[-3].sVal
, CMD_ALWAYSONTOP
, ""); free(yyvsp
[-3].sVal
); }
1136 #line 135 "winprefsyacc.y"
1137 { AddMenuLine(yyvsp
[-4].sVal
, CMD_EXEC
, yyvsp
[-2].sVal
); free(yyvsp
[-4].sVal
); free(yyvsp
[-2].sVal
); }
1141 #line 136 "winprefsyacc.y"
1142 { AddMenuLine(yyvsp
[-4].sVal
, CMD_MENU
, yyvsp
[-2].sVal
); free(yyvsp
[-4].sVal
); free(yyvsp
[-2].sVal
); }
1146 #line 137 "winprefsyacc.y"
1147 { AddMenuLine(yyvsp
[-3].sVal
, CMD_RELOAD
, ""); free(yyvsp
[-3].sVal
); }
1151 #line 144 "winprefsyacc.y"
1152 { OpenMenu(yyvsp
[-1].sVal
); free(yyvsp
[-1].sVal
); }
1156 #line 144 "winprefsyacc.y"
1161 #line 147 "winprefsyacc.y"
1162 { AddIconLine(yyvsp
[-3].sVal
, yyvsp
[-2].sVal
); free(yyvsp
[-3].sVal
); free(yyvsp
[-2].sVal
); }
1166 #line 154 "winprefsyacc.y"
1171 #line 154 "winprefsyacc.y"
1176 #line 157 "winprefsyacc.y"
1177 { yyval
.iVal
=AT_END
; }
1181 #line 158 "winprefsyacc.y"
1182 { yyval
.iVal
=AT_START
; }
1186 #line 159 "winprefsyacc.y"
1187 { yyval
.iVal
=AT_END
; }
1191 #line 162 "winprefsyacc.y"
1192 { AddSysMenuLine(yyvsp
[-4].sVal
, yyvsp
[-3].sVal
, yyvsp
[-2].iVal
); free(yyvsp
[-4].sVal
); free(yyvsp
[-3].sVal
); }
1196 #line 169 "winprefsyacc.y"
1201 #line 169 "winprefsyacc.y"
1206 #line 172 "winprefsyacc.y"
1207 { pref
.fSilentExit
= TRUE
; }
1211 #line 175 "winprefsyacc.y"
1212 { ErrorF("LoadPreferences: %s\n", yyvsp
[-1].sVal
); free(yyvsp
[-1].sVal
); }
1218 /* Line 1016 of /usr/local/share/bison/yacc.c. */
1219 #line 1220 "winprefsyacc.c"
1228 short *yyssp1
= yyss
- 1;
1229 YYFPRINTF (stderr
, "state stack now");
1230 while (yyssp1
!= yyssp
)
1231 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1232 YYFPRINTF (stderr
, "\n");
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. */
1245 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1246 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1247 yystate
= yytable
[yystate
];
1249 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1254 /*------------------------------------.
1255 | yyerrlab -- here on detecting error |
1256 `------------------------------------*/
1258 /* If not already recovering from an error, report this error. */
1263 yyn
= yypact
[yystate
];
1265 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1267 YYSIZE_T yysize
= 0;
1268 int yytype
= YYTRANSLATE (yychar
);
1273 /* Start YYX at -YYN if negative to avoid negative indexes in
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
);
1284 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1285 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1290 for (yyx
= yyn
< 0 ? -yyn
: 0;
1291 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
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
]);
1302 YYSTACK_FREE (yymsg
);
1305 yyerror ("parse error; also virtual memory exhausted");
1308 #endif /* YYERROR_VERBOSE */
1309 yyerror ("parse error");
1314 /*----------------------------------------------------.
1315 | yyerrlab1 -- error raised explicitly by an action. |
1316 `----------------------------------------------------*/
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. */
1328 /* Pop the rest of the stack. */
1329 while (yyssp
> yyss
)
1331 YYDPRINTF ((stderr
, "Error: popping "));
1332 YYDSYMPRINT ((stderr
,
1335 YYDPRINTF ((stderr
, "\n"));
1336 yydestruct (yystos
[*yyssp
], *yyvsp
);
1342 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1343 yychar
, yytname
[yychar1
]));
1344 yydestruct (yychar1
, yylval
);
1348 /* Else will try to reuse lookahead token after shifting the error
1351 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1355 yyn
= yypact
[yystate
];
1356 if (yyn
!= YYPACT_NINF
)
1359 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1367 /* Pop the current state because it cannot handle the error token. */
1371 YYDPRINTF ((stderr
, "Error: popping "));
1372 YYDSYMPRINT ((stderr
,
1373 yystos
[*yyssp
], *yyvsp
));
1374 YYDPRINTF ((stderr
, "\n"));
1376 yydestruct (yystos
[yystate
], *yyvsp
);
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");
1396 YYDPRINTF ((stderr
, "Shifting error token, "));
1405 /*-------------------------------------.
1406 | yyacceptlab -- YYACCEPT comes here. |
1407 `-------------------------------------*/
1412 /*-----------------------------------.
1413 | yyabortlab -- YYABORT comes here. |
1414 `-----------------------------------*/
1420 /*----------------------------------------------.
1421 | yyoverflowlab -- parser overflow comes here. |
1422 `----------------------------------------------*/
1424 yyerror ("parser stack overflow");
1432 YYSTACK_FREE (yyss
);
1438 #line 179 "winprefsyacc.y"
1441 * Errors in parsing abort and print log messages
1446 extern int yylineno
; /* Handled by flex internally */
1448 ErrorF("LoadPreferences: %s line %d\n", s
, yylineno
);
1452 /* Miscellaneous functions to store TOKENs into the structure */
1454 SetIconDirectory (char *path
)
1456 strncpy (pref
.iconDirectory
, path
, PATH_MAX
);
1457 pref
.iconDirectory
[PATH_MAX
] = 0;
1461 SetDefaultIcon (char *fname
)
1463 strncpy (pref
.defaultIconName
, fname
, NAME_MAX
);
1464 pref
.defaultIconName
[NAME_MAX
] = 0;
1468 SetTrayIcon (char *fname
)
1470 strncpy (pref
.trayIconName
, fname
, NAME_MAX
);
1471 pref
.trayIconName
[NAME_MAX
] = 0;
1475 SetRootMenu (char *menu
)
1477 strncpy (pref
.rootMenuName
, menu
, MENU_MAX
);
1478 pref
.rootMenuName
[MENU_MAX
] = 0;
1482 SetDefaultSysMenu (char *menu
, int pos
)
1484 strncpy (pref
.defaultSysMenuName
, menu
, MENU_MAX
);
1485 pref
.defaultSysMenuName
[MENU_MAX
] = 0;
1486 pref
.defaultSysMenuPos
= pos
;
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;
1500 AddMenuLine (char *text
, MENUCOMMANDTYPE cmd
, char *param
)
1502 if (menu
.menuItem
==NULL
)
1503 menu
.menuItem
= (MENUITEM
*)malloc(sizeof(MENUITEM
));
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;
1524 if (menu
.menuItem
==NULL
|| menu
.menuItems
==0)
1526 ErrorF("LoadPreferences: Empty menu detected\n");
1531 pref
.menu
= (MENUPARSED
*)
1532 realloc (pref
.menu
, (pref
.menuItems
+1)*sizeof(MENUPARSED
));
1534 pref
.menu
= (MENUPARSED
*)malloc (sizeof(MENUPARSED
));
1536 memcpy (pref
.menu
+pref
.menuItems
, &menu
, sizeof(MENUPARSED
));
1539 memset (&menu
, 0, sizeof(MENUPARSED
));
1545 if (pref
.icon
!= NULL
) {
1546 ErrorF("LoadPreferences: Redefining icon mappings\n");
1554 AddIconLine (char *matchstr
, char *iconfile
)
1556 if (pref
.icon
==NULL
)
1557 pref
.icon
= (ICONITEM
*)malloc(sizeof(ICONITEM
));
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;
1581 if (pref
.sysMenu
!= NULL
) {
1582 ErrorF("LoadPreferences: Redefining system menu\n");
1584 pref
.sysMenu
= NULL
;
1586 pref
.sysMenuItems
= 0;
1590 AddSysMenuLine (char *matchstr
, char *menuname
, int pos
)
1592 if (pref
.sysMenu
==NULL
)
1593 pref
.sysMenu
= (SYSMENUITEM
*)malloc(sizeof(SYSMENUITEM
));
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
++;