#define YYBISON 1
#define YYBISON_VERSION "2.3"
#define YYSKELETON_NAME "yacc.c"
#define YYPURE 0
#define YYLSP_NEEDED 0
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype {
NEWLINE = 258,
MENU = 259,
LB = 260,
RB = 261,
ICONDIRECTORY = 262,
DEFAULTICON = 263,
ICONS = 264,
DEFAULTSYSMENU = 265,
SYSMENU = 266,
ROOTMENU = 267,
SEPARATOR = 268,
ATSTART = 269,
ATEND = 270,
EXEC = 271,
ALWAYSONTOP = 272,
DEBUG = 273,
RELOAD = 274,
TRAYICON = 275,
SILENTEXIT = 276,
STRING = 277
};
#endif
#define NEWLINE 258
#define MENU 259
#define LB 260
#define RB 261
#define ICONDIRECTORY 262
#define DEFAULTICON 263
#define ICONS 264
#define DEFAULTSYSMENU 265
#define SYSMENU 266
#define ROOTMENU 267
#define SEPARATOR 268
#define ATSTART 269
#define ATEND 270
#define EXEC 271
#define ALWAYSONTOP 272
#define DEBUG 273
#define RELOAD 274
#define TRAYICON 275
#define SILENTEXIT 276
#define STRING 277
#line 1 "winprefsyacc.y"
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "winprefs.h"
#define YYERROR_VERBOSE 1
WINPREFS pref;
static MENUPARSED menu;
static void SetIconDirectory (char *path);
static void SetDefaultIcon (char *fname);
static void SetRootMenu (char *menu);
static void SetDefaultSysMenu (char *menu, int pos);
static void SetTrayIcon (char *fname);
static void OpenMenu(char *menuname);
static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
static void CloseMenu(void);
static void OpenIcons(void);
static void AddIconLine(char *matchstr, char *iconfile);
static void CloseIcons(void);
static void OpenSysMenu(void);
static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
static void CloseSysMenu(void);
static int yyerror (char *s);
extern void ErrorF (const char* , ...);
extern char *yytext;
extern int yylex(void);
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 79 "winprefsyacc.y"
{
char *sVal;
int iVal;
}
#line 223 "winprefsyacc.c"
YYSTYPE;
# define yystype YYSTYPE
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
#line 236 "winprefsyacc.c"
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stddef.h>
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h>
# define YY_(msgid) dgettext ("bison-runtime", msgid)
# endif
# endif
# ifndef YY_
# define YY_(msgid) msgid
# endif
#endif
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e)
#endif
#ifndef lint
# define YYID(n) (n)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
YYID (int i)
#else
static int
YYID (i)
int i;
#endif
{
return i;
}
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h>
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h>
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
# define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM 4032
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h>
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T);
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *);
# endif
# endif
# endif
#endif
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
union yyalloc
{
yytype_int16 yyss;
YYSTYPE yyvs;
};
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
# endif
# endif
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (YYID (0))
#endif
#define YYFINAL 2
#define YYLAST 68
#define YYNTOKENS 23
#define YYNNTS 25
#define YYNRULES 46
#define YYNSTATES 94
#define YYUNDEFTOK 2
#define YYMAXUTOK 277
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22
};
#if YYDEBUG
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 4, 7, 9, 11, 12, 15, 17,
19, 21, 23, 25, 27, 29, 31, 33, 35, 39,
43, 48, 52, 56, 60, 65, 71, 77, 82, 84,
87, 88, 96, 101, 103, 106, 107, 114, 115, 117,
119, 125, 127, 130, 131, 139, 142
};
static const yytype_int8 yyrhs[] =
{
24, 0, -1, -1, 24, 25, -1, 3, -1, 27,
-1, -1, 3, 26, -1, 31, -1, 32, -1, 35,
-1, 39, -1, 44, -1, 29, -1, 30, -1, 47,
-1, 28, -1, 46, -1, 20, 22, 3, -1, 12,
22, 3, -1, 10, 22, 41, 3, -1, 8, 22,
3, -1, 7, 22, 3, -1, 13, 3, 26, -1,
22, 17, 3, 26, -1, 22, 16, 22, 3, 26,
-1, 22, 4, 22, 3, 26, -1, 22, 19, 3,
26, -1, 33, -1, 33, 34, -1, -1, 4, 22,
5, 36, 26, 34, 6, -1, 22, 22, 3, 26,
-1, 37, -1, 37, 38, -1, -1, 9, 5, 40,
26, 38, 6, -1, -1, 14, -1, 15, -1, 22,
22, 41, 3, 26, -1, 42, -1, 42, 43, -1,
-1, 11, 5, 3, 45, 26, 43, 6, -1, 21,
3, -1, 18, 22, 3, -1
};
static const yytype_uint8 yyrline[] =
{
0, 93, 93, 94, 97, 98, 102, 103, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 118, 121,
124, 127, 130, 133, 134, 135, 136, 137, 140, 141,
144, 144, 147, 150, 151, 154, 154, 157, 158, 159,
162, 165, 166, 169, 169, 172, 175
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
static const char *const yytname[] =
{
"$end", "error", "$undefined", "NEWLINE", "MENU", "LB", "RB",
"ICONDIRECTORY", "DEFAULTICON", "ICONS", "DEFAULTSYSMENU", "SYSMENU",
"ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", "ALWAYSONTOP",
"DEBUG", "RELOAD", "TRAYICON", "SILENTEXIT", "STRING", "$accept",
"input", "line", "newline_or_nada", "command", "trayicon", "rootmenu",
"defaultsysmenu", "defaulticon", "icondirectory", "menuline", "menulist",
"menu", "@1", "iconline", "iconlist", "icons", "@2", "atspot",
"sysmenuline", "sysmenulist", "sysmenu", "@3", "silentexit", "debug", 0
};
#endif
# ifdef YYPRINT
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277
};
# endif
static const yytype_uint8 yyr1[] =
{
0, 23, 24, 24, 25, 25, 26, 26, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 28, 29,
30, 31, 32, 33, 33, 33, 33, 33, 34, 34,
36, 35, 37, 38, 38, 40, 39, 41, 41, 41,
42, 43, 43, 45, 44, 46, 47
};
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 1, 1, 0, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
4, 3, 3, 3, 4, 5, 5, 4, 1, 2,
0, 7, 4, 1, 2, 0, 6, 0, 1, 1,
5, 1, 2, 0, 7, 2, 3
};
static const yytype_uint8 yydefact[] =
{
2, 0, 1, 4, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 5, 16, 13, 14, 8,
9, 10, 11, 12, 17, 15, 0, 0, 0, 35,
37, 0, 0, 0, 0, 45, 30, 22, 21, 6,
38, 39, 0, 43, 19, 46, 18, 6, 6, 0,
20, 6, 0, 7, 0, 33, 0, 0, 0, 0,
28, 0, 0, 34, 36, 0, 41, 0, 6, 0,
0, 0, 0, 29, 31, 6, 37, 42, 44, 23,
0, 0, 6, 6, 32, 0, 6, 6, 24, 27,
6, 26, 25, 40
};
static const yytype_int8 yydefgoto[] =
{
-1, 1, 14, 49, 15, 16, 17, 18, 19, 20,
60, 61, 21, 47, 55, 56, 22, 39, 42, 66,
67, 23, 51, 24, 25
};
#define YYPACT_NINF -48
static const yytype_int8 yypact[] =
{
-48, 2, -48, -48, -15, -3, 4, 22, 7, 25,
9, 11, 12, 29, -48, -48, -48, -48, -48, -48,
-48, -48, -48, -48, -48, -48, 32, 35, 38, -48,
10, 39, 41, 42, 43, -48, -48, -48, -48, 44,
-48, -48, 45, -48, -48, -48, -48, 44, 44, 27,
-48, 44, -5, -48, 28, 27, 46, 31, 48, -1,
-5, 49, 51, -48, -48, 34, 31, 52, 44, 37,
40, 54, 57, -48, -48, 44, 10, -48, -48, -48,
58, 60, 44, 44, -48, 61, 44, 44, -48, -48,
44, -48, -48, -48
};
static const yytype_int8 yypgoto[] =
{
-48, -48, -48, -47, -48, -48, -48, -48, -48, -48,
-48, 5, -48, -48, -48, 13, -48, -48, -10, -48,
1, -48, -48, -48, -48
};
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
52, 53, 2, 69, 57, 3, 4, 26, 58, 5,
6, 7, 8, 9, 10, 70, 71, 59, 72, 27,
11, 79, 12, 13, 40, 41, 28, 29, 84, 30,
31, 32, 35, 33, 34, 88, 89, 36, 37, 91,
92, 38, 43, 93, 44, 45, 46, 48, 50, 54,
62, 68, 64, 65, 75, 74, 76, 82, 78, 80,
83, 86, 81, 87, 90, 73, 85, 77, 63
};
static const yytype_uint8 yycheck[] =
{
47, 48, 0, 4, 51, 3, 4, 22, 13, 7,
8, 9, 10, 11, 12, 16, 17, 22, 19, 22,
18, 68, 20, 21, 14, 15, 22, 5, 75, 22,
5, 22, 3, 22, 22, 82, 83, 5, 3, 86,
87, 3, 3, 90, 3, 3, 3, 3, 3, 22,
22, 3, 6, 22, 3, 6, 22, 3, 6, 22,
3, 3, 22, 3, 3, 60, 76, 66, 55
};
static const yytype_uint8 yystos[] =
{
0, 24, 0, 3, 4, 7, 8, 9, 10, 11,
12, 18, 20, 21, 25, 27, 28, 29, 30, 31,
32, 35, 39, 44, 46, 47, 22, 22, 22, 5,
22, 5, 22, 22, 22, 3, 5, 3, 3, 40,
14, 15, 41, 3, 3, 3, 3, 36, 3, 26,
3, 45, 26, 26, 22, 37, 38, 26, 13, 22,
33, 34, 22, 38, 6, 22, 42, 43, 3, 4,
16, 17, 19, 34, 6, 3, 22, 43, 6, 26,
22, 22, 3, 3, 26, 41, 3, 3, 26, 26,
3, 26, 26, 26
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
#define YYTERROR 1
#define YYERRCODE 256
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#endif
#ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
(Loc).last_line, (Loc).last_column)
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif
#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h>
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (YYID (0))
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (YYID (0))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#endif
{
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
YYUSE (yyoutput);
# endif
switch (yytype)
{
default:
break;
}
}
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
#endif
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
}
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
#else
static void
yy_stack_print (bottom, top)
yytype_int16 *bottom;
yytype_int16 *top;
#endif
{
YYFPRINTF (stderr, "Stack now");
for (; bottom <= top; ++bottom)
YYFPRINTF (stderr, " %d", *bottom);
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (YYID (0))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yyrule)
YYSTYPE *yyvsp;
int yyrule;
#endif
{
int yynrhs = yyr2[yyrule];
int yyi;
unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
for (yyi = 0; yyi < yynrhs; yyi++)
{
fprintf (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
fprintf (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyvsp, Rule); \
} while (YYID (0))
int yydebug;
#else
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
const char *yystr;
#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
#endif
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
static YYSIZE_T
yysyntax_error (char *yyresult, int yystate, int yychar)
{
int yyn = yypact[yystate];
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
return 0;
else
{
int yytype = YYTRANSLATE (yychar);
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
int yysize_overflow = 0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yyx;
# if 0
YY_("syntax error, unexpected %s");
YY_("syntax error, unexpected %s, expecting %s");
YY_("syntax error, unexpected %s, expecting %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
# endif
char *yyfmt;
char const *yyf;
static char const yyunexpected[] = "syntax error, unexpected %s";
static char const yyexpecting[] = ", expecting %s";
static char const yyor[] = " or %s";
char yyformat[sizeof yyunexpected
+ sizeof yyexpecting - 1
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof yyor - 1))];
char const *yyprefix = yyexpecting;
int yyxbegin = yyn < 0 ? -yyn : 0;
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
yyarg[0] = yytname[yytype];
yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0';
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor;
}
yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
if (yysize_overflow)
return YYSIZE_MAXIMUM;
if (yyresult)
{
char *yyp = yyresult;
int yyi = 0;
while ((*yyp = *yyf) != '\0')
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
}
else
{
yyp++;
yyf++;
}
}
}
return yysize;
}
}
#endif
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yymsg, yytype, yyvaluep)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
#endif
{
YYUSE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype)
{
default:
break;
}
}
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif
int yychar;
YYSTYPE yylval;
int yynerrs;
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
void *YYPARSE_PARAM;
#endif
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
#else
int
yyparse ()
#endif
#endif
{
int yystate;
int yyn;
int yyresult;
int yyerrstatus;
int yytoken = 0;
#if YYERROR_VERBOSE
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss = yyssa;
yytype_int16 *yyssp;
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
YYSTYPE *yyvsp;
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
YYSIZE_T yystacksize = YYINITDEPTH;
YYSTYPE yyval;
int yylen = 0;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY;
yyssp = yyss;
yyvsp = yyvs;
goto yysetstate;
yynewstate:
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
#else
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
goto yybackup;
yybackup:
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
if (yyn == YYFINAL)
YYACCEPT;
if (yyerrstatus)
yyerrstatus--;
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
if (yychar != YYEOF)
yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
goto yynewstate;
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
yyreduce:
yylen = yyr2[yyn];
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 18:
#line 118 "winprefsyacc.y"
{ SetTrayIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
break;
case 19:
#line 121 "winprefsyacc.y"
{ SetRootMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
break;
case 20:
#line 124 "winprefsyacc.y"
{ SetDefaultSysMenu((yyvsp[(2) - (4)].sVal), (yyvsp[(3) - (4)].iVal)); free((yyvsp[(2) - (4)].sVal)); }
break;
case 21:
#line 127 "winprefsyacc.y"
{ SetDefaultIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
break;
case 22:
#line 130 "winprefsyacc.y"
{ SetIconDirectory((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
break;
case 23:
#line 133 "winprefsyacc.y"
{ AddMenuLine("-", CMD_SEPARATOR, ""); }
break;
case 24:
#line 134 "winprefsyacc.y"
{ AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_ALWAYSONTOP, ""); free((yyvsp[(1) - (4)].sVal)); }
break;
case 25:
#line 135 "winprefsyacc.y"
{ AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_EXEC, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); }
break;
case 26:
#line 136 "winprefsyacc.y"
{ AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_MENU, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); }
break;
case 27:
#line 137 "winprefsyacc.y"
{ AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_RELOAD, ""); free((yyvsp[(1) - (4)].sVal)); }
break;
case 30:
#line 144 "winprefsyacc.y"
{ OpenMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
break;
case 31:
#line 144 "winprefsyacc.y"
{CloseMenu();}
break;
case 32:
#line 147 "winprefsyacc.y"
{ AddIconLine((yyvsp[(1) - (4)].sVal), (yyvsp[(2) - (4)].sVal)); free((yyvsp[(1) - (4)].sVal)); free((yyvsp[(2) - (4)].sVal)); }
break;
case 35:
#line 154 "winprefsyacc.y"
{OpenIcons();}
break;
case 36:
#line 154 "winprefsyacc.y"
{CloseIcons();}
break;
case 37:
#line 157 "winprefsyacc.y"
{ (yyval.iVal)=AT_END; }
break;
case 38:
#line 158 "winprefsyacc.y"
{ (yyval.iVal)=AT_START; }
break;
case 39:
#line 159 "winprefsyacc.y"
{ (yyval.iVal)=AT_END; }
break;
case 40:
#line 162 "winprefsyacc.y"
{ AddSysMenuLine((yyvsp[(1) - (5)].sVal), (yyvsp[(2) - (5)].sVal), (yyvsp[(3) - (5)].iVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(2) - (5)].sVal)); }
break;
case 43:
#line 169 "winprefsyacc.y"
{OpenSysMenu();}
break;
case 44:
#line 169 "winprefsyacc.y"
{CloseSysMenu();}
break;
case 45:
#line 172 "winprefsyacc.y"
{ pref.fSilentExit = TRUE; }
break;
case 46:
#line 175 "winprefsyacc.y"
{ ErrorF("LoadPreferences: %s\n", (yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
break;
#line 1613 "winprefsyacc.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
yyerrlab:
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
{
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
{
YYSIZE_T yyalloc = 2 * yysize;
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
yyalloc = YYSTACK_ALLOC_MAXIMUM;
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
if (yymsg)
yymsg_alloc = yyalloc;
else
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
}
}
if (0 < yysize && yysize <= yymsg_alloc)
{
(void) yysyntax_error (yymsg, yystate, yychar);
yyerror (yymsg);
}
else
{
yyerror (YY_("syntax error"));
if (yysize != 0)
goto yyexhaustedlab;
}
}
#endif
}
if (yyerrstatus == 3)
{
if (yychar <= YYEOF)
{
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}
}
goto yyerrlab1;
yyerrorlab:
if ( 0)
goto yyerrorlab;
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
yyerrlab1:
yyerrstatus = 3;
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
if (yyn == YYFINAL)
YYACCEPT;
*++yyvsp = yylval;
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
yyacceptlab:
yyresult = 0;
goto yyreturn;
yyabortlab:
yyresult = 1;
goto yyreturn;
#ifndef yyoverflow
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
#endif
yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
return YYID (yyresult);
}
#line 179 "winprefsyacc.y"
static int
yyerror (char *s)
{
extern int yylineno;
ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
return 1;
}
static void
SetIconDirectory (char *path)
{
strncpy (pref.iconDirectory, path, PATH_MAX);
pref.iconDirectory[PATH_MAX] = 0;
}
static void
SetDefaultIcon (char *fname)
{
strncpy (pref.defaultIconName, fname, NAME_MAX);
pref.defaultIconName[NAME_MAX] = 0;
}
static void
SetTrayIcon (char *fname)
{
strncpy (pref.trayIconName, fname, NAME_MAX);
pref.trayIconName[NAME_MAX] = 0;
}
static void
SetRootMenu (char *menu)
{
strncpy (pref.rootMenuName, menu, MENU_MAX);
pref.rootMenuName[MENU_MAX] = 0;
}
static void
SetDefaultSysMenu (char *menu, int pos)
{
strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
pref.defaultSysMenuName[MENU_MAX] = 0;
pref.defaultSysMenuPos = pos;
}
static void
OpenMenu (char *menuname)
{
if (menu.menuItem) free(menu.menuItem);
menu.menuItem = NULL;
strncpy(menu.menuName, menuname, MENU_MAX);
menu.menuName[MENU_MAX] = 0;
menu.menuItems = 0;
}
static void
AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
{
if (menu.menuItem==NULL)
menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
else
menu.menuItem = (MENUITEM*)
realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
menu.menuItem[menu.menuItems].cmd = cmd;
strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
menu.menuItem[menu.menuItems].commandID = 0;
menu.menuItems++;
}
static void
CloseMenu (void)
{
if (menu.menuItem==NULL || menu.menuItems==0)
{
ErrorF("LoadPreferences: Empty menu detected\n");
return;
}
if (pref.menuItems)
pref.menu = (MENUPARSED*)
realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
else
pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
pref.menuItems++;
memset (&menu, 0, sizeof(MENUPARSED));
}
static void
OpenIcons (void)
{
if (pref.icon != NULL) {
ErrorF("LoadPreferences: Redefining icon mappings\n");
free(pref.icon);
pref.icon = NULL;
}
pref.iconItems = 0;
}
static void
AddIconLine (char *matchstr, char *iconfile)
{
if (pref.icon==NULL)
pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
else
pref.icon = (ICONITEM*)
realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
pref.icon[pref.iconItems].match[MENU_MAX] = 0;
strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
pref.icon[pref.iconItems].hicon = 0;
pref.iconItems++;
}
static void
CloseIcons (void)
{
}
static void
OpenSysMenu (void)
{
if (pref.sysMenu != NULL) {
ErrorF("LoadPreferences: Redefining system menu\n");
free(pref.sysMenu);
pref.sysMenu = NULL;
}
pref.sysMenuItems = 0;
}
static void
AddSysMenuLine (char *matchstr, char *menuname, int pos)
{
if (pref.sysMenu==NULL)
pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
else
pref.sysMenu = (SYSMENUITEM*)
realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
pref.sysMenu[pref.sysMenuItems].menuPos = pos;
pref.sysMenuItems++;
}
static void
CloseSysMenu (void)
{
}