1 /* A Bison parser, made by GNU Bison 2.3. */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46 /* Identify Bison output. */
47 #define YYBISON 1
48
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers. */
56 #define YYPURE 0
57
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
60
61
62
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 ALT_TOK = 258,
70 APP_TOK = 259,
71 BACK_TOK = 260,
72 BORDER_TOK = 261,
73 BTN1_CLICK2_TOK = 262,
74 BTN1_CLICK_TOK = 263,
75 BTN1_DOWN_TOK = 264,
76 BTN1_UP_TOK = 265,
77 BTN2_CLICK2_TOK = 266,
78 BTN2_CLICK_TOK = 267,
79 BTN2_DOWN_TOK = 268,
80 BTN2_UP_TOK = 269,
81 BTN3_CLICK2_TOK = 270,
82 BTN3_CLICK_TOK = 271,
83 BTN3_DOWN_TOK = 272,
84 BTN3_UP_TOK = 273,
85 BTN4_CLICK2_TOK = 274,
86 BTN4_CLICK_TOK = 275,
87 BTN4_DOWN_TOK = 276,
88 BTN4_UP_TOK = 277,
89 BTN5_CLICK2_TOK = 278,
90 BTN5_CLICK_TOK = 279,
91 BTN5_DOWN_TOK = 280,
92 BTN5_UP_TOK = 281,
93 BUTTONS_TOK = 282,
94 CTRL_TOK = 283,
95 FBEEP_TOK = 284,
96 FCIRCLE_DOWN_TOK = 285,
97 FCIRCLE_UP_TOK = 286,
98 FEXEC_TOK = 287,
99 FFOCUS_COLOR_TOK = 288,
100 FFOCUS_KEY_TOK = 289,
101 FKILL_TOK = 290,
102 FLOWER_TOK = 291,
103 FMAXIMIZE_TOK = 292,
104 FMENU_TOK = 293,
105 FMINIMIZE_TOK = 294,
106 FMOVE_TOK = 295,
107 FNEXT_CMAP_TOK = 296,
108 FNEXT_KEY_TOK = 297,
109 FNOP_TOK = 298,
110 FNORMALIZE_TOK = 299,
111 FNORMANDRAISE_TOK = 300,
112 FPACK_ICONS_TOK = 301,
113 FPASS_KEYS_TOK = 302,
114 FPOST_WMENU_TOK = 303,
115 FPREV_CMAP_TOK = 304,
116 FPREV_KEY_TOK = 305,
117 FQUIT_MWM_TOK = 306,
118 FRAISE_LOWER_TOK = 307,
119 FRAISE_TOK = 308,
120 FRAME_TOK = 309,
121 FREE_FAMILY_TOK = 310,
122 FREFRESH_TOK = 311,
123 FREFRESH_WIN_TOK = 312,
124 FRESIZE_TOK = 313,
125 FRESTART_TOK = 314,
126 FRESTOREANDRAISE_TOK = 315,
127 FRESTORE_TOK = 316,
128 FSCREEN_TOK = 317,
129 FSEND_MSG_TOK = 318,
130 FSEPARATOR_TOK = 319,
131 FSET_BEHAVIOR_TOK = 320,
132 FTITLE_TOK = 321,
133 FWINDOWLIST_TOK = 322,
134 FDESK_TOK = 323,
135 FTOGGLE_PAGE_TOK = 324,
136 FGOTO_PAGE_TOK = 325,
137 ICON_TOK = 326,
138 KEY_TOK = 327,
139 KEYS_TOK = 328,
140 LOCK_TOK = 329,
141 MENU_TOK = 330,
142 MENUB_TOK = 331,
143 MINIMIZEB_TOK = 332,
144 MAXIMIZEB_TOK = 333,
145 MOD1_TOK = 334,
146 MOD2_TOK = 335,
147 MOD3_TOK = 336,
148 MOD4_TOK = 337,
149 MOD5_TOK = 338,
150 NEXT_TOK = 339,
151 PREV_TOK = 340,
152 ROOT_TOK = 341,
153 SHIFT_TOK = 342,
154 TITLE_TOK = 343,
155 TRANSIENT_TOK = 344,
156 WINDOW_TOK = 345,
157 WITHIN_TOK = 346,
158 STRING_TOK = 347
159 };
160 #endif
161 /* Tokens. */
162 #define ALT_TOK 258
163 #define APP_TOK 259
164 #define BACK_TOK 260
165 #define BORDER_TOK 261
166 #define BTN1_CLICK2_TOK 262
167 #define BTN1_CLICK_TOK 263
168 #define BTN1_DOWN_TOK 264
169 #define BTN1_UP_TOK 265
170 #define BTN2_CLICK2_TOK 266
171 #define BTN2_CLICK_TOK 267
172 #define BTN2_DOWN_TOK 268
173 #define BTN2_UP_TOK 269
174 #define BTN3_CLICK2_TOK 270
175 #define BTN3_CLICK_TOK 271
176 #define BTN3_DOWN_TOK 272
177 #define BTN3_UP_TOK 273
178 #define BTN4_CLICK2_TOK 274
179 #define BTN4_CLICK_TOK 275
180 #define BTN4_DOWN_TOK 276
181 #define BTN4_UP_TOK 277
182 #define BTN5_CLICK2_TOK 278
183 #define BTN5_CLICK_TOK 279
184 #define BTN5_DOWN_TOK 280
185 #define BTN5_UP_TOK 281
186 #define BUTTONS_TOK 282
187 #define CTRL_TOK 283
188 #define FBEEP_TOK 284
189 #define FCIRCLE_DOWN_TOK 285
190 #define FCIRCLE_UP_TOK 286
191 #define FEXEC_TOK 287
192 #define FFOCUS_COLOR_TOK 288
193 #define FFOCUS_KEY_TOK 289
194 #define FKILL_TOK 290
195 #define FLOWER_TOK 291
196 #define FMAXIMIZE_TOK 292
197 #define FMENU_TOK 293
198 #define FMINIMIZE_TOK 294
199 #define FMOVE_TOK 295
200 #define FNEXT_CMAP_TOK 296
201 #define FNEXT_KEY_TOK 297
202 #define FNOP_TOK 298
203 #define FNORMALIZE_TOK 299
204 #define FNORMANDRAISE_TOK 300
205 #define FPACK_ICONS_TOK 301
206 #define FPASS_KEYS_TOK 302
207 #define FPOST_WMENU_TOK 303
208 #define FPREV_CMAP_TOK 304
209 #define FPREV_KEY_TOK 305
210 #define FQUIT_MWM_TOK 306
211 #define FRAISE_LOWER_TOK 307
212 #define FRAISE_TOK 308
213 #define FRAME_TOK 309
214 #define FREE_FAMILY_TOK 310
215 #define FREFRESH_TOK 311
216 #define FREFRESH_WIN_TOK 312
217 #define FRESIZE_TOK 313
218 #define FRESTART_TOK 314
219 #define FRESTOREANDRAISE_TOK 315
220 #define FRESTORE_TOK 316
221 #define FSCREEN_TOK 317
222 #define FSEND_MSG_TOK 318
223 #define FSEPARATOR_TOK 319
224 #define FSET_BEHAVIOR_TOK 320
225 #define FTITLE_TOK 321
226 #define FWINDOWLIST_TOK 322
227 #define FDESK_TOK 323
228 #define FTOGGLE_PAGE_TOK 324
229 #define FGOTO_PAGE_TOK 325
230 #define ICON_TOK 326
231 #define KEY_TOK 327
232 #define KEYS_TOK 328
233 #define LOCK_TOK 329
234 #define MENU_TOK 330
235 #define MENUB_TOK 331
236 #define MINIMIZEB_TOK 332
237 #define MAXIMIZEB_TOK 333
238 #define MOD1_TOK 334
239 #define MOD2_TOK 335
240 #define MOD3_TOK 336
241 #define MOD4_TOK 337
242 #define MOD5_TOK 338
243 #define NEXT_TOK 339
244 #define PREV_TOK 340
245 #define ROOT_TOK 341
246 #define SHIFT_TOK 342
247 #define TITLE_TOK 343
248 #define TRANSIENT_TOK 344
249 #define WINDOW_TOK 345
250 #define WITHIN_TOK 346
251 #define STRING_TOK 347
252
253
254
255
256 /* Copy the first part of user declarations. */
257 #line 1 "mwmparse.y"
258
259 /**
260 *
261 * $Id: mwmparse.y,v 1.1 2004/08/28 19:27:39 dannybackx Exp $
262 *
263 * Copyright (C) 1995 Free Software Foundation, Inc.
264 * Copyright (C) 1995-2002 LessTif Development Team
265 *
266 * This file is part of the GNU LessTif Library.
267 *
268 * This library is free software; you can redistribute it and/or
269 * modify it under the terms of the GNU Library General Public
270 * License as published by the Free Software Foundation; either
271 * version 2 of the License, or (at your option) any later version.
272 *
273 * This library is distributed in the hope that it will be useful,
274 * but WITHOUT ANY WARRANTY; without even the implied warranty of
275 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
276 * Library General Public License for more details.
277 *
278 * You should have received a copy of the GNU Library General Public
279 * License along with this library; if not, write to the Free
280 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
281 *
282 **/
283
284 #include "LTconfig.h"
285
286 #include <stdlib.h>
287 #include <stdarg.h>
288 #include <stdio.h>
289 #include <string.h>
290 #ifdef HAVE_FCNTL_H
291 #include <fcntl.h>
292 #endif
293 #ifdef HAVE_UNISTD_H
294 #include <unistd.h>
295 #endif
296 #ifdef HAVE_SYS_TYPES_H
297 #include <sys/types.h>
298 #endif
299 #ifdef HAVE_SYS_STAT_H
300 #include <sys/stat.h>
301 #else
302 #error "you lose (I don't know how to fix this)"
303 #endif
304 #include <X11/Xfuncs.h>
305
306 #include <Xm/Xm.h>
307 #include <Xm/MwmUtil.h>
308
309 #include "mwm.h"
310
311
312 extern int yydebug;
313 extern int yylex(void);
314
315 static int num_items;
316 static MenuRoot *cur_menu;
317 static ScreenInfo *pscr;
318 static Boolean skip_test;
319 static Boolean button_bind_match;
320 static Boolean button_bind_found;
321 static Boolean key_bind_match;
322 static Boolean key_bind_found;
323
324 /*
325 * this must be here for the parser
326 */
327 static int lineno;
328
329
330
331 /* Enabling traces. */
332 #ifndef YYDEBUG
333 # define YYDEBUG 0
334 #endif
335
336 /* Enabling verbose error messages. */
337 #ifdef YYERROR_VERBOSE
338 # undef YYERROR_VERBOSE
339 # define YYERROR_VERBOSE 1
340 #else
341 # define YYERROR_VERBOSE 0
342 #endif
343
344 /* Enabling the token table. */
345 #ifndef YYTOKEN_TABLE
346 # define YYTOKEN_TABLE 0
347 #endif
348
349 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
350 typedef union YYSTYPE
351 #line 228 "mwmparse.y"
352 {
353 char *string;
354 int number;
355 KeySym key;
356 struct {
357 int func;
358 char *arg;
359 } function;
360 struct {
361 int type;
362 char *string;
363 } label;
364 long modifiers;
365 struct {
366 int button;
367 int event;
368 int count;
369 int modifiers;
370 } button;
371 struct {
372 int modifiers;
373 KeySym key;
374 } hotkey;
375 }
376 /* Line 187 of yacc.c. */
377 #line 378 "mwmparse.c"
378 YYSTYPE;
379 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
380 # define YYSTYPE_IS_DECLARED 1
381 # define YYSTYPE_IS_TRIVIAL 1
382 #endif
383
384
385
386 /* Copy the second part of user declarations. */
387
388
389 /* Line 216 of yacc.c. */
390 #line 391 "mwmparse.c"
391
392 #ifdef short
393 # undef short
394 #endif
395
396 #ifdef YYTYPE_UINT8
397 typedef YYTYPE_UINT8 yytype_uint8;
398 #else
399 typedef unsigned char yytype_uint8;
400 #endif
401
402 #ifdef YYTYPE_INT8
403 typedef YYTYPE_INT8 yytype_int8;
404 #elif (defined __STDC__ || defined __C99__FUNC__ \
405 || defined __cplusplus || defined _MSC_VER)
406 typedef signed char yytype_int8;
407 #else
408 typedef short int yytype_int8;
409 #endif
410
411 #ifdef YYTYPE_UINT16
412 typedef YYTYPE_UINT16 yytype_uint16;
413 #else
414 typedef unsigned short int yytype_uint16;
415 #endif
416
417 #ifdef YYTYPE_INT16
418 typedef YYTYPE_INT16 yytype_int16;
419 #else
420 typedef short int yytype_int16;
421 #endif
422
423 #ifndef YYSIZE_T
424 # ifdef __SIZE_TYPE__
425 # define YYSIZE_T __SIZE_TYPE__
426 # elif defined size_t
427 # define YYSIZE_T size_t
428 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
429 || defined __cplusplus || defined _MSC_VER)
430 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
431 # define YYSIZE_T size_t
432 # else
433 # define YYSIZE_T unsigned int
434 # endif
435 #endif
436
437 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
438
439 #ifndef YY_
440 # if YYENABLE_NLS
441 # if ENABLE_NLS
442 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
443 # define YY_(msgid) dgettext ("bison-runtime", msgid)
444 # endif
445 # endif
446 # ifndef YY_
447 # define YY_(msgid) msgid
448 # endif
449 #endif
450
451 /* Suppress unused-variable warnings by "using" E. */
452 #if ! defined lint || defined __GNUC__
453 # define YYUSE(e) ((void) (e))
454 #else
455 # define YYUSE(e) /* empty */
456 #endif
457
458 /* Identity function, used to suppress warnings about constant conditions. */
459 #ifndef lint
460 # define YYID(n) (n)
461 #else
462 #if (defined __STDC__ || defined __C99__FUNC__ \
463 || defined __cplusplus || defined _MSC_VER)
464 static int
YYID(int i)465 YYID (int i)
466 #else
467 static int
468 YYID (i)
469 int i;
470 #endif
471 {
472 return i;
473 }
474 #endif
475
476 #if ! defined yyoverflow || YYERROR_VERBOSE
477
478 /* The parser invokes alloca or malloc; define the necessary symbols. */
479
480 # ifdef YYSTACK_USE_ALLOCA
481 # if YYSTACK_USE_ALLOCA
482 # ifdef __GNUC__
483 # define YYSTACK_ALLOC __builtin_alloca
484 # elif defined __BUILTIN_VA_ARG_INCR
485 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
486 # elif defined _AIX
487 # define YYSTACK_ALLOC __alloca
488 # elif defined _MSC_VER
489 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
490 # define alloca _alloca
491 # else
492 # define YYSTACK_ALLOC alloca
493 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
494 || defined __cplusplus || defined _MSC_VER)
495 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
496 # ifndef _STDLIB_H
497 # define _STDLIB_H 1
498 # endif
499 # endif
500 # endif
501 # endif
502 # endif
503
504 # ifdef YYSTACK_ALLOC
505 /* Pacify GCC's `empty if-body' warning. */
506 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
507 # ifndef YYSTACK_ALLOC_MAXIMUM
508 /* The OS might guarantee only one guard page at the bottom of the stack,
509 and a page size can be as small as 4096 bytes. So we cannot safely
510 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
511 to allow for a few compiler-allocated temporary stack slots. */
512 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
513 # endif
514 # else
515 # define YYSTACK_ALLOC YYMALLOC
516 # define YYSTACK_FREE YYFREE
517 # ifndef YYSTACK_ALLOC_MAXIMUM
518 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
519 # endif
520 # if (defined __cplusplus && ! defined _STDLIB_H \
521 && ! ((defined YYMALLOC || defined malloc) \
522 && (defined YYFREE || defined free)))
523 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
524 # ifndef _STDLIB_H
525 # define _STDLIB_H 1
526 # endif
527 # endif
528 # ifndef YYMALLOC
529 # define YYMALLOC malloc
530 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
531 || defined __cplusplus || defined _MSC_VER)
532 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
533 # endif
534 # endif
535 # ifndef YYFREE
536 # define YYFREE free
537 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
538 || defined __cplusplus || defined _MSC_VER)
539 void free (void *); /* INFRINGES ON USER NAME SPACE */
540 # endif
541 # endif
542 # endif
543 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
544
545
546 #if (! defined yyoverflow \
547 && (! defined __cplusplus \
548 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
549
550 /* A type that is properly aligned for any stack member. */
551 union yyalloc
552 {
553 yytype_int16 yyss;
554 YYSTYPE yyvs;
555 };
556
557 /* The size of the maximum gap between one aligned stack and the next. */
558 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
559
560 /* The size of an array large to enough to hold all stacks, each with
561 N elements. */
562 # define YYSTACK_BYTES(N) \
563 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
564 + YYSTACK_GAP_MAXIMUM)
565
566 /* Copy COUNT objects from FROM to TO. The source and destination do
567 not overlap. */
568 # ifndef YYCOPY
569 # if defined __GNUC__ && 1 < __GNUC__
570 # define YYCOPY(To, From, Count) \
571 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
572 # else
573 # define YYCOPY(To, From, Count) \
574 do \
575 { \
576 YYSIZE_T yyi; \
577 for (yyi = 0; yyi < (Count); yyi++) \
578 (To)[yyi] = (From)[yyi]; \
579 } \
580 while (YYID (0))
581 # endif
582 # endif
583
584 /* Relocate STACK from its old location to the new one. The
585 local variables YYSIZE and YYSTACKSIZE give the old and new number of
586 elements in the stack, and YYPTR gives the new location of the
587 stack. Advance YYPTR to a properly aligned location for the next
588 stack. */
589 # define YYSTACK_RELOCATE(Stack) \
590 do \
591 { \
592 YYSIZE_T yynewbytes; \
593 YYCOPY (&yyptr->Stack, Stack, yysize); \
594 Stack = &yyptr->Stack; \
595 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
596 yyptr += yynewbytes / sizeof (*yyptr); \
597 } \
598 while (YYID (0))
599
600 #endif
601
602 /* YYFINAL -- State number of the termination state. */
603 #define YYFINAL 2
604 /* YYLAST -- Last index in YYTABLE. */
605 #define YYLAST 385
606
607 /* YYNTOKENS -- Number of terminals. */
608 #define YYNTOKENS 102
609 /* YYNNTS -- Number of nonterminals. */
610 #define YYNNTS 30
611 /* YYNRULES -- Number of rules. */
612 #define YYNRULES 133
613 /* YYNRULES -- Number of states. */
614 #define YYNSTATES 176
615
616 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
617 #define YYUNDEFTOK 2
618 #define YYMAXUTOK 347
619
620 #define YYTRANSLATE(YYX) \
621 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
622
623 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
624 static const yytype_uint8 yytranslate[] =
625 {
626 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 100, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 101, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 96, 2, 97, 2, 98, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 99, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 93, 95, 94, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
651 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
652 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
653 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
654 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
655 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
656 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
657 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
658 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
659 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
660 85, 86, 87, 88, 89, 90, 91, 92
661 };
662
663 #if YYDEBUG
664 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
665 YYRHS. */
666 static const yytype_uint16 yyprhs[] =
667 {
668 0, 0, 3, 6, 7, 9, 11, 13, 14, 21,
669 24, 26, 27, 31, 32, 39, 42, 44, 45, 49,
670 50, 57, 60, 62, 63, 68, 70, 71, 75, 77,
671 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
672 99, 104, 108, 114, 119, 122, 124, 126, 128, 130,
673 132, 134, 136, 138, 140, 142, 144, 146, 148, 150,
674 152, 154, 156, 158, 160, 162, 164, 166, 168, 170,
675 172, 174, 176, 178, 180, 182, 184, 186, 188, 190,
676 193, 196, 197, 199, 202, 205, 208, 211, 213, 215,
677 217, 220, 222, 225, 227, 229, 231, 234, 236, 238,
678 240, 242, 244, 246, 248, 251, 253, 256, 259, 261,
679 263, 265, 267, 269, 272, 275, 278, 280, 282, 284,
680 286, 288, 290, 291, 294, 296, 298, 300, 302, 304,
681 306, 308, 310, 312
682 };
683
684 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
685 static const yytype_int16 yyrhs[] =
686 {
687 103, 0, -1, 103, 104, -1, -1, 105, -1, 109,
688 -1, 113, -1, -1, 27, 131, 106, 93, 107, 94,
689 -1, 107, 108, -1, 1, -1, -1, 120, 118, 128,
690 -1, -1, 73, 131, 110, 93, 111, 94, -1, 111,
691 112, -1, 1, -1, -1, 121, 118, 128, -1, -1,
692 75, 131, 114, 93, 115, 94, -1, 115, 116, -1,
693 1, -1, -1, 125, 127, 117, 128, -1, 121, -1,
694 -1, 118, 95, 119, -1, 119, -1, 86, -1, 71,
695 -1, 76, -1, 77, -1, 78, -1, 90, -1, 88,
696 -1, 54, -1, 6, -1, 4, -1, 1, -1, 122,
697 96, 124, 97, -1, 96, 124, 97, -1, 122, 96,
698 72, 97, 92, -1, 96, 72, 97, 92, -1, 122,
699 123, -1, 123, -1, 28, -1, 87, -1, 3, -1,
700 74, -1, 79, -1, 80, -1, 81, -1, 82, -1,
701 83, -1, 9, -1, 10, -1, 8, -1, 7, -1,
702 13, -1, 14, -1, 12, -1, 11, -1, 17, -1,
703 18, -1, 16, -1, 15, -1, 21, -1, 22, -1,
704 20, -1, 19, -1, 25, -1, 26, -1, 24, -1,
705 23, -1, 1, -1, 131, -1, 126, -1, 1, -1,
706 98, 131, -1, 99, 131, -1, -1, 29, -1, 30,
707 129, -1, 31, 129, -1, 32, 131, -1, 100, 131,
708 -1, 33, -1, 34, -1, 35, -1, 36, 129, -1,
709 37, -1, 38, 131, -1, 39, -1, 40, -1, 41,
710 -1, 42, 129, -1, 43, -1, 44, -1, 45, -1,
711 46, -1, 47, -1, 48, -1, 49, -1, 50, 129,
712 -1, 51, -1, 53, 129, -1, 52, 129, -1, 56,
713 -1, 57, -1, 58, -1, 61, -1, 60, -1, 59,
714 129, -1, 62, 129, -1, 63, 131, -1, 64, -1,
715 65, -1, 66, -1, 67, -1, 1, -1, 130, -1,
716 -1, 101, 131, -1, 86, -1, 90, -1, 89, -1,
717 71, -1, 91, -1, 55, -1, 84, -1, 85, -1,
718 5, -1, 92, -1
719 };
720
721 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
722 static const yytype_uint16 yyrline[] =
723 {
724 0, 254, 254, 255, 258, 259, 260, 264, 263, 285,
725 286, 292, 295, 402, 401, 423, 424, 430, 433, 486,
726 485, 496, 497, 503, 506, 608, 611, 614, 616, 620,
727 622, 624, 626, 628, 630, 632, 634, 636, 638, 640,
728 644, 649, 656, 661, 668, 670, 674, 676, 678, 680,
729 682, 684, 686, 688, 690, 694, 700, 706, 712, 718,
730 724, 730, 736, 742, 748, 754, 760, 766, 772, 778,
731 784, 790, 796, 802, 808, 814, 823, 825, 827, 835,
732 839, 850, 853, 858, 863, 868, 873, 878, 883, 888,
733 893, 898, 903, 908, 913, 918, 923, 928, 933, 938,
734 943, 948, 953, 958, 963, 968, 973, 978, 983, 988,
735 993, 998, 1003, 1008, 1013, 1018, 1023, 1028, 1033, 1038,
736 1043, 1051, 1054, 1057, 1059, 1061, 1063, 1065, 1067, 1069,
737 1071, 1073, 1075, 1078
738 };
739 #endif
740
741 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
742 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
743 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
744 static const char *const yytname[] =
745 {
746 "$end", "error", "$undefined", "ALT_TOK", "APP_TOK", "BACK_TOK",
747 "BORDER_TOK", "BTN1_CLICK2_TOK", "BTN1_CLICK_TOK", "BTN1_DOWN_TOK",
748 "BTN1_UP_TOK", "BTN2_CLICK2_TOK", "BTN2_CLICK_TOK", "BTN2_DOWN_TOK",
749 "BTN2_UP_TOK", "BTN3_CLICK2_TOK", "BTN3_CLICK_TOK", "BTN3_DOWN_TOK",
750 "BTN3_UP_TOK", "BTN4_CLICK2_TOK", "BTN4_CLICK_TOK", "BTN4_DOWN_TOK",
751 "BTN4_UP_TOK", "BTN5_CLICK2_TOK", "BTN5_CLICK_TOK", "BTN5_DOWN_TOK",
752 "BTN5_UP_TOK", "BUTTONS_TOK", "CTRL_TOK", "FBEEP_TOK",
753 "FCIRCLE_DOWN_TOK", "FCIRCLE_UP_TOK", "FEXEC_TOK", "FFOCUS_COLOR_TOK",
754 "FFOCUS_KEY_TOK", "FKILL_TOK", "FLOWER_TOK", "FMAXIMIZE_TOK",
755 "FMENU_TOK", "FMINIMIZE_TOK", "FMOVE_TOK", "FNEXT_CMAP_TOK",
756 "FNEXT_KEY_TOK", "FNOP_TOK", "FNORMALIZE_TOK", "FNORMANDRAISE_TOK",
757 "FPACK_ICONS_TOK", "FPASS_KEYS_TOK", "FPOST_WMENU_TOK", "FPREV_CMAP_TOK",
758 "FPREV_KEY_TOK", "FQUIT_MWM_TOK", "FRAISE_LOWER_TOK", "FRAISE_TOK",
759 "FRAME_TOK", "FREE_FAMILY_TOK", "FREFRESH_TOK", "FREFRESH_WIN_TOK",
760 "FRESIZE_TOK", "FRESTART_TOK", "FRESTOREANDRAISE_TOK", "FRESTORE_TOK",
761 "FSCREEN_TOK", "FSEND_MSG_TOK", "FSEPARATOR_TOK", "FSET_BEHAVIOR_TOK",
762 "FTITLE_TOK", "FWINDOWLIST_TOK", "FDESK_TOK", "FTOGGLE_PAGE_TOK",
763 "FGOTO_PAGE_TOK", "ICON_TOK", "KEY_TOK", "KEYS_TOK", "LOCK_TOK",
764 "MENU_TOK", "MENUB_TOK", "MINIMIZEB_TOK", "MAXIMIZEB_TOK", "MOD1_TOK",
765 "MOD2_TOK", "MOD3_TOK", "MOD4_TOK", "MOD5_TOK", "NEXT_TOK", "PREV_TOK",
766 "ROOT_TOK", "SHIFT_TOK", "TITLE_TOK", "TRANSIENT_TOK", "WINDOW_TOK",
767 "WITHIN_TOK", "STRING_TOK", "'{'", "'}'", "'|'", "'<'", "'>'", "'@'",
768 "'_'", "'!'", "'-'", "$accept", "res_file", "binding", "button_bindings",
769 "@1", "button_list", "button_binding", "key_bindings", "@2", "key_list",
770 "key_binding", "menu_bindings", "@3", "item_list", "item_binding",
771 "accelerator", "context", "object", "button", "key", "modifier_list",
772 "modifier_name", "button_event_name", "label", "bitmap_file", "mnemonic",
773 "function", "optional_arg", "arg", "string", 0
774 };
775 #endif
776
777 # ifdef YYPRINT
778 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
779 token YYLEX-NUM. */
780 static const yytype_uint16 yytoknum[] =
781 {
782 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
783 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
784 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
785 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
786 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
787 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
788 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
789 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
790 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
791 345, 346, 347, 123, 125, 124, 60, 62, 64, 95,
792 33, 45
793 };
794 # endif
795
796 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
797 static const yytype_uint8 yyr1[] =
798 {
799 0, 102, 103, 103, 104, 104, 104, 106, 105, 107,
800 107, 107, 108, 110, 109, 111, 111, 111, 112, 114,
801 113, 115, 115, 115, 116, 117, 117, 118, 118, 119,
802 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
803 120, 120, 121, 121, 122, 122, 123, 123, 123, 123,
804 123, 123, 123, 123, 123, 124, 124, 124, 124, 124,
805 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
806 124, 124, 124, 124, 124, 124, 125, 125, 125, 126,
807 127, 127, 128, 128, 128, 128, 128, 128, 128, 128,
808 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
809 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
810 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
811 128, 129, 129, 130, 130, 130, 130, 130, 130, 130,
812 130, 130, 130, 131
813 };
814
815 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
816 static const yytype_uint8 yyr2[] =
817 {
818 0, 2, 2, 0, 1, 1, 1, 0, 6, 2,
819 1, 0, 3, 0, 6, 2, 1, 0, 3, 0,
820 6, 2, 1, 0, 4, 1, 0, 3, 1, 1,
821 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
822 4, 3, 5, 4, 2, 1, 1, 1, 1, 1,
823 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
825 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
826 2, 0, 1, 2, 2, 2, 2, 1, 1, 1,
827 2, 1, 2, 1, 1, 1, 2, 1, 1, 1,
828 1, 1, 1, 1, 2, 1, 2, 2, 1, 1,
829 1, 1, 1, 2, 2, 2, 1, 1, 1, 1,
830 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
831 1, 1, 1, 1
832 };
833
834 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
835 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
836 means the default is an error. */
837 static const yytype_uint8 yydefact[] =
838 {
839 3, 0, 1, 0, 0, 0, 2, 4, 5, 6,
840 133, 7, 13, 19, 0, 0, 0, 0, 0, 0,
841 10, 0, 16, 0, 22, 0, 48, 46, 49, 50,
842 51, 52, 53, 54, 47, 8, 0, 9, 0, 0,
843 45, 14, 0, 15, 0, 0, 78, 20, 0, 21,
844 81, 77, 76, 75, 58, 57, 55, 56, 62, 61,
845 59, 60, 66, 65, 63, 64, 70, 69, 67, 68,
846 74, 73, 71, 72, 0, 39, 38, 37, 36, 30,
847 31, 32, 33, 29, 35, 34, 0, 28, 0, 44,
848 0, 0, 0, 79, 0, 26, 41, 120, 82, 122,
849 122, 0, 87, 88, 89, 122, 91, 0, 93, 94,
850 95, 122, 97, 98, 99, 100, 101, 102, 103, 122,
851 105, 122, 122, 108, 109, 110, 122, 112, 111, 122,
852 0, 116, 117, 118, 119, 0, 0, 12, 0, 0,
853 18, 0, 80, 0, 25, 132, 129, 127, 130, 131,
854 124, 126, 125, 128, 0, 83, 121, 84, 85, 90,
855 92, 96, 104, 107, 106, 113, 114, 115, 27, 86,
856 40, 43, 0, 24, 123, 42
857 };
858
859 /* YYDEFGOTO[NTERM-NUM]. */
860 static const yytype_int16 yydefgoto[] =
861 {
862 -1, 1, 6, 7, 14, 21, 37, 8, 15, 23,
863 43, 9, 16, 25, 49, 143, 86, 87, 38, 44,
864 45, 40, 74, 50, 51, 95, 137, 155, 156, 11
865 };
866
867 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
868 STATE-NUM. */
869 #define YYPACT_NINF -105
870 static const yytype_int16 yypact[] =
871 {
872 -105, 11, -105, -87, -87, -87, -105, -105, -105, -105,
873 -105, -105, -105, -105, -86, -85, -83, 117, 200, 1,
874 -105, 174, -105, 224, -105, 2, -105, -105, -105, -105,
875 -105, -105, -105, -105, -105, -105, 359, -105, 31, 234,
876 -105, -105, -59, -105, 31, 257, -105, -105, -87, -105,
877 -80, -105, -105, -105, -105, -105, -105, -105, -105, -105,
878 -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
879 -105, -105, -105, -105, -81, -105, -105, -105, -105, -105,
880 -105, -105, -105, -105, -105, -105, 16, -105, 359, -105,
881 -77, 16, -58, -105, -87, 269, -105, -105, -105, 135,
882 135, -87, -105, -105, -105, 135, -105, -87, -105, -105,
883 -105, 135, -105, -105, -105, -105, -105, -105, -105, 135,
884 -105, 135, 135, -105, -105, -105, 135, -105, -105, 135,
885 -87, -105, -105, -105, -105, 31, -87, -105, -75, -68,
886 -105, -70, -105, 122, -105, -105, -105, -105, -105, -105,
887 -105, -105, -105, -105, -87, -105, -105, -105, -105, -105,
888 -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
889 -105, -105, -64, -105, -105, -105
890 };
891
892 /* YYPGOTO[NTERM-NUM]. */
893 static const yytype_int8 yypgoto[] =
894 {
895 -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
896 -105, -105, -105, -105, -105, -105, -15, -104, -105, -61,
897 15, -33, -49, -105, -105, -105, -73, -96, -105, -4
898 };
899
900 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
901 positive, shift that token. If negative, reduce the rule which
902 number is the opposite. If zero, do what YYDEFACT says.
903 If YYTABLE_NINF, syntax error. */
904 #define YYTABLE_NINF -24
905 static const yytype_int16 yytable[] =
906 {
907 12, 13, 24, 46, 157, 10, 89, 17, 18, 159,
908 19, 2, 89, 90, 141, 161, 96, 97, 140, 94,
909 139, 52, 170, 162, 171, 163, 164, 172, 175, 91,
910 165, 168, 75, 166, 144, 76, 39, 77, 3, 138,
911 0, 0, 0, 0, 93, 98, 99, 100, 101, 102,
912 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
913 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
914 173, 0, 123, 124, 125, 126, 127, 128, 129, 130,
915 131, 132, 133, 134, 4, 78, 5, 0, 0, 0,
916 142, 0, 0, -23, 10, -23, 47, 158, 0, -23,
917 48, 0, 79, 160, 0, 0, 0, 80, 81, 82,
918 0, 135, 0, 0, 0, 0, 136, 83, 20, 84,
919 -11, 85, 0, 97, 0, 0, 167, 0, 0, 0,
920 0, 0, 169, 0, 0, 0, 0, 0, 0, 0,
921 145, 0, 0, 0, 0, -11, 0, 0, 0, 0,
922 174, 98, 99, 100, 101, 102, 103, 104, 105, 106,
923 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
924 117, 118, 119, 120, 121, 122, 0, 26, 123, 124,
925 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
926 146, -11, 0, 0, 0, 0, -11, -11, -11, -11,
927 -11, 22, 27, -17, -11, 0, 147, 0, 0, 0,
928 0, -11, 0, -11, 0, 0, 0, 0, 0, 148,
929 149, 150, 136, 0, 151, 152, 153, 26, -17, 0,
930 0, 0, 0, 0, 0, 0, 154, 26, 0, 0,
931 0, 0, 0, 0, 0, 0, 0, 0, 28, 0,
932 0, 0, 27, 29, 30, 31, 32, 33, 0, 0,
933 26, 34, 27, 0, 0, 0, 0, 0, 35, 0,
934 36, 0, 26, 0, -17, 0, 0, 0, 0, -17,
935 -17, -17, -17, -17, 0, 27, 0, -17, 0, 0,
936 0, 0, 0, 0, -17, 0, -17, 27, 28, 0,
937 0, 0, 0, 29, 30, 31, 32, 33, 28, 0,
938 0, 34, 0, 29, 30, 31, 32, 33, 41, 0,
939 42, 34, 0, 0, 0, 0, 0, 0, 0, 0,
940 88, 28, 0, 0, 0, 0, 29, 30, 31, 32,
941 33, 0, 0, 28, 34, 0, 0, 0, 29, 30,
942 31, 32, 33, 92, 0, 0, 34, 0, 0, 0,
943 53, 0, 0, 0, 0, 42, 54, 55, 56, 57,
944 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
945 68, 69, 70, 71, 72, 73
946 };
947
948 static const yytype_int16 yycheck[] =
949 {
950 4, 5, 1, 1, 100, 92, 39, 93, 93, 105,
951 93, 0, 45, 72, 72, 111, 97, 1, 91, 99,
952 97, 25, 97, 119, 92, 121, 122, 97, 92, 44,
953 126, 135, 1, 129, 95, 4, 21, 6, 27, 88,
954 -1, -1, -1, -1, 48, 29, 30, 31, 32, 33,
955 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
956 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
957 143, -1, 56, 57, 58, 59, 60, 61, 62, 63,
958 64, 65, 66, 67, 73, 54, 75, -1, -1, -1,
959 94, -1, -1, 92, 92, 94, 94, 101, -1, 98,
960 98, -1, 71, 107, -1, -1, -1, 76, 77, 78,
961 -1, 95, -1, -1, -1, -1, 100, 86, 1, 88,
962 3, 90, -1, 1, -1, -1, 130, -1, -1, -1,
963 -1, -1, 136, -1, -1, -1, -1, -1, -1, -1,
964 5, -1, -1, -1, -1, 28, -1, -1, -1, -1,
965 154, 29, 30, 31, 32, 33, 34, 35, 36, 37,
966 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
967 48, 49, 50, 51, 52, 53, -1, 3, 56, 57,
968 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
969 55, 74, -1, -1, -1, -1, 79, 80, 81, 82,
970 83, 1, 28, 3, 87, -1, 71, -1, -1, -1,
971 -1, 94, -1, 96, -1, -1, -1, -1, -1, 84,
972 85, 86, 100, -1, 89, 90, 91, 3, 28, -1,
973 -1, -1, -1, -1, -1, -1, 101, 3, -1, -1,
974 -1, -1, -1, -1, -1, -1, -1, -1, 74, -1,
975 -1, -1, 28, 79, 80, 81, 82, 83, -1, -1,
976 3, 87, 28, -1, -1, -1, -1, -1, 94, -1,
977 96, -1, 3, -1, 74, -1, -1, -1, -1, 79,
978 80, 81, 82, 83, -1, 28, -1, 87, -1, -1,
979 -1, -1, -1, -1, 94, -1, 96, 28, 74, -1,
980 -1, -1, -1, 79, 80, 81, 82, 83, 74, -1,
981 -1, 87, -1, 79, 80, 81, 82, 83, 94, -1,
982 96, 87, -1, -1, -1, -1, -1, -1, -1, -1,
983 96, 74, -1, -1, -1, -1, 79, 80, 81, 82,
984 83, -1, -1, 74, 87, -1, -1, -1, 79, 80,
985 81, 82, 83, 96, -1, -1, 87, -1, -1, -1,
986 1, -1, -1, -1, -1, 96, 7, 8, 9, 10,
987 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
988 21, 22, 23, 24, 25, 26
989 };
990
991 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
992 symbol of state STATE-NUM. */
993 static const yytype_uint8 yystos[] =
994 {
995 0, 103, 0, 27, 73, 75, 104, 105, 109, 113,
996 92, 131, 131, 131, 106, 110, 114, 93, 93, 93,
997 1, 107, 1, 111, 1, 115, 3, 28, 74, 79,
998 80, 81, 82, 83, 87, 94, 96, 108, 120, 122,
999 123, 94, 96, 112, 121, 122, 1, 94, 98, 116,
1000 125, 126, 131, 1, 7, 8, 9, 10, 11, 12,
1001 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1002 23, 24, 25, 26, 124, 1, 4, 6, 54, 71,
1003 76, 77, 78, 86, 88, 90, 118, 119, 96, 123,
1004 72, 118, 96, 131, 99, 127, 97, 1, 29, 30,
1005 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1006 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
1007 51, 52, 53, 56, 57, 58, 59, 60, 61, 62,
1008 63, 64, 65, 66, 67, 95, 100, 128, 124, 97,
1009 128, 72, 131, 117, 121, 5, 55, 71, 84, 85,
1010 86, 89, 90, 91, 101, 129, 130, 129, 131, 129,
1011 131, 129, 129, 129, 129, 129, 129, 131, 119, 131,
1012 97, 92, 97, 128, 131, 92
1013 };
1014
1015 #define yyerrok (yyerrstatus = 0)
1016 #define yyclearin (yychar = YYEMPTY)
1017 #define YYEMPTY (-2)
1018 #define YYEOF 0
1019
1020 #define YYACCEPT goto yyacceptlab
1021 #define YYABORT goto yyabortlab
1022 #define YYERROR goto yyerrorlab
1023
1024
1025 /* Like YYERROR except do call yyerror. This remains here temporarily
1026 to ease the transition to the new meaning of YYERROR, for GCC.
1027 Once GCC version 2 has supplanted version 1, this can go. */
1028
1029 #define YYFAIL goto yyerrlab
1030
1031 #define YYRECOVERING() (!!yyerrstatus)
1032
1033 #define YYBACKUP(Token, Value) \
1034 do \
1035 if (yychar == YYEMPTY && yylen == 1) \
1036 { \
1037 yychar = (Token); \
1038 yylval = (Value); \
1039 yytoken = YYTRANSLATE (yychar); \
1040 YYPOPSTACK (1); \
1041 goto yybackup; \
1042 } \
1043 else \
1044 { \
1045 yyerror (YY_("syntax error: cannot back up")); \
1046 YYERROR; \
1047 } \
1048 while (YYID (0))
1049
1050
1051 #define YYTERROR 1
1052 #define YYERRCODE 256
1053
1054
1055 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1056 If N is 0, then set CURRENT to the empty location which ends
1057 the previous symbol: RHS[0] (always defined). */
1058
1059 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1060 #ifndef YYLLOC_DEFAULT
1061 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1062 do \
1063 if (YYID (N)) \
1064 { \
1065 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1066 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1067 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1068 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1069 } \
1070 else \
1071 { \
1072 (Current).first_line = (Current).last_line = \
1073 YYRHSLOC (Rhs, 0).last_line; \
1074 (Current).first_column = (Current).last_column = \
1075 YYRHSLOC (Rhs, 0).last_column; \
1076 } \
1077 while (YYID (0))
1078 #endif
1079
1080
1081 /* YY_LOCATION_PRINT -- Print the location on the stream.
1082 This macro was not mandated originally: define only if we know
1083 we won't break user code: when these are the locations we know. */
1084
1085 #ifndef YY_LOCATION_PRINT
1086 # if YYLTYPE_IS_TRIVIAL
1087 # define YY_LOCATION_PRINT(File, Loc) \
1088 fprintf (File, "%d.%d-%d.%d", \
1089 (Loc).first_line, (Loc).first_column, \
1090 (Loc).last_line, (Loc).last_column)
1091 # else
1092 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1093 # endif
1094 #endif
1095
1096
1097 /* YYLEX -- calling `yylex' with the right arguments. */
1098
1099 #ifdef YYLEX_PARAM
1100 # define YYLEX yylex (YYLEX_PARAM)
1101 #else
1102 # define YYLEX yylex ()
1103 #endif
1104
1105 /* Enable debugging if requested. */
1106 #if YYDEBUG
1107
1108 # ifndef YYFPRINTF
1109 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1110 # define YYFPRINTF fprintf
1111 # endif
1112
1113 # define YYDPRINTF(Args) \
1114 do { \
1115 if (yydebug) \
1116 YYFPRINTF Args; \
1117 } while (YYID (0))
1118
1119 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1120 do { \
1121 if (yydebug) \
1122 { \
1123 YYFPRINTF (stderr, "%s ", Title); \
1124 yy_symbol_print (stderr, \
1125 Type, Value); \
1126 YYFPRINTF (stderr, "\n"); \
1127 } \
1128 } while (YYID (0))
1129
1130
1131 /*--------------------------------.
1132 | Print this symbol on YYOUTPUT. |
1133 `--------------------------------*/
1134
1135 /*ARGSUSED*/
1136 #if (defined __STDC__ || defined __C99__FUNC__ \
1137 || defined __cplusplus || defined _MSC_VER)
1138 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)1139 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1140 #else
1141 static void
1142 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1143 FILE *yyoutput;
1144 int yytype;
1145 YYSTYPE const * const yyvaluep;
1146 #endif
1147 {
1148 if (!yyvaluep)
1149 return;
1150 # ifdef YYPRINT
1151 if (yytype < YYNTOKENS)
1152 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1153 # else
1154 YYUSE (yyoutput);
1155 # endif
1156 switch (yytype)
1157 {
1158 default:
1159 break;
1160 }
1161 }
1162
1163
1164 /*--------------------------------.
1165 | Print this symbol on YYOUTPUT. |
1166 `--------------------------------*/
1167
1168 #if (defined __STDC__ || defined __C99__FUNC__ \
1169 || defined __cplusplus || defined _MSC_VER)
1170 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)1171 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1172 #else
1173 static void
1174 yy_symbol_print (yyoutput, yytype, yyvaluep)
1175 FILE *yyoutput;
1176 int yytype;
1177 YYSTYPE const * const yyvaluep;
1178 #endif
1179 {
1180 if (yytype < YYNTOKENS)
1181 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1182 else
1183 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1184
1185 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1186 YYFPRINTF (yyoutput, ")");
1187 }
1188
1189 /*------------------------------------------------------------------.
1190 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1191 | TOP (included). |
1192 `------------------------------------------------------------------*/
1193
1194 #if (defined __STDC__ || defined __C99__FUNC__ \
1195 || defined __cplusplus || defined _MSC_VER)
1196 static void
yy_stack_print(yytype_int16 * bottom,yytype_int16 * top)1197 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1198 #else
1199 static void
1200 yy_stack_print (bottom, top)
1201 yytype_int16 *bottom;
1202 yytype_int16 *top;
1203 #endif
1204 {
1205 YYFPRINTF (stderr, "Stack now");
1206 for (; bottom <= top; ++bottom)
1207 YYFPRINTF (stderr, " %d", *bottom);
1208 YYFPRINTF (stderr, "\n");
1209 }
1210
1211 # define YY_STACK_PRINT(Bottom, Top) \
1212 do { \
1213 if (yydebug) \
1214 yy_stack_print ((Bottom), (Top)); \
1215 } while (YYID (0))
1216
1217
1218 /*------------------------------------------------.
1219 | Report that the YYRULE is going to be reduced. |
1220 `------------------------------------------------*/
1221
1222 #if (defined __STDC__ || defined __C99__FUNC__ \
1223 || defined __cplusplus || defined _MSC_VER)
1224 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)1225 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1226 #else
1227 static void
1228 yy_reduce_print (yyvsp, yyrule)
1229 YYSTYPE *yyvsp;
1230 int yyrule;
1231 #endif
1232 {
1233 int yynrhs = yyr2[yyrule];
1234 int yyi;
1235 unsigned long int yylno = yyrline[yyrule];
1236 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1237 yyrule - 1, yylno);
1238 /* The symbols being reduced. */
1239 for (yyi = 0; yyi < yynrhs; yyi++)
1240 {
1241 fprintf (stderr, " $%d = ", yyi + 1);
1242 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1243 &(yyvsp[(yyi + 1) - (yynrhs)])
1244 );
1245 fprintf (stderr, "\n");
1246 }
1247 }
1248
1249 # define YY_REDUCE_PRINT(Rule) \
1250 do { \
1251 if (yydebug) \
1252 yy_reduce_print (yyvsp, Rule); \
1253 } while (YYID (0))
1254
1255 /* Nonzero means print parse trace. It is left uninitialized so that
1256 multiple parsers can coexist. */
1257 int yydebug;
1258 #else /* !YYDEBUG */
1259 # define YYDPRINTF(Args)
1260 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1261 # define YY_STACK_PRINT(Bottom, Top)
1262 # define YY_REDUCE_PRINT(Rule)
1263 #endif /* !YYDEBUG */
1264
1265
1266 /* YYINITDEPTH -- initial size of the parser's stacks. */
1267 #ifndef YYINITDEPTH
1268 # define YYINITDEPTH 200
1269 #endif
1270
1271 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1272 if the built-in stack extension method is used).
1273
1274 Do not make this value too large; the results are undefined if
1275 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1276 evaluated with infinite-precision integer arithmetic. */
1277
1278 #ifndef YYMAXDEPTH
1279 # define YYMAXDEPTH 10000
1280 #endif
1281
1282
1283
1284 #if YYERROR_VERBOSE
1285
1286 # ifndef yystrlen
1287 # if defined __GLIBC__ && defined _STRING_H
1288 # define yystrlen strlen
1289 # else
1290 /* Return the length of YYSTR. */
1291 #if (defined __STDC__ || defined __C99__FUNC__ \
1292 || defined __cplusplus || defined _MSC_VER)
1293 static YYSIZE_T
yystrlen(const char * yystr)1294 yystrlen (const char *yystr)
1295 #else
1296 static YYSIZE_T
1297 yystrlen (yystr)
1298 const char *yystr;
1299 #endif
1300 {
1301 YYSIZE_T yylen;
1302 for (yylen = 0; yystr[yylen]; yylen++)
1303 continue;
1304 return yylen;
1305 }
1306 # endif
1307 # endif
1308
1309 # ifndef yystpcpy
1310 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1311 # define yystpcpy stpcpy
1312 # else
1313 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1314 YYDEST. */
1315 #if (defined __STDC__ || defined __C99__FUNC__ \
1316 || defined __cplusplus || defined _MSC_VER)
1317 static char *
yystpcpy(char * yydest,const char * yysrc)1318 yystpcpy (char *yydest, const char *yysrc)
1319 #else
1320 static char *
1321 yystpcpy (yydest, yysrc)
1322 char *yydest;
1323 const char *yysrc;
1324 #endif
1325 {
1326 char *yyd = yydest;
1327 const char *yys = yysrc;
1328
1329 while ((*yyd++ = *yys++) != '\0')
1330 continue;
1331
1332 return yyd - 1;
1333 }
1334 # endif
1335 # endif
1336
1337 # ifndef yytnamerr
1338 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1339 quotes and backslashes, so that it's suitable for yyerror. The
1340 heuristic is that double-quoting is unnecessary unless the string
1341 contains an apostrophe, a comma, or backslash (other than
1342 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1343 null, do not copy; instead, return the length of what the result
1344 would have been. */
1345 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1346 yytnamerr (char *yyres, const char *yystr)
1347 {
1348 if (*yystr == '"')
1349 {
1350 YYSIZE_T yyn = 0;
1351 char const *yyp = yystr;
1352
1353 for (;;)
1354 switch (*++yyp)
1355 {
1356 case '\'':
1357 case ',':
1358 goto do_not_strip_quotes;
1359
1360 case '\\':
1361 if (*++yyp != '\\')
1362 goto do_not_strip_quotes;
1363 /* Fall through. */
1364 default:
1365 if (yyres)
1366 yyres[yyn] = *yyp;
1367 yyn++;
1368 break;
1369
1370 case '"':
1371 if (yyres)
1372 yyres[yyn] = '\0';
1373 return yyn;
1374 }
1375 do_not_strip_quotes: ;
1376 }
1377
1378 if (! yyres)
1379 return yystrlen (yystr);
1380
1381 return yystpcpy (yyres, yystr) - yyres;
1382 }
1383 # endif
1384
1385 /* Copy into YYRESULT an error message about the unexpected token
1386 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1387 including the terminating null byte. If YYRESULT is null, do not
1388 copy anything; just return the number of bytes that would be
1389 copied. As a special case, return 0 if an ordinary "syntax error"
1390 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1391 size calculation. */
1392 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)1393 yysyntax_error (char *yyresult, int yystate, int yychar)
1394 {
1395 int yyn = yypact[yystate];
1396
1397 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1398 return 0;
1399 else
1400 {
1401 int yytype = YYTRANSLATE (yychar);
1402 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1403 YYSIZE_T yysize = yysize0;
1404 YYSIZE_T yysize1;
1405 int yysize_overflow = 0;
1406 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1407 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1408 int yyx;
1409
1410 # if 0
1411 /* This is so xgettext sees the translatable formats that are
1412 constructed on the fly. */
1413 YY_("syntax error, unexpected %s");
1414 YY_("syntax error, unexpected %s, expecting %s");
1415 YY_("syntax error, unexpected %s, expecting %s or %s");
1416 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1417 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1418 # endif
1419 char *yyfmt;
1420 char const *yyf;
1421 static char const yyunexpected[] = "syntax error, unexpected %s";
1422 static char const yyexpecting[] = ", expecting %s";
1423 static char const yyor[] = " or %s";
1424 char yyformat[sizeof yyunexpected
1425 + sizeof yyexpecting - 1
1426 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1427 * (sizeof yyor - 1))];
1428 char const *yyprefix = yyexpecting;
1429
1430 /* Start YYX at -YYN if negative to avoid negative indexes in
1431 YYCHECK. */
1432 int yyxbegin = yyn < 0 ? -yyn : 0;
1433
1434 /* Stay within bounds of both yycheck and yytname. */
1435 int yychecklim = YYLAST - yyn + 1;
1436 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1437 int yycount = 1;
1438
1439 yyarg[0] = yytname[yytype];
1440 yyfmt = yystpcpy (yyformat, yyunexpected);
1441
1442 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1443 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1444 {
1445 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1446 {
1447 yycount = 1;
1448 yysize = yysize0;
1449 yyformat[sizeof yyunexpected - 1] = '\0';
1450 break;
1451 }
1452 yyarg[yycount++] = yytname[yyx];
1453 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1454 yysize_overflow |= (yysize1 < yysize);
1455 yysize = yysize1;
1456 yyfmt = yystpcpy (yyfmt, yyprefix);
1457 yyprefix = yyor;
1458 }
1459
1460 yyf = YY_(yyformat);
1461 yysize1 = yysize + yystrlen (yyf);
1462 yysize_overflow |= (yysize1 < yysize);
1463 yysize = yysize1;
1464
1465 if (yysize_overflow)
1466 return YYSIZE_MAXIMUM;
1467
1468 if (yyresult)
1469 {
1470 /* Avoid sprintf, as that infringes on the user's name space.
1471 Don't have undefined behavior even if the translation
1472 produced a string with the wrong number of "%s"s. */
1473 char *yyp = yyresult;
1474 int yyi = 0;
1475 while ((*yyp = *yyf) != '\0')
1476 {
1477 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1478 {
1479 yyp += yytnamerr (yyp, yyarg[yyi++]);
1480 yyf += 2;
1481 }
1482 else
1483 {
1484 yyp++;
1485 yyf++;
1486 }
1487 }
1488 }
1489 return yysize;
1490 }
1491 }
1492 #endif /* YYERROR_VERBOSE */
1493
1494
1495 /*-----------------------------------------------.
1496 | Release the memory associated to this symbol. |
1497 `-----------------------------------------------*/
1498
1499 /*ARGSUSED*/
1500 #if (defined __STDC__ || defined __C99__FUNC__ \
1501 || defined __cplusplus || defined _MSC_VER)
1502 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1503 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1504 #else
1505 static void
1506 yydestruct (yymsg, yytype, yyvaluep)
1507 const char *yymsg;
1508 int yytype;
1509 YYSTYPE *yyvaluep;
1510 #endif
1511 {
1512 YYUSE (yyvaluep);
1513
1514 if (!yymsg)
1515 yymsg = "Deleting";
1516 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1517
1518 switch (yytype)
1519 {
1520
1521 default:
1522 break;
1523 }
1524 }
1525
1526
1527 /* Prevent warnings from -Wmissing-prototypes. */
1528
1529 #ifdef YYPARSE_PARAM
1530 #if defined __STDC__ || defined __cplusplus
1531 int yyparse (void *YYPARSE_PARAM);
1532 #else
1533 int yyparse ();
1534 #endif
1535 #else /* ! YYPARSE_PARAM */
1536 #if defined __STDC__ || defined __cplusplus
1537 int yyparse (void);
1538 #else
1539 int yyparse ();
1540 #endif
1541 #endif /* ! YYPARSE_PARAM */
1542
1543
1544
1545 /* The look-ahead symbol. */
1546 int yychar;
1547
1548 /* The semantic value of the look-ahead symbol. */
1549 YYSTYPE yylval;
1550
1551 /* Number of syntax errors so far. */
1552 int yynerrs;
1553
1554
1555
1556 /*----------.
1557 | yyparse. |
1558 `----------*/
1559
1560 #ifdef YYPARSE_PARAM
1561 #if (defined __STDC__ || defined __C99__FUNC__ \
1562 || defined __cplusplus || defined _MSC_VER)
1563 int
yyparse(void * YYPARSE_PARAM)1564 yyparse (void *YYPARSE_PARAM)
1565 #else
1566 int
1567 yyparse (YYPARSE_PARAM)
1568 void *YYPARSE_PARAM;
1569 #endif
1570 #else /* ! YYPARSE_PARAM */
1571 #if (defined __STDC__ || defined __C99__FUNC__ \
1572 || defined __cplusplus || defined _MSC_VER)
1573 int
1574 yyparse (void)
1575 #else
1576 int
1577 yyparse ()
1578
1579 #endif
1580 #endif
1581 {
1582
1583 int yystate;
1584 int yyn;
1585 int yyresult;
1586 /* Number of tokens to shift before error messages enabled. */
1587 int yyerrstatus;
1588 /* Look-ahead token as an internal (translated) token number. */
1589 int yytoken = 0;
1590 #if YYERROR_VERBOSE
1591 /* Buffer for error messages, and its allocated size. */
1592 char yymsgbuf[128];
1593 char *yymsg = yymsgbuf;
1594 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1595 #endif
1596
1597 /* Three stacks and their tools:
1598 `yyss': related to states,
1599 `yyvs': related to semantic values,
1600 `yyls': related to locations.
1601
1602 Refer to the stacks thru separate pointers, to allow yyoverflow
1603 to reallocate them elsewhere. */
1604
1605 /* The state stack. */
1606 yytype_int16 yyssa[YYINITDEPTH];
1607 yytype_int16 *yyss = yyssa;
1608 yytype_int16 *yyssp;
1609
1610 /* The semantic value stack. */
1611 YYSTYPE yyvsa[YYINITDEPTH];
1612 YYSTYPE *yyvs = yyvsa;
1613 YYSTYPE *yyvsp;
1614
1615
1616
1617 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1618
1619 YYSIZE_T yystacksize = YYINITDEPTH;
1620
1621 /* The variables used to return semantic value and location from the
1622 action routines. */
1623 YYSTYPE yyval;
1624
1625
1626 /* The number of symbols on the RHS of the reduced rule.
1627 Keep to zero when no symbol should be popped. */
1628 int yylen = 0;
1629
1630 YYDPRINTF ((stderr, "Starting parse\n"));
1631
1632 yystate = 0;
1633 yyerrstatus = 0;
1634 yynerrs = 0;
1635 yychar = YYEMPTY; /* Cause a token to be read. */
1636
1637 /* Initialize stack pointers.
1638 Waste one element of value and location stack
1639 so that they stay on the same level as the state stack.
1640 The wasted elements are never initialized. */
1641
1642 yyssp = yyss;
1643 yyvsp = yyvs;
1644
1645 goto yysetstate;
1646
1647 /*------------------------------------------------------------.
1648 | yynewstate -- Push a new state, which is found in yystate. |
1649 `------------------------------------------------------------*/
1650 yynewstate:
1651 /* In all cases, when you get here, the value and location stacks
1652 have just been pushed. So pushing a state here evens the stacks. */
1653 yyssp++;
1654
1655 yysetstate:
1656 *yyssp = yystate;
1657
1658 if (yyss + yystacksize - 1 <= yyssp)
1659 {
1660 /* Get the current used size of the three stacks, in elements. */
1661 YYSIZE_T yysize = yyssp - yyss + 1;
1662
1663 #ifdef yyoverflow
1664 {
1665 /* Give user a chance to reallocate the stack. Use copies of
1666 these so that the &'s don't force the real ones into
1667 memory. */
1668 YYSTYPE *yyvs1 = yyvs;
1669 yytype_int16 *yyss1 = yyss;
1670
1671
1672 /* Each stack pointer address is followed by the size of the
1673 data in use in that stack, in bytes. This used to be a
1674 conditional around just the two extra args, but that might
1675 be undefined if yyoverflow is a macro. */
1676 yyoverflow (YY_("memory exhausted"),
1677 &yyss1, yysize * sizeof (*yyssp),
1678 &yyvs1, yysize * sizeof (*yyvsp),
1679
1680 &yystacksize);
1681
1682 yyss = yyss1;
1683 yyvs = yyvs1;
1684 }
1685 #else /* no yyoverflow */
1686 # ifndef YYSTACK_RELOCATE
1687 goto yyexhaustedlab;
1688 # else
1689 /* Extend the stack our own way. */
1690 if (YYMAXDEPTH <= yystacksize)
1691 goto yyexhaustedlab;
1692 yystacksize *= 2;
1693 if (YYMAXDEPTH < yystacksize)
1694 yystacksize = YYMAXDEPTH;
1695
1696 {
1697 yytype_int16 *yyss1 = yyss;
1698 union yyalloc *yyptr =
1699 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1700 if (! yyptr)
1701 goto yyexhaustedlab;
1702 YYSTACK_RELOCATE (yyss);
1703 YYSTACK_RELOCATE (yyvs);
1704
1705 # undef YYSTACK_RELOCATE
1706 if (yyss1 != yyssa)
1707 YYSTACK_FREE (yyss1);
1708 }
1709 # endif
1710 #endif /* no yyoverflow */
1711
1712 yyssp = yyss + yysize - 1;
1713 yyvsp = yyvs + yysize - 1;
1714
1715
1716 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1717 (unsigned long int) yystacksize));
1718
1719 if (yyss + yystacksize - 1 <= yyssp)
1720 YYABORT;
1721 }
1722
1723 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1724
1725 goto yybackup;
1726
1727 /*-----------.
1728 | yybackup. |
1729 `-----------*/
1730 yybackup:
1731
1732 /* Do appropriate processing given the current state. Read a
1733 look-ahead token if we need one and don't already have one. */
1734
1735 /* First try to decide what to do without reference to look-ahead token. */
1736 yyn = yypact[yystate];
1737 if (yyn == YYPACT_NINF)
1738 goto yydefault;
1739
1740 /* Not known => get a look-ahead token if don't already have one. */
1741
1742 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1743 if (yychar == YYEMPTY)
1744 {
1745 YYDPRINTF ((stderr, "Reading a token: "));
1746 yychar = YYLEX;
1747 }
1748
1749 if (yychar <= YYEOF)
1750 {
1751 yychar = yytoken = YYEOF;
1752 YYDPRINTF ((stderr, "Now at end of input.\n"));
1753 }
1754 else
1755 {
1756 yytoken = YYTRANSLATE (yychar);
1757 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1758 }
1759
1760 /* If the proper action on seeing token YYTOKEN is to reduce or to
1761 detect an error, take that action. */
1762 yyn += yytoken;
1763 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1764 goto yydefault;
1765 yyn = yytable[yyn];
1766 if (yyn <= 0)
1767 {
1768 if (yyn == 0 || yyn == YYTABLE_NINF)
1769 goto yyerrlab;
1770 yyn = -yyn;
1771 goto yyreduce;
1772 }
1773
1774 if (yyn == YYFINAL)
1775 YYACCEPT;
1776
1777 /* Count tokens shifted since error; after three, turn off error
1778 status. */
1779 if (yyerrstatus)
1780 yyerrstatus--;
1781
1782 /* Shift the look-ahead token. */
1783 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1784
1785 /* Discard the shifted token unless it is eof. */
1786 if (yychar != YYEOF)
1787 yychar = YYEMPTY;
1788
1789 yystate = yyn;
1790 *++yyvsp = yylval;
1791
1792 goto yynewstate;
1793
1794
1795 /*-----------------------------------------------------------.
1796 | yydefault -- do the default action for the current state. |
1797 `-----------------------------------------------------------*/
1798 yydefault:
1799 yyn = yydefact[yystate];
1800 if (yyn == 0)
1801 goto yyerrlab;
1802 goto yyreduce;
1803
1804
1805 /*-----------------------------.
1806 | yyreduce -- Do a reduction. |
1807 `-----------------------------*/
1808 yyreduce:
1809 /* yyn is the number of a rule to reduce with. */
1810 yylen = yyr2[yyn];
1811
1812 /* If YYLEN is nonzero, implement the default value of the action:
1813 `$$ = $1'.
1814
1815 Otherwise, the following line sets YYVAL to garbage.
1816 This behavior is undocumented and Bison
1817 users should not rely upon it. Assigning to YYVAL
1818 unconditionally makes the parser a bit smaller, and it avoids a
1819 GCC warning that YYVAL may be used uninitialized. */
1820 yyval = yyvsp[1-yylen];
1821
1822
1823 YY_REDUCE_PRINT (yyn);
1824 switch (yyn)
1825 {
1826 case 7:
1827 #line 264 "mwmparse.y"
1828 {
1829 if (!skip_test) {
1830 if (button_bind_found == False) {
1831 if (strcmp((yyvsp[(2) - (2)].string), pscr->button_bindings) == 0)
1832 button_bind_match = True;
1833 else
1834 button_bind_match = False;
1835 }
1836 else if (strcmp((yyvsp[(2) - (2)].string), pscr->button_bindings) == 0) {
1837 yyerror("Ignoring duplicate button bindings");
1838 button_bind_match = False;
1839 }
1840 else
1841 button_bind_match = False;
1842 }
1843 else
1844 button_bind_match = True;
1845 }
1846 break;
1847
1848 case 10:
1849 #line 287 "mwmparse.y"
1850 {
1851 yyerror("Invalid button binding");
1852 yyerrok;
1853 yyclearin;
1854 }
1855 break;
1856
1857 case 12:
1858 #line 296 "mwmparse.y"
1859 {
1860 int contexts = (yyvsp[(2) - (3)].number);
1861 int mods, func;
1862 MenuItem *mi = NULL;
1863 MouseButton *temp = NULL, *ptr;
1864
1865 if (!button_bind_match)
1866 break;
1867
1868 mods = (yyvsp[(1) - (3)].button).modifiers;
1869 if ((contexts & C_WINDOW) &&
1870 (((mods == 0) || mods == AnyModifier))) {
1871 pscr->buttons2grab &= ~((yyvsp[(1) - (3)].button).button);
1872 }
1873
1874 func = (yyvsp[(3) - (3)].function).func;
1875
1876 if ((func == F_EXEC) ||
1877 (func == F_RESTART) ||
1878 (func == F_CIRCULATE_UP) ||
1879 (func == F_CIRCULATE_DOWN) ||
1880 (func == F_WARP)) {
1881 mi = (MenuItem *)XtMalloc(sizeof(MenuItem));
1882
1883 mi->next = (MenuItem *) NULL;
1884 mi->prev = (MenuItem *) NULL;
1885 if ((func == F_EXEC) || (func == F_RESTART)) {
1886 mi->item = XtNewString("DOIT");
1887 mi->action = (yyvsp[(3) - (3)].function).arg;
1888 }
1889 else {
1890 mi->item = XtNewString("DONT DOIT");
1891 mi->action = (yyvsp[(3) - (3)].function).arg;
1892 }
1893 mi->item2 = "";
1894 mi->state = 0;
1895 mi->func = func;
1896 mi->strlen = strlen(mi->item);
1897 mi->strlen2 = 0;
1898 mi->val1 = 0;
1899 mi->val2 = 0;
1900 mi->val1_unit = 1;
1901 mi->val2_unit = 1;
1902 }
1903
1904 temp = pscr->buttons;
1905 pscr->buttons =
1906 (MouseButton *)XtMalloc(sizeof(MouseButton));
1907 pscr->buttons->func = func;
1908 if (func == F_POPUP)
1909 pscr->buttons->menu = (MenuRoot *)(yyvsp[(3) - (3)].function).arg;
1910 else if (func == F_W_POPUP)
1911 pscr->buttons->menu = (MenuRoot *)DEFAULT_WIN_MENU_NAME;
1912 else
1913 pscr->buttons->menu = NULL;
1914 pscr->buttons->item = mi;
1915 pscr->buttons->button =
1916 ffs((yyvsp[(1) - (3)].button).button) - 8;
1917 pscr->buttons->context = contexts;
1918 pscr->buttons->modifier = mods;
1919 pscr->buttons->mask = (yyvsp[(1) - (3)].button).event;
1920 pscr->buttons->count = (yyvsp[(1) - (3)].button).count;
1921 pscr->buttons->val1 = 0;
1922 pscr->buttons->val2 = 0;
1923 pscr->buttons->val1_unit = pscr->d_width;
1924 pscr->buttons->val2_unit = pscr->d_height;
1925
1926 /* if duplicate, skip second */
1927 for (ptr = temp;
1928 ptr != NULL;
1929 ptr = ptr->next) {
1930 /* If everything is the same except for having
1931 func's F_POPUP and F_WINDOWLIST, the
1932 second is a duplicate */
1933 if (((ptr->func == F_POPUP ||
1934 ptr->func == F_WINDOWLIST) &&
1935 (pscr->buttons->func == F_POPUP ||
1936 pscr->buttons->func == F_WINDOWLIST)) &&
1937 ptr->modifier == pscr->buttons->modifier &&
1938 ptr->mask == pscr->buttons->mask &&
1939 ptr->count == pscr->buttons->count &&
1940 ptr->context == pscr->buttons->context &&
1941 ptr->button == pscr->buttons->button) {
1942
1943 XtFree((char *)pscr->buttons);
1944 pscr->buttons = temp;
1945 break;
1946 }
1947
1948 if (ptr->func == pscr->buttons->func &&
1949 ptr->modifier == pscr->buttons->modifier &&
1950 ptr->mask == pscr->buttons->mask &&
1951 ptr->count == pscr->buttons->count &&
1952 ptr->button == pscr->buttons->button) {
1953 ptr->context |= pscr->buttons->context;
1954 XtFree((char *)pscr->buttons);
1955 pscr->buttons = temp;
1956 break;
1957 }
1958 }
1959 if (ptr == NULL)
1960 pscr->buttons->next = temp;
1961 }
1962 break;
1963
1964 case 13:
1965 #line 402 "mwmparse.y"
1966 {
1967 if (!skip_test) {
1968 if (key_bind_found == False) {
1969 if (strcmp((yyvsp[(2) - (2)].string), pscr->key_bindings) == 0)
1970 key_bind_match = True;
1971 else
1972 key_bind_match = False;
1973 }
1974 else if (strcmp((yyvsp[(2) - (2)].string), pscr->key_bindings) == 0) {
1975 yyerror("Ignoring duplicate key bindings");
1976 key_bind_match = False;
1977 }
1978 else
1979 key_bind_match = False;
1980 }
1981 else
1982 key_bind_match = True;
1983 }
1984 break;
1985
1986 case 16:
1987 #line 425 "mwmparse.y"
1988 {
1989 yyerror("Invalid key binding");
1990 yyerrok;
1991 yyclearin;
1992 }
1993 break;
1994
1995 case 18:
1996 #line 434 "mwmparse.y"
1997 {
1998 FuncKey *tmp = NULL;
1999 KeySym keysym;
2000 KeyCode keycode;
2001 int i, min, max;
2002 int func, contexts;
2003 char *ptr;
2004
2005 if (!key_bind_match)
2006 break;
2007
2008 ptr = (yyvsp[(3) - (3)].function).arg;
2009 func = (yyvsp[(3) - (3)].function).func;
2010 contexts = (yyvsp[(2) - (3)].number);
2011
2012 /*
2013 * Don't let a 0 keycode go through, since that
2014 * means AnyKey to the XGrabKey call in GrabKeys().
2015 */
2016 keysym = (yyvsp[(1) - (3)].hotkey).key;
2017 if (keysym == 0)
2018 break;
2019 if ((keycode = XKeysymToKeycode(dpy, (yyvsp[(1) - (3)].hotkey).key)) == 0)
2020 break;
2021
2022 XDisplayKeycodes(dpy, &min, &max);
2023 for (i = min; i <= max; i++) {
2024 if (XKeycodeToKeysym(dpy, i, 0) == keysym) {
2025 tmp = (FuncKey *)XtMalloc(sizeof(FuncKey));
2026 tmp->next = pscr->keys;
2027 pscr->keys = tmp;
2028
2029 tmp->name = "HOTKEY";
2030 tmp->keycode = i;
2031 tmp->cont = contexts;
2032 tmp->mods = (yyvsp[(1) - (3)].hotkey).modifiers;
2033 tmp->func = func;
2034 if (func == F_W_POPUP)
2035 tmp->action = DEFAULT_WIN_MENU_NAME;
2036 else
2037 tmp->action = ptr;
2038 tmp->val1 = 0;
2039 tmp->val2 = 0;
2040 tmp->val1_unit = pscr->d_width;
2041 tmp->val2_unit = pscr->d_height;
2042 tmp->menu = NULL;
2043 }
2044 }
2045 }
2046 break;
2047
2048 case 19:
2049 #line 486 "mwmparse.y"
2050 {
2051 num_items = 0;
2052 cur_menu = MENU_Create((yyvsp[(2) - (2)].string));
2053 }
2054 break;
2055
2056 case 20:
2057 #line 491 "mwmparse.y"
2058 {
2059 MENU_Add(pscr, cur_menu);
2060 }
2061 break;
2062
2063 case 22:
2064 #line 498 "mwmparse.y"
2065 {
2066 yyerror("Invalid menu item");
2067 yyerrok;
2068 yyclearin;
2069 }
2070 break;
2071
2072 case 24:
2073 #line 507 "mwmparse.y"
2074 {
2075 MenuItem *tmp;
2076 int width, width2;
2077 FuncKey *tmpk = NULL;
2078 KeySym keysym;
2079 KeyCode keycode;
2080 int i, min, max;
2081 int func, contexts;
2082 char *ptr, *acc;
2083
2084 tmp = (MenuItem *)XtCalloc(1, sizeof(MenuItem));
2085 if (cur_menu->first == NULL) {
2086 cur_menu->first = tmp;
2087 tmp->prev = NULL;
2088 tmp->next = NULL;
2089 }
2090 else {
2091 cur_menu->last->next = tmp;
2092 tmp->prev = cur_menu->last;
2093 }
2094 cur_menu->last = tmp;
2095 cur_menu->items++;
2096
2097 if ((yyvsp[(4) - (4)].function).func == F_NOP)
2098 tmp->item = "";
2099 else
2100 tmp->item = (yyvsp[(1) - (4)].label).string;
2101 tmp->item2 = "";
2102 MENU_FindHotKey(tmp, (yyvsp[(2) - (4)].key));
2103 if (strcmp(tmp->item, "no-label") == 0)
2104 tmp->strlen = 0;
2105 else
2106 tmp->strlen = strlen(tmp->item);
2107
2108 tmp->action = (yyvsp[(4) - (4)].function).arg;
2109 tmp->next = NULL;
2110 tmp->state = 0;
2111 tmp->func = (yyvsp[(4) - (4)].function).func;
2112 tmp->val1 = 0;
2113 tmp->val2 = 0;
2114 tmp->val1_unit = pscr->d_width;
2115 tmp->val2_unit = pscr->d_height;
2116
2117 width = XTextWidth(pscr->components[MWM_MENU].font,
2118 tmp->item, tmp->strlen);
2119 if (tmp->func == F_POPUP)
2120 width += 15;
2121 if (width <= 0)
2122 width = 1;
2123 if (width > cur_menu->width)
2124 cur_menu->width = width;
2125
2126 ptr = (yyvsp[(4) - (4)].function).arg;
2127 func = (yyvsp[(4) - (4)].function).func;
2128 contexts = C_WINDOW|C_ICON|C_FRAME|C_TITLE|C_LALL|C_RALL;
2129
2130 /*
2131 * Don't let a 0 keycode go through, since that
2132 * means AnyKey to the XGrabKey call in GrabKeys().
2133 */
2134 keysym = (yyvsp[(3) - (4)].hotkey).key;
2135 if (keysym == 0)
2136 break;
2137 if ((keycode = XKeysymToKeycode(dpy, (yyvsp[(3) - (4)].hotkey).key)) == 0)
2138 break;
2139
2140 acc = MENU_AcceleratorString(pscr,
2141 (yyvsp[(3) - (4)].hotkey).key,
2142 (yyvsp[(3) - (4)].hotkey).modifiers);
2143 if (strlen(acc)) {
2144 tmp->item2 = XtNewString(acc);
2145 tmp->strlen2 = strlen(acc);
2146 width2 = XTextWidth(pscr->components[MWM_MENU].font,
2147 tmp->item2, tmp->strlen2);
2148 if (width2 > cur_menu->width2)
2149 cur_menu->width2 = width2;
2150 }
2151
2152 XDisplayKeycodes(dpy, &min, &max);
2153 for (i = min; i <= max; i++) {
2154 if (XKeycodeToKeysym(dpy, i, 0) == keysym) {
2155 tmpk = (FuncKey *)XtMalloc(sizeof(FuncKey));
2156 tmpk->next = pscr->keys;
2157 pscr->keys = tmpk;
2158
2159 tmpk->name = "HOTKEY";
2160 tmpk->keycode = i;
2161 tmpk->cont = contexts;
2162 tmpk->mods = (yyvsp[(3) - (4)].hotkey).modifiers;
2163 tmpk->func = func;
2164 tmpk->action = ptr;
2165 tmpk->val1 = 0;
2166 tmpk->val2 = 0;
2167 tmpk->val1_unit = pscr->d_width;
2168 tmpk->val2_unit = pscr->d_height;
2169 tmpk->menu = NULL;
2170 }
2171 }
2172 }
2173 break;
2174
2175 case 25:
2176 #line 609 "mwmparse.y"
2177 { (yyval.hotkey) = (yyvsp[(1) - (1)].hotkey); }
2178 break;
2179
2180 case 26:
2181 #line 611 "mwmparse.y"
2182 { (yyval.hotkey).modifiers = 0; (yyval.hotkey).key = 0; }
2183 break;
2184
2185 case 27:
2186 #line 615 "mwmparse.y"
2187 { (yyval.number) = (yyvsp[(1) - (3)].number) | (yyvsp[(3) - (3)].number); }
2188 break;
2189
2190 case 28:
2191 #line 617 "mwmparse.y"
2192 { (yyval.number) = (yyvsp[(1) - (1)].number); }
2193 break;
2194
2195 case 29:
2196 #line 621 "mwmparse.y"
2197 { (yyval.number) = C_ROOT; }
2198 break;
2199
2200 case 30:
2201 #line 623 "mwmparse.y"
2202 { (yyval.number) = C_ICON; }
2203 break;
2204
2205 case 31:
2206 #line 625 "mwmparse.y"
2207 { (yyval.number) = C_MENUB; }
2208 break;
2209
2210 case 32:
2211 #line 627 "mwmparse.y"
2212 { (yyval.number) = C_MINIMIZEB; }
2213 break;
2214
2215 case 33:
2216 #line 629 "mwmparse.y"
2217 { (yyval.number) = C_MAXIMIZEB; }
2218 break;
2219
2220 case 34:
2221 #line 631 "mwmparse.y"
2222 { (yyval.number) = C_WINDOW|C_FRAME|C_TITLE|C_LALL|C_RALL|C_ICON; }
2223 break;
2224
2225 case 35:
2226 #line 633 "mwmparse.y"
2227 { (yyval.number) = C_TITLE; }
2228 break;
2229
2230 case 36:
2231 #line 635 "mwmparse.y"
2232 { (yyval.number) = C_FRAME|C_TITLE|C_LALL|C_RALL; }
2233 break;
2234
2235 case 37:
2236 #line 637 "mwmparse.y"
2237 { (yyval.number) = C_FRAME; }
2238 break;
2239
2240 case 38:
2241 #line 639 "mwmparse.y"
2242 { (yyval.number) = C_WINDOW; }
2243 break;
2244
2245 case 39:
2246 #line 641 "mwmparse.y"
2247 { yyerror("Invalid context"); (yyval.number) = 0; }
2248 break;
2249
2250 case 40:
2251 #line 645 "mwmparse.y"
2252 {
2253 (yyval.button) = (yyvsp[(3) - (4)].button);
2254 (yyval.button).modifiers = (yyvsp[(1) - (4)].modifiers);
2255 }
2256 break;
2257
2258 case 41:
2259 #line 650 "mwmparse.y"
2260 {
2261 (yyval.button) = (yyvsp[(2) - (3)].button);
2262 (yyval.button).modifiers = 0;
2263 }
2264 break;
2265
2266 case 42:
2267 #line 657 "mwmparse.y"
2268 {
2269 (yyval.hotkey).modifiers = (yyvsp[(1) - (5)].modifiers);
2270 (yyval.hotkey).key = XStringToKeysym((yyvsp[(5) - (5)].string));
2271 }
2272 break;
2273
2274 case 43:
2275 #line 662 "mwmparse.y"
2276 {
2277 (yyval.hotkey).modifiers = 0;
2278 (yyval.hotkey).key = XStringToKeysym((yyvsp[(4) - (4)].string));
2279 }
2280 break;
2281
2282 case 44:
2283 #line 669 "mwmparse.y"
2284 { (yyval.modifiers) = (yyvsp[(1) - (2)].modifiers) | (yyvsp[(2) - (2)].modifiers); }
2285 break;
2286
2287 case 45:
2288 #line 671 "mwmparse.y"
2289 { (yyval.modifiers) = (yyvsp[(1) - (1)].modifiers); }
2290 break;
2291
2292 case 46:
2293 #line 675 "mwmparse.y"
2294 { (yyval.modifiers) = ControlMask; }
2295 break;
2296
2297 case 47:
2298 #line 677 "mwmparse.y"
2299 { (yyval.modifiers) = ShiftMask; }
2300 break;
2301
2302 case 48:
2303 #line 679 "mwmparse.y"
2304 { (yyval.modifiers) = pscr->alt_mask; }
2305 break;
2306
2307 case 49:
2308 #line 681 "mwmparse.y"
2309 { (yyval.modifiers) = LockMask; }
2310 break;
2311
2312 case 50:
2313 #line 683 "mwmparse.y"
2314 { (yyval.modifiers) = Mod1Mask; }
2315 break;
2316
2317 case 51:
2318 #line 685 "mwmparse.y"
2319 { (yyval.modifiers) = Mod2Mask; }
2320 break;
2321
2322 case 52:
2323 #line 687 "mwmparse.y"
2324 { (yyval.modifiers) = Mod3Mask; }
2325 break;
2326
2327 case 53:
2328 #line 689 "mwmparse.y"
2329 { (yyval.modifiers) = Mod4Mask; }
2330 break;
2331
2332 case 54:
2333 #line 691 "mwmparse.y"
2334 { (yyval.modifiers) = Mod5Mask; }
2335 break;
2336
2337 case 55:
2338 #line 695 "mwmparse.y"
2339 {
2340 (yyval.button).button = Button1Mask;
2341 (yyval.button).event = ButtonPressMask;
2342 (yyval.button).count = 0;
2343 }
2344 break;
2345
2346 case 56:
2347 #line 701 "mwmparse.y"
2348 {
2349 (yyval.button).button = Button1Mask;
2350 (yyval.button).event = ButtonReleaseMask;
2351 (yyval.button).count = 0;
2352 }
2353 break;
2354
2355 case 57:
2356 #line 707 "mwmparse.y"
2357 {
2358 (yyval.button).button = Button1Mask;
2359 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2360 (yyval.button).count = 1;
2361 }
2362 break;
2363
2364 case 58:
2365 #line 713 "mwmparse.y"
2366 {
2367 (yyval.button).button = Button1Mask;
2368 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2369 (yyval.button).count = 2;
2370 }
2371 break;
2372
2373 case 59:
2374 #line 719 "mwmparse.y"
2375 {
2376 (yyval.button).button = Button2Mask;
2377 (yyval.button).event = ButtonPressMask;
2378 (yyval.button).count = 0;
2379 }
2380 break;
2381
2382 case 60:
2383 #line 725 "mwmparse.y"
2384 {
2385 (yyval.button).button = Button2Mask;
2386 (yyval.button).event = ButtonReleaseMask;
2387 (yyval.button).count = 0;
2388 }
2389 break;
2390
2391 case 61:
2392 #line 731 "mwmparse.y"
2393 {
2394 (yyval.button).button = Button2Mask;
2395 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2396 (yyval.button).count = 1;
2397 }
2398 break;
2399
2400 case 62:
2401 #line 737 "mwmparse.y"
2402 {
2403 (yyval.button).button = Button2Mask;
2404 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2405 (yyval.button).count = 2;
2406 }
2407 break;
2408
2409 case 63:
2410 #line 743 "mwmparse.y"
2411 {
2412 (yyval.button).button = Button3Mask;
2413 (yyval.button).event = ButtonPressMask;
2414 (yyval.button).count = 0;
2415 }
2416 break;
2417
2418 case 64:
2419 #line 749 "mwmparse.y"
2420 {
2421 (yyval.button).button = Button3Mask;
2422 (yyval.button).event = ButtonReleaseMask;
2423 (yyval.button).count = 0;
2424 }
2425 break;
2426
2427 case 65:
2428 #line 755 "mwmparse.y"
2429 {
2430 (yyval.button).button = Button3Mask;
2431 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2432 (yyval.button).count = 1;
2433 }
2434 break;
2435
2436 case 66:
2437 #line 761 "mwmparse.y"
2438 {
2439 (yyval.button).button = Button3Mask;
2440 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2441 (yyval.button).count = 2;
2442 }
2443 break;
2444
2445 case 67:
2446 #line 767 "mwmparse.y"
2447 {
2448 (yyval.button).button = Button4Mask;
2449 (yyval.button).event = ButtonPressMask;
2450 (yyval.button).count = 0;
2451 }
2452 break;
2453
2454 case 68:
2455 #line 773 "mwmparse.y"
2456 {
2457 (yyval.button).button = Button4Mask;
2458 (yyval.button).event = ButtonReleaseMask;
2459 (yyval.button).count = 0;
2460 }
2461 break;
2462
2463 case 69:
2464 #line 779 "mwmparse.y"
2465 {
2466 (yyval.button).button = Button4Mask;
2467 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2468 (yyval.button).count = 1;
2469 }
2470 break;
2471
2472 case 70:
2473 #line 785 "mwmparse.y"
2474 {
2475 (yyval.button).button = Button4Mask;
2476 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2477 (yyval.button).count = 2;
2478 }
2479 break;
2480
2481 case 71:
2482 #line 791 "mwmparse.y"
2483 {
2484 (yyval.button).button = Button5Mask;
2485 (yyval.button).event = ButtonPressMask;
2486 (yyval.button).count = 0;
2487 }
2488 break;
2489
2490 case 72:
2491 #line 797 "mwmparse.y"
2492 {
2493 (yyval.button).button = Button5Mask;
2494 (yyval.button).event = ButtonReleaseMask;
2495 (yyval.button).count = 0;
2496 }
2497 break;
2498
2499 case 73:
2500 #line 803 "mwmparse.y"
2501 {
2502 (yyval.button).button = Button5Mask;
2503 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2504 (yyval.button).count = 1;
2505 }
2506 break;
2507
2508 case 74:
2509 #line 809 "mwmparse.y"
2510 {
2511 (yyval.button).button = Button5Mask;
2512 (yyval.button).event = ButtonPressMask|ButtonReleaseMask;
2513 (yyval.button).count = 2;
2514 }
2515 break;
2516
2517 case 75:
2518 #line 815 "mwmparse.y"
2519 {
2520 yyerror("Invalid button event name");
2521 (yyval.button).button = 0;
2522 (yyval.button).event = 0;
2523 (yyval.button).count = 0;
2524 }
2525 break;
2526
2527 case 76:
2528 #line 824 "mwmparse.y"
2529 { (yyval.label).type = IS_STRING; (yyval.label).string = (yyvsp[(1) - (1)].string); }
2530 break;
2531
2532 case 77:
2533 #line 826 "mwmparse.y"
2534 { (yyval.label).type = IS_BITMAP; (yyval.label).string = (yyvsp[(1) - (1)].string); }
2535 break;
2536
2537 case 78:
2538 #line 828 "mwmparse.y"
2539 {
2540 yyerror("Invalid label");
2541 (yyval.label).type = IS_STRING;
2542 (yyval.label).string = "";
2543 }
2544 break;
2545
2546 case 79:
2547 #line 836 "mwmparse.y"
2548 { (yyval.string) = (yyvsp[(2) - (2)].string); }
2549 break;
2550
2551 case 80:
2552 #line 840 "mwmparse.y"
2553 {
2554 if (strlen((yyvsp[(2) - (2)].string)) != 1) {
2555 yyerror("Invalid mnemonic specification");
2556 (yyval.key) = 0;
2557 }
2558 else {
2559 (yyval.key) = XStringToKeysym((yyvsp[(2) - (2)].string));
2560 }
2561 }
2562 break;
2563
2564 case 81:
2565 #line 850 "mwmparse.y"
2566 { (yyval.key) = 0; }
2567 break;
2568
2569 case 82:
2570 #line 854 "mwmparse.y"
2571 {
2572 (yyval.function).func = F_BEEP;
2573 (yyval.function).arg = "";
2574 }
2575 break;
2576
2577 case 83:
2578 #line 859 "mwmparse.y"
2579 {
2580 (yyval.function).func = F_CIRCULATE_DOWN;
2581 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2582 }
2583 break;
2584
2585 case 84:
2586 #line 864 "mwmparse.y"
2587 {
2588 (yyval.function).func = F_CIRCULATE_UP;
2589 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2590 }
2591 break;
2592
2593 case 85:
2594 #line 869 "mwmparse.y"
2595 {
2596 (yyval.function).func = F_EXEC;
2597 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2598 }
2599 break;
2600
2601 case 86:
2602 #line 874 "mwmparse.y"
2603 {
2604 (yyval.function).func = F_EXEC;
2605 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2606 }
2607 break;
2608
2609 case 87:
2610 #line 879 "mwmparse.y"
2611 {
2612 (yyval.function).func = F_FOCUS_COLOR;
2613 (yyval.function).arg = "";
2614 }
2615 break;
2616
2617 case 88:
2618 #line 884 "mwmparse.y"
2619 {
2620 (yyval.function).func = F_FOCUS_KEY;
2621 (yyval.function).arg = "";
2622 }
2623 break;
2624
2625 case 89:
2626 #line 889 "mwmparse.y"
2627 {
2628 (yyval.function).func = F_CLOSE;
2629 (yyval.function).arg = "";
2630 }
2631 break;
2632
2633 case 90:
2634 #line 894 "mwmparse.y"
2635 {
2636 (yyval.function).func = F_LOWER;
2637 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2638 }
2639 break;
2640
2641 case 91:
2642 #line 899 "mwmparse.y"
2643 {
2644 (yyval.function).func = F_MAXIMIZE;
2645 (yyval.function).arg = "";
2646 }
2647 break;
2648
2649 case 92:
2650 #line 904 "mwmparse.y"
2651 {
2652 (yyval.function).func = F_POPUP;
2653 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2654 }
2655 break;
2656
2657 case 93:
2658 #line 909 "mwmparse.y"
2659 {
2660 (yyval.function).func = F_ICONIFY;
2661 (yyval.function).arg = "";
2662 }
2663 break;
2664
2665 case 94:
2666 #line 914 "mwmparse.y"
2667 {
2668 (yyval.function).func = F_MOVE;
2669 (yyval.function).arg = "";
2670 }
2671 break;
2672
2673 case 95:
2674 #line 919 "mwmparse.y"
2675 {
2676 (yyval.function).func = F_NEXT_CMAP;
2677 (yyval.function).arg = "";
2678 }
2679 break;
2680
2681 case 96:
2682 #line 924 "mwmparse.y"
2683 {
2684 (yyval.function).func = F_NEXT_KEY;
2685 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2686 }
2687 break;
2688
2689 case 97:
2690 #line 929 "mwmparse.y"
2691 {
2692 (yyval.function).func = F_NOP;
2693 (yyval.function).arg = "";
2694 }
2695 break;
2696
2697 case 98:
2698 #line 934 "mwmparse.y"
2699 {
2700 (yyval.function).func = F_NORMALIZE;
2701 (yyval.function).arg = "";
2702 }
2703 break;
2704
2705 case 99:
2706 #line 939 "mwmparse.y"
2707 {
2708 (yyval.function).func = F_NORM_AND_RAISE;
2709 (yyval.function).arg = "";
2710 }
2711 break;
2712
2713 case 100:
2714 #line 944 "mwmparse.y"
2715 {
2716 (yyval.function).func = F_PACK_ICONS;
2717 (yyval.function).arg = "";
2718 }
2719 break;
2720
2721 case 101:
2722 #line 949 "mwmparse.y"
2723 {
2724 (yyval.function).func = F_PASS_KEYS;
2725 (yyval.function).arg = "";
2726 }
2727 break;
2728
2729 case 102:
2730 #line 954 "mwmparse.y"
2731 {
2732 (yyval.function).func = F_W_POPUP;
2733 (yyval.function).arg = "";
2734 }
2735 break;
2736
2737 case 103:
2738 #line 959 "mwmparse.y"
2739 {
2740 (yyval.function).func = F_PREV_CMAP;
2741 (yyval.function).arg = "";
2742 }
2743 break;
2744
2745 case 104:
2746 #line 964 "mwmparse.y"
2747 {
2748 (yyval.function).func = F_PREV_KEY;
2749 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2750 }
2751 break;
2752
2753 case 105:
2754 #line 969 "mwmparse.y"
2755 {
2756 (yyval.function).func = F_QUIT;
2757 (yyval.function).arg = "";
2758 }
2759 break;
2760
2761 case 106:
2762 #line 974 "mwmparse.y"
2763 {
2764 (yyval.function).func = F_RAISE;
2765 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2766 }
2767 break;
2768
2769 case 107:
2770 #line 979 "mwmparse.y"
2771 {
2772 (yyval.function).func = F_RAISELOWER;
2773 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2774 }
2775 break;
2776
2777 case 108:
2778 #line 984 "mwmparse.y"
2779 {
2780 (yyval.function).func = F_REFRESH;
2781 (yyval.function).arg = "";
2782 }
2783 break;
2784
2785 case 109:
2786 #line 989 "mwmparse.y"
2787 {
2788 (yyval.function).func = F_REFRESH_WIN;
2789 (yyval.function).arg = "";
2790 }
2791 break;
2792
2793 case 110:
2794 #line 994 "mwmparse.y"
2795 {
2796 (yyval.function).func = F_RESIZE;
2797 (yyval.function).arg = "";
2798 }
2799 break;
2800
2801 case 111:
2802 #line 999 "mwmparse.y"
2803 {
2804 (yyval.function).func = F_ICONIFY;
2805 (yyval.function).arg = "";
2806 }
2807 break;
2808
2809 case 112:
2810 #line 1004 "mwmparse.y"
2811 {
2812 (yyval.function).func = F_RESTORE_AND_RAISE;
2813 (yyval.function).arg = "";
2814 }
2815 break;
2816
2817 case 113:
2818 #line 1009 "mwmparse.y"
2819 {
2820 (yyval.function).func = F_RESTART;
2821 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2822 }
2823 break;
2824
2825 case 114:
2826 #line 1014 "mwmparse.y"
2827 {
2828 (yyval.function).func = F_SCREEN;
2829 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2830 }
2831 break;
2832
2833 case 115:
2834 #line 1019 "mwmparse.y"
2835 {
2836 (yyval.function).func = F_SEND_MSG;
2837 (yyval.function).arg = (yyvsp[(2) - (2)].string);
2838 }
2839 break;
2840
2841 case 116:
2842 #line 1024 "mwmparse.y"
2843 {
2844 (yyval.function).func = F_NOP;
2845 (yyval.function).arg = "";
2846 }
2847 break;
2848
2849 case 117:
2850 #line 1029 "mwmparse.y"
2851 {
2852 (yyval.function).func = F_SET_BEHAVIOR;
2853 (yyval.function).arg = "";
2854 }
2855 break;
2856
2857 case 118:
2858 #line 1034 "mwmparse.y"
2859 {
2860 (yyval.function).func = F_TITLE;
2861 (yyval.function).arg = "";
2862 }
2863 break;
2864
2865 case 119:
2866 #line 1039 "mwmparse.y"
2867 {
2868 (yyval.function).func = F_WINDOWLIST;
2869 (yyval.function).arg = "";
2870 }
2871 break;
2872
2873 case 120:
2874 #line 1044 "mwmparse.y"
2875 {
2876 yyerror("Invalid mnemonic, accelerator, or function");
2877 (yyval.function).func = F_NOP;
2878 (yyval.function).arg = "";
2879 }
2880 break;
2881
2882 case 121:
2883 #line 1052 "mwmparse.y"
2884 { (yyval.string) = (yyvsp[(1) - (1)].string); }
2885 break;
2886
2887 case 122:
2888 #line 1054 "mwmparse.y"
2889 { (yyval.string) = ""; }
2890 break;
2891
2892 case 123:
2893 #line 1058 "mwmparse.y"
2894 { (yyval.string) = (yyvsp[(2) - (2)].string); }
2895 break;
2896
2897 case 124:
2898 #line 1060 "mwmparse.y"
2899 { (yyval.string) = "ROOT"; }
2900 break;
2901
2902 case 125:
2903 #line 1062 "mwmparse.y"
2904 { (yyval.string) = "WINDOW"; }
2905 break;
2906
2907 case 126:
2908 #line 1064 "mwmparse.y"
2909 { (yyval.string) = "TRANSIENT"; }
2910 break;
2911
2912 case 127:
2913 #line 1066 "mwmparse.y"
2914 { (yyval.string) = "ICON"; }
2915 break;
2916
2917 case 128:
2918 #line 1068 "mwmparse.y"
2919 { (yyval.string) = "WITHIN"; }
2920 break;
2921
2922 case 129:
2923 #line 1070 "mwmparse.y"
2924 { (yyval.string) = "FREE_FAMILY"; }
2925 break;
2926
2927 case 130:
2928 #line 1072 "mwmparse.y"
2929 { (yyval.string) = "NEXT"; }
2930 break;
2931
2932 case 131:
2933 #line 1074 "mwmparse.y"
2934 { (yyval.string) = "PREV"; }
2935 break;
2936
2937 case 132:
2938 #line 1076 "mwmparse.y"
2939 { (yyval.string) = "BACK"; }
2940 break;
2941
2942 case 133:
2943 #line 1079 "mwmparse.y"
2944 { (yyval.string) = (yyvsp[(1) - (1)].string); }
2945 break;
2946
2947
2948 /* Line 1267 of yacc.c. */
2949 #line 2950 "mwmparse.c"
2950 default: break;
2951 }
2952 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2953
2954 YYPOPSTACK (yylen);
2955 yylen = 0;
2956 YY_STACK_PRINT (yyss, yyssp);
2957
2958 *++yyvsp = yyval;
2959
2960
2961 /* Now `shift' the result of the reduction. Determine what state
2962 that goes to, based on the state we popped back to and the rule
2963 number reduced by. */
2964
2965 yyn = yyr1[yyn];
2966
2967 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2968 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2969 yystate = yytable[yystate];
2970 else
2971 yystate = yydefgoto[yyn - YYNTOKENS];
2972
2973 goto yynewstate;
2974
2975
2976 /*------------------------------------.
2977 | yyerrlab -- here on detecting error |
2978 `------------------------------------*/
2979 yyerrlab:
2980 /* If not already recovering from an error, report this error. */
2981 if (!yyerrstatus)
2982 {
2983 ++yynerrs;
2984 #if ! YYERROR_VERBOSE
2985 yyerror (YY_("syntax error"));
2986 #else
2987 {
2988 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2989 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2990 {
2991 YYSIZE_T yyalloc = 2 * yysize;
2992 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2993 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2994 if (yymsg != yymsgbuf)
2995 YYSTACK_FREE (yymsg);
2996 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2997 if (yymsg)
2998 yymsg_alloc = yyalloc;
2999 else
3000 {
3001 yymsg = yymsgbuf;
3002 yymsg_alloc = sizeof yymsgbuf;
3003 }
3004 }
3005
3006 if (0 < yysize && yysize <= yymsg_alloc)
3007 {
3008 (void) yysyntax_error (yymsg, yystate, yychar);
3009 yyerror (yymsg);
3010 }
3011 else
3012 {
3013 yyerror (YY_("syntax error"));
3014 if (yysize != 0)
3015 goto yyexhaustedlab;
3016 }
3017 }
3018 #endif
3019 }
3020
3021
3022
3023 if (yyerrstatus == 3)
3024 {
3025 /* If just tried and failed to reuse look-ahead token after an
3026 error, discard it. */
3027
3028 if (yychar <= YYEOF)
3029 {
3030 /* Return failure if at end of input. */
3031 if (yychar == YYEOF)
3032 YYABORT;
3033 }
3034 else
3035 {
3036 yydestruct ("Error: discarding",
3037 yytoken, &yylval);
3038 yychar = YYEMPTY;
3039 }
3040 }
3041
3042 /* Else will try to reuse look-ahead token after shifting the error
3043 token. */
3044 goto yyerrlab1;
3045
3046
3047 /*---------------------------------------------------.
3048 | yyerrorlab -- error raised explicitly by YYERROR. |
3049 `---------------------------------------------------*/
3050 yyerrorlab:
3051
3052 /* Pacify compilers like GCC when the user code never invokes
3053 YYERROR and the label yyerrorlab therefore never appears in user
3054 code. */
3055 if (/*CONSTCOND*/ 0)
3056 goto yyerrorlab;
3057
3058 /* Do not reclaim the symbols of the rule which action triggered
3059 this YYERROR. */
3060 YYPOPSTACK (yylen);
3061 yylen = 0;
3062 YY_STACK_PRINT (yyss, yyssp);
3063 yystate = *yyssp;
3064 goto yyerrlab1;
3065
3066
3067 /*-------------------------------------------------------------.
3068 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3069 `-------------------------------------------------------------*/
3070 yyerrlab1:
3071 yyerrstatus = 3; /* Each real token shifted decrements this. */
3072
3073 for (;;)
3074 {
3075 yyn = yypact[yystate];
3076 if (yyn != YYPACT_NINF)
3077 {
3078 yyn += YYTERROR;
3079 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3080 {
3081 yyn = yytable[yyn];
3082 if (0 < yyn)
3083 break;
3084 }
3085 }
3086
3087 /* Pop the current state because it cannot handle the error token. */
3088 if (yyssp == yyss)
3089 YYABORT;
3090
3091
3092 yydestruct ("Error: popping",
3093 yystos[yystate], yyvsp);
3094 YYPOPSTACK (1);
3095 yystate = *yyssp;
3096 YY_STACK_PRINT (yyss, yyssp);
3097 }
3098
3099 if (yyn == YYFINAL)
3100 YYACCEPT;
3101
3102 *++yyvsp = yylval;
3103
3104
3105 /* Shift the error token. */
3106 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3107
3108 yystate = yyn;
3109 goto yynewstate;
3110
3111
3112 /*-------------------------------------.
3113 | yyacceptlab -- YYACCEPT comes here. |
3114 `-------------------------------------*/
3115 yyacceptlab:
3116 yyresult = 0;
3117 goto yyreturn;
3118
3119 /*-----------------------------------.
3120 | yyabortlab -- YYABORT comes here. |
3121 `-----------------------------------*/
3122 yyabortlab:
3123 yyresult = 1;
3124 goto yyreturn;
3125
3126 #ifndef yyoverflow
3127 /*-------------------------------------------------.
3128 | yyexhaustedlab -- memory exhaustion comes here. |
3129 `-------------------------------------------------*/
3130 yyexhaustedlab:
3131 yyerror (YY_("memory exhausted"));
3132 yyresult = 2;
3133 /* Fall through. */
3134 #endif
3135
3136 yyreturn:
3137 if (yychar != YYEOF && yychar != YYEMPTY)
3138 yydestruct ("Cleanup: discarding lookahead",
3139 yytoken, &yylval);
3140 /* Do not reclaim the symbols of the rule which action triggered
3141 this YYABORT or YYACCEPT. */
3142 YYPOPSTACK (yylen);
3143 YY_STACK_PRINT (yyss, yyssp);
3144 while (yyssp != yyss)
3145 {
3146 yydestruct ("Cleanup: popping",
3147 yystos[*yyssp], yyvsp);
3148 YYPOPSTACK (1);
3149 }
3150 #ifndef yyoverflow
3151 if (yyss != yyssa)
3152 YYSTACK_FREE (yyss);
3153 #endif
3154 #if YYERROR_VERBOSE
3155 if (yymsg != yymsgbuf)
3156 YYSTACK_FREE (yymsg);
3157 #endif
3158 /* Make sure YYID is used. */
3159 return YYID (yyresult);
3160 }
3161
3162
3163 #line 1081 "mwmparse.y"
3164
3165
3166 /*
3167 * these to variables are used by the parser to control input
3168 */
3169 #define MAX_UNGET 1024
3170 static const char *curpos;
3171 static const char *endpos;
3172 static const char *input_buf;
3173 static char unget[MAX_UNGET];
3174 static int upos = 0;
3175
3176 static char *_MwmRootMenu = DEFAULT_MWM_ROOT_MENU;
3177 static char *_MwmKeyBindings = DEFAULT_MWM_KEY_BINDINGS;
3178 static char *_MwmWindowMenu = DEFAULT_MWM_WINDOW_MENU;
3179 static char *_MwmBehaviorKey = MWM_BEHAVIOR_KEY_BINDINGS;
3180 static char *_MwmBuiltinButtonBindings = BUILTIN_MWM_BUTTON_BINDINGS;
3181 static char *_MwmBuiltinMenuButtonBindings = BUILTIN_MENU_BUTTON_BINDINGS;
3182 static char *_MwmBuiltinKillButtonBindings = BUILTIN_KILL_BUTTON_BINDINGS;
3183 static char *_MwmBuiltinIconButtonBindings = BUILTIN_ICON_BUTTON_BINDINGS;
3184
3185 void
yyerror(const char * fmt,...)3186 yyerror(const char *fmt, ...) {
3187 va_list arg_list;
3188
3189 va_start(arg_list, fmt);
3190 vfprintf(stderr, fmt, arg_list);
3191 va_end(arg_list);
3192 fprintf(stderr, " at line %d\n", lineno);
3193 }
3194
3195
3196 char
mwm_getc(void)3197 mwm_getc(void) {
3198 char c;
3199
3200 if (upos) {
3201 upos--;
3202 c = unget[upos];
3203 if (c == '\n')
3204 lineno++;
3205 return c;
3206 }
3207 if (curpos >= endpos)
3208 return 0;
3209 else if (*curpos == 0) {
3210 curpos++;
3211 return 0;
3212 }
3213 c = *curpos;
3214 curpos++;
3215 if (c == '\n')
3216 lineno++;
3217 return c;
3218 }
3219
3220
3221 void
mwm_putc(char c)3222 mwm_putc(char c) {
3223 printf("OUTPUT: %c\n", c);
3224 }
3225
3226
3227 void
mwm_unputc(char c)3228 mwm_unputc(char c) {
3229 if (upos == MAX_UNGET) {
3230 yyerror("Lexer can't back up anymore.\n");
3231 return;
3232 }
3233 if (c == '\n')
3234 lineno--;
3235 unget[upos] = c;
3236 upos++;
3237 }
3238
3239
3240 int
PARSE_buf(ScreenInfo * scr,char * buffer)3241 PARSE_buf(ScreenInfo *scr, char *buffer) {
3242 pscr = scr;
3243 lineno = 1;
3244 curpos = input_buf = buffer;
3245 endpos = input_buf + strlen(input_buf);
3246 upos = 0;
3247 return yyparse();
3248 }
3249
3250
3251 static void
do_standard(ScreenInfo * scr)3252 do_standard(ScreenInfo *scr)
3253 {
3254 skip_test = True;
3255
3256 PARSE_buf(scr, _MwmRootMenu);
3257 PARSE_buf(scr, _MwmWindowMenu);
3258 PARSE_buf(scr, _MwmKeyBindings);
3259 PARSE_buf(scr, _MwmBehaviorKey);
3260
3261 /* a certain amount seems to be expected as builtin */
3262 PARSE_buf(scr, _MwmBuiltinButtonBindings);
3263 if (Mwm.w_menu_button_click)
3264 PARSE_buf(scr, _MwmBuiltinMenuButtonBindings);
3265 if (Mwm.w_menu_button_click_2)
3266 PARSE_buf(scr, _MwmBuiltinKillButtonBindings);
3267 if (Mwm.icon_click)
3268 PARSE_buf(scr, _MwmBuiltinIconButtonBindings);
3269
3270 PROP_SetBehavior(scr, False);
3271 }
3272
3273
3274 static void
do_custom(ScreenInfo * scr)3275 do_custom(ScreenInfo *scr)
3276 {
3277 char *configfile, *ptr;
3278 int fd;
3279
3280 configfile=find_config_file();
3281 if (configfile==NULL)
3282 {
3283 yyerror("Cannot find configuration file. "
3284 "Using builtin defaults.\n", configfile);
3285 do_standard(scr);
3286 return;
3287 }
3288
3289 #ifdef __EMX__
3290 if ((fd = open(configfile, O_RDONLY|O_TEXT)) < 0)
3291 #else
3292 if ((fd = open(configfile, O_RDONLY)) < 0)
3293 #endif
3294 {
3295 yyerror("Cannot open configuration file '%s'. "
3296 "Using builtin defaults.\n", configfile);
3297 do_standard(scr);
3298 }
3299 else {
3300 int bytes_read, statrc;
3301 struct stat st;
3302
3303 if (debugging)
3304 fprintf(stderr, "Reading configuration from '%s'\n", configfile);
3305
3306 statrc=stat(configfile, &st);
3307 ptr = XtMalloc(st.st_size + 1);
3308 bytes_read=read(fd, ptr, st.st_size);
3309 close(fd);
3310
3311 skip_test = False;
3312 ptr[bytes_read] = '\0';
3313 PARSE_buf(scr, ptr);
3314
3315 /* a certain amount seems to be expected as builtin */
3316 skip_test = True;
3317
3318 PARSE_buf(scr, _MwmBuiltinButtonBindings);
3319 if (Mwm.w_menu_button_click)
3320 PARSE_buf(scr, _MwmBuiltinMenuButtonBindings);
3321 if (Mwm.w_menu_button_click_2)
3322 PARSE_buf(scr, _MwmBuiltinKillButtonBindings);
3323 if (Mwm.icon_click)
3324 PARSE_buf(scr, _MwmBuiltinIconButtonBindings);
3325
3326 PROP_SetBehavior(scr, True);
3327
3328 XtFree(ptr);
3329 }
3330
3331 XtFree(configfile);
3332 }
3333
3334 void
PARSE_mwmrc(ScreenInfo * scr)3335 PARSE_mwmrc(ScreenInfo *scr) {
3336 int flag;
3337
3338 key_bind_found = False;
3339 button_bind_found = False;
3340 key_bind_match = False;
3341 button_bind_match = False;
3342
3343 if ((flag = PROP_GetBehavior(scr)) & MWM_INFO_STARTUP_CUSTOM) {
3344 if (debugging)
3345 printf("parsing custom file.\n");
3346 do_custom(scr);
3347 }
3348 else if (flag & MWM_INFO_STARTUP_STANDARD) {
3349 if (debugging)
3350 printf("parsing standard bindings.\n");
3351 do_standard(scr);
3352 }
3353 else {
3354 if (debugging)
3355 printf("parsing custom file by default.\n");
3356 do_custom(scr);
3357 }
3358
3359 return;
3360 }
3361
3362