1eb0fc745e5b2e14aed49a8dcc601db4c1d9100b
[reactos.git] / reactos / tools / wrc / y.tab.c
1 /* A Bison parser, made by GNU Bison 1.875c. */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
25
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36 /* Identify Bison output. */
37 #define YYBISON 1
38
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
41
42 /* Pure parsers. */
43 #define YYPURE 0
44
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
47
48
49
50 /* Tokens. */
51 #ifndef YYTOKENTYPE
52 # define YYTOKENTYPE
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
54 know about them. */
55 enum yytokentype {
56 tNL = 258,
57 tNUMBER = 259,
58 tLNUMBER = 260,
59 tSTRING = 261,
60 tIDENT = 262,
61 tFILENAME = 263,
62 tRAWDATA = 264,
63 tACCELERATORS = 265,
64 tBITMAP = 266,
65 tCURSOR = 267,
66 tDIALOG = 268,
67 tDIALOGEX = 269,
68 tMENU = 270,
69 tMENUEX = 271,
70 tMESSAGETABLE = 272,
71 tRCDATA = 273,
72 tVERSIONINFO = 274,
73 tSTRINGTABLE = 275,
74 tFONT = 276,
75 tFONTDIR = 277,
76 tICON = 278,
77 tAUTO3STATE = 279,
78 tAUTOCHECKBOX = 280,
79 tAUTORADIOBUTTON = 281,
80 tCHECKBOX = 282,
81 tDEFPUSHBUTTON = 283,
82 tPUSHBUTTON = 284,
83 tRADIOBUTTON = 285,
84 tSTATE3 = 286,
85 tGROUPBOX = 287,
86 tCOMBOBOX = 288,
87 tLISTBOX = 289,
88 tSCROLLBAR = 290,
89 tCONTROL = 291,
90 tEDITTEXT = 292,
91 tRTEXT = 293,
92 tCTEXT = 294,
93 tLTEXT = 295,
94 tBLOCK = 296,
95 tVALUE = 297,
96 tSHIFT = 298,
97 tALT = 299,
98 tASCII = 300,
99 tVIRTKEY = 301,
100 tGRAYED = 302,
101 tCHECKED = 303,
102 tINACTIVE = 304,
103 tNOINVERT = 305,
104 tPURE = 306,
105 tIMPURE = 307,
106 tDISCARDABLE = 308,
107 tLOADONCALL = 309,
108 tPRELOAD = 310,
109 tFIXED = 311,
110 tMOVEABLE = 312,
111 tCLASS = 313,
112 tCAPTION = 314,
113 tCHARACTERISTICS = 315,
114 tEXSTYLE = 316,
115 tSTYLE = 317,
116 tVERSION = 318,
117 tLANGUAGE = 319,
118 tFILEVERSION = 320,
119 tPRODUCTVERSION = 321,
120 tFILEFLAGSMASK = 322,
121 tFILEOS = 323,
122 tFILETYPE = 324,
123 tFILEFLAGS = 325,
124 tFILESUBTYPE = 326,
125 tMENUBARBREAK = 327,
126 tMENUBREAK = 328,
127 tMENUITEM = 329,
128 tPOPUP = 330,
129 tSEPARATOR = 331,
130 tHELP = 332,
131 tTOOLBAR = 333,
132 tBUTTON = 334,
133 tBEGIN = 335,
134 tEND = 336,
135 tDLGINIT = 337,
136 tNOT = 338,
137 pUPM = 339
138 };
139 #endif
140 #define tNL 258
141 #define tNUMBER 259
142 #define tLNUMBER 260
143 #define tSTRING 261
144 #define tIDENT 262
145 #define tFILENAME 263
146 #define tRAWDATA 264
147 #define tACCELERATORS 265
148 #define tBITMAP 266
149 #define tCURSOR 267
150 #define tDIALOG 268
151 #define tDIALOGEX 269
152 #define tMENU 270
153 #define tMENUEX 271
154 #define tMESSAGETABLE 272
155 #define tRCDATA 273
156 #define tVERSIONINFO 274
157 #define tSTRINGTABLE 275
158 #define tFONT 276
159 #define tFONTDIR 277
160 #define tICON 278
161 #define tAUTO3STATE 279
162 #define tAUTOCHECKBOX 280
163 #define tAUTORADIOBUTTON 281
164 #define tCHECKBOX 282
165 #define tDEFPUSHBUTTON 283
166 #define tPUSHBUTTON 284
167 #define tRADIOBUTTON 285
168 #define tSTATE3 286
169 #define tGROUPBOX 287
170 #define tCOMBOBOX 288
171 #define tLISTBOX 289
172 #define tSCROLLBAR 290
173 #define tCONTROL 291
174 #define tEDITTEXT 292
175 #define tRTEXT 293
176 #define tCTEXT 294
177 #define tLTEXT 295
178 #define tBLOCK 296
179 #define tVALUE 297
180 #define tSHIFT 298
181 #define tALT 299
182 #define tASCII 300
183 #define tVIRTKEY 301
184 #define tGRAYED 302
185 #define tCHECKED 303
186 #define tINACTIVE 304
187 #define tNOINVERT 305
188 #define tPURE 306
189 #define tIMPURE 307
190 #define tDISCARDABLE 308
191 #define tLOADONCALL 309
192 #define tPRELOAD 310
193 #define tFIXED 311
194 #define tMOVEABLE 312
195 #define tCLASS 313
196 #define tCAPTION 314
197 #define tCHARACTERISTICS 315
198 #define tEXSTYLE 316
199 #define tSTYLE 317
200 #define tVERSION 318
201 #define tLANGUAGE 319
202 #define tFILEVERSION 320
203 #define tPRODUCTVERSION 321
204 #define tFILEFLAGSMASK 322
205 #define tFILEOS 323
206 #define tFILETYPE 324
207 #define tFILEFLAGS 325
208 #define tFILESUBTYPE 326
209 #define tMENUBARBREAK 327
210 #define tMENUBREAK 328
211 #define tMENUITEM 329
212 #define tPOPUP 330
213 #define tSEPARATOR 331
214 #define tHELP 332
215 #define tTOOLBAR 333
216 #define tBUTTON 334
217 #define tBEGIN 335
218 #define tEND 336
219 #define tDLGINIT 337
220 #define tNOT 338
221 #define pUPM 339
222
223
224
225
226 /* Copy the first part of user declarations. */
227 #line 1 "parser.y"
228
229 /*
230 * Copyright 1994 Martin von Loewis
231 * Copyright 1998-2000 Bertho A. Stultiens (BS)
232 * 1999 Juergen Schmied (JS)
233 *
234 * This library is free software; you can redistribute it and/or
235 * modify it under the terms of the GNU Lesser General Public
236 * License as published by the Free Software Foundation; either
237 * version 2.1 of the License, or (at your option) any later version.
238 *
239 * This library is distributed in the hope that it will be useful,
240 * but WITHOUT ANY WARRANTY; without even the implied warranty of
241 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
242 * Lesser General Public License for more details.
243 *
244 * You should have received a copy of the GNU Lesser General Public
245 * License along with this library; if not, write to the Free Software
246 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
247 *
248 * History:
249 * 24-Jul-2000 BS - Made a fix for broken Berkeley yacc on
250 * non-terminals (see cjunk rule).
251 * 21-May-2000 BS - Partial implementation of font resources.
252 * - Corrected language propagation for binary
253 * resources such as bitmaps, icons, cursors,
254 * userres and rcdata. The language is now
255 * correct in .res files.
256 * - Fixed reading the resource name as ident,
257 * so that it may overlap keywords.
258 * 20-May-2000 BS - Implemented animated cursors and icons
259 * resource types.
260 * 30-Apr-2000 BS - Reintegration into the wine-tree
261 * 14-Jan-2000 BS - Redid the usertype resources so that they
262 * are compatible.
263 * 02-Jan-2000 BS - Removed the preprocessor from the grammar
264 * except for the # command (line numbers).
265 *
266 * 06-Nov-1999 JS - see CHANGES
267 *
268 * 29-Dec-1998 AdH - Grammar and function extensions.
269 * grammar: TOOLBAR resources, Named ICONs in
270 * DIALOGS
271 * functions: semantic actions for the grammar
272 * changes, resource files can now be anywhere
273 * on the include path instead of just in the
274 * current directory
275 *
276 * 20-Jun-1998 BS - Fixed a bug in load_file() where the name was not
277 * printed out correctly.
278 *
279 * 17-Jun-1998 BS - Fixed a bug in CLASS statement parsing which should
280 * also accept a tSTRING as argument.
281 *
282 * 25-May-1998 BS - Found out that I need to support language, version
283 * and characteristics in inline resources (bitmap,
284 * cursor, etc) but they can also be specified with
285 * a filename. This renders my filename-scanning scheme
286 * worthless. Need to build newline parsing to solve
287 * this one.
288 * It will come with version 1.1.0 (sigh).
289 *
290 * 19-May-1998 BS - Started to build a builtin preprocessor
291 *
292 * 30-Apr-1998 BS - Redid the stringtable parsing/handling. My previous
293 * ideas had some serious flaws.
294 *
295 * 27-Apr-1998 BS - Removed a lot of dead comments and put it in a doc
296 * file.
297 *
298 * 21-Apr-1998 BS - Added correct behavior for cursors and icons.
299 * - This file is growing too big. It is time to strip
300 * things and put it in a support file.
301 *
302 * 19-Apr-1998 BS - Tagged the stringtable resource so that only one
303 * resource will be created. This because the table
304 * has a different layout than other resources. The
305 * table has to be sorted, and divided into smaller
306 * resource entries (see comment in source).
307 *
308 * 17-Apr-1998 BS - Almost all strings, including identifiers, are parsed
309 * as string_t which include unicode strings upon
310 * input.
311 * - Parser now emits a warning when compiling win32
312 * extensions in win16 mode.
313 *
314 * 16-Apr-1998 BS - Raw data elements are now *optionally* separated
315 * by commas. Read the comments in file sq2dq.l.
316 * - FIXME: there are instances in the source that rely
317 * on the fact that int==32bit and pointers are int size.
318 * - Fixed the conflict in menuex by changing a rule
319 * back into right recursion. See note in source.
320 * - UserType resources cannot have an expression as its
321 * typeclass. See note in source.
322 *
323 * 15-Apr-1998 BS - Changed all right recursion into left recursion to
324 * get reduction of the parsestack.
325 * This also helps communication between bison and flex.
326 * Main advantage is that the Empty rule gets reduced
327 * first, which is used to allocate/link things.
328 * It also added a shift/reduce conflict in the menuex
329 * handling, due to expression/option possibility,
330 * although not serious.
331 *
332 * 14-Apr-1998 BS - Redone almost the entire parser. We're not talking
333 * about making it more efficient, but readable (for me)
334 * and slightly easier to expand/change.
335 * This is done primarily by using more reduce states
336 * with many (intuitive) types for the various resource
337 * statements.
338 * - Added expression handling for all resources where a
339 * number is accepted (not only for win32). Also added
340 * multiply and division (not MS compatible, but handy).
341 * Unary minus introduced a shift/reduce conflict, but
342 * it is not serious.
343 *
344 * 13-Apr-1998 BS - Reordered a lot of things
345 * - Made the source more readable
346 * - Added Win32 resource definitions
347 * - Corrected syntax problems with an old yacc (;)
348 * - Added extra comment about grammar
349 */
350 #include "config.h"
351
352 #include <stdio.h>
353 #include <stdlib.h>
354 #include <stdarg.h>
355 #include <assert.h>
356 #include <ctype.h>
357 #include <string.h>
358 #ifdef HAVE_ALLOCA_H
359 #include <alloca.h>
360 #endif
361
362 #include "wrc.h"
363 #include "utils.h"
364 #include "newstruc.h"
365 #include "dumpres.h"
366 #include "wine/wpp.h"
367 #include "wine/unicode.h"
368 #include "parser.h"
369 #include "windef.h"
370 #include "winbase.h"
371 #include "wingdi.h"
372 #include "winuser.h"
373
374 #if defined(YYBYACC)
375 /* Berkeley yacc (byacc) doesn't seem to know about these */
376 /* Some *BSD supplied versions do define these though */
377 # ifndef YYEMPTY
378 # define YYEMPTY (-1) /* Empty lookahead value of yychar */
379 # endif
380 # ifndef YYLEX
381 # define YYLEX yylex()
382 # endif
383
384 #elif defined(YYBISON)
385 /* Bison was used for original development */
386 /* #define YYEMPTY -2 */
387 /* #define YYLEX yylex() */
388
389 #else
390 /* No yacc we know yet */
391 # if !defined(YYEMPTY) || !defined(YYLEX)
392 # error Yacc version/type unknown. This version needs to be verified for settings of YYEMPTY and YYLEX.
393 # elif defined(__GNUC__) /* gcc defines the #warning directive */
394 # warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but is not tested
395 /* #else we just take a chance that it works... */
396 # endif
397 #endif
398
399 int want_nl = 0; /* Signal flex that we need the next newline */
400 int want_id = 0; /* Signal flex that we need the next identifier */
401 stringtable_t *tagstt; /* Stringtable tag.
402 * It is set while parsing a stringtable to one of
403 * the stringtables in the sttres list or a new one
404 * if the language was not parsed before.
405 */
406 stringtable_t *sttres; /* Stringtable resources. This holds the list of
407 * stringtables with different lanuages
408 */
409 static int dont_want_id = 0; /* See language parsing for details */
410
411 /* Set to the current options of the currently scanning stringtable */
412 static int *tagstt_memopt;
413 static characts_t *tagstt_characts;
414 static version_t *tagstt_version;
415
416 static const char riff[4] = "RIFF"; /* RIFF file magic for animated cursor/icon */
417
418 /* Prototypes of here defined functions */
419 static event_t *get_event_head(event_t *p);
420 static control_t *get_control_head(control_t *p);
421 static ver_value_t *get_ver_value_head(ver_value_t *p);
422 static ver_block_t *get_ver_block_head(ver_block_t *p);
423 static resource_t *get_resource_head(resource_t *p);
424 static menuex_item_t *get_itemex_head(menuex_item_t *p);
425 static menu_item_t *get_item_head(menu_item_t *p);
426 static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str);
427 static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i);
428 static raw_data_t *merge_raw_data_long(raw_data_t *r1, int i);
429 static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
430 static raw_data_t *str2raw_data(string_t *str);
431 static raw_data_t *int2raw_data(int i);
432 static raw_data_t *long2raw_data(int i);
433 static raw_data_t *load_file(string_t *name, language_t *lang);
434 static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
435 static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
436 static event_t *add_event(int key, int id, int flags, event_t *prev);
437 static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg);
438 static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg);
439 static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg);
440 static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg);
441 static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg);
442 static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg);
443 static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg);
444 static dialogex_t *dialogex_exstyle(style_t *st, dialogex_t *dlg);
445 static dialogex_t *dialogex_style(style_t *st, dialogex_t *dlg);
446 static name_id_t *convert_ctlclass(name_id_t *cls);
447 static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
448 static dialog_t *dialog_version(version_t *v, dialog_t *dlg);
449 static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
450 static dialog_t *dialog_language(language_t *l, dialog_t *dlg);
451 static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
452 static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
453 static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg);
454 static dialog_t *dialog_caption(string_t *s, dialog_t *dlg);
455 static dialog_t *dialog_exstyle(style_t * st, dialog_t *dlg);
456 static dialog_t *dialog_style(style_t * st, dialog_t *dlg);
457 static resource_t *build_stt_resources(stringtable_t *stthead);
458 static stringtable_t *find_stringtable(lvc_t *lvc);
459 static toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec);
460 static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems);
461 static string_t *make_filename(string_t *s);
462 static resource_t *build_fontdirs(resource_t *tail);
463 static resource_t *build_fontdir(resource_t **fnt, int nfnt);
464 static int rsrcid_to_token(int lookahead);
465
466
467
468 /* Enabling traces. */
469 #ifndef YYDEBUG
470 # define YYDEBUG 1
471 #endif
472
473 /* Enabling verbose error messages. */
474 #ifdef YYERROR_VERBOSE
475 # undef YYERROR_VERBOSE
476 # define YYERROR_VERBOSE 1
477 #else
478 # define YYERROR_VERBOSE 0
479 #endif
480
481 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
482 #line 240 "parser.y"
483 typedef union YYSTYPE {
484 string_t *str;
485 int num;
486 int *iptr;
487 char *cptr;
488 resource_t *res;
489 accelerator_t *acc;
490 bitmap_t *bmp;
491 dialog_t *dlg;
492 dialogex_t *dlgex;
493 font_t *fnt;
494 fontdir_t *fnd;
495 menu_t *men;
496 menuex_t *menex;
497 rcdata_t *rdt;
498 stringtable_t *stt;
499 stt_entry_t *stte;
500 user_t *usr;
501 messagetable_t *msg;
502 versioninfo_t *veri;
503 control_t *ctl;
504 name_id_t *nid;
505 font_id_t *fntid;
506 language_t *lan;
507 version_t *ver;
508 characts_t *chars;
509 event_t *event;
510 menu_item_t *menitm;
511 menuex_item_t *menexitm;
512 itemex_opt_t *exopt;
513 raw_data_t *raw;
514 lvc_t *lvc;
515 ver_value_t *val;
516 ver_block_t *blk;
517 ver_words_t *verw;
518 toolbar_t *tlbar;
519 toolbar_item_t *tlbarItems;
520 dlginit_t *dginit;
521 style_pair_t *styles;
522 style_t *style;
523 ani_any_t *ani;
524 } YYSTYPE;
525 /* Line 191 of yacc.c. */
526 #line 527 "parser.tab.c"
527 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
528 # define YYSTYPE_IS_DECLARED 1
529 # define YYSTYPE_IS_TRIVIAL 1
530 #endif
531
532
533
534 /* Copy the second part of user declarations. */
535
536
537 /* Line 214 of yacc.c. */
538 #line 539 "parser.tab.c"
539
540 #if ! defined (yyoverflow) || YYERROR_VERBOSE
541
542 # ifndef YYFREE
543 # define YYFREE free
544 # endif
545 # ifndef YYMALLOC
546 # define YYMALLOC malloc
547 # endif
548
549 /* The parser invokes alloca or malloc; define the necessary symbols. */
550
551 # ifdef YYSTACK_USE_ALLOCA
552 # if YYSTACK_USE_ALLOCA
553 # define YYSTACK_ALLOC alloca
554 # endif
555 # else
556 # if defined (alloca) || defined (_ALLOCA_H)
557 # define YYSTACK_ALLOC alloca
558 # else
559 # ifdef __GNUC__
560 # define YYSTACK_ALLOC __builtin_alloca
561 # endif
562 # endif
563 # endif
564
565 # ifdef YYSTACK_ALLOC
566 /* Pacify GCC's `empty if-body' warning. */
567 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
568 # else
569 # if defined (__STDC__) || defined (__cplusplus)
570 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
571 # define YYSIZE_T size_t
572 # endif
573 # define YYSTACK_ALLOC YYMALLOC
574 # define YYSTACK_FREE YYFREE
575 # endif
576 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
577
578
579 #if (! defined (yyoverflow) \
580 && (! defined (__cplusplus) \
581 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
582
583 /* A type that is properly aligned for any stack member. */
584 union yyalloc
585 {
586 short yyss;
587 YYSTYPE yyvs;
588 };
589
590 /* The size of the maximum gap between one aligned stack and the next. */
591 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
592
593 /* The size of an array large to enough to hold all stacks, each with
594 N elements. */
595 # define YYSTACK_BYTES(N) \
596 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
597 + YYSTACK_GAP_MAXIMUM)
598
599 /* Copy COUNT objects from FROM to TO. The source and destination do
600 not overlap. */
601 # ifndef YYCOPY
602 # if defined (__GNUC__) && 1 < __GNUC__
603 # define YYCOPY(To, From, Count) \
604 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
605 # else
606 # define YYCOPY(To, From, Count) \
607 do \
608 { \
609 register YYSIZE_T yyi; \
610 for (yyi = 0; yyi < (Count); yyi++) \
611 (To)[yyi] = (From)[yyi]; \
612 } \
613 while (0)
614 # endif
615 # endif
616
617 /* Relocate STACK from its old location to the new one. The
618 local variables YYSIZE and YYSTACKSIZE give the old and new number of
619 elements in the stack, and YYPTR gives the new location of the
620 stack. Advance YYPTR to a properly aligned location for the next
621 stack. */
622 # define YYSTACK_RELOCATE(Stack) \
623 do \
624 { \
625 YYSIZE_T yynewbytes; \
626 YYCOPY (&yyptr->Stack, Stack, yysize); \
627 Stack = &yyptr->Stack; \
628 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
629 yyptr += yynewbytes / sizeof (*yyptr); \
630 } \
631 while (0)
632
633 #endif
634
635 #if defined (__STDC__) || defined (__cplusplus)
636 typedef signed char yysigned_char;
637 #else
638 typedef short yysigned_char;
639 #endif
640
641 /* YYFINAL -- State number of the termination state. */
642 #define YYFINAL 3
643 /* YYLAST -- Last index in YYTABLE. */
644 #define YYLAST 738
645
646 /* YYNTOKENS -- Number of terminals. */
647 #define YYNTOKENS 96
648 /* YYNNTS -- Number of nonterminals. */
649 #define YYNNTS 83
650 /* YYNRULES -- Number of rules. */
651 #define YYNRULES 257
652 /* YYNRULES -- Number of states. */
653 #define YYNSTATES 571
654
655 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
656 #define YYUNDEFTOK 2
657 #define YYMAXUTOK 339
658
659 #define YYTRANSLATE(YYX) \
660 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
661
662 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
663 static const unsigned char yytranslate[] =
664 {
665 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
668 2, 2, 2, 2, 2, 2, 2, 2, 85, 2,
669 94, 95, 88, 86, 93, 87, 2, 89, 2, 2,
670 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
671 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
672 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
674 2, 2, 2, 2, 84, 2, 2, 2, 2, 2,
675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
676 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
677 2, 2, 2, 2, 83, 2, 90, 2, 2, 2,
678 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
690 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
691 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
692 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
693 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
694 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
695 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
696 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
697 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
698 75, 76, 77, 78, 79, 80, 81, 82, 91, 92
699 };
700
701 #if YYDEBUG
702 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
703 YYRHS. */
704 static const unsigned short yyprhs[] =
705 {
706 0, 0, 3, 5, 6, 9, 12, 16, 20, 22,
707 23, 29, 30, 32, 34, 36, 38, 40, 42, 44,
708 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,
709 66, 68, 70, 72, 74, 76, 80, 84, 88, 92,
710 96, 100, 104, 108, 112, 114, 116, 123, 124, 130,
711 136, 137, 140, 142, 146, 148, 150, 152, 154, 156,
712 158, 172, 173, 177, 181, 185, 188, 192, 196, 199,
713 202, 205, 206, 210, 214, 218, 222, 226, 230, 234,
714 238, 242, 246, 250, 254, 258, 262, 266, 270, 274,
715 285, 298, 309, 310, 315, 322, 331, 349, 365, 370,
716 371, 374, 379, 383, 387, 389, 392, 394, 396, 411,
717 412, 416, 420, 424, 427, 430, 434, 438, 441, 444,
718 447, 448, 452, 456, 460, 464, 468, 472, 476, 480,
719 484, 488, 492, 496, 500, 504, 508, 512, 516, 527,
720 547, 564, 579, 592, 593, 595, 596, 599, 609, 610,
721 613, 618, 622, 623, 630, 634, 640, 641, 645, 649,
722 653, 657, 661, 665, 670, 674, 675, 680, 684, 690,
723 691, 694, 700, 707, 708, 711, 716, 723, 732, 737,
724 741, 742, 747, 748, 750, 757, 758, 768, 778, 782,
725 786, 790, 794, 798, 799, 802, 808, 809, 812, 814,
726 819, 824, 826, 830, 840, 841, 845, 848, 849, 852,
727 855, 857, 859, 861, 863, 865, 867, 869, 870, 873,
728 876, 879, 884, 887, 890, 895, 897, 899, 902, 904,
729 907, 909, 913, 917, 922, 926, 931, 935, 937, 939,
730 940, 942, 944, 948, 952, 956, 960, 964, 968, 972,
731 975, 978, 981, 985, 987, 989, 992, 994
732 };
733
734 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
735 static const short yyrhs[] =
736 {
737 97, 0, -1, 98, -1, -1, 98, 99, -1, 98,
738 3, -1, 175, 101, 104, -1, 7, 101, 104, -1,
739 151, -1, -1, 64, 100, 175, 93, 175, -1, -1,
740 175, -1, 7, -1, 102, -1, 6, -1, 116, -1,
741 106, -1, 107, -1, 121, -1, 132, -1, 113, -1,
742 109, -1, 110, -1, 108, -1, 142, -1, 146, -1,
743 111, -1, 112, -1, 162, -1, 114, -1, 155, -1,
744 8, -1, 7, -1, 6, -1, 11, 164, 173, -1,
745 12, 164, 173, -1, 23, 164, 173, -1, 21, 164,
746 173, -1, 22, 164, 173, -1, 17, 164, 173, -1,
747 18, 164, 173, -1, 82, 164, 173, -1, 115, 164,
748 173, -1, 4, -1, 7, -1, 10, 164, 167, 80,
749 117, 81, -1, -1, 117, 6, 93, 175, 118, -1,
750 117, 175, 93, 175, 118, -1, -1, 93, 119, -1,
751 120, -1, 119, 93, 120, -1, 50, -1, 43, -1,
752 36, -1, 44, -1, 45, -1, 46, -1, 13, 164,
753 175, 93, 175, 93, 175, 93, 175, 122, 80, 123,
754 81, -1, -1, 122, 62, 130, -1, 122, 61, 130,
755 -1, 122, 59, 6, -1, 122, 128, -1, 122, 58,
756 103, -1, 122, 15, 102, -1, 122, 168, -1, 122,
757 169, -1, 122, 170, -1, -1, 123, 36, 127, -1,
758 123, 37, 125, -1, 123, 34, 125, -1, 123, 33,
759 125, -1, 123, 35, 125, -1, 123, 27, 124, -1,
760 123, 28, 124, -1, 123, 32, 124, -1, 123, 29,
761 124, -1, 123, 30, 124, -1, 123, 24, 124, -1,
762 123, 31, 124, -1, 123, 25, 124, -1, 123, 26,
763 124, -1, 123, 40, 124, -1, 123, 39, 124, -1,
764 123, 38, 124, -1, 123, 23, 103, 154, 175, 93,
765 175, 93, 175, 126, -1, 6, 154, 175, 93, 175,
766 93, 175, 93, 175, 93, 175, 129, -1, 175, 93,
767 175, 93, 175, 93, 175, 93, 175, 129, -1, -1,
768 93, 175, 93, 175, -1, 93, 175, 93, 175, 93,
769 130, -1, 93, 175, 93, 175, 93, 130, 93, 130,
770 -1, 103, 154, 175, 93, 131, 93, 130, 93, 175,
771 93, 175, 93, 175, 93, 175, 93, 130, -1, 103,
772 154, 175, 93, 131, 93, 130, 93, 175, 93, 175,
773 93, 175, 93, 175, -1, 21, 175, 93, 6, -1,
774 -1, 93, 130, -1, 93, 130, 93, 130, -1, 130,
775 83, 130, -1, 94, 130, 95, -1, 176, -1, 91,
776 176, -1, 175, -1, 6, -1, 14, 164, 175, 93,
777 175, 93, 175, 93, 175, 139, 133, 80, 134, 81,
778 -1, -1, 133, 62, 130, -1, 133, 61, 130, -1,
779 133, 59, 6, -1, 133, 128, -1, 133, 140, -1,
780 133, 58, 103, -1, 133, 15, 102, -1, 133, 168,
781 -1, 133, 169, -1, 133, 170, -1, -1, 134, 36,
782 135, -1, 134, 37, 137, -1, 134, 34, 137, -1,
783 134, 33, 137, -1, 134, 35, 137, -1, 134, 27,
784 136, -1, 134, 28, 136, -1, 134, 32, 136, -1,
785 134, 29, 136, -1, 134, 30, 136, -1, 134, 24,
786 136, -1, 134, 31, 136, -1, 134, 25, 136, -1,
787 134, 26, 136, -1, 134, 40, 136, -1, 134, 39,
788 136, -1, 134, 38, 136, -1, 134, 23, 103, 154,
789 175, 93, 175, 93, 175, 126, -1, 103, 154, 175,
790 93, 131, 93, 130, 93, 175, 93, 175, 93, 175,
791 93, 175, 93, 130, 139, 138, -1, 103, 154, 175,
792 93, 131, 93, 130, 93, 175, 93, 175, 93, 175,
793 93, 175, 138, -1, 6, 154, 175, 93, 175, 93,
794 175, 93, 175, 93, 175, 129, 139, 138, -1, 175,
795 93, 175, 93, 175, 93, 175, 93, 175, 129, 139,
796 138, -1, -1, 171, -1, -1, 93, 175, -1, 21,
797 175, 93, 6, 93, 175, 93, 175, 141, -1, -1,
798 93, 175, -1, 15, 164, 167, 143, -1, 80, 144,
799 81, -1, -1, 144, 74, 6, 154, 175, 145, -1,
800 144, 74, 76, -1, 144, 75, 6, 145, 143, -1,
801 -1, 154, 48, 145, -1, 154, 47, 145, -1, 154,
802 77, 145, -1, 154, 49, 145, -1, 154, 72, 145,
803 -1, 154, 73, 145, -1, 16, 164, 167, 147, -1,
804 80, 148, 81, -1, -1, 148, 74, 6, 149, -1,
805 148, 74, 76, -1, 148, 75, 6, 150, 147, -1,
806 -1, 93, 175, -1, 93, 174, 93, 174, 145, -1,
807 93, 174, 93, 174, 93, 175, -1, -1, 93, 175,
808 -1, 93, 174, 93, 175, -1, 93, 174, 93, 174,
809 93, 175, -1, 93, 174, 93, 174, 93, 174, 93,
810 175, -1, 152, 80, 153, 81, -1, 20, 164, 167,
811 -1, -1, 153, 175, 154, 6, -1, -1, 93, -1,
812 19, 164, 156, 80, 157, 81, -1, -1, 156, 65,
813 175, 93, 175, 93, 175, 93, 175, -1, 156, 66,
814 175, 93, 175, 93, 175, 93, 175, -1, 156, 70,
815 175, -1, 156, 67, 175, -1, 156, 68, 175, -1,
816 156, 69, 175, -1, 156, 71, 175, -1, -1, 157,
817 158, -1, 41, 6, 80, 159, 81, -1, -1, 159,
818 160, -1, 158, -1, 42, 6, 93, 6, -1, 42,
819 6, 93, 161, -1, 175, -1, 161, 93, 175, -1,
820 78, 164, 175, 93, 175, 167, 80, 163, 81, -1,
821 -1, 163, 79, 175, -1, 163, 76, -1, -1, 164,
822 165, -1, 164, 166, -1, 55, -1, 57, -1, 53,
823 -1, 51, -1, 54, -1, 56, -1, 52, -1, -1,
824 167, 168, -1, 167, 169, -1, 167, 170, -1, 64,
825 175, 93, 175, -1, 60, 175, -1, 63, 175, -1,
826 167, 80, 172, 81, -1, 9, -1, 4, -1, 87,
827 4, -1, 5, -1, 87, 5, -1, 6, -1, 172,
828 154, 9, -1, 172, 154, 4, -1, 172, 154, 87,
829 4, -1, 172, 154, 5, -1, 172, 154, 87, 5,
830 -1, 172, 154, 6, -1, 105, -1, 171, -1, -1,
831 175, -1, 177, -1, 177, 86, 177, -1, 177, 87,
832 177, -1, 177, 83, 177, -1, 177, 85, 177, -1,
833 177, 88, 177, -1, 177, 89, 177, -1, 177, 84,
834 177, -1, 90, 177, -1, 87, 177, -1, 86, 177,
835 -1, 94, 177, 95, -1, 178, -1, 176, -1, 91,
836 178, -1, 4, -1, 5, -1
837 };
838
839 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
840 static const unsigned short yyrline[] =
841 {
842 0, 361, 361, 395, 396, 466, 472, 484, 494, 502,
843 502, 546, 552, 559, 569, 570, 579, 580, 581, 605,
844 606, 612, 613, 614, 615, 639, 640, 646, 647, 648,
845 649, 650, 654, 655, 656, 660, 664, 680, 702, 712,
846 720, 728, 732, 736, 747, 752, 761, 785, 786, 787,
847 796, 797, 800, 801, 804, 805, 806, 807, 808, 809,
848 814, 849, 850, 851, 852, 853, 854, 855, 856, 857,
849 858, 861, 862, 863, 864, 865, 866, 867, 868, 869,
850 870, 872, 873, 874, 875, 876, 877, 878, 879, 881,
851 891, 916, 938, 940, 945, 952, 963, 977, 992, 997,
852 998, 999, 1003, 1004, 1005, 1006, 1010, 1015, 1023, 1067,
853 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077,
854 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089,
855 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1100, 1110,
856 1135, 1151, 1179, 1202, 1203, 1206, 1207, 1211, 1218, 1219,
857 1223, 1246, 1250, 1251, 1260, 1266, 1285, 1286, 1287, 1288,
858 1289, 1290, 1291, 1295, 1320, 1324, 1325, 1341, 1347, 1367,
859 1368, 1372, 1380, 1391, 1392, 1396, 1402, 1410, 1430, 1471,
860 1482, 1483, 1516, 1518, 1523, 1539, 1540, 1550, 1560, 1567,
861 1574, 1581, 1588, 1598, 1599, 1608, 1616, 1617, 1626, 1631,
862 1637, 1646, 1647, 1651, 1677, 1678, 1683, 1692, 1693, 1703,
863 1718, 1719, 1720, 1721, 1724, 1725, 1726, 1730, 1731, 1739,
864 1747, 1765, 1772, 1776, 1780, 1795, 1796, 1797, 1798, 1799,
865 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1810, 1811, 1818,
866 1819, 1823, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833,
867 1834, 1835, 1836, 1837, 1841, 1842, 1845, 1846
868 };
869 #endif
870
871 #if YYDEBUG || YYERROR_VERBOSE
872 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
873 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
874 static const char *const yytname[] =
875 {
876 "$end", "error", "$undefined", "tNL", "tNUMBER", "tLNUMBER", "tSTRING",
877 "tIDENT", "tFILENAME", "tRAWDATA", "tACCELERATORS", "tBITMAP", "tCURSOR",
878 "tDIALOG", "tDIALOGEX", "tMENU", "tMENUEX", "tMESSAGETABLE", "tRCDATA",
879 "tVERSIONINFO", "tSTRINGTABLE", "tFONT", "tFONTDIR", "tICON",
880 "tAUTO3STATE", "tAUTOCHECKBOX", "tAUTORADIOBUTTON", "tCHECKBOX",
881 "tDEFPUSHBUTTON", "tPUSHBUTTON", "tRADIOBUTTON", "tSTATE3", "tGROUPBOX",
882 "tCOMBOBOX", "tLISTBOX", "tSCROLLBAR", "tCONTROL", "tEDITTEXT", "tRTEXT",
883 "tCTEXT", "tLTEXT", "tBLOCK", "tVALUE", "tSHIFT", "tALT", "tASCII",
884 "tVIRTKEY", "tGRAYED", "tCHECKED", "tINACTIVE", "tNOINVERT", "tPURE",
885 "tIMPURE", "tDISCARDABLE", "tLOADONCALL", "tPRELOAD", "tFIXED",
886 "tMOVEABLE", "tCLASS", "tCAPTION", "tCHARACTERISTICS", "tEXSTYLE",
887 "tSTYLE", "tVERSION", "tLANGUAGE", "tFILEVERSION", "tPRODUCTVERSION",
888 "tFILEFLAGSMASK", "tFILEOS", "tFILETYPE", "tFILEFLAGS", "tFILESUBTYPE",
889 "tMENUBARBREAK", "tMENUBREAK", "tMENUITEM", "tPOPUP", "tSEPARATOR",
890 "tHELP", "tTOOLBAR", "tBUTTON", "tBEGIN", "tEND", "tDLGINIT", "'|'",
891 "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'~'", "tNOT", "pUPM", "','",
892 "'('", "')'", "$accept", "resource_file", "resources", "resource", "@1",
893 "usrcvt", "nameid", "nameid_s", "resource_definition", "filename",
894 "bitmap", "cursor", "icon", "font", "fontdir", "messagetable", "rcdata",
895 "dlginit", "userres", "usertype", "accelerators", "events", "acc_opt",
896 "accs", "acc", "dialog", "dlg_attributes", "ctrls", "lab_ctrl",
897 "ctrl_desc", "iconinfo", "gen_ctrl", "opt_font", "optional_style_pair",
898 "style", "ctlclass", "dialogex", "dlgex_attribs", "exctrls",
899 "gen_exctrl", "lab_exctrl", "exctrl_desc", "opt_data", "helpid",
900 "opt_exfont", "opt_expr", "menu", "menu_body", "item_definitions",
901 "item_options", "menuex", "menuex_body", "itemex_definitions",
902 "itemex_options", "itemex_p_options", "stringtable", "stt_head",
903 "strings", "opt_comma", "versioninfo", "fix_version", "ver_blocks",
904 "ver_block", "ver_values", "ver_value", "ver_words", "toolbar",
905 "toolbar_items", "loadmemopts", "lamo", "lama", "opt_lvc",
906 "opt_language", "opt_characts", "opt_version", "raw_data",
907 "raw_elements", "file_raw", "e_expr", "expr", "xpr_no_not", "xpr",
908 "any_num", 0
909 };
910 #endif
911
912 # ifdef YYPRINT
913 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
914 token YYLEX-NUM. */
915 static const unsigned short yytoknum[] =
916 {
917 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
918 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
919 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
920 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
921 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
922 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
923 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
924 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
925 335, 336, 337, 124, 94, 38, 43, 45, 42, 47,
926 126, 338, 339, 44, 40, 41
927 };
928 # endif
929
930 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
931 static const unsigned char yyr1[] =
932 {
933 0, 96, 97, 98, 98, 98, 99, 99, 99, 100,
934 99, 101, 102, 102, 103, 103, 104, 104, 104, 104,
935 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
936 104, 104, 105, 105, 105, 106, 107, 108, 109, 110,
937 111, 112, 113, 114, 115, 115, 116, 117, 117, 117,
938 118, 118, 119, 119, 120, 120, 120, 120, 120, 120,
939 121, 122, 122, 122, 122, 122, 122, 122, 122, 122,
940 122, 123, 123, 123, 123, 123, 123, 123, 123, 123,
941 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
942 124, 125, 126, 126, 126, 126, 127, 127, 128, 129,
943 129, 129, 130, 130, 130, 130, 131, 131, 132, 133,
944 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
945 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
946 134, 134, 134, 134, 134, 134, 134, 134, 134, 135,
947 135, 136, 137, 138, 138, 139, 139, 140, 141, 141,
948 142, 143, 144, 144, 144, 144, 145, 145, 145, 145,
949 145, 145, 145, 146, 147, 148, 148, 148, 148, 149,
950 149, 149, 149, 150, 150, 150, 150, 150, 151, 152,
951 153, 153, 154, 154, 155, 156, 156, 156, 156, 156,
952 156, 156, 156, 157, 157, 158, 159, 159, 160, 160,
953 160, 161, 161, 162, 163, 163, 163, 164, 164, 164,
954 165, 165, 165, 165, 166, 166, 166, 167, 167, 167,
955 167, 168, 169, 170, 171, 172, 172, 172, 172, 172,
956 172, 172, 172, 172, 172, 172, 172, 173, 173, 174,
957 174, 175, 176, 176, 176, 176, 176, 176, 176, 176,
958 176, 176, 176, 176, 177, 177, 178, 178
959 };
960
961 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
962 static const unsigned char yyr2[] =
963 {
964 0, 2, 1, 0, 2, 2, 3, 3, 1, 0,
965 5, 0, 1, 1, 1, 1, 1, 1, 1, 1,
966 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
967 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
968 3, 3, 3, 3, 1, 1, 6, 0, 5, 5,
969 0, 2, 1, 3, 1, 1, 1, 1, 1, 1,
970 13, 0, 3, 3, 3, 2, 3, 3, 2, 2,
971 2, 0, 3, 3, 3, 3, 3, 3, 3, 3,
972 3, 3, 3, 3, 3, 3, 3, 3, 3, 10,
973 12, 10, 0, 4, 6, 8, 17, 15, 4, 0,
974 2, 4, 3, 3, 1, 2, 1, 1, 14, 0,
975 3, 3, 3, 2, 2, 3, 3, 2, 2, 2,
976 0, 3, 3, 3, 3, 3, 3, 3, 3, 3,
977 3, 3, 3, 3, 3, 3, 3, 3, 10, 19,
978 16, 14, 12, 0, 1, 0, 2, 9, 0, 2,
979 4, 3, 0, 6, 3, 5, 0, 3, 3, 3,
980 3, 3, 3, 4, 3, 0, 4, 3, 5, 0,
981 2, 5, 6, 0, 2, 4, 6, 8, 4, 3,
982 0, 4, 0, 1, 6, 0, 9, 9, 3, 3,
983 3, 3, 3, 0, 2, 5, 0, 2, 1, 4,
984 4, 1, 3, 9, 0, 3, 2, 0, 2, 2,
985 1, 1, 1, 1, 1, 1, 1, 0, 2, 2,
986 2, 4, 2, 2, 4, 1, 1, 2, 1, 2,
987 1, 3, 3, 4, 3, 4, 3, 1, 1, 0,
988 1, 1, 3, 3, 3, 3, 3, 3, 3, 2,
989 2, 2, 3, 1, 1, 2, 1, 1
990 };
991
992 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
993 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
994 means the default is an error. */
995 static const unsigned short yydefact[] =
996 {
997 3, 0, 2, 1, 5, 256, 257, 11, 207, 9,
998 0, 0, 0, 0, 0, 4, 8, 0, 11, 254,
999 241, 253, 0, 217, 0, 251, 250, 249, 255, 0,
1000 180, 0, 0, 0, 0, 0, 0, 0, 0, 44,
1001 45, 207, 207, 207, 207, 207, 207, 207, 207, 207,
1002 207, 207, 207, 207, 207, 207, 7, 17, 18, 24,
1003 22, 23, 27, 28, 21, 30, 207, 16, 19, 20,
1004 25, 26, 31, 29, 213, 216, 212, 214, 210, 215,
1005 211, 208, 209, 179, 0, 252, 0, 6, 244, 248,
1006 245, 242, 243, 246, 247, 217, 217, 217, 0, 0,
1007 217, 217, 217, 217, 185, 217, 217, 217, 0, 217,
1008 217, 0, 0, 0, 218, 219, 220, 0, 178, 182,
1009 0, 34, 33, 32, 237, 0, 238, 35, 36, 0,
1010 0, 0, 0, 40, 41, 0, 38, 39, 37, 0,
1011 42, 43, 222, 223, 0, 10, 183, 0, 47, 0,
1012 0, 0, 152, 150, 165, 163, 0, 0, 0, 0,
1013 0, 0, 0, 193, 0, 0, 181, 0, 226, 228,
1014 230, 225, 0, 182, 0, 0, 0, 0, 0, 0,
1015 189, 190, 191, 188, 192, 0, 217, 221, 0, 46,
1016 0, 227, 229, 224, 0, 0, 0, 0, 0, 151,
1017 0, 0, 164, 0, 0, 0, 184, 194, 0, 0,
1018 0, 232, 234, 236, 231, 0, 0, 0, 182, 154,
1019 182, 169, 167, 173, 0, 0, 0, 204, 50, 50,
1020 233, 235, 0, 0, 0, 0, 0, 239, 166, 239,
1021 0, 0, 0, 196, 0, 0, 48, 49, 61, 145,
1022 182, 155, 182, 182, 182, 182, 182, 182, 0, 170,
1023 0, 174, 168, 0, 0, 0, 206, 0, 203, 56,
1024 55, 57, 58, 59, 54, 51, 52, 0, 0, 109,
1025 153, 158, 157, 160, 161, 162, 159, 239, 239, 0,
1026 0, 0, 195, 198, 197, 205, 0, 0, 0, 0,
1027 0, 0, 0, 71, 65, 68, 69, 70, 146, 0,
1028 182, 240, 0, 175, 186, 187, 0, 53, 13, 67,
1029 12, 0, 15, 14, 66, 64, 0, 0, 63, 104,
1030 0, 62, 0, 0, 0, 0, 0, 0, 0, 120,
1031 113, 114, 117, 118, 119, 183, 171, 239, 0, 0,
1032 105, 253, 0, 0, 0, 0, 0, 0, 0, 0,
1033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1034 0, 0, 60, 116, 0, 115, 112, 111, 110, 0,
1035 172, 0, 176, 199, 200, 201, 98, 103, 102, 182,
1036 182, 82, 84, 85, 77, 78, 80, 81, 83, 79,
1037 75, 0, 74, 76, 182, 72, 73, 88, 87, 86,
1038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1039 0, 0, 0, 0, 0, 0, 0, 0, 0, 108,
1040 0, 0, 0, 0, 0, 0, 98, 182, 182, 131,
1041 133, 134, 126, 127, 129, 130, 132, 128, 124, 0,
1042 123, 125, 182, 121, 122, 137, 136, 135, 177, 202,
1043 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1044 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1045 0, 107, 0, 106, 0, 0, 0, 0, 0, 0,
1046 0, 0, 0, 148, 0, 0, 0, 0, 92, 0,
1047 0, 0, 0, 147, 0, 0, 0, 0, 0, 89,
1048 0, 0, 0, 149, 92, 0, 0, 0, 0, 0,
1049 99, 0, 138, 0, 0, 0, 0, 0, 0, 91,
1050 0, 0, 99, 0, 93, 99, 100, 0, 0, 145,
1051 0, 0, 90, 0, 0, 99, 143, 0, 94, 101,
1052 0, 145, 142, 144, 0, 0, 0, 143, 0, 95,
1053 97, 141, 0, 0, 143, 96, 0, 140, 145, 143,
1054 139
1055 };
1056
1057 /* YYDEFGOTO[NTERM-NUM]. */
1058 static const short yydefgoto[] =
1059 {
1060 -1, 1, 2, 15, 24, 22, 323, 324, 56, 124,
1061 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1062 67, 167, 246, 275, 276, 68, 277, 332, 391, 400,
1063 509, 405, 304, 529, 328, 482, 69, 309, 379, 453,
1064 439, 448, 552, 279, 341, 503, 70, 153, 176, 235,
1065 71, 155, 177, 238, 240, 16, 17, 86, 236, 72,
1066 135, 185, 207, 265, 294, 384, 73, 244, 23, 81,
1067 82, 125, 114, 115, 116, 126, 173, 127, 258, 320,
1068 19, 20, 21
1069 };
1070
1071 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1072 STATE-NUM. */
1073 #define YYPACT_NINF -487
1074 static const short yypact[] =
1075 {
1076 -487, 6, 43, -487, -487, -487, -487, -487, -487, -487,
1077 30, 30, 30, 215, 30, -487, -487, -60, -487, -487,
1078 636, -487, 434, 675, 30, -487, -487, -487, -487, 623,
1079 -487, 434, 30, 30, 30, 30, 30, 30, 30, -487,
1080 -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,
1081 -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,
1082 -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,
1083 -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,
1084 -487, -487, -487, 310, -62, -487, 131, -487, 563, 195,
1085 232, 213, 213, -487, -487, 675, 533, 533, 87, 87,
1086 675, 675, 533, 533, 675, 533, 533, 533, 87, 533,
1087 533, 30, 30, 30, -487, -487, -487, 30, -487, -48,
1088 136, -487, -487, -487, -487, 163, -487, -487, -487, -44,
1089 -25, 199, 231, -487, -487, 410, -487, -487, -487, -3,
1090 -487, -487, -487, -487, 5, -487, -487, 67, -487, 21,
1091 30, 30, -487, -487, -487, -487, 30, 30, 30, 30,
1092 30, 30, 30, -487, 30, 30, -487, 89, -487, -487,
1093 -487, -487, 334, -19, 26, 32, 259, 284, 34, 38,
1094 -487, -487, -487, -487, -487, -24, -487, -487, 57, -487,
1095 68, -487, -487, -487, 60, 30, 30, -4, 161, -487,
1096 3, 176, -487, 30, 30, 191, -487, -487, 308, 30,
1097 30, -487, -487, -487, -487, 356, 113, 116, -48, -487,
1098 -70, 118, -487, 135, 140, 143, 144, -487, 145, 145,
1099 -487, -487, 30, 30, 30, 168, 278, 30, -487, 30,
1100 173, 30, 30, -487, 47, 512, -487, -487, -487, 167,
1101 171, -487, 71, 71, 71, 71, 71, 71, 185, 200,
1102 210, 200, -487, 217, 220, -29, -487, 30, -487, -487,
1103 -487, -487, -487, -487, -487, 243, -487, 354, 30, -487,
1104 -487, -487, -487, -487, -487, -487, -487, 30, 30, 30,
1105 30, 251, -487, -487, -487, -487, 512, 164, 30, 293,
1106 318, 312, 312, -487, -487, -487, -487, -487, -487, 514,
1107 254, -487, 261, 200, -487, -487, 274, -487, -487, -487,
1108 -487, 283, -487, -487, -487, -487, 30, 312, 294, 649,
1109 636, 294, 572, 164, 30, 293, 338, 312, 312, -487,
1110 -487, -487, -487, -487, -487, 30, -487, 30, 262, 372,
1111 649, -487, 17, 312, 293, 375, 375, 375, 375, 375,
1112 375, 375, 375, 375, 30, 30, 30, 293, 30, 375,
1113 375, 375, -487, -487, 289, -487, -487, 294, 294, 590,
1114 -487, 292, 200, -487, 298, -487, -487, -487, -487, -48,
1115 -48, -487, -487, -487, -487, -487, -487, -487, -487, -487,
1116 -487, 299, -487, -487, -48, -487, -487, -487, -487, -487,
1117 380, 293, 389, 389, 389, 389, 389, 389, 389, 389,
1118 389, 30, 30, 30, 293, 30, 389, 389, 389, -487,
1119 30, 30, 30, 30, 30, 30, 307, -48, -48, -487,
1120 -487, -487, -487, -487, -487, -487, -487, -487, -487, 316,
1121 -487, -487, -48, -487, -487, -487, -487, -487, -487, -487,
1122 317, 329, 332, 333, 30, 30, 30, 30, 30, 30,
1123 30, 30, 303, 342, 347, 349, 350, 361, 365, 366,
1124 367, -487, 368, -487, 30, 30, 30, 30, 303, 30,
1125 30, 30, 312, 378, 379, 381, 398, 399, 400, 401,
1126 402, -72, 30, -487, 30, 30, 30, 312, 30, -487,
1127 30, 30, 30, -487, 400, 404, 405, -16, 406, 408,
1128 412, 414, -487, 30, 30, 30, 30, 30, 312, -487,
1129 30, 420, 412, 421, 422, 412, 39, 424, 30, 167,
1130 30, 312, -487, 312, 30, 412, 344, 425, 112, 294,
1131 426, 167, -487, -487, 30, 312, 30, 344, 427, 294,
1132 433, -487, 30, 312, 25, 294, 312, -487, 121, 344,
1133 -487
1134 };
1135
1136 /* YYPGOTO[NTERM-NUM]. */
1137 static const short yypgoto[] =
1138 {
1139 -487, -487, -487, -487, -487, 383, -278, -182, 374, -487,
1140 -487, -487, -487, -487, -487, -487, -487, -487, -487, -487,
1141 -487, -487, 182, -487, 100, -487, -487, -487, 304, -95,
1142 -87, -487, 218, -431, -251, -15, -487, -487, -487, -487,
1143 263, 14, -486, -469, -487, -487, -487, 295, -487, -66,
1144 -487, 291, -487, -487, -487, -487, -487, -487, -115, -487,
1145 -487, -487, 268, -487, -487, -487, -487, -487, 591, -487,
1146 -487, -20, -253, -249, -248, -354, -487, 595, -234, -2,
1147 -294, 4, -12
1148 };
1149
1150 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1151 positive, shift that token. If negative, reduce the rule which
1152 number is the opposite. If zero, do what YYDEFACT says.
1153 If YYTABLE_NINF, syntax error. */
1154 #define YYTABLE_NINF -255
1155 static const short yytable[] =
1156 {
1157 18, 28, 218, 83, 147, 260, 3, 329, 329, 221,
1158 -156, 353, 205, 291, 25, 26, 27, 205, 29, 319,
1159 30, 512, 84, 146, 305, 168, 169, 170, 306, 307,
1160 171, 117, 350, 329, 5, 6, 88, 89, 90, 91,
1161 92, 93, 94, 329, 329, 146, 4, 5, 6, 150,
1162 7, 331, 292, 310, 312, 373, 342, 206, 194, 329,
1163 343, 344, 193, 8, 211, 212, 213, 353, 151, 214,
1164 546, 561, 219, 166, 146, 120, 352, 525, 567, 222,
1165 131, 132, 557, 570, 119, -217, 377, 378, -217, -217,
1166 164, 5, 6, 5, 6, 188, 129, 130, 165, 569,
1167 353, 539, 388, 234, 542, -217, 139, 9, 172, 142,
1168 143, 144, 387, 381, 551, 145, 10, 11, 566, 195,
1169 12, 13, 353, 266, 14, 196, 267, 203, 268, 10,
1170 11, 204, 543, 12, 13, 5, 6, 14, 74, 75,
1171 76, 77, 78, 79, 80, -156, -156, 215, 174, 175,
1172 209, -156, -156, 375, 178, 179, 180, 181, 182, 183,
1173 184, 210, 186, 187, 146, 190, 208, 220, 5, 6,
1174 189, 318, 389, 10, 11, 10, 11, 12, 13, 12,
1175 13, 14, 223, 14, 280, 404, 281, 282, 283, 284,
1176 285, 286, 553, 216, 217, 353, 111, 226, 329, 112,
1177 113, 224, 225, 553, 353, 555, 232, 228, 229, 233,
1178 553, 237, 118, 329, 278, 553, 148, 10, 11, 5,
1179 6, 12, 13, 111, 243, 14, 112, 113, 239, 437,
1180 248, 249, 250, 241, 329, 259, 242, 261, 245, 263,
1181 264, 501, 452, 149, 346, -156, -156, 329, 152, 329,
1182 10, 11, -156, 154, 12, 13, 517, 316, 14, 111,
1183 278, 329, 112, 113, 146, 295, 5, 6, 383, 329,
1184 402, 403, 329, 406, 432, 433, 308, 536, 287, 152,
1185 34, 35, 36, 37, 38, 311, 313, 314, 315, 435,
1186 548, 111, 549, -240, 112, 113, 321, 5, 6, 322,
1187 318, 37, 38, 288, 559, 330, 330, 5, 6, 481,
1188 289, 154, 565, 290, 351, 568, 5, 6, 35, 36,
1189 37, 38, 465, 466, 325, 252, 253, 254, -156, -156,
1190 330, 29, 374, 197, 198, -156, 296, 468, 191, 192,
1191 199, 330, 330, 380, 376, 382, 385, 345, 10, 11,
1192 255, 256, 12, 13, 347, 257, 14, 330, 200, 201,
1193 230, 231, 401, 401, 401, 202, 401, 348, 111, 297,
1194 111, 112, 113, 112, 113, 298, 349, 353, 386, 10,
1195 11, 390, 410, 12, 13, 430, 436, 14, 227, 10,
1196 11, 431, 434, 12, 13, 438, 317, 14, 10, 11,
1197 464, 31, 12, 326, -217, 87, 327, -217, -217, 467,
1198 469, 247, 299, 300, 111, 301, 302, 112, 113, 449,
1199 449, 449, 470, 449, -217, 471, 472, 522, 458, 459,
1200 460, 461, 462, 463, 303, 484, 450, 451, 39, 454,
1201 485, 40, 486, 487, 41, 42, 43, 44, 45, 46,
1202 47, 48, 49, 50, 488, 51, 52, 53, 489, 490,
1203 491, 492, 473, 474, 475, 476, 477, 478, 479, 480,
1204 483, 502, 504, 497, 505, 156, 157, 158, 159, 160,
1205 161, 162, 493, 494, 495, 496, 483, 498, 499, 500,
1206 163, 506, 507, 508, 510, 511, 330, 523, 524, 526,
1207 513, 527, 514, 515, 516, 528, 518, 530, 519, 520,
1208 521, 330, 54, 538, 540, 541, 55, 544, 554, 556,
1209 562, 531, 532, 533, 534, 535, 563, 340, 537, 333,
1210 251, 262, 330, 293, 0, 334, 545, 0, 547, 121,
1211 122, 123, 550, 0, 0, 330, 0, 330, 269, 0,
1212 0, 0, 558, 0, 560, 270, 271, 272, 273, 330,
1213 564, 0, 274, 0, 0, 0, 0, 330, 0, 0,
1214 330, 0, 335, 336, 111, 337, 338, 112, 113, 0,
1215 0, 0, 0, 0, 74, 75, 76, 77, 78, 79,
1216 80, 0, 0, 0, 339, 354, 355, 356, 357, 358,
1217 359, 360, 361, 362, 363, 364, 365, 366, 367, 368,
1218 369, 370, 371, 411, 412, 413, 414, 415, 416, 417,
1219 418, 419, 420, 421, 422, 423, 424, 425, 426, 427,
1220 428, 0, 95, 96, 97, 98, 99, 100, 101, 102,
1221 103, 104, 105, 106, 107, 108, 109, 33, 34, 35,
1222 36, 37, 38, 372, 0, 0, 0, 110, 0, 0,
1223 392, 393, 394, 395, 396, 397, 398, 399, 0, 0,
1224 0, 429, 0, 407, 408, 409, 440, 441, 442, 443,
1225 444, 445, 446, 447, 0, 0, 0, 0, 0, 455,
1226 456, 457, 128, 0, 0, 0, 0, 133, 134, 0,
1227 136, 137, 138, 0, 140, 141, 32, 33, 34, 35,
1228 36, 37, 38, 0, 0, 0, 0, 0, 85, 32,
1229 33, 34, 35, 36, 37, 38, 74, 75, 76, 77,
1230 78, 79, 80, -254, -254, -254, -254, -254, -254
1231 };
1232
1233 static const short yycheck[] =
1234 {
1235 2, 13, 6, 23, 119, 239, 0, 301, 302, 6,
1236 80, 83, 41, 42, 10, 11, 12, 41, 14, 297,
1237 80, 93, 24, 93, 277, 4, 5, 6, 277, 277,
1238 9, 93, 326, 327, 4, 5, 32, 33, 34, 35,
1239 36, 37, 38, 337, 338, 93, 3, 4, 5, 93,
1240 7, 302, 81, 287, 288, 333, 309, 81, 173, 353,
1241 309, 309, 81, 20, 4, 5, 6, 83, 93, 9,
1242 539, 557, 76, 6, 93, 95, 327, 93, 564, 76,
1243 100, 101, 551, 569, 86, 60, 337, 338, 63, 64,
1244 93, 4, 5, 4, 5, 6, 98, 99, 93, 568,
1245 83, 532, 353, 218, 535, 80, 108, 64, 87, 111,
1246 112, 113, 95, 347, 545, 117, 86, 87, 93, 93,
1247 90, 91, 83, 76, 94, 93, 79, 93, 81, 86,
1248 87, 93, 93, 90, 91, 4, 5, 94, 51, 52,
1249 53, 54, 55, 56, 57, 74, 75, 87, 150, 151,
1250 93, 80, 81, 335, 156, 157, 158, 159, 160, 161,
1251 162, 93, 164, 165, 93, 167, 186, 6, 4, 5,
1252 81, 7, 354, 86, 87, 86, 87, 90, 91, 90,
1253 91, 94, 6, 94, 250, 367, 252, 253, 254, 255,
1254 256, 257, 546, 195, 196, 83, 60, 6, 492, 63,
1255 64, 203, 204, 557, 83, 93, 93, 209, 210, 93,
1256 564, 93, 81, 507, 93, 569, 80, 86, 87, 4,
1257 5, 90, 91, 60, 80, 94, 63, 64, 93, 411,
1258 232, 233, 234, 93, 528, 237, 93, 239, 93, 241,
1259 242, 492, 424, 80, 310, 74, 75, 541, 80, 543,
1260 86, 87, 81, 80, 90, 91, 507, 6, 94, 60,
1261 93, 555, 63, 64, 93, 267, 4, 5, 6, 563,
1262 365, 366, 566, 368, 389, 390, 278, 528, 93, 80,
1263 85, 86, 87, 88, 89, 287, 288, 289, 290, 404,
1264 541, 60, 543, 93, 63, 64, 298, 4, 5, 6,
1265 7, 88, 89, 93, 555, 301, 302, 4, 5, 6,
1266 93, 80, 563, 93, 326, 566, 4, 5, 86, 87,
1267 88, 89, 437, 438, 6, 47, 48, 49, 74, 75,
1268 326, 327, 334, 74, 75, 81, 93, 452, 4, 5,
1269 81, 337, 338, 345, 6, 347, 348, 93, 86, 87,
1270 72, 73, 90, 91, 93, 77, 94, 353, 74, 75,
1271 4, 5, 364, 365, 366, 81, 368, 93, 60, 15,
1272 60, 63, 64, 63, 64, 21, 93, 83, 6, 86,
1273 87, 6, 93, 90, 91, 93, 6, 94, 80, 86,
1274 87, 93, 93, 90, 91, 6, 296, 94, 86, 87,
1275 93, 18, 90, 91, 60, 31, 94, 63, 64, 93,
1276 93, 229, 58, 59, 60, 61, 62, 63, 64, 421,
1277 422, 423, 93, 425, 80, 93, 93, 514, 430, 431,
1278 432, 433, 434, 435, 80, 93, 422, 423, 4, 425,
1279 93, 7, 93, 93, 10, 11, 12, 13, 14, 15,
1280 16, 17, 18, 19, 93, 21, 22, 23, 93, 93,
1281 93, 93, 464, 465, 466, 467, 468, 469, 470, 471,
1282 472, 93, 93, 488, 93, 65, 66, 67, 68, 69,
1283 70, 71, 484, 485, 486, 487, 488, 489, 490, 491,
1284 80, 93, 93, 93, 93, 93, 492, 93, 93, 93,
1285 502, 93, 504, 505, 506, 93, 508, 93, 510, 511,
1286 512, 507, 78, 93, 93, 93, 82, 93, 93, 93,
1287 93, 523, 524, 525, 526, 527, 93, 309, 530, 15,
1288 235, 240, 528, 265, -1, 21, 538, -1, 540, 6,
1289 7, 8, 544, -1, -1, 541, -1, 543, 36, -1,
1290 -1, -1, 554, -1, 556, 43, 44, 45, 46, 555,
1291 562, -1, 50, -1, -1, -1, -1, 563, -1, -1,
1292 566, -1, 58, 59, 60, 61, 62, 63, 64, -1,
1293 -1, -1, -1, -1, 51, 52, 53, 54, 55, 56,
1294 57, -1, -1, -1, 80, 23, 24, 25, 26, 27,
1295 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
1296 38, 39, 40, 23, 24, 25, 26, 27, 28, 29,
1297 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1298 40, -1, 41, 42, 43, 44, 45, 46, 47, 48,
1299 49, 50, 51, 52, 53, 54, 55, 84, 85, 86,
1300 87, 88, 89, 81, -1, -1, -1, 66, -1, -1,
1301 356, 357, 358, 359, 360, 361, 362, 363, -1, -1,
1302 -1, 81, -1, 369, 370, 371, 413, 414, 415, 416,
1303 417, 418, 419, 420, -1, -1, -1, -1, -1, 426,
1304 427, 428, 97, -1, -1, -1, -1, 102, 103, -1,
1305 105, 106, 107, -1, 109, 110, 83, 84, 85, 86,
1306 87, 88, 89, -1, -1, -1, -1, -1, 95, 83,
1307 84, 85, 86, 87, 88, 89, 51, 52, 53, 54,
1308 55, 56, 57, 84, 85, 86, 87, 88, 89
1309 };
1310
1311 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1312 symbol of state STATE-NUM. */
1313 static const unsigned char yystos[] =
1314 {
1315 0, 97, 98, 0, 3, 4, 5, 7, 20, 64,
1316 86, 87, 90, 91, 94, 99, 151, 152, 175, 176,
1317 177, 178, 101, 164, 100, 177, 177, 177, 178, 177,
1318 80, 101, 83, 84, 85, 86, 87, 88, 89, 4,
1319 7, 10, 11, 12, 13, 14, 15, 16, 17, 18,
1320 19, 21, 22, 23, 78, 82, 104, 106, 107, 108,
1321 109, 110, 111, 112, 113, 114, 115, 116, 121, 132,
1322 142, 146, 155, 162, 51, 52, 53, 54, 55, 56,
1323 57, 165, 166, 167, 175, 95, 153, 104, 177, 177,
1324 177, 177, 177, 177, 177, 164, 164, 164, 164, 164,
1325 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1326 164, 60, 63, 64, 168, 169, 170, 93, 81, 175,
1327 167, 6, 7, 8, 105, 167, 171, 173, 173, 175,
1328 175, 167, 167, 173, 173, 156, 173, 173, 173, 175,
1329 173, 173, 175, 175, 175, 175, 93, 154, 80, 80,
1330 93, 93, 80, 143, 80, 147, 65, 66, 67, 68,
1331 69, 70, 71, 80, 93, 93, 6, 117, 4, 5,
1332 6, 9, 87, 172, 175, 175, 144, 148, 175, 175,
1333 175, 175, 175, 175, 175, 157, 175, 175, 6, 81,
1334 175, 4, 5, 81, 154, 93, 93, 74, 75, 81,
1335 74, 75, 81, 93, 93, 41, 81, 158, 167, 93,
1336 93, 4, 5, 6, 9, 87, 175, 175, 6, 76,
1337 6, 6, 76, 6, 175, 175, 6, 80, 175, 175,
1338 4, 5, 93, 93, 154, 145, 154, 93, 149, 93,
1339 150, 93, 93, 80, 163, 93, 118, 118, 175, 175,
1340 175, 143, 47, 48, 49, 72, 73, 77, 174, 175,
1341 174, 175, 147, 175, 175, 159, 76, 79, 81, 36,
1342 43, 44, 45, 46, 50, 119, 120, 122, 93, 139,
1343 145, 145, 145, 145, 145, 145, 145, 93, 93, 93,
1344 93, 42, 81, 158, 160, 175, 93, 15, 21, 58,
1345 59, 61, 62, 80, 128, 168, 169, 170, 175, 133,
1346 174, 175, 174, 175, 175, 175, 6, 120, 7, 102,
1347 175, 175, 6, 102, 103, 6, 91, 94, 130, 176,
1348 177, 130, 123, 15, 21, 58, 59, 61, 62, 80,
1349 128, 140, 168, 169, 170, 93, 145, 93, 93, 93,
1350 176, 178, 130, 83, 23, 24, 25, 26, 27, 28,
1351 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1352 39, 40, 81, 102, 175, 103, 6, 130, 130, 134,
1353 175, 174, 175, 6, 161, 175, 6, 95, 130, 103,
1354 6, 124, 124, 124, 124, 124, 124, 124, 124, 124,
1355 125, 175, 125, 125, 103, 127, 125, 124, 124, 124,
1356 93, 23, 24, 25, 26, 27, 28, 29, 30, 31,
1357 32, 33, 34, 35, 36, 37, 38, 39, 40, 81,
1358 93, 93, 154, 154, 93, 154, 6, 103, 6, 136,
1359 136, 136, 136, 136, 136, 136, 136, 136, 137, 175,
1360 137, 137, 103, 135, 137, 136, 136, 136, 175, 175,
1361 175, 175, 175, 175, 93, 154, 154, 93, 154, 93,
1362 93, 93, 93, 175, 175, 175, 175, 175, 175, 175,
1363 175, 6, 131, 175, 93, 93, 93, 93, 93, 93,
1364 93, 93, 93, 175, 175, 175, 175, 131, 175, 175,
1365 175, 130, 93, 141, 93, 93, 93, 93, 93, 126,
1366 93, 93, 93, 175, 175, 175, 175, 130, 175, 175,
1367 175, 175, 126, 93, 93, 93, 93, 93, 93, 129,
1368 93, 175, 175, 175, 175, 175, 130, 175, 93, 129,
1369 93, 93, 129, 93, 93, 175, 139, 175, 130, 130,
1370 175, 129, 138, 171, 93, 93, 93, 139, 175, 130,
1371 175, 138, 93, 93, 175, 130, 93, 138, 130, 139,
1372 138
1373 };
1374
1375 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1376 # define YYSIZE_T __SIZE_TYPE__
1377 #endif
1378 #if ! defined (YYSIZE_T) && defined (size_t)
1379 # define YYSIZE_T size_t
1380 #endif
1381 #if ! defined (YYSIZE_T)
1382 # if defined (__STDC__) || defined (__cplusplus)
1383 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1384 # define YYSIZE_T size_t
1385 # endif
1386 #endif
1387 #if ! defined (YYSIZE_T)
1388 # define YYSIZE_T unsigned int
1389 #endif
1390
1391 #define yyerrok (yyerrstatus = 0)
1392 #define yyclearin (yychar = YYEMPTY)
1393 #define YYEMPTY (-2)
1394 #define YYEOF 0
1395
1396 #define YYACCEPT goto yyacceptlab
1397 #define YYABORT goto yyabortlab
1398 #define YYERROR goto yyerrorlab
1399
1400
1401 /* Like YYERROR except do call yyerror. This remains here temporarily
1402 to ease the transition to the new meaning of YYERROR, for GCC.
1403 Once GCC version 2 has supplanted version 1, this can go. */
1404
1405 #define YYFAIL goto yyerrlab
1406
1407 #define YYRECOVERING() (!!yyerrstatus)
1408
1409 #define YYBACKUP(Token, Value) \
1410 do \
1411 if (yychar == YYEMPTY && yylen == 1) \
1412 { \
1413 yychar = (Token); \
1414 yylval = (Value); \
1415 yytoken = YYTRANSLATE (yychar); \
1416 YYPOPSTACK; \
1417 goto yybackup; \
1418 } \
1419 else \
1420 { \
1421 yyerror ("syntax error: cannot back up");\
1422 YYERROR; \
1423 } \
1424 while (0)
1425
1426 #define YYTERROR 1
1427 #define YYERRCODE 256
1428
1429 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
1430 are run). */
1431
1432 #ifndef YYLLOC_DEFAULT
1433 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1434 ((Current).first_line = (Rhs)[1].first_line, \
1435 (Current).first_column = (Rhs)[1].first_column, \
1436 (Current).last_line = (Rhs)[N].last_line, \
1437 (Current).last_column = (Rhs)[N].last_column)
1438 #endif
1439
1440 /* YYLEX -- calling `yylex' with the right arguments. */
1441
1442 #ifdef YYLEX_PARAM
1443 # define YYLEX yylex (YYLEX_PARAM)
1444 #else
1445 # define YYLEX yylex ()
1446 #endif
1447
1448 /* Enable debugging if requested. */
1449 #if YYDEBUG
1450
1451 # ifndef YYFPRINTF
1452 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1453 # define YYFPRINTF fprintf
1454 # endif
1455
1456 # define YYDPRINTF(Args) \
1457 do { \
1458 if (yydebug) \
1459 YYFPRINTF Args; \
1460 } while (0)
1461
1462 # define YYDSYMPRINT(Args) \
1463 do { \
1464 if (yydebug) \
1465 yysymprint Args; \
1466 } while (0)
1467
1468 # define YYDSYMPRINTF(Title, Token, Value, Location) \
1469 do { \
1470 if (yydebug) \
1471 { \
1472 YYFPRINTF (stderr, "%s ", Title); \
1473 yysymprint (stderr, \
1474 Token, Value); \
1475 YYFPRINTF (stderr, "\n"); \
1476 } \
1477 } while (0)
1478
1479 /*------------------------------------------------------------------.
1480 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1481 | TOP (included). |
1482 `------------------------------------------------------------------*/
1483
1484 #if defined (__STDC__) || defined (__cplusplus)
1485 static void
1486 yy_stack_print (short *bottom, short *top)
1487 #else
1488 static void
1489 yy_stack_print (bottom, top)
1490 short *bottom;
1491 short *top;
1492 #endif
1493 {
1494 YYFPRINTF (stderr, "Stack now");
1495 for (/* Nothing. */; bottom <= top; ++bottom)
1496 YYFPRINTF (stderr, " %d", *bottom);
1497 YYFPRINTF (stderr, "\n");
1498 }
1499
1500 # define YY_STACK_PRINT(Bottom, Top) \
1501 do { \
1502 if (yydebug) \
1503 yy_stack_print ((Bottom), (Top)); \
1504 } while (0)
1505
1506
1507 /*------------------------------------------------.
1508 | Report that the YYRULE is going to be reduced. |
1509 `------------------------------------------------*/
1510
1511 #if defined (__STDC__) || defined (__cplusplus)
1512 static void
1513 yy_reduce_print (int yyrule)
1514 #else
1515 static void
1516 yy_reduce_print (yyrule)
1517 int yyrule;
1518 #endif
1519 {
1520 int yyi;
1521 unsigned int yylno = yyrline[yyrule];
1522 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1523 yyrule - 1, yylno);
1524 /* Print the symbols being reduced, and their result. */
1525 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1526 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1527 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1528 }
1529
1530 # define YY_REDUCE_PRINT(Rule) \
1531 do { \
1532 if (yydebug) \
1533 yy_reduce_print (Rule); \
1534 } while (0)
1535
1536 /* Nonzero means print parse trace. It is left uninitialized so that
1537 multiple parsers can coexist. */
1538 int yydebug;
1539 #else /* !YYDEBUG */
1540 # define YYDPRINTF(Args)
1541 # define YYDSYMPRINT(Args)
1542 # define YYDSYMPRINTF(Title, Token, Value, Location)
1543 # define YY_STACK_PRINT(Bottom, Top)
1544 # define YY_REDUCE_PRINT(Rule)
1545 #endif /* !YYDEBUG */
1546
1547
1548 /* YYINITDEPTH -- initial size of the parser's stacks. */
1549 #ifndef YYINITDEPTH
1550 # define YYINITDEPTH 200
1551 #endif
1552
1553 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1554 if the built-in stack extension method is used).
1555
1556 Do not make this value too large; the results are undefined if
1557 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1558 evaluated with infinite-precision integer arithmetic. */
1559
1560 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1561 # undef YYMAXDEPTH
1562 #endif
1563
1564 #ifndef YYMAXDEPTH
1565 # define YYMAXDEPTH 10000
1566 #endif
1567
1568 \f
1569
1570 #if YYERROR_VERBOSE
1571
1572 # ifndef yystrlen
1573 # if defined (__GLIBC__) && defined (_STRING_H)
1574 # define yystrlen strlen
1575 # else
1576 /* Return the length of YYSTR. */
1577 static YYSIZE_T
1578 # if defined (__STDC__) || defined (__cplusplus)
1579 yystrlen (const char *yystr)
1580 # else
1581 yystrlen (yystr)
1582 const char *yystr;
1583 # endif
1584 {
1585 register const char *yys = yystr;
1586
1587 while (*yys++ != '\0')
1588 continue;
1589
1590 return yys - yystr - 1;
1591 }
1592 # endif
1593 # endif
1594
1595 # ifndef yystpcpy
1596 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1597 # define yystpcpy stpcpy
1598 # else
1599 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1600 YYDEST. */
1601 static char *
1602 # if defined (__STDC__) || defined (__cplusplus)
1603 yystpcpy (char *yydest, const char *yysrc)
1604 # else
1605 yystpcpy (yydest, yysrc)
1606 char *yydest;
1607 const char *yysrc;
1608 # endif
1609 {
1610 register char *yyd = yydest;
1611 register const char *yys = yysrc;
1612
1613 while ((*yyd++ = *yys++) != '\0')
1614 continue;
1615
1616 return yyd - 1;
1617 }
1618 # endif
1619 # endif
1620
1621 #endif /* !YYERROR_VERBOSE */
1622
1623 \f
1624
1625 #if YYDEBUG
1626 /*--------------------------------.
1627 | Print this symbol on YYOUTPUT. |
1628 `--------------------------------*/
1629
1630 #if defined (__STDC__) || defined (__cplusplus)
1631 static void
1632 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1633 #else
1634 static void
1635 yysymprint (yyoutput, yytype, yyvaluep)
1636 FILE *yyoutput;
1637 int yytype;
1638 YYSTYPE *yyvaluep;
1639 #endif
1640 {
1641 /* Pacify ``unused variable'' warnings. */
1642 (void) yyvaluep;
1643
1644 if (yytype < YYNTOKENS)
1645 {
1646 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1647 # ifdef YYPRINT
1648 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1649 # endif
1650 }
1651 else
1652 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1653
1654 switch (yytype)
1655 {
1656 default:
1657 break;
1658 }
1659 YYFPRINTF (yyoutput, ")");
1660 }
1661
1662 #endif /* ! YYDEBUG */
1663 /*-----------------------------------------------.
1664 | Release the memory associated to this symbol. |
1665 `-----------------------------------------------*/
1666
1667 #if defined (__STDC__) || defined (__cplusplus)
1668 static void
1669 yydestruct (int yytype, YYSTYPE *yyvaluep)
1670 #else
1671 static void
1672 yydestruct (yytype, yyvaluep)
1673 int yytype;
1674 YYSTYPE *yyvaluep;
1675 #endif
1676 {
1677 /* Pacify ``unused variable'' warnings. */
1678 (void) yyvaluep;
1679
1680 switch (yytype)
1681 {
1682
1683 default:
1684 break;
1685 }
1686 }
1687 \f
1688
1689 /* Prevent warnings from -Wmissing-prototypes. */
1690
1691 #ifdef YYPARSE_PARAM
1692 # if defined (__STDC__) || defined (__cplusplus)
1693 int yyparse (void *YYPARSE_PARAM);
1694 # else
1695 int yyparse ();
1696 # endif
1697 #else /* ! YYPARSE_PARAM */
1698 #if defined (__STDC__) || defined (__cplusplus)
1699 int yyparse (void);
1700 #else
1701 int yyparse ();
1702 #endif
1703 #endif /* ! YYPARSE_PARAM */
1704
1705
1706
1707 /* The lookahead symbol. */
1708 int yychar;
1709
1710 /* The semantic value of the lookahead symbol. */
1711 YYSTYPE yylval;
1712
1713 /* Number of syntax errors so far. */
1714 int yynerrs;
1715
1716
1717
1718 /*----------.
1719 | yyparse. |
1720 `----------*/
1721
1722 #ifdef YYPARSE_PARAM
1723 # if defined (__STDC__) || defined (__cplusplus)
1724 int yyparse (void *YYPARSE_PARAM)
1725 # else
1726 int yyparse (YYPARSE_PARAM)
1727 void *YYPARSE_PARAM;
1728 # endif
1729 #else /* ! YYPARSE_PARAM */
1730 #if defined (__STDC__) || defined (__cplusplus)
1731 int
1732 yyparse (void)
1733 #else
1734 int
1735 yyparse ()
1736
1737 #endif
1738 #endif
1739 {
1740
1741 register int yystate;
1742 register int yyn;
1743 int yyresult;
1744 /* Number of tokens to shift before error messages enabled. */
1745 int yyerrstatus;
1746 /* Lookahead token as an internal (translated) token number. */
1747 int yytoken = 0;
1748
1749 /* Three stacks and their tools:
1750 `yyss': related to states,
1751 `yyvs': related to semantic values,
1752 `yyls': related to locations.
1753
1754 Refer to the stacks thru separate pointers, to allow yyoverflow
1755 to reallocate them elsewhere. */
1756
1757 /* The state stack. */
1758 short yyssa[YYINITDEPTH];
1759 short *yyss = yyssa;
1760 register short *yyssp;
1761
1762 /* The semantic value stack. */
1763 YYSTYPE yyvsa[YYINITDEPTH];
1764 YYSTYPE *yyvs = yyvsa;
1765 register YYSTYPE *yyvsp;
1766
1767
1768
1769 #define YYPOPSTACK (yyvsp--, yyssp--)
1770
1771 YYSIZE_T yystacksize = YYINITDEPTH;
1772
1773 /* The variables used to return semantic value and location from the
1774 action routines. */
1775 YYSTYPE yyval;
1776
1777
1778 /* When reducing, the number of symbols on the RHS of the reduced
1779 rule. */
1780 int yylen;
1781
1782 YYDPRINTF ((stderr, "Starting parse\n"));
1783
1784 yystate = 0;
1785 yyerrstatus = 0;
1786 yynerrs = 0;
1787 yychar = YYEMPTY; /* Cause a token to be read. */
1788
1789 /* Initialize stack pointers.
1790 Waste one element of value and location stack
1791 so that they stay on the same level as the state stack.
1792 The wasted elements are never initialized. */
1793
1794 yyssp = yyss;
1795 yyvsp = yyvs;
1796
1797 goto yysetstate;
1798
1799 /*------------------------------------------------------------.
1800 | yynewstate -- Push a new state, which is found in yystate. |
1801 `------------------------------------------------------------*/
1802 yynewstate:
1803 /* In all cases, when you get here, the value and location stacks
1804 have just been pushed. so pushing a state here evens the stacks.
1805 */
1806 yyssp++;
1807
1808 yysetstate:
1809 *yyssp = yystate;
1810
1811 if (yyss + yystacksize - 1 <= yyssp)
1812 {
1813 /* Get the current used size of the three stacks, in elements. */
1814 YYSIZE_T yysize = yyssp - yyss + 1;
1815
1816 #ifdef yyoverflow
1817 {
1818 /* Give user a chance to reallocate the stack. Use copies of
1819 these so that the &'s don't force the real ones into
1820 memory. */
1821 YYSTYPE *yyvs1 = yyvs;
1822 short *yyss1 = yyss;
1823
1824
1825 /* Each stack pointer address is followed by the size of the
1826 data in use in that stack, in bytes. This used to be a
1827 conditional around just the two extra args, but that might
1828 be undefined if yyoverflow is a macro. */
1829 yyoverflow ("parser stack overflow",
1830 &yyss1, yysize * sizeof (*yyssp),
1831 &yyvs1, yysize * sizeof (*yyvsp),
1832
1833 &yystacksize);
1834
1835 yyss = yyss1;
1836 yyvs = yyvs1;
1837 }
1838 #else /* no yyoverflow */
1839 # ifndef YYSTACK_RELOCATE
1840 goto yyoverflowlab;
1841 # else
1842 /* Extend the stack our own way. */
1843 if (YYMAXDEPTH <= yystacksize)
1844 goto yyoverflowlab;
1845 yystacksize *= 2;
1846 if (YYMAXDEPTH < yystacksize)
1847 yystacksize = YYMAXDEPTH;
1848
1849 {
1850 short *yyss1 = yyss;
1851 union yyalloc *yyptr =
1852 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1853 if (! yyptr)
1854 goto yyoverflowlab;
1855 YYSTACK_RELOCATE (yyss);
1856 YYSTACK_RELOCATE (yyvs);
1857
1858 # undef YYSTACK_RELOCATE
1859 if (yyss1 != yyssa)
1860 YYSTACK_FREE (yyss1);
1861 }
1862 # endif
1863 #endif /* no yyoverflow */
1864
1865 yyssp = yyss + yysize - 1;
1866 yyvsp = yyvs + yysize - 1;
1867
1868
1869 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1870 (unsigned long int) yystacksize));
1871
1872 if (yyss + yystacksize - 1 <= yyssp)
1873 YYABORT;
1874 }
1875
1876 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1877
1878 goto yybackup;
1879
1880 /*-----------.
1881 | yybackup. |
1882 `-----------*/
1883 yybackup:
1884
1885 /* Do appropriate processing given the current state. */
1886 /* Read a lookahead token if we need one and don't already have one. */
1887 /* yyresume: */
1888
1889 /* First try to decide what to do without reference to lookahead token. */
1890
1891 yyn = yypact[yystate];
1892 if (yyn == YYPACT_NINF)
1893 goto yydefault;
1894
1895 /* Not known => get a lookahead token if don't already have one. */
1896
1897 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1898 if (yychar == YYEMPTY)
1899 {
1900 YYDPRINTF ((stderr, "Reading a token: "));
1901 yychar = YYLEX;
1902 }
1903
1904 if (yychar <= YYEOF)
1905 {
1906 yychar = yytoken = YYEOF;
1907 YYDPRINTF ((stderr, "Now at end of input.\n"));
1908 }
1909 else
1910 {
1911 yytoken = YYTRANSLATE (yychar);
1912 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1913 }
1914
1915 /* If the proper action on seeing token YYTOKEN is to reduce or to
1916 detect an error, take that action. */
1917 yyn += yytoken;
1918 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1919 goto yydefault;
1920 yyn = yytable[yyn];
1921 if (yyn <= 0)
1922 {
1923 if (yyn == 0 || yyn == YYTABLE_NINF)
1924 goto yyerrlab;
1925 yyn = -yyn;
1926 goto yyreduce;
1927 }
1928
1929 if (yyn == YYFINAL)
1930 YYACCEPT;
1931
1932 /* Shift the lookahead token. */
1933 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1934
1935 /* Discard the token being shifted unless it is eof. */
1936 if (yychar != YYEOF)
1937 yychar = YYEMPTY;
1938
1939 *++yyvsp = yylval;
1940
1941
1942 /* Count tokens shifted since error; after three, turn off error
1943 status. */
1944 if (yyerrstatus)
1945 yyerrstatus--;
1946
1947 yystate = yyn;
1948 goto yynewstate;
1949
1950
1951 /*-----------------------------------------------------------.
1952 | yydefault -- do the default action for the current state. |
1953 `-----------------------------------------------------------*/
1954 yydefault:
1955 yyn = yydefact[yystate];
1956 if (yyn == 0)
1957 goto yyerrlab;
1958 goto yyreduce;
1959
1960
1961 /*-----------------------------.
1962 | yyreduce -- Do a reduction. |
1963 `-----------------------------*/
1964 yyreduce:
1965 /* yyn is the number of a rule to reduce with. */
1966 yylen = yyr2[yyn];
1967
1968 /* If YYLEN is nonzero, implement the default value of the action:
1969 `$$ = $1'.
1970
1971 Otherwise, the following line sets YYVAL to garbage.
1972 This behavior is undocumented and Bison
1973 users should not rely upon it. Assigning to YYVAL
1974 unconditionally makes the parser a bit smaller, and it avoids a
1975 GCC warning that YYVAL may be used uninitialized. */
1976 yyval = yyvsp[1-yylen];
1977
1978
1979 YY_REDUCE_PRINT (yyn);
1980 switch (yyn)
1981 {
1982 case 2:
1983 #line 361 "parser.y"
1984 {
1985 resource_t *rsc;
1986 /* First add stringtables to the resource-list */
1987 rsc = build_stt_resources(sttres);
1988 /* 'build_stt_resources' returns a head and $1 is a tail */
1989 if(yyvsp[0].res)
1990 {
1991 yyvsp[0].res->next = rsc;
1992 if(rsc)
1993 rsc->prev = yyvsp[0].res;
1994 }
1995 else
1996 yyvsp[0].res = rsc;
1997 /* Find the tail again */
1998 while(yyvsp[0].res && yyvsp[0].res->next)
1999 yyvsp[0].res = yyvsp[0].res->next;
2000 /* Now add any fontdirecory */
2001 rsc = build_fontdirs(yyvsp[0].res);
2002 /* 'build_fontdir' returns a head and $1 is a tail */
2003 if(yyvsp[0].res)
2004 {
2005 yyvsp[0].res->next = rsc;
2006 if(rsc)
2007 rsc->prev = yyvsp[0].res;
2008 }
2009 else
2010 yyvsp[0].res = rsc;
2011 /* Final statement before were done */
2012 resource_top = get_resource_head(yyvsp[0].res);
2013 ;}
2014 break;
2015
2016 case 3:
2017 #line 395 "parser.y"
2018 { yyval.res = NULL; want_id = 1; ;}
2019 break;
2020
2021 case 4:
2022 #line 396 "parser.y"
2023 {
2024 if(yyvsp[0].res)
2025 {
2026 resource_t *tail = yyvsp[0].res;
2027 resource_t *head = yyvsp[0].res;
2028 while(tail->next)
2029 tail = tail->next;
2030 while(head->prev)
2031 head = head->prev;
2032 head->prev = yyvsp[-1].res;
2033 if(yyvsp[-1].res)
2034 yyvsp[-1].res->next = head;
2035 yyval.res = tail;
2036 /* Check for duplicate identifiers */
2037 while(yyvsp[-1].res && head)
2038 {
2039 resource_t *rsc = yyvsp[-1].res;
2040 while(rsc)
2041 {
2042 if(rsc->type == head->type
2043 && rsc->lan->id == head->lan->id
2044 && rsc->lan->sub == head->lan->sub
2045 && !compare_name_id(rsc->name, head->name))
2046 {
2047 yyerror("Duplicate resource name '%s'", get_nameid_str(rsc->name));
2048 }
2049 rsc = rsc->prev;
2050 }
2051 head = head->next;
2052 }
2053 }
2054 else if(yyvsp[-1].res)
2055 {
2056 resource_t *tail = yyvsp[-1].res;
2057 while(tail->next)
2058 tail = tail->next;
2059 yyval.res = tail;
2060 }
2061 else
2062 yyval.res = NULL;
2063
2064 if(!dont_want_id) /* See comments in language parsing below */
2065 want_id = 1;
2066 dont_want_id = 0;
2067 ;}
2068 break;
2069
2070 case 6:
2071 #line 472 "parser.y"
2072 {
2073 yyval.res = yyvsp[0].res;
2074 if(yyval.res)
2075 {
2076 if(yyvsp[-2].num > 65535 || yyvsp[-2].num < -32768)
2077 yyerror("Resource's ID out of range (%d)", yyvsp[-2].num);
2078 yyval.res->name = new_name_id();
2079 yyval.res->name->type = name_ord;
2080 yyval.res->name->name.i_name = yyvsp[-2].num;
2081 chat("Got %s (%d)", get_typename(yyvsp[0].res), yyval.res->name->name.i_name);
2082 }
2083 ;}
2084 break;
2085
2086 case 7:
2087 #line 484 "parser.y"
2088 {
2089 yyval.res = yyvsp[0].res;
2090 if(yyval.res)
2091 {
2092 yyval.res->name = new_name_id();
2093 yyval.res->name->type = name_str;
2094 yyval.res->name->name.s_name = yyvsp[-2].str;
2095 chat("Got %s (%s)", get_typename(yyvsp[0].res), yyval.res->name->name.s_name->str.cstr);
2096 }
2097 ;}
2098 break;
2099
2100 case 8:
2101 #line 494 "parser.y"
2102 {
2103 /* Don't do anything, stringtables are converted to
2104 * resource_t structures when we are finished parsing and
2105 * the final rule of the parser is reduced (see above)
2106 */
2107 yyval.res = NULL;
2108 chat("Got STRINGTABLE");
2109 ;}
2110 break;
2111
2112 case 9:
2113 #line 502 "parser.y"
2114 {want_nl = 1; ;}
2115 break;
2116
2117 case 10:
2118 #line 502 "parser.y"
2119 {
2120 /* We *NEED* the newline to delimit the expression.
2121 * Otherwise, we would not be able to set the next
2122 * want_id anymore because of the token-lookahead.
2123 *
2124 * However, we can test the lookahead-token for
2125 * being "non-expression" type, in which case we
2126 * continue. Fortunately, tNL is the only token that
2127 * will break expression parsing and is implicitely
2128 * void, so we just remove it. This scheme makes it
2129 * possible to do some (not all) fancy preprocessor
2130 * stuff.
2131 * BTW, we also need to make sure that the next
2132 * reduction of 'resources' above will *not* set
2133 * want_id because we already have a lookahead that
2134 * cannot be undone.
2135 */
2136 if(yychar != YYEMPTY && yychar != tNL)
2137 dont_want_id = 1;
2138
2139 if(yychar == tNL)
2140 yychar = YYEMPTY; /* Could use 'yyclearin', but we already need the*/
2141 /* direct access to yychar in rule 'usrcvt' below. */
2142 else if(yychar == tIDENT)
2143 yywarning("LANGUAGE statement not delimited with newline; next identifier might be wrong");
2144
2145 want_nl = 0; /* We don't want it anymore if we didn't get it */
2146
2147 if(!win32)
2148 yywarning("LANGUAGE not supported in 16-bit mode");
2149 if(currentlanguage)
2150 free(currentlanguage);
2151 if (get_language_codepage(yyvsp[-2].num, yyvsp[0].num) == -1)
2152 yyerror( "Language %04x is not supported", (yyvsp[0].num<<10) + yyvsp[-2].num);
2153 currentlanguage = new_language(yyvsp[-2].num, yyvsp[0].num);
2154 yyval.res = NULL;
2155 chat("Got LANGUAGE %d,%d (0x%04x)", yyvsp[-2].num, yyvsp[0].num, (yyvsp[0].num<<10) + yyvsp[-2].num);
2156 ;}
2157 break;
2158
2159 case 11:
2160 #line 546 "parser.y"
2161 { yychar = rsrcid_to_token(yychar); ;}
2162 break;
2163
2164 case 12:
2165 #line 552 "parser.y"
2166 {
2167 if(yyvsp[0].num > 65535 || yyvsp[0].num < -32768)
2168 yyerror("Resource's ID out of range (%d)", yyvsp[0].num);
2169 yyval.nid = new_name_id();
2170 yyval.nid->type = name_ord;
2171 yyval.nid->name.i_name = yyvsp[0].num;
2172 ;}
2173 break;
2174
2175 case 13:
2176 #line 559 "parser.y"
2177 {
2178 yyval.nid = new_name_id();
2179 yyval.nid->type = name_str;
2180 yyval.nid->name.s_name = yyvsp[0].str;
2181 ;}
2182 break;
2183
2184 case 14:
2185 #line 569 "parser.y"
2186 { yyval.nid = yyvsp[0].nid; ;}
2187 break;
2188
2189 case 15:
2190 #line 570 "parser.y"
2191 {
2192 yyval.nid = new_name_id();
2193 yyval.nid->type = name_str;
2194 yyval.nid->name.s_name = yyvsp[0].str;
2195 ;}
2196 break;
2197
2198 case 16:
2199 #line 579 "parser.y"
2200 { yyval.res = new_resource(res_acc, yyvsp[0].acc, yyvsp[0].acc->memopt, yyvsp[0].acc->lvc.language); ;}
2201 break;
2202
2203 case 17:
2204 #line 580 "parser.y"
2205 { yyval.res = new_resource(res_bmp, yyvsp[0].bmp, yyvsp[0].bmp->memopt, yyvsp[0].bmp->data->lvc.language); ;}
2206 break;
2207
2208 case 18:
2209 #line 581 "parser.y"
2210 {
2211 resource_t *rsc;
2212 if(yyvsp[0].ani->type == res_anicur)
2213 {
2214 yyval.res = rsc = new_resource(res_anicur, yyvsp[0].ani->u.ani, yyvsp[0].ani->u.ani->memopt, yyvsp[0].ani->u.ani->data->lvc.language);
2215 }
2216 else if(yyvsp[0].ani->type == res_curg)
2217 {
2218 cursor_t *cur;
2219 yyval.res = rsc = new_resource(res_curg, yyvsp[0].ani->u.curg, yyvsp[0].ani->u.curg->memopt, yyvsp[0].ani->u.curg->lvc.language);
2220 for(cur = yyvsp[0].ani->u.curg->cursorlist; cur; cur = cur->next)
2221 {
2222 rsc->prev = new_resource(res_cur, cur, yyvsp[0].ani->u.curg->memopt, yyvsp[0].ani->u.curg->lvc.language);
2223 rsc->prev->next = rsc;
2224 rsc = rsc->prev;
2225 rsc->name = new_name_id();
2226 rsc->name->type = name_ord;
2227 rsc->name->name.i_name = cur->id;
2228 }
2229 }
2230 else
2231 internal_error(__FILE__, __LINE__, "Invalid top-level type %d in cursor resource", yyvsp[0].ani->type);
2232 free(yyvsp[0].ani);
2233 ;}
2234 break;
2235
2236 case 19:
2237 #line 605 "parser.y"
2238 { yyval.res = new_resource(res_dlg, yyvsp[0].dlg, yyvsp[0].dlg->memopt, yyvsp[0].dlg->lvc.language); ;}
2239 break;
2240
2241 case 20:
2242 #line 606 "parser.y"
2243 {
2244 if(win32)
2245 yyval.res = new_resource(res_dlgex, yyvsp[0].dlgex, yyvsp[0].dlgex->memopt, yyvsp[0].dlgex->lvc.language);
2246 else
2247 yyval.res = NULL;
2248 ;}
2249 break;
2250
2251 case 21:
2252 #line 612 "parser.y"
2253 { yyval.res = new_resource(res_dlginit, yyvsp[0].dginit, yyvsp[0].dginit->memopt, yyvsp[0].dginit->data->lvc.language); ;}
2254 break;
2255
2256 case 22:
2257 #line 613 "parser.y"
2258 { yyval.res = new_resource(res_fnt, yyvsp[0].fnt, yyvsp[0].fnt->memopt, yyvsp[0].fnt->data->lvc.language); ;}
2259 break;
2260
2261 case 23:
2262 #line 614 "parser.y"
2263 { yyval.res = new_resource(res_fntdir, yyvsp[0].fnd, yyvsp[0].fnd->memopt, yyvsp[0].fnd->data->lvc.language); ;}
2264 break;
2265
2266 case 24:
2267 #line 615 "parser.y"
2268 {
2269 resource_t *rsc;
2270 if(yyvsp[0].ani->type == res_aniico)
2271 {
2272 yyval.res = rsc = new_resource(res_aniico, yyvsp[0].ani->u.ani, yyvsp[0].ani->u.ani->memopt, yyvsp[0].ani->u.ani->data->lvc.language);
2273 }
2274 else if(yyvsp[0].ani->type == res_icog)
2275 {
2276 icon_t *ico;
2277 yyval.res = rsc = new_resource(res_icog, yyvsp[0].ani->u.icog, yyvsp[0].ani->u.icog->memopt, yyvsp[0].ani->u.icog->lvc.language);
2278 for(ico = yyvsp[0].ani->u.icog->iconlist; ico; ico = ico->next)
2279 {
2280 rsc->prev = new_resource(res_ico, ico, yyvsp[0].ani->u.icog->memopt, yyvsp[0].ani->u.icog->lvc.language);
2281 rsc->prev->next = rsc;
2282 rsc = rsc->prev;
2283 rsc->name = new_name_id();
2284 rsc->name->type = name_ord;
2285 rsc->name->name.i_name = ico->id;
2286 }
2287 }
2288 else
2289 internal_error(__FILE__, __LINE__, "Invalid top-level type %d in icon resource", yyvsp[0].ani->type);
2290 free(yyvsp[0].ani);
2291 ;}
2292 break;
2293
2294 case 25:
2295 #line 639 "parser.y"
2296 { yyval.res = new_resource(res_men, yyvsp[0].men, yyvsp[0].men->memopt, yyvsp[0].men->lvc.language); ;}
2297 break;
2298
2299 case 26:
2300 #line 640 "parser.y"
2301 {
2302 if(win32)
2303 yyval.res = new_resource(res_menex, yyvsp[0].menex, yyvsp[0].menex->memopt, yyvsp[0].menex->lvc.language);
2304 else
2305 yyval.res = NULL;
2306 ;}
2307 break;
2308
2309 case 27:
2310 #line 646 "parser.y"
2311 { yyval.res = new_resource(res_msg, yyvsp[0].msg, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, yyvsp[0].msg->data->lvc.language); ;}
2312 break;
2313
2314 case 28:
2315 #line 647 "parser.y"
2316 { yyval.res = new_resource(res_rdt, yyvsp[0].rdt, yyvsp[0].rdt->memopt, yyvsp[0].rdt->data->lvc.language); ;}
2317 break;
2318
2319 case 29:
2320 #line 648 "parser.y"
2321 { yyval.res = new_resource(res_toolbar, yyvsp[0].tlbar, yyvsp[0].tlbar->memopt, yyvsp[0].tlbar->lvc.language); ;}
2322 break;
2323
2324 case 30:
2325 #line 649 "parser.y"
2326 { yyval.res = new_resource(res_usr, yyvsp[0].usr, yyvsp[0].usr->memopt, yyvsp[0].usr->data->lvc.language); ;}
2327 break;
2328
2329 case 31:
2330 #line 650 "parser.y"
2331 { yyval.res = new_resource(res_ver, yyvsp[0].veri, WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE, yyvsp[0].veri->lvc.language); ;}
2332 break;
2333
2334 case 32:
2335 #line 654 "parser.y"
2336 { yyval.str = make_filename(yyvsp[0].str); ;}
2337 break;
2338
2339 case 33:
2340 #line 655 "parser.y"
2341 { yyval.str = make_filename(yyvsp[0].str); ;}
2342 break;
2343
2344 case 34:
2345 #line 656 "parser.y"
2346 { yyval.str = make_filename(yyvsp[0].str); ;}
2347 break;
2348
2349 case 35:
2350 #line 660 "parser.y"
2351 { yyval.bmp = new_bitmap(yyvsp[0].raw, yyvsp[-1].iptr); ;}
2352 break;
2353
2354 case 36:
2355 #line 664 "parser.y"
2356 {
2357 yyval.ani = new_ani_any();
2358 if(yyvsp[0].raw->size > 4 && !memcmp(yyvsp[0].raw->data, riff, sizeof(riff)))
2359 {
2360 yyval.ani->type = res_anicur;
2361 yyval.ani->u.ani = new_ani_curico(res_anicur, yyvsp[0].raw, yyvsp[-1].iptr);
2362 }
2363 else
2364 {
2365 yyval.ani->type = res_curg;
2366 yyval.ani->u.curg = new_cursor_group(yyvsp[0].raw, yyvsp[-1].iptr);
2367 }
2368 ;}
2369 break;
2370
2371 case 37:
2372 #line 680 "parser.y"
2373 {
2374 yyval.ani = new_ani_any();
2375 if(yyvsp[0].raw->size > 4 && !memcmp(yyvsp[0].raw->data, riff, sizeof(riff)))
2376 {
2377 yyval.ani->type = res_aniico;
2378 yyval.ani->u.ani = new_ani_curico(res_aniico, yyvsp[0].raw, yyvsp[-1].iptr);
2379 }
2380 else
2381 {
2382 yyval.ani->type = res_icog;
2383 yyval.ani->u.icog = new_icon_group(yyvsp[0].raw, yyvsp[-1].iptr);
2384 }
2385 ;}
2386 break;
2387
2388 case 38:
2389 #line 702 "parser.y"
2390 { yyval.fnt = new_font(yyvsp[0].raw, yyvsp[-1].iptr); ;}
2391 break;
2392
2393 case 39:
2394 #line 712 "parser.y"
2395 { yyval.fnd = new_fontdir(yyvsp[0].raw, yyvsp[-1].iptr); ;}
2396 break;
2397
2398 case 40:
2399 #line 720 "parser.y"
2400 {
2401 if(!win32)
2402 yywarning("MESSAGETABLE not supported in 16-bit mode");
2403 yyval.msg = new_messagetable(yyvsp[0].raw, yyvsp[-1].iptr);
2404 ;}
2405 break;
2406
2407 case 41:
2408 #line 728 "parser.y"
2409 { yyval.rdt = new_rcdata(yyvsp[0].raw, yyvsp[-1].iptr); ;}
2410 break;
2411
2412 case 42:
2413 #line 732 "parser.y"
2414 { yyval.dginit = new_dlginit(yyvsp[0].raw, yyvsp[-1].iptr); ;}
2415 break;
2416
2417 case 43:
2418 #line 736 "parser.y"
2419 {
2420 #ifdef WORDS_BIGENDIAN
2421 if(pedantic && byteorder != WRC_BO_LITTLE)
2422 #else
2423 if(pedantic && byteorder == WRC_BO_BIG)
2424 #endif
2425 yywarning("Byteordering is not little-endian and type cannot be interpreted");
2426 yyval.usr = new_user(yyvsp[-2].nid, yyvsp[0].raw, yyvsp[-1].iptr);
2427 ;}
2428 break;
2429
2430 case 44:
2431 #line 747 "parser.y"
2432 {
2433 yyval.nid = new_name_id();
2434 yyval.nid->type = name_ord;
2435 yyval.nid->name.i_name = yyvsp[0].num;
2436 ;}
2437 break;
2438
2439 case 45:
2440 #line 752 "parser.y"
2441 {
2442 yyval.nid = new_name_id();
2443 yyval.nid->type = name_str;
2444 yyval.nid->name.s_name = yyvsp[0].str;
2445 ;}
2446 break;
2447
2448 case 46:
2449 #line 761 "parser.y"
2450 {
2451 yyval.acc = new_accelerator();
2452 if(yyvsp[-4].iptr)
2453 {
2454 yyval.acc->memopt = *(yyvsp[-4].iptr);
2455 free(yyvsp[-4].iptr);
2456 }
2457 else
2458 {
2459 yyval.acc->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
2460 }
2461 if(!yyvsp[-1].event)
2462 yyerror("Accelerator table must have at least one entry");
2463 yyval.acc->events = get_event_head(yyvsp[-1].event);
2464 if(yyvsp[-3].lvc)
2465 {
2466 yyval.acc->lvc = *(yyvsp[-3].lvc);
2467 free(yyvsp[-3].lvc);
2468 }
2469 if(!yyval.acc->lvc.language)
2470 yyval.acc->lvc.language = dup_language(currentlanguage);
2471 ;}
2472 break;
2473
2474 case 47:
2475 #line 785 "parser.y"
2476 { yyval.event=NULL; ;}
2477 break;
2478
2479 case 48:
2480 #line 786 "parser.y"
2481 { yyval.event=add_string_event(yyvsp[-3].str, yyvsp[-1].num, yyvsp[0].num, yyvsp[-4].event); ;}
2482 break;
2483
2484 case 49:
2485 #line 787 "parser.y"
2486 { yyval.event=add_event(yyvsp[-3].num, yyvsp[-1].num, yyvsp[0].num, yyvsp[-4].event); ;}
2487 break;
2488
2489 case 50:
2490 #line 796 "parser.y"
2491 { yyval.num = 0; ;}
2492 break;
2493
2494 case 51:
2495 #line 797 "parser.y"
2496 { yyval.num = yyvsp[0].num; ;}
2497 break;
2498
2499 case 52:
2500 #line 800 "parser.y"
2501 { yyval.num = yyvsp[0].num; ;}
2502 break;
2503
2504 case 53:
2505 #line 801 "parser.y"
2506 { yyval.num = yyvsp[-2].num | yyvsp[0].num; ;}
2507 break;
2508
2509 case 54:
2510 #line 804 "parser.y"
2511 { yyval.num = WRC_AF_NOINVERT; ;}
2512 break;
2513
2514 case 55:
2515 #line 805 "parser.y"
2516 { yyval.num = WRC_AF_SHIFT; ;}
2517 break;
2518
2519 case 56:
2520 #line 806 "parser.y"
2521 { yyval.num = WRC_AF_CONTROL; ;}
2522 break;
2523
2524 case 57:
2525 #line 807 "parser.y"
2526 { yyval.num = WRC_AF_ALT; ;}
2527 break;
2528
2529 case 58:
2530 #line 808 "parser.y"
2531 { yyval.num = WRC_AF_ASCII; ;}
2532 break;
2533
2534 case 59:
2535 #line 809 "parser.y"
2536 { yyval.num = WRC_AF_VIRTKEY; ;}
2537 break;
2538
2539 case 60:
2540 #line 815 "parser.y"
2541 {
2542 if(yyvsp[-11].iptr)
2543 {
2544 yyvsp[-3].dlg->memopt = *(yyvsp[-11].iptr);
2545 free(yyvsp[-11].iptr);
2546 }
2547 else
2548 yyvsp[-3].dlg->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE;
2549 yyvsp[-3].dlg->x = yyvsp[-10].num;
2550 yyvsp[-3].dlg->y = yyvsp[-8].num;
2551 yyvsp[-3].dlg->width = yyvsp[-6].num;
2552 yyvsp[-3].dlg->height = yyvsp[-4].num;
2553 yyvsp[-3].dlg->controls = get_control_head(yyvsp[-1].ctl);
2554 yyval.dlg = yyvsp[-3].dlg;
2555 if(!yyval.dlg->gotstyle)
2556 {
2557 yyval.dlg->style = new_style(0,0);
2558 yyval.dlg->style->or_mask = WS_POPUP;
2559 yyval.dlg->gotstyle = TRUE;
2560 }
2561 if(yyval.dlg->title)
2562 yyval.dlg->style->or_mask |= WS_CAPTION;
2563 if(yyval.dlg->font)
2564 yyval.dlg->style->or_mask |= DS_SETFONT;
2565
2566 yyval.dlg->style->or_mask &= ~(yyval.dlg->style->and_mask);
2567 yyval.dlg->style->and_mask = 0;
2568
2569 if(!yyval.dlg->lvc.language)
2570 yyval.dlg->lvc.language = dup_language(currentlanguage);
2571 ;}
2572 break;
2573
2574 case 61:
2575 #line 849 "parser.y"
2576 { yyval.dlg=new_dialog(); ;}
2577 break;
2578
2579 case 62:
2580 #line 850 "parser.y"
2581 { yyval.dlg=dialog_style(yyvsp[0].style,yyvsp[-2].dlg); ;}
2582 break;
2583
2584 case 63:
2585 #line 851 "parser.y"
2586 { yyval.dlg=dialog_exstyle(yyvsp[0].style,yyvsp[-2].dlg); ;}
2587 break;
2588
2589 case 64:
2590 #line 852 "parser.y"
2591 { yyval.dlg=dialog_caption(yyvsp[0].str,yyvsp[-2].dlg); ;}
2592 break;
2593
2594 case 65:
2595 #line 853 "parser.y"
2596 { yyval.dlg=dialog_font(yyvsp[0].fntid,yyvsp[-1].dlg); ;}
2597 break;
2598
2599 case 66:
2600 #line 854 "parser.y"
2601 { yyval.dlg=dialog_class(yyvsp[0].nid,yyvsp[-2].dlg); ;}
2602 break;
2603
2604 case 67:
2605 #line 855 "parser.y"
2606 { yyval.dlg=dialog_menu(yyvsp[0].nid,yyvsp[-2].dlg); ;}
2607 break;
2608
2609 case 68:
2610 #line 856 "parser.y"
2611 { yyval.dlg=dialog_language(yyvsp[0].lan,yyvsp[-1].dlg); ;}
2612 break;
2613
2614 case 69:
2615 #line 857 "parser.y"
2616 { yyval.dlg=dialog_characteristics(yyvsp[0].chars,yyvsp[-1].dlg); ;}
2617 break;
2618
2619 case 70:
2620 #line 858 "parser.y"
2621 { yyval.dlg=dialog_version(yyvsp[0].ver,yyvsp[-1].dlg); ;}
2622 break;
2623
2624 case 71:
2625 #line 861 "parser.y"
2626 { yyval.ctl = NULL; ;}
2627 break;
2628
2629 case 72:
2630 #line 862 "parser.y"
2631 { yyval.ctl=ins_ctrl(-1, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2632 break;
2633
2634 case 73:
2635 #line 863 "parser.y"
2636 { yyval.ctl=ins_ctrl(CT_EDIT, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2637 break;
2638
2639 case 74:
2640 #line 864 "parser.y"
2641 { yyval.ctl=ins_ctrl(CT_LISTBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2642 break;
2643
2644 case 75:
2645 #line 865 "parser.y"
2646 { yyval.ctl=ins_ctrl(CT_COMBOBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2647 break;
2648
2649 case 76:
2650 #line 866 "parser.y"
2651 { yyval.ctl=ins_ctrl(CT_SCROLLBAR, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2652 break;
2653
2654 case 77:
2655 #line 867 "parser.y"
2656 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_CHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2657 break;
2658
2659 case 78:
2660 #line 868 "parser.y"
2661 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2662 break;
2663
2664 case 79:
2665 #line 869 "parser.y"
2666 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_GROUPBOX, yyvsp[0].ctl, yyvsp[-2].ctl);;}
2667 break;
2668
2669 case 80:
2670 #line 870 "parser.y"
2671 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2672 break;
2673
2674 case 81:
2675 #line 872 "parser.y"
2676 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2677 break;
2678
2679 case 82:
2680 #line 873 "parser.y"
2681 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2682 break;
2683
2684 case 83:
2685 #line 874 "parser.y"
2686 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2687 break;
2688
2689 case 84:
2690 #line 875 "parser.y"
2691 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2692 break;
2693
2694 case 85:
2695 #line 876 "parser.y"
2696 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2697 break;
2698
2699 case 86:
2700 #line 877 "parser.y"
2701 { yyval.ctl=ins_ctrl(CT_STATIC, SS_LEFT, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2702 break;
2703
2704 case 87:
2705 #line 878 "parser.y"
2706 { yyval.ctl=ins_ctrl(CT_STATIC, SS_CENTER, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2707 break;
2708
2709 case 88:
2710 #line 879 "parser.y"
2711 { yyval.ctl=ins_ctrl(CT_STATIC, SS_RIGHT, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
2712 break;
2713
2714 case 89:
2715 #line 881 "parser.y"
2716 {
2717 yyvsp[0].ctl->title = yyvsp[-7].nid;
2718 yyvsp[0].ctl->id = yyvsp[-5].num;
2719 yyvsp[0].ctl->x = yyvsp[-3].num;
2720 yyvsp[0].ctl->y = yyvsp[-1].num;
2721 yyval.ctl = ins_ctrl(CT_STATIC, SS_ICON, yyvsp[0].ctl, yyvsp[-9].ctl);
2722 ;}
2723 break;
2724
2725 case 90:
2726 #line 891 "parser.y"
2727 {
2728 yyval.ctl=new_control();
2729 yyval.ctl->title = new_name_id();
2730 yyval.ctl->title->type = name_str;
2731 yyval.ctl->title->name.s_name = yyvsp[-11].str;
2732 yyval.ctl->id = yyvsp[-9].num;
2733 yyval.ctl->x = yyvsp[-7].num;
2734 yyval.ctl->y = yyvsp[-5].num;
2735 yyval.ctl->width = yyvsp[-3].num;
2736 yyval.ctl->height = yyvsp[-1].num;
2737 if(yyvsp[0].styles)
2738 {
2739 yyval.ctl->style = yyvsp[0].styles->style;
2740 yyval.ctl->gotstyle = TRUE;
2741 if (yyvsp[0].styles->exstyle)
2742 {
2743 yyval.ctl->exstyle = yyvsp[0].styles->exstyle;
2744 yyval.ctl->gotexstyle = TRUE;
2745 }
2746 free(yyvsp[0].styles);
2747 }
2748 ;}
2749 break;
2750
2751 case 91:
2752 #line 916 "parser.y"
2753 {
2754 yyval.ctl = new_control();
2755 yyval.ctl->id = yyvsp[-9].num;
2756 yyval.ctl->x = yyvsp[-7].num;
2757 yyval.ctl->y = yyvsp[-5].num;
2758 yyval.ctl->width = yyvsp[-3].num;
2759 yyval.ctl->height = yyvsp[-1].num;
2760 if(yyvsp[0].styles)
2761 {
2762 yyval.ctl->style = yyvsp[0].styles->style;
2763 yyval.ctl->gotstyle = TRUE;
2764 if (yyvsp[0].styles->exstyle)
2765 {
2766 yyval.ctl->exstyle = yyvsp[0].styles->exstyle;
2767 yyval.ctl->gotexstyle = TRUE;
2768 }
2769 free(yyvsp[0].styles);
2770 }
2771 ;}
2772 break;
2773
2774 case 92:
2775 #line 938 "parser.y"
2776 { yyval.ctl = new_control(); ;}
2777 break;
2778
2779 case 93:
2780 #line 940 "parser.y"
2781 {
2782 yyval.ctl = new_control();
2783 yyval.ctl->width = yyvsp[-2].num;
2784 yyval.ctl->height = yyvsp[0].num;
2785 ;}
2786 break;
2787
2788 case 94:
2789 #line 945 "parser.y"
2790 {
2791 yyval.ctl = new_control();
2792 yyval.ctl->width = yyvsp[-4].num;
2793 yyval.ctl->height = yyvsp[-2].num;
2794 yyval.ctl->style = yyvsp[0].style;
2795 yyval.ctl->gotstyle = TRUE;
2796 ;}
2797 break;
2798
2799 case 95:
2800 #line 952 "parser.y"
2801 {
2802 yyval.ctl = new_control();
2803 yyval.ctl->width = yyvsp[-6].num;
2804 yyval.ctl->height = yyvsp[-4].num;
2805 yyval.ctl->style = yyvsp[-2].style;
2806 yyval.ctl->gotstyle = TRUE;
2807 yyval.ctl->exstyle = yyvsp[0].style;
2808 yyval.ctl->gotexstyle = TRUE;
2809 ;}
2810 break;
2811
2812 case 96:
2813 #line 963 "parser.y"
2814 {
2815 yyval.ctl=new_control();
2816 yyval.ctl->title = yyvsp[-16].nid;
2817 yyval.ctl->id = yyvsp[-14].num;
2818 yyval.ctl->ctlclass = convert_ctlclass(yyvsp[-12].nid);
2819 yyval.ctl->style = yyvsp[-10].style;
2820 yyval.ctl->gotstyle = TRUE;
2821 yyval.ctl->x = yyvsp[-8].num;
2822 yyval.ctl->y = yyvsp[-6].num;
2823 yyval.ctl->width = yyvsp[-4].num;
2824 yyval.ctl->height = yyvsp[-2].num;
2825 yyval.ctl->exstyle = yyvsp[0].style;
2826 yyval.ctl->gotexstyle = TRUE;
2827 ;}
2828 break;
2829
2830 case 97:
2831 #line 977 "parser.y"
2832 {
2833 yyval.ctl=new_control();
2834 yyval.ctl->title = yyvsp[-14].nid;
2835 yyval.ctl->id = yyvsp[-12].num;
2836 yyval.ctl->ctlclass = convert_ctlclass(yyvsp[-10].nid);
2837 yyval.ctl->style = yyvsp[-8].style;
2838 yyval.ctl->gotstyle = TRUE;
2839 yyval.ctl->x = yyvsp[-6].num;
2840 yyval.ctl->y = yyvsp[-4].num;
2841 yyval.ctl->width = yyvsp[-2].num;
2842 yyval.ctl->height = yyvsp[0].num;
2843 ;}
2844 break;
2845
2846 case 98:
2847 #line 992 "parser.y"
2848 { yyval.fntid = new_font_id(yyvsp[-2].num, yyvsp[0].str, 0, 0); ;}
2849 break;
2850
2851 case 99:
2852 #line 997 "parser.y"
2853 { yyval.styles = NULL; ;}
2854 break;
2855
2856 case 100:
2857 #line 998 "parser.y"
2858 { yyval.styles = new_style_pair(yyvsp[0].style, 0); ;}
2859 break;
2860
2861 case 101:
2862 #line 999 "parser.y"
2863 { yyval.styles = new_style_pair(yyvsp[-2].style, yyvsp[0].style); ;}
2864 break;
2865
2866 case 102:
2867 #line 1003 "parser.y"
2868 { yyval.style = new_style(yyvsp[-2].style->or_mask | yyvsp[0].style->or_mask, yyvsp[-2].style->and_mask | yyvsp[0].style->and_mask); free(yyvsp[-2].style); free(yyvsp[0].style);;}
2869 break;
2870
2871 case 103:
2872 #line 1004 "parser.y"
2873 { yyval.style = yyvsp[-1].style; ;}
2874 break;
2875
2876 case 104:
2877 #line 1005 "parser.y"
2878 { yyval.style = new_style(yyvsp[0].num, 0); ;}
2879 break;
2880
2881 case 105:
2882 #line 1006 "parser.y"
2883 { yyval.style = new_style(0, yyvsp[0].num); ;}
2884 break;
2885
2886 case 106:
2887 #line 1010 "parser.y"
2888 {
2889 yyval.nid = new_name_id();
2890 yyval.nid->type = name_ord;
2891 yyval.nid->name.i_name = yyvsp[0].num;
2892 ;}
2893 break;
2894
2895 case 107:
2896 #line 1015 "parser.y"
2897 {
2898 yyval.nid = new_name_id();
2899 yyval.nid->type = name_str;
2900 yyval.nid->name.s_name = yyvsp[0].str;
2901 ;}
2902 break;
2903
2904 case 108:
2905 #line 1024 "parser.y"
2906 {
2907 if(!win32)
2908 yywarning("DIALOGEX not supported in 16-bit mode");
2909 if(yyvsp[-12].iptr)
2910 {
2911 yyvsp[-3].dlgex->memopt = *(yyvsp[-12].iptr);
2912 free(yyvsp[-12].iptr);
2913 }
2914 else
2915 yyvsp[-3].dlgex->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE;
2916 yyvsp[-3].dlgex->x = yyvsp[-11].num;
2917 yyvsp[-3].dlgex->y = yyvsp[-9].num;
2918 yyvsp[-3].dlgex->width = yyvsp[-7].num;
2919 yyvsp[-3].dlgex->height = yyvsp[-5].num;
2920 if(yyvsp[-4].iptr)
2921 {
2922 yyvsp[-3].dlgex->helpid = *(yyvsp[-4].iptr);
2923 yyvsp[-3].dlgex->gothelpid = TRUE;
2924 free(yyvsp[-4].iptr);
2925 }
2926 yyvsp[-3].dlgex->controls = get_control_head(yyvsp[-1].ctl);
2927 yyval.dlgex = yyvsp[-3].dlgex;
2928
2929 assert(yyval.dlgex->style != NULL);
2930 if(!yyval.dlgex->gotstyle)
2931 {
2932 yyval.dlgex->style->or_mask = WS_POPUP;
2933 yyval.dlgex->gotstyle = TRUE;
2934 }
2935 if(yyval.dlgex->title)
2936 yyval.dlgex->style->or_mask |= WS_CAPTION;
2937 if(yyval.dlgex->font)
2938 yyval.dlgex->style->or_mask |= DS_SETFONT;
2939
2940 yyval.dlgex->style->or_mask &= ~(yyval.dlgex->style->and_mask);
2941 yyval.dlgex->style->and_mask = 0;
2942
2943 if(!yyval.dlgex->lvc.language)
2944 yyval.dlgex->lvc.language = dup_language(currentlanguage);
2945 ;}
2946 break;
2947
2948 case 109:
2949 #line 1067 "parser.y"
2950 { yyval.dlgex=new_dialogex(); ;}
2951 break;
2952
2953 case 110:
2954 #line 1068 "parser.y"
2955 { yyval.dlgex=dialogex_style(yyvsp[0].style,yyvsp[-2].dlgex); ;}
2956 break;
2957
2958 case 111:
2959 #line 1069 "parser.y"
2960 { yyval.dlgex=dialogex_exstyle(yyvsp[0].style,yyvsp[-2].dlgex); ;}
2961 break;
2962
2963 case 112:
2964 #line 1070 "parser.y"
2965 { yyval.dlgex=dialogex_caption(yyvsp[0].str,yyvsp[-2].dlgex); ;}
2966 break;
2967
2968 case 113:
2969 #line 1071 "parser.y"
2970 { yyval.dlgex=dialogex_font(yyvsp[0].fntid,yyvsp[-1].dlgex); ;}
2971 break;
2972
2973 case 114:
2974 #line 1072 "parser.y"
2975 { yyval.dlgex=dialogex_font(yyvsp[0].fntid,yyvsp[-1].dlgex); ;}
2976 break;
2977
2978 case 115:
2979 #line 1073 "parser.y"
2980 { yyval.dlgex=dialogex_class(yyvsp[0].nid,yyvsp[-2].dlgex); ;}
2981 break;
2982
2983 case 116:
2984 #line 1074 "parser.y"
2985 { yyval.dlgex=dialogex_menu(yyvsp[0].nid,yyvsp[-2].dlgex); ;}
2986 break;
2987
2988 case 117:
2989 #line 1075 "parser.y"
2990 { yyval.dlgex=dialogex_language(yyvsp[0].lan,yyvsp[-1].dlgex); ;}
2991 break;
2992
2993 case 118:
2994 #line 1076 "parser.y"
2995 { yyval.dlgex=dialogex_characteristics(yyvsp[0].chars,yyvsp[-1].dlgex); ;}
2996 break;
2997
2998 case 119:
2999 #line 1077 "parser.y"
3000 { yyval.dlgex=dialogex_version(yyvsp[0].ver,yyvsp[-1].dlgex); ;}
3001 break;
3002
3003 case 120:
3004 #line 1080 "parser.y"
3005 { yyval.ctl = NULL; ;}
3006 break;
3007
3008 case 121:
3009 #line 1081 "parser.y"
3010 { yyval.ctl=ins_ctrl(-1, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3011 break;
3012
3013 case 122:
3014 #line 1082 "parser.y"
3015 { yyval.ctl=ins_ctrl(CT_EDIT, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3016 break;
3017
3018 case 123:
3019 #line 1083 "parser.y"
3020 { yyval.ctl=ins_ctrl(CT_LISTBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3021 break;
3022
3023 case 124:
3024 #line 1084 "parser.y"
3025 { yyval.ctl=ins_ctrl(CT_COMBOBOX, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3026 break;
3027
3028 case 125:
3029 #line 1085 "parser.y"
3030 { yyval.ctl=ins_ctrl(CT_SCROLLBAR, 0, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3031 break;
3032
3033 case 126:
3034 #line 1086 "parser.y"
3035 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_CHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3036 break;
3037
3038 case 127:
3039 #line 1087 "parser.y"
3040 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_DEFPUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3041 break;
3042
3043 case 128:
3044 #line 1088 "parser.y"
3045 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_GROUPBOX, yyvsp[0].ctl, yyvsp[-2].ctl);;}
3046 break;
3047
3048 case 129:
3049 #line 1089 "parser.y"
3050 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_PUSHBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3051 break;
3052
3053 case 130:
3054 #line 1091 "parser.y"
3055 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_RADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3056 break;
3057
3058 case 131:
3059 #line 1092 "parser.y"
3060 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTO3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3061 break;
3062
3063 case 132:
3064 #line 1093 "parser.y"
3065 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_3STATE, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3066 break;
3067
3068 case 133:
3069 #line 1094 "parser.y"
3070 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTOCHECKBOX, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3071 break;
3072
3073 case 134:
3074 #line 1095 "parser.y"
3075 { yyval.ctl=ins_ctrl(CT_BUTTON, BS_AUTORADIOBUTTON, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3076 break;
3077
3078 case 135:
3079 #line 1096 "parser.y"
3080 { yyval.ctl=ins_ctrl(CT_STATIC, SS_LEFT, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3081 break;
3082
3083 case 136:
3084 #line 1097 "parser.y"
3085 { yyval.ctl=ins_ctrl(CT_STATIC, SS_CENTER, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3086 break;
3087
3088 case 137:
3089 #line 1098 "parser.y"
3090 { yyval.ctl=ins_ctrl(CT_STATIC, SS_RIGHT, yyvsp[0].ctl, yyvsp[-2].ctl); ;}
3091 break;
3092
3093 case 138:
3094 #line 1100 "parser.y"
3095 {
3096 yyvsp[0].ctl->title = yyvsp[-7].nid;
3097 yyvsp[0].ctl->id = yyvsp[-5].num;
3098 yyvsp[0].ctl->x = yyvsp[-3].num;
3099 yyvsp[0].ctl->y = yyvsp[-1].num;
3100 yyval.ctl = ins_ctrl(CT_STATIC, SS_ICON, yyvsp[0].ctl, yyvsp[-9].ctl);
3101 ;}
3102 break;
3103
3104 case 139:
3105 #line 1111 "parser.y"
3106 {
3107 yyval.ctl=new_control();
3108 yyval.ctl->title = yyvsp[-18].nid;
3109 yyval.ctl->id = yyvsp[-16].num;
3110 yyval.ctl->ctlclass = convert_ctlclass(yyvsp[-14].nid);
3111 yyval.ctl->style = yyvsp[-12].style;
3112 yyval.ctl->gotstyle = TRUE;
3113 yyval.ctl->x = yyvsp[-10].num;
3114 yyval.ctl->y = yyvsp[-8].num;
3115 yyval.ctl->width = yyvsp[-6].num;
3116 yyval.ctl->height = yyvsp[-4].num;
3117 if(yyvsp[-2].style)
3118 {
3119 yyval.ctl->exstyle = yyvsp[-2].style;
3120 yyval.ctl->gotexstyle = TRUE;
3121 }
3122 if(yyvsp[-1].iptr)
3123 {
3124 yyval.ctl->helpid = *(yyvsp[-1].iptr);
3125 yyval.ctl->gothelpid = TRUE;
3126 free(yyvsp[-1].iptr);
3127 }
3128 yyval.ctl->extra = yyvsp[0].raw;
3129 ;}
3130 break;
3131
3132 case 140:
3133 #line 1135 "parser.y"
3134 {
3135 yyval.ctl=new_control();
3136 yyval.ctl->title = yyvsp[-15].nid;
3137 yyval.ctl->id = yyvsp[-13].num;
3138 yyval.ctl->style = yyvsp[-9].style;
3139 yyval.ctl->gotstyle = TRUE;
3140 yyval.ctl->ctlclass = convert_ctlclass(yyvsp[-11].nid);
3141 yyval.ctl->x = yyvsp[-7].num;
3142 yyval.ctl->y = yyvsp[-5].num;
3143 yyval.ctl->width = yyvsp[-3].num;
3144 yyval.ctl->height = yyvsp[-1].num;
3145 yyval.ctl->extra = yyvsp[0].raw;
3146 ;}
3147 break;
3148
3149 case 141:
3150 #line 1151 "parser.y"
3151 {
3152 yyval.ctl=new_control();
3153 yyval.ctl->title = new_name_id();
3154 yyval.ctl->title->type = name_str;
3155 yyval.ctl->title->name.s_name = yyvsp[-13].str;
3156 yyval.ctl->id = yyvsp[-11].num;
3157 yyval.ctl->x = yyvsp[-9].num;
3158 yyval.ctl->y = yyvsp[-7].num;
3159 yyval.ctl->width = yyvsp[-5].num;
3160 yyval.ctl->height = yyvsp[-3].num;
3161 if(yyvsp[-2].styles)
3162 {
3163 yyval.ctl->style = yyvsp[-2].styles->style;
3164 yyval.ctl->gotstyle = TRUE;
3165
3166 if (yyvsp[-2].styles->exstyle)
3167 {
3168 yyval.ctl->exstyle = yyvsp[-2].styles->exstyle;
3169 yyval.ctl->gotexstyle = TRUE;
3170 }
3171 free(yyvsp[-2].styles);
3172 }
3173
3174 yyval.ctl->extra = yyvsp[0].raw;
3175 ;}
3176 break;
3177
3178 case 142:
3179 #line 1179 "parser.y"
3180 {
3181 yyval.ctl = new_control();
3182 yyval.ctl->id = yyvsp[-11].num;
3183 yyval.ctl->x = yyvsp[-9].num;
3184 yyval.ctl->y = yyvsp[-7].num;
3185 yyval.ctl->width = yyvsp[-5].num;
3186 yyval.ctl->height = yyvsp[-3].num;
3187 if(yyvsp[-2].styles)
3188 {
3189 yyval.ctl->style = yyvsp[-2].styles->style;
3190 yyval.ctl->gotstyle = TRUE;
3191
3192 if (yyvsp[-2].styles->exstyle)
3193 {
3194 yyval.ctl->exstyle = yyvsp[-2].styles->exstyle;
3195 yyval.ctl->gotexstyle = TRUE;
3196 }
3197 free(yyvsp[-2].styles);
3198 }
3199 yyval.ctl->extra = yyvsp[0].raw;
3200 ;}
3201 break;
3202
3203 case 143:
3204 #line 1202 "parser.y"
3205 { yyval.raw = NULL; ;}
3206 break;
3207
3208 case 144:
3209 #line 1203 "parser.y"
3210 { yyval.raw = yyvsp[0].raw; ;}
3211 break;
3212
3213 case 145:
3214 #line 1206 "parser.y"
3215 { yyval.iptr = NULL; ;}
3216 break;
3217
3218 case 146:
3219 #line 1207 "parser.y"
3220 { yyval.iptr = new_int(yyvsp[0].num); ;}
3221 break;
3222
3223 case 147:
3224 #line 1211 "parser.y"
3225 { yyval.fntid = new_font_id(yyvsp[-7].num, yyvsp[-5].str, yyvsp[-3].num, yyvsp[-1].num); ;}
3226 break;
3227
3228 case 148:
3229 #line 1218 "parser.y"
3230 { yyval.fntid = NULL; ;}
3231 break;
3232
3233 case 149:
3234 #line 1219 "parser.y"
3235 { yyval.fntid = NULL; ;}
3236 break;
3237
3238 case 150:
3239 #line 1223 "parser.y"
3240 {
3241 if(!yyvsp[0].menitm)
3242 yyerror("Menu must contain items");
3243 yyval.men = new_menu();
3244 if(yyvsp[-2].iptr)
3245 {
3246 yyval.men->memopt = *(yyvsp[-2].iptr);
3247 free(yyvsp[-2].iptr);
3248 }
3249 else
3250 yyval.men->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE;
3251 yyval.men->items = get_item_head(yyvsp[0].menitm);
3252 if(yyvsp[-1].lvc)
3253 {
3254 yyval.men->lvc = *(yyvsp[-1].lvc);
3255 free(yyvsp[-1].lvc);
3256 }
3257 if(!yyval.men->lvc.language)
3258 yyval.men->lvc.language = dup_language(currentlanguage);
3259 ;}
3260 break;
3261
3262 case 151:
3263 #line 1246 "parser.y"
3264 { yyval.menitm = yyvsp[-1].menitm; ;}
3265 break;
3266
3267 case 152:
3268 #line 1250 "parser.y"
3269 {yyval.menitm = NULL;;}
3270 break;
3271
3272 case 153:
3273 #line 1251 "parser.y"
3274 {
3275 yyval.menitm=new_menu_item();
3276 yyval.menitm->prev = yyvsp[-5].menitm;
3277 if(yyvsp[-5].menitm)
3278 yyvsp[-5].menitm->next = yyval.menitm;
3279 yyval.menitm->id = yyvsp[-1].num;
3280 yyval.menitm->state = yyvsp[0].num;
3281 yyval.menitm->name = yyvsp[-3].str;
3282 ;}
3283 break;
3284
3285 case 154:
3286 #line 1260 "parser.y"
3287 {
3288 yyval.menitm=new_menu_item();
3289 yyval.menitm->prev = yyvsp[-2].menitm;
3290 if(yyvsp[-2].menitm)
3291 yyvsp[-2].menitm->next = yyval.menitm;
3292 ;}
3293 break;
3294
3295 case 155:
3296 #line 1266 "parser.y"
3297 {
3298 yyval.menitm = new_menu_item();
3299 yyval.menitm->prev = yyvsp[-4].menitm;
3300 if(yyvsp[-4].menitm)
3301 yyvsp[-4].menitm->next = yyval.menitm;
3302 yyval.menitm->popup = get_item_head(yyvsp[0].menitm);
3303 yyval.menitm->name = yyvsp[-2].str;
3304 ;}
3305 break;
3306
3307 case 156:
3308 #line 1285 "parser.y"
3309 { yyval.num = 0; ;}
3310 break;
3311
3312 case 157:
3313 #line 1286 "parser.y"
3314 { yyval.num = yyvsp[0].num | MF_CHECKED; ;}
3315 break;
3316
3317 case 158:
3318 #line 1287 "parser.y"
3319 { yyval.num = yyvsp[0].num | MF_GRAYED; ;}
3320 break;
3321
3322 case 159:
3323 #line 1288 "parser.y"
3324 { yyval.num = yyvsp[0].num | MF_HELP; ;}
3325 break;
3326
3327 case 160:
3328 #line 1289 "parser.y"
3329 { yyval.num = yyvsp[0].num | MF_DISABLED; ;}
3330 break;
3331
3332 case 161:
3333 #line 1290 "parser.y"
3334 { yyval.num = yyvsp[0].num | MF_MENUBARBREAK; ;}
3335 break;
3336
3337 case 162:
3338 #line 1291 "parser.y"
3339 { yyval.num = yyvsp[0].num | MF_MENUBREAK; ;}
3340 break;
3341
3342 case 163:
3343 #line 1295 "parser.y"
3344 {
3345 if(!win32)
3346 yywarning("MENUEX not supported in 16-bit mode");
3347 if(!yyvsp[0].menexitm)
3348 yyerror("MenuEx must contain items");
3349 yyval.menex = new_menuex();
3350 if(yyvsp[-2].iptr)
3351 {
3352 yyval.menex->memopt = *(yyvsp[-2].iptr);
3353 free(yyvsp[-2].iptr);
3354 }
3355 else
3356 yyval.menex->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE | WRC_MO_DISCARDABLE;
3357 yyval.menex->items = get_itemex_head(yyvsp[0].menexitm);
3358 if(yyvsp[-1].lvc)
3359 {
3360 yyval.menex->lvc = *(yyvsp[-1].lvc);
3361 free(yyvsp[-1].lvc);
3362 }
3363 if(!yyval.menex->lvc.language)
3364 yyval.menex->lvc.language = dup_language(currentlanguage);
3365 ;}
3366 break;
3367
3368 case 164:
3369 #line 1320 "parser.y"
3370 { yyval.menexitm = yyvsp[-1].menexitm; ;}
3371 break;
3372
3373 case 165:
3374 #line 1324 "parser.y"
3375 {yyval.menexitm = NULL; ;}
3376 break;
3377
3378 case 166:
3379 #line 1325 "parser.y"
3380 {
3381 yyval.menexitm = new_menuex_item();
3382 yyval.menexitm->prev = yyvsp[-3].menexitm;
3383 if(yyvsp[-3].menexitm)
3384 yyvsp[-3].menexitm->next = yyval.menexitm;
3385 yyval.menexitm->name = yyvsp[-1].str;
3386 yyval.menexitm->id = yyvsp[0].exopt->id;
3387 yyval.menexitm->type = yyvsp[0].exopt->type;
3388 yyval.menexitm->state = yyvsp[0].exopt->state;
3389 yyval.menexitm->helpid = yyvsp[0].exopt->helpid;
3390 yyval.menexitm->gotid = yyvsp[0].exopt->gotid;
3391 yyval.menexitm->gottype = yyvsp[0].exopt->gottype;
3392 yyval.menexitm->gotstate = yyvsp[0].exopt->gotstate;
3393 yyval.menexitm->gothelpid = yyvsp[0].exopt->gothelpid;
3394 free(yyvsp[0].exopt);
3395 ;}
3396 break;
3397
3398 case 167:
3399 #line 1341 "parser.y"
3400 {
3401 yyval.menexitm = new_menuex_item();
3402 yyval.menexitm->prev = yyvsp[-2].menexitm;
3403 if(yyvsp[-2].menexitm)
3404 yyvsp[-2].menexitm->next = yyval.menexitm;
3405 ;}
3406 break;
3407
3408 case 168:
3409 #line 1347 "parser.y"
3410 {
3411 yyval.menexitm = new_menuex_item();
3412 yyval.menexitm->prev = yyvsp[-4].menexitm;
3413 if(yyvsp[-4].menexitm)
3414 yyvsp[-4].menexitm->next = yyval.menexitm;
3415 yyval.menexitm->popup = get_itemex_head(yyvsp[0].menexitm);
3416 yyval.menexitm->name = yyvsp[-2].str;
3417 yyval.menexitm->id = yyvsp[-1].exopt->id;
3418 yyval.menexitm->type = yyvsp[-1].exopt->type;
3419 yyval.menexitm->state = yyvsp[-1].exopt->state;
3420 yyval.menexitm->helpid = yyvsp[-1].exopt->helpid;
3421 yyval.menexitm->gotid = yyvsp[-1].exopt->gotid;
3422 yyval.menexitm->gottype = yyvsp[-1].exopt->gottype;
3423 yyval.menexitm->gotstate = yyvsp[-1].exopt->gotstate;
3424 yyval.menexitm->gothelpid = yyvsp[-1].exopt->gothelpid;
3425 free(yyvsp[-1].exopt);
3426 ;}
3427 break;
3428
3429 case 169:
3430 #line 1367 "parser.y"
3431 { yyval.exopt = new_itemex_opt(0, 0, 0, 0); ;}
3432 break;
3433
3434 case 170:
3435 #line 1368 "parser.y"
3436 {
3437 yyval.exopt = new_itemex_opt(yyvsp[0].num, 0, 0, 0);
3438 yyval.exopt->gotid = TRUE;
3439 ;}
3440 break;
3441
3442 case 171:
3443 #line 1372 "parser.y"
3444 {
3445 yyval.exopt = new_itemex_opt(yyvsp[-3].iptr ? *(yyvsp[-3].iptr) : 0, yyvsp[-1].iptr ? *(yyvsp[-1].iptr) : 0, yyvsp[0].num, 0);
3446 yyval.exopt->gotid = TRUE;
3447 yyval.exopt->gottype = TRUE;
3448 yyval.exopt->gotstate = TRUE;
3449 if(yyvsp[-3].iptr) free(yyvsp[-3].iptr);
3450 if(yyvsp[-1].iptr) free(yyvsp[-1].iptr);
3451 ;}
3452 break;
3453
3454 case 172:
3455 #line 1380 "parser.y"
3456 {
3457 yyval.exopt = new_itemex_opt(yyvsp[-4].iptr ? *(yyvsp[-4].iptr) : 0, yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num, 0);
3458 yyval.exopt->gotid = TRUE;
3459 yyval.exopt->gottype = TRUE;
3460 yyval.exopt->gotstate = TRUE;
3461 if(yyvsp[-4].iptr) free(yyvsp[-4].iptr);
3462 if(yyvsp[-2].iptr) free(yyvsp[-2].iptr);
3463 ;}
3464 break;
3465
3466 case 173:
3467 #line 1391 "parser.y"
3468 { yyval.exopt = new_itemex_opt(0, 0, 0, 0); ;}
3469 break;
3470
3471 case 174:
3472 #line 1392 "parser.y"
3473 {
3474 yyval.exopt = new_itemex_opt(yyvsp[0].num, 0, 0, 0);
3475 yyval.exopt->gotid = TRUE;
3476 ;}
3477 break;
3478
3479 case 175:
3480 #line 1396 "parser.y"
3481 {
3482 yyval.exopt = new_itemex_opt(yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num, 0, 0);
3483 if(yyvsp[-2].iptr) free(yyvsp[-2].iptr);
3484 yyval.exopt->gotid = TRUE;
3485 yyval.exopt->gottype = TRUE;
3486 ;}
3487 break;
3488
3489 case 176:
3490 #line 1402 "parser.y"
3491 {
3492 yyval.exopt = new_itemex_opt(yyvsp[-4].iptr ? *(yyvsp[-4].iptr) : 0, yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num, 0);
3493 if(yyvsp[-4].iptr) free(yyvsp[-4].iptr);
3494 if(yyvsp[-2].iptr) free(yyvsp[-2].iptr);
3495 yyval.exopt->gotid = TRUE;
3496 yyval.exopt->gottype = TRUE;
3497 yyval.exopt->gotstate = TRUE;
3498 ;}
3499 break;
3500
3501 case 177:
3502 #line 1410 "parser.y"
3503 {
3504 yyval.exopt = new_itemex_opt(yyvsp[-6].iptr ? *(yyvsp[-6].iptr) : 0, yyvsp[-4].iptr ? *(yyvsp[-4].iptr) : 0, yyvsp[-2].iptr ? *(yyvsp[-2].iptr) : 0, yyvsp[0].num);
3505 if(yyvsp[-6].iptr) free(yyvsp[-6].iptr);
3506 if(yyvsp[-4].iptr) free(yyvsp[-4].iptr);
3507 if(yyvsp[-2].iptr) free(yyvsp[-2].iptr);
3508 yyval.exopt->gotid = TRUE;
3509 yyval.exopt->gottype = TRUE;
3510 yyval.exopt->gotstate = TRUE;
3511 yyval.exopt->gothelpid = TRUE;
3512 ;}
3513 break;
3514
3515 case 178:
3516 #line 1430 "parser.y"
3517 {
3518 if(!yyvsp[-1].stt)
3519 {
3520 yyerror("Stringtable must have at least one entry");
3521 }
3522 else
3523 {
3524 stringtable_t *stt;
3525 /* Check if we added to a language table or created
3526 * a new one.
3527 */
3528 for(stt = sttres; stt; stt = stt->next)
3529 {
3530 if(stt == tagstt)
3531 break;
3532 }
3533 if(!stt)
3534 {
3535 /* It is a new one */
3536 if(sttres)
3537 {
3538 sttres->prev = tagstt;
3539 tagstt->next = sttres;
3540 sttres = tagstt;
3541 }
3542 else
3543 sttres = tagstt;
3544 }
3545 /* Else were done */
3546 }
3547 if(tagstt_memopt)
3548 {
3549 free(tagstt_memopt);
3550 tagstt_memopt = NULL;
3551 }
3552
3553 yyval.stt = tagstt;
3554 ;}
3555 break;
3556
3557 case 179:
3558 #line 1471 "parser.y"
3559 {
3560 if((tagstt = find_stringtable(yyvsp[0].lvc)) == NULL)
3561 tagstt = new_stringtable(yyvsp[0].lvc);
3562 tagstt_memopt = yyvsp[-1].iptr;
3563 tagstt_version = yyvsp[0].lvc->version;
3564 tagstt_characts = yyvsp[0].lvc->characts;
3565 if(yyvsp[0].lvc)
3566 free(yyvsp[0].lvc);
3567 ;}
3568 break;
3569
3570 case 180:
3571 #line 1482 "parser.y"
3572 { yyval.stt = NULL; ;}
3573 break;
3574
3575 case 181:
3576 #line 1483 "parser.y"
3577 {
3578 int i;
3579 assert(tagstt != NULL);
3580 if(yyvsp[-2].num > 65535 || yyvsp[-2].num < -32768)
3581 yyerror("Stringtable entry's ID out of range (%d)", yyvsp[-2].num);
3582 /* Search for the ID */
3583 for(i = 0; i < tagstt->nentries; i++)
3584 {
3585 if(tagstt->entries[i].id == yyvsp[-2].num)
3586 yyerror("Stringtable ID %d already in use", yyvsp[-2].num);
3587 }
3588 /* If we get here, then we have a new unique entry */
3589 tagstt->nentries++;
3590 tagstt->entries = xrealloc(tagstt->entries, sizeof(tagstt->entries[0]) * tagstt->nentries);
3591 tagstt->entries[tagstt->nentries-1].id = yyvsp[-2].num;
3592 tagstt->entries[tagstt->nentries-1].str = yyvsp[0].str;
3593 if(tagstt_memopt)
3594 tagstt->entries[tagstt->nentries-1].memopt = *tagstt_memopt;
3595 else
3596 tagstt->entries[tagstt->nentries-1].memopt = WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE | WRC_MO_PURE;
3597 tagstt->entries[tagstt->nentries-1].version = tagstt_version;
3598 tagstt->entries[tagstt->nentries-1].characts = tagstt_characts;
3599
3600 if(pedantic && !yyvsp[0].str->size)
3601 yywarning("Zero length strings make no sense");
3602 if(!win32 && yyvsp[0].str->size > 254)
3603 yyerror("Stringtable entry more than 254 characters");
3604 if(win32 && yyvsp[0].str->size > 65534) /* Hmm..., does this happen? */
3605 yyerror("Stringtable entry more than 65534 characters (probably something else that went wrong)");
3606 yyval.stt = tagstt;
3607 ;}
3608 break;
3609
3610 case 184:
3611 #line 1523 "parser.y"
3612 {
3613 yyval.veri = yyvsp[-3].veri;
3614 if(yyvsp[-4].iptr)
3615 {
3616 yyval.veri->memopt = *(yyvsp[-4].iptr);
3617 free(yyvsp[-4].iptr);
3618 }
3619 else
3620 yyval.veri->memopt = WRC_MO_MOVEABLE | (win32 ? WRC_MO_PURE : 0);
3621 yyval.veri->blocks = get_ver_block_head(yyvsp[-1].blk);
3622 /* Set language; there is no version or characteristics */
3623 yyval.veri->lvc.language = dup_language(currentlanguage);
3624 ;}
3625 break;
3626
3627 case 185:
3628 #line 1539 "parser.y"
3629 { yyval.veri = new_versioninfo(); ;}
3630 break;
3631
3632 case 186:
3633 #line 1540 "parser.y"
3634 {
3635 if(yyvsp[-8].veri->gotit.fv)
3636 yyerror("FILEVERSION already defined");
3637 yyval.veri = yyvsp[-8].veri;
3638 yyval.veri->filever_maj1 = yyvsp[-6].num;
3639 yyval.veri->filever_maj2 = yyvsp[-4].num;
3640 yyval.veri->filever_min1 = yyvsp[-2].num;
3641 yyval.veri->filever_min2 = yyvsp[0].num;
3642 yyval.veri->gotit.fv = 1;
3643 ;}
3644 break;
3645
3646 case 187:
3647 #line 1550 "parser.y"
3648 {
3649 if(yyvsp[-8].veri->gotit.pv)
3650 yyerror("PRODUCTVERSION already defined");
3651 yyval.veri = yyvsp[-8].veri;
3652 yyval.veri->prodver_maj1 = yyvsp[-6].num;
3653 yyval.veri->prodver_maj2 = yyvsp[-4].num;
3654 yyval.veri->prodver_min1 = yyvsp[-2].num;
3655 yyval.veri->prodver_min2 = yyvsp[0].num;
3656 yyval.veri->gotit.pv = 1;
3657 ;}
3658 break;
3659
3660 case 188:
3661 #line 1560 "parser.y"
3662 {
3663 if(yyvsp[-2].veri->gotit.ff)
3664 yyerror("FILEFLAGS already defined");
3665 yyval.veri = yyvsp[-2].veri;
3666 yyval.veri->fileflags = yyvsp[0].num;
3667 yyval.veri->gotit.ff = 1;
3668 ;}
3669 break;
3670
3671 case 189:
3672 #line 1567 "parser.y"
3673 {
3674 if(yyvsp[-2].veri->gotit.ffm)
3675 yyerror("FILEFLAGSMASK already defined");
3676 yyval.veri = yyvsp[-2].veri;
3677 yyval.veri->fileflagsmask = yyvsp[0].num;
3678 yyval.veri->gotit.ffm = 1;
3679 ;}
3680 break;
3681
3682 case 190:
3683 #line 1574 "parser.y"
3684 {
3685 if(yyvsp[-2].veri->gotit.fo)
3686 yyerror("FILEOS already defined");
3687 yyval.veri = yyvsp[-2].veri;
3688 yyval.veri->fileos = yyvsp[0].num;
3689 yyval.veri->gotit.fo = 1;
3690 ;}
3691 break;
3692
3693 case 191:
3694 #line 1581 "parser.y"
3695 {
3696 if(yyvsp[-2].veri->gotit.ft)
3697 yyerror("FILETYPE already defined");
3698 yyval.veri = yyvsp[-2].veri;
3699 yyval.veri->filetype = yyvsp[0].num;
3700 yyval.veri->gotit.ft = 1;
3701 ;}
3702 break;
3703
3704 case 192:
3705 #line 1588 "parser.y"
3706 {
3707 if(yyvsp[-2].veri->gotit.fst)
3708 yyerror("FILESUBTYPE already defined");
3709 yyval.veri = yyvsp[-2].veri;
3710 yyval.veri->filesubtype = yyvsp[0].num;
3711 yyval.veri->gotit.fst = 1;
3712 ;}
3713 break;
3714
3715 case 193:
3716 #line 1598 "parser.y"
3717 { yyval.blk = NULL; ;}
3718 break;
3719
3720 case 194:
3721 #line 1599 "parser.y"
3722 {
3723 yyval.blk = yyvsp[0].blk;
3724 yyval.blk->prev = yyvsp[-1].blk;
3725 if(yyvsp[-1].blk)
3726 yyvsp[-1].blk->next = yyval.blk;
3727 ;}
3728 break;
3729
3730 case 195:
3731 #line 1608 "parser.y"
3732 {
3733 yyval.blk = new_ver_block();
3734 yyval.blk->name = yyvsp[-3].str;
3735 yyval.blk->values = get_ver_value_head(yyvsp[-1].val);
3736 ;}
3737 break;
3738
3739 case 196:
3740 #line 1616 "parser.y"
3741 { yyval.val = NULL; ;}
3742 break;
3743
3744 case 197:
3745 #line 1617 "parser.y"
3746 {
3747 yyval.val = yyvsp[0].val;
3748 yyval.val->prev = yyvsp[-1].val;
3749 if(yyvsp[-1].val)
3750 yyvsp[-1].val->next = yyval.val;
3751 ;}
3752 break;
3753
3754 case 198:
3755 #line 1626 "parser.y"
3756 {
3757 yyval.val = new_ver_value();
3758 yyval.val->type = val_block;
3759 yyval.val->value.block = yyvsp[0].blk;
3760 ;}
3761 break;
3762
3763 case 199:
3764 #line 1631 "parser.y"
3765 {
3766 yyval.val = new_ver_value();
3767 yyval.val->type = val_str;
3768 yyval.val->key = yyvsp[-2].str;
3769 yyval.val->value.str = yyvsp[0].str;
3770 ;}
3771 break;
3772
3773 case 200:
3774 #line 1637 "parser.y"
3775 {
3776 yyval.val = new_ver_value();
3777 yyval.val->type = val_words;
3778 yyval.val->key = yyvsp[-2].str;
3779 yyval.val->value.words = yyvsp[0].verw;
3780 ;}
3781 break;
3782
3783 case 201:
3784 #line 1646 "parser.y"
3785 { yyval.verw = new_ver_words(yyvsp[0].num); ;}
3786 break;
3787
3788 case 202:
3789 #line 1647 "parser.y"
3790 { yyval.verw = add_ver_words(yyvsp[-2].verw, yyvsp[0].num); ;}
3791 break;
3792
3793 case 203:
3794 #line 1651 "parser.y"
3795 {
3796 int nitems;
3797 toolbar_item_t *items = get_tlbr_buttons_head(yyvsp[-1].tlbarItems, &nitems);
3798 yyval.tlbar = new_toolbar(yyvsp[-6].num, yyvsp[-4].num, items, nitems);
3799 if(yyvsp[-7].iptr)
3800 {
3801 yyval.tlbar->memopt = *(yyvsp[-7].iptr);
3802 free(yyvsp[-7].iptr);
3803 }
3804 else
3805 {
3806 yyval.tlbar->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE;
3807 }
3808 if(yyvsp[-3].lvc)
3809 {
3810 yyval.tlbar->lvc = *(yyvsp[-3].lvc);
3811 free(yyvsp[-3].lvc);
3812 }
3813 if(!yyval.tlbar->lvc.language)
3814 {
3815 yyval.tlbar->lvc.language = dup_language(currentlanguage);
3816 }
3817 ;}
3818 break;
3819
3820 case 204:
3821 #line 1677 "parser.y"
3822 { yyval.tlbarItems = NULL; ;}
3823 break;
3824
3825 case 205:
3826 #line 1678 "parser.y"
3827 {
3828 toolbar_item_t *idrec = new_toolbar_item();
3829 idrec->id = yyvsp[0].num;
3830 yyval.tlbarItems = ins_tlbr_button(yyvsp[-2].tlbarItems, idrec);
3831 ;}
3832 break;
3833
3834 case 206:
3835 #line 1683 "parser.y"
3836 {
3837 toolbar_item_t *idrec = new_toolbar_item();
3838 idrec->id = 0;
3839 yyval.tlbarItems = ins_tlbr_button(yyvsp[-1].tlbarItems, idrec);
3840 ;}
3841 break;
3842
3843 case 207:
3844 #line 1692 "parser.y"
3845 { yyval.iptr = NULL; ;}
3846 break;
3847
3848 case 208:
3849 #line 1693 "parser.y"
3850 {
3851 if(yyvsp[-1].iptr)
3852 {
3853 *(yyvsp[-1].iptr) |= *(yyvsp[0].iptr);
3854 yyval.iptr = yyvsp[-1].iptr;
3855 free(yyvsp[0].iptr);
3856 }
3857 else
3858 yyval.iptr = yyvsp[0].iptr;
3859 ;}
3860 break;
3861
3862 case 209:
3863 #line 1703 "parser.y"
3864 {
3865 if(yyvsp[-1].iptr)
3866 {
3867 *(yyvsp[-1].iptr) &= *(yyvsp[0].iptr);
3868 yyval.iptr = yyvsp[-1].iptr;
3869 free(yyvsp[0].iptr);
3870 }
3871 else
3872 {
3873 *yyvsp[0].iptr &= WRC_MO_MOVEABLE | WRC_MO_DISCARDABLE | WRC_MO_PURE;
3874 yyval.iptr = yyvsp[0].iptr;
3875 }
3876 ;}
3877 break;
3878
3879 case 210:
3880 #line 1718 "parser.y"
3881 { yyval.iptr = new_int(WRC_MO_PRELOAD); ;}
3882 break;
3883
3884 case 211:
3885 #line 1719 "parser.y"
3886 { yyval.iptr = new_int(WRC_MO_MOVEABLE); ;}
3887 break;
3888
3889 case 212:
3890 #line 1720 "parser.y"
3891 { yyval.iptr = new_int(WRC_MO_DISCARDABLE); ;}
3892 break;
3893
3894 case 213:
3895 #line 1721 "parser.y"
3896 { yyval.iptr = new_int(WRC_MO_PURE); ;}
3897 break;
3898
3899 case 214:
3900 #line 1724 "parser.y"
3901 { yyval.iptr = new_int(~WRC_MO_PRELOAD); ;}
3902 break;
3903
3904 case 215:
3905 #line 1725 "parser.y"
3906 { yyval.iptr = new_int(~WRC_MO_MOVEABLE); ;}
3907 break;
3908
3909 case 216:
3910 #line 1726 "parser.y"
3911 { yyval.iptr = new_int(~WRC_MO_PURE); ;}
3912 break;
3913
3914 case 217:
3915 #line 1730 "parser.y"
3916 { yyval.lvc = new_lvc(); ;}
3917 break;
3918
3919 case 218:
3920 #line 1731 "parser.y"
3921 {
3922 if(!win32)
3923 yywarning("LANGUAGE not supported in 16-bit mode");
3924 if(yyvsp[-1].lvc->language)
3925 yyerror("Language already defined");
3926 yyval.lvc = yyvsp[-1].lvc;
3927 yyvsp[-1].lvc->language = yyvsp[0].lan;
3928 ;}
3929 break;
3930
3931 case 219:
3932 #line 1739 "parser.y"
3933 {
3934 if(!win32)
3935 yywarning("CHARACTERISTICS not supported in 16-bit mode");
3936 if(yyvsp[-1].lvc->characts)
3937 yyerror("Characteristics already defined");
3938 yyval.lvc = yyvsp[-1].lvc;
3939 yyvsp[-1].lvc->characts = yyvsp[0].chars;
3940 ;}
3941 break;
3942
3943 case 220:
3944 #line 1747 "parser.y"
3945 {
3946 if(!win32)
3947 yywarning("VERSION not supported in 16-bit mode");
3948 if(yyvsp[-1].lvc->version)
3949 yyerror("Version already defined");
3950 yyval.lvc = yyvsp[-1].lvc;
3951 yyvsp[-1].lvc->version = yyvsp[0].ver;
3952 ;}
3953 break;
3954
3955 case 221:
3956 #line 1765 "parser.y"
3957 { yyval.lan = new_language(yyvsp[-2].num, yyvsp[0].num);
3958 if (get_language_codepage(yyvsp[-2].num, yyvsp[0].num) == -1)
3959 yyerror( "Language %04x is not supported", (yyvsp[0].num<<10) + yyvsp[-2].num);
3960 ;}
3961 break;
3962
3963 case 222:
3964 #line 1772 "parser.y"
3965 { yyval.chars = new_characts(yyvsp[0].num); ;}
3966 break;
3967
3968 case 223:
3969 #line 1776 "parser.y"
3970 { yyval.ver = new_version(yyvsp[0].num); ;}
3971 break;
3972
3973 case 224:
3974 #line 1780 "parser.y"
3975 {
3976 if(yyvsp[-3].lvc)
3977 {
3978 yyvsp[-1].raw->lvc = *(yyvsp[-3].lvc);
3979 free(yyvsp[-3].lvc);
3980 }
3981
3982 if(!yyvsp[-1].raw->lvc.language)
3983 yyvsp[-1].raw->lvc.language = dup_language(currentlanguage);
3984
3985 yyval.raw = yyvsp[-1].raw;
3986 ;}
3987 break;
3988
3989 case 225:
3990 #line 1795 "parser.y"
3991 { yyval.raw = yyvsp[0].raw; ;}
3992 break;
3993
3994 case 226:
3995 #line 1796 "parser.y"
3996 { yyval.raw = int2raw_data(yyvsp[0].num); ;}
3997 break;
3998
3999 case 227:
4000 #line 1797 "parser.y"
4001 { yyval.raw = int2raw_data(-(yyvsp[0].num)); ;}
4002 break;
4003
4004 case 228:
4005 #line 1798 "parser.y"
4006 { yyval.raw = long2raw_data(yyvsp[0].num); ;}
4007 break;
4008
4009 case 229:
4010 #line 1799 "parser.y"
4011 { yyval.raw = long2raw_data(-(yyvsp[0].num)); ;}
4012 break;
4013
4014 case 230:
4015 #line 1800 "parser.y"
4016 { yyval.raw = str2raw_data(yyvsp[0].str); ;}
4017 break;
4018
4019 case 231:
4020 #line 1801 "parser.y"
4021 { yyval.raw = merge_raw_data(yyvsp[-2].raw, yyvsp[0].raw); free(yyvsp[0].raw->data); free(yyvsp[0].raw); ;}
4022 break;
4023
4024 case 232:
4025 #line 1802 "parser.y"
4026 { yyval.raw = merge_raw_data_int(yyvsp[-2].raw, yyvsp[0].num); ;}
4027 break;
4028
4029 case 233:
4030 #line 1803 "parser.y"
4031 { yyval.raw = merge_raw_data_int(yyvsp[-3].raw, -(yyvsp[0].num)); ;}
4032 break;
4033
4034 case 234:
4035 #line 1804 "parser.y"
4036 { yyval.raw = merge_raw_data_long(yyvsp[-2].raw, yyvsp[0].num); ;}
4037 break;
4038
4039 case 235:
4040 #line 1805 "parser.y"
4041 { yyval.raw = merge_raw_data_long(yyvsp[-3].raw, -(yyvsp[0].num)); ;}
4042 break;
4043
4044 case 236:
4045 #line 1806 "parser.y"
4046 { yyval.raw = merge_raw_data_str(yyvsp[-2].raw, yyvsp[0].str); ;}
4047 break;
4048
4049 case 237:
4050 #line 1810 "parser.y"
4051 { yyval.raw = load_file(yyvsp[0].str,dup_language(currentlanguage)); ;}
4052 break;
4053
4054 case 238:
4055 #line 1811 "parser.y"
4056 { yyval.raw = yyvsp[0].raw; ;}
4057 break;
4058
4059 case 239:
4060 #line 1818 "parser.y"
4061 { yyval.iptr = 0; ;}
4062 break;
4063
4064 case 240:
4065 #line 1819 "parser.y"
4066 { yyval.iptr = new_int(yyvsp[0].num); ;}
4067 break;
4068
4069 case 241:
4070 #line 1823 "parser.y"
4071 { yyval.num = (yyvsp[0].num); ;}
4072 break;
4073
4074 case 242:
4075 #line 1826 "parser.y"
4076 { yyval.num = (yyvsp[-2].num) + (yyvsp[0].num); ;}
4077 break;
4078
4079 case 243:
4080 #line 1827 "parser.y"
4081 { yyval.num = (yyvsp[-2].num) - (yyvsp[0].num); ;}
4082 break;
4083
4084 case 244:
4085 #line 1828 "parser.y"
4086 { yyval.num = (yyvsp[-2].num) | (yyvsp[0].num); ;}
4087 break;
4088
4089 case 245:
4090 #line 1829 "parser.y"
4091 { yyval.num = (yyvsp[-2].num) & (yyvsp[0].num); ;}
4092 break;
4093
4094 case 246:
4095 #line 1830 "parser.y"
4096 { yyval.num = (yyvsp[-2].num) * (yyvsp[0].num); ;}
4097 break;
4098
4099 case 247:
4100 #line 1831 "parser.y"
4101 { yyval.num = (yyvsp[-2].num) / (yyvsp[0].num); ;}
4102 break;
4103
4104 case 248:
4105 #line 1832 "parser.y"
4106 { yyval.num = (yyvsp[-2].num) ^ (yyvsp[0].num); ;}
4107 break;
4108
4109 case 249:
4110 #line 1833 "parser.y"
4111 { yyval.num = ~(yyvsp[0].num); ;}
4112 break;
4113
4114 case 250:
4115 #line 1834 "parser.y"
4116 { yyval.num = -(yyvsp[0].num); ;}
4117 break;
4118
4119 case 251:
4120 #line 1835 "parser.y"
4121 { yyval.num = yyvsp[0].num; ;}
4122 break;
4123
4124 case 252:
4125 #line 1836 "parser.y"
4126 { yyval.num = yyvsp[-1].num; ;}
4127 break;
4128
4129 case 253:
4130 #line 1837 "parser.y"
4131 { yyval.num = yyvsp[0].num; ;}
4132 break;
4133
4134 case 254:
4135 #line 1841 "parser.y"
4136 { yyval.num = (yyvsp[0].num); ;}
4137 break;
4138
4139 case 255:
4140 #line 1842 "parser.y"
4141 { yyval.num = ~(yyvsp[0].num); ;}
4142 break;
4143
4144 case 256:
4145 #line 1845 "parser.y"
4146 { yyval.num = yyvsp[0].num; ;}
4147 break;
4148
4149 case 257:
4150 #line 1846 "parser.y"
4151 { yyval.num = yyvsp[0].num; ;}
4152 break;
4153
4154
4155 }
4156
4157 /* Line 1000 of yacc.c. */
4158 #line 4159 "parser.tab.c"
4159 \f
4160 yyvsp -= yylen;
4161 yyssp -= yylen;
4162
4163
4164 YY_STACK_PRINT (yyss, yyssp);
4165
4166 *++yyvsp = yyval;
4167
4168
4169 /* Now `shift' the result of the reduction. Determine what state
4170 that goes to, based on the state we popped back to and the rule
4171 number reduced by. */
4172
4173 yyn = yyr1[yyn];
4174
4175 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4176 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4177 yystate = yytable[yystate];
4178 else
4179 yystate = yydefgoto[yyn - YYNTOKENS];
4180
4181 goto yynewstate;
4182
4183
4184 /*------------------------------------.
4185 | yyerrlab -- here on detecting error |
4186 `------------------------------------*/
4187 yyerrlab:
4188 /* If not already recovering from an error, report this error. */
4189 if (!yyerrstatus)
4190 {
4191 ++yynerrs;
4192 #if YYERROR_VERBOSE
4193 yyn = yypact[yystate];
4194
4195 if (YYPACT_NINF < yyn && yyn < YYLAST)
4196 {
4197 YYSIZE_T yysize = 0;
4198 int yytype = YYTRANSLATE (yychar);
4199 const char* yyprefix;
4200 char *yymsg;
4201 int yyx;
4202
4203 /* Start YYX at -YYN if negative to avoid negative indexes in
4204 YYCHECK. */
4205 int yyxbegin = yyn < 0 ? -yyn : 0;
4206
4207 /* Stay within bounds of both yycheck and yytname. */
4208 int yychecklim = YYLAST - yyn;
4209 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4210 int yycount = 0;
4211
4212 yyprefix = ", expecting ";
4213 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4214 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4215 {
4216 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
4217 yycount += 1;
4218 if (yycount == 5)
4219 {
4220 yysize = 0;
4221 break;
4222 }
4223 }
4224 yysize += (sizeof ("syntax error, unexpected ")
4225 + yystrlen (yytname[yytype]));
4226 yymsg = (char *) YYSTACK_ALLOC (yysize);
4227 if (yymsg != 0)
4228 {
4229 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
4230 yyp = yystpcpy (yyp, yytname[yytype]);
4231
4232 if (yycount < 5)
4233 {
4234 yyprefix = ", expecting ";
4235 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4236 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4237 {
4238 yyp = yystpcpy (yyp, yyprefix);
4239 yyp = yystpcpy (yyp, yytname[yyx]);
4240 yyprefix = " or ";
4241 }
4242 }
4243 yyerror (yymsg);
4244 YYSTACK_FREE (yymsg);
4245 }
4246 else
4247 yyerror ("syntax error; also virtual memory exhausted");
4248 }
4249 else
4250 #endif /* YYERROR_VERBOSE */
4251 yyerror ("syntax error");
4252 }
4253
4254
4255
4256 if (yyerrstatus == 3)
4257 {
4258 /* If just tried and failed to reuse lookahead token after an
4259 error, discard it. */
4260
4261 if (yychar <= YYEOF)
4262 {
4263 /* If at end of input, pop the error token,
4264 then the rest of the stack, then return failure. */
4265 if (yychar == YYEOF)
4266 for (;;)
4267 {
4268 YYPOPSTACK;
4269 if (yyssp == yyss)
4270 YYABORT;
4271 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
4272 yydestruct (yystos[*yyssp], yyvsp);
4273 }
4274 }
4275 else
4276 {
4277 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
4278 yydestruct (yytoken, &yylval);
4279 yychar = YYEMPTY;
4280
4281 }
4282 }
4283
4284 /* Else will try to reuse lookahead token after shifting the error
4285 token. */
4286 goto yyerrlab1;
4287
4288
4289 /*---------------------------------------------------.
4290 | yyerrorlab -- error raised explicitly by YYERROR. |
4291 `---------------------------------------------------*/
4292 yyerrorlab:
4293
4294 #ifdef __GNUC__
4295 /* Pacify GCC when the user code never invokes YYERROR and the label
4296 yyerrorlab therefore never appears in user code. */
4297 if (0)
4298 goto yyerrorlab;
4299 #endif
4300
4301 yyvsp -= yylen;
4302 yyssp -= yylen;
4303 yystate = *yyssp;
4304 goto yyerrlab1;
4305
4306
4307 /*-------------------------------------------------------------.
4308 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4309 `-------------------------------------------------------------*/
4310 yyerrlab1:
4311 yyerrstatus = 3; /* Each real token shifted decrements this. */
4312
4313 for (;;)
4314 {
4315 yyn = yypact[yystate];
4316 if (yyn != YYPACT_NINF)
4317 {
4318 yyn += YYTERROR;
4319 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4320 {
4321 yyn = yytable[yyn];
4322 if (0 < yyn)
4323 break;
4324 }
4325 }
4326
4327 /* Pop the current state because it cannot handle the error token. */
4328 if (yyssp == yyss)
4329 YYABORT;
4330
4331 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
4332 yydestruct (yystos[yystate], yyvsp);
4333 YYPOPSTACK;
4334 yystate = *yyssp;
4335 YY_STACK_PRINT (yyss, yyssp);
4336 }
4337
4338 if (yyn == YYFINAL)
4339 YYACCEPT;
4340
4341 YYDPRINTF ((stderr, "Shifting error token, "));
4342
4343 *++yyvsp = yylval;
4344
4345
4346 yystate = yyn;
4347 goto yynewstate;
4348
4349
4350 /*-------------------------------------.
4351 | yyacceptlab -- YYACCEPT comes here. |
4352 `-------------------------------------*/
4353 yyacceptlab:
4354 yyresult = 0;
4355 goto yyreturn;
4356
4357 /*-----------------------------------.
4358 | yyabortlab -- YYABORT comes here. |
4359 `-----------------------------------*/
4360 yyabortlab:
4361 yyresult = 1;
4362 goto yyreturn;
4363
4364 #ifndef yyoverflow
4365 /*----------------------------------------------.
4366 | yyoverflowlab -- parser overflow comes here. |
4367 `----------------------------------------------*/
4368 yyoverflowlab:
4369 yyerror ("parser stack overflow");
4370 yyresult = 2;
4371 /* Fall through. */
4372 #endif
4373
4374 yyreturn:
4375 #ifndef yyoverflow
4376 if (yyss != yyssa)
4377 YYSTACK_FREE (yyss);
4378 #endif
4379 return yyresult;
4380 }
4381
4382
4383 #line 1849 "parser.y"
4384
4385 /* Dialog specific functions */
4386 static dialog_t *dialog_style(style_t * st, dialog_t *dlg)
4387 {
4388 assert(dlg != NULL);
4389 if(dlg->style == NULL)
4390 {
4391 dlg->style = new_style(0,0);
4392 }
4393
4394 if(dlg->gotstyle)
4395 {
4396 yywarning("Style already defined, or-ing together");
4397 }
4398 else
4399 {
4400 dlg->style->or_mask = 0;
4401 dlg->style->and_mask = 0;
4402 }
4403 dlg->style->or_mask |= st->or_mask;
4404 dlg->style->and_mask |= st->and_mask;
4405 dlg->gotstyle = TRUE;
4406 free(st);
4407 return dlg;
4408 }
4409
4410 static dialog_t *dialog_exstyle(style_t *st, dialog_t *dlg)
4411 {
4412 assert(dlg != NULL);
4413 if(dlg->exstyle == NULL)
4414 {
4415 dlg->exstyle = new_style(0,0);
4416 }
4417
4418 if(dlg->gotexstyle)
4419 {
4420 yywarning("ExStyle already defined, or-ing together");
4421 }
4422 else
4423 {
4424 dlg->exstyle->or_mask = 0;
4425 dlg->exstyle->and_mask = 0;
4426 }
4427 dlg->exstyle->or_mask |= st->or_mask;
4428 dlg->exstyle->and_mask |= st->and_mask;
4429 dlg->gotexstyle = TRUE;
4430 free(st);
4431 return dlg;
4432 }
4433
4434 static dialog_t *dialog_caption(string_t *s, dialog_t *dlg)
4435 {
4436 assert(dlg != NULL);
4437 if(dlg->title)
4438 yyerror("Caption already defined");
4439 dlg->title = s;
4440 return dlg;
4441 }
4442
4443 static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg)
4444 {
4445 assert(dlg != NULL);
4446 if(dlg->font)
4447 yyerror("Font already defined");
4448 dlg->font = f;
4449 return dlg;
4450 }
4451
4452 static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg)
4453 {
4454 assert(dlg != NULL);
4455 if(dlg->dlgclass)
4456 yyerror("Class already defined");
4457 dlg->dlgclass = n;
4458 return dlg;
4459 }
4460
4461 static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg)
4462 {
4463 assert(dlg != NULL);
4464 if(dlg->menu)
4465 yyerror("Menu already defined");
4466 dlg->menu = m;
4467 return dlg;
4468 }
4469
4470 static dialog_t *dialog_language(language_t *l, dialog_t *dlg)
4471 {
4472 assert(dlg != NULL);
4473 if(dlg->lvc.language)
4474 yyerror("Language already defined");
4475 dlg->lvc.language = l;
4476 return dlg;
4477 }
4478
4479 static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
4480 {
4481 assert(dlg != NULL);
4482 if(dlg->lvc.characts)
4483 yyerror("Characteristics already defined");
4484 dlg->lvc.characts = c;
4485 return dlg;
4486 }
4487
4488 static dialog_t *dialog_version(version_t *v, dialog_t *dlg)
4489 {
4490 assert(dlg != NULL);
4491 if(dlg->lvc.version)
4492 yyerror("Version already defined");
4493 dlg->lvc.version = v;
4494 return dlg;
4495 }
4496
4497 /* Controls specific functions */
4498 static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev)
4499 {
4500 /* Hm... this seems to be jammed in at all time... */
4501 int defaultstyle = WS_CHILD | WS_VISIBLE;
4502
4503 assert(ctrl != NULL);
4504 ctrl->prev = prev;
4505
4506 if(prev)
4507 prev->next = ctrl;
4508
4509 if(type != -1)
4510 {
4511 ctrl->ctlclass = new_name_id();
4512 ctrl->ctlclass->type = name_ord;
4513 ctrl->ctlclass->name.i_name = type;
4514 }
4515
4516 switch(type)
4517 {
4518 case CT_BUTTON:
4519 if(special_style != BS_GROUPBOX && special_style != BS_RADIOBUTTON)
4520 defaultstyle |= WS_TABSTOP;
4521 break;
4522 case CT_EDIT:
4523 defaultstyle |= WS_TABSTOP | WS_BORDER;
4524 break;
4525 case CT_LISTBOX:
4526 defaultstyle |= LBS_NOTIFY | WS_BORDER;
4527 break;
4528 case CT_COMBOBOX:
4529 if (!(ctrl->style->or_mask & (CBS_SIMPLE | CBS_DROPDOWN | CBS_DROPDOWNLIST)))
4530 defaultstyle |= CBS_SIMPLE;
4531 break;
4532 case CT_STATIC:
4533 if(special_style == SS_CENTER || special_style == SS_LEFT || special_style == SS_RIGHT)
4534 defaultstyle |= WS_GROUP;
4535 break;
4536 }
4537
4538 if(!ctrl->gotstyle) /* Handle default style setting */
4539 {
4540 switch(type)
4541 {
4542 case CT_EDIT:
4543 defaultstyle |= ES_LEFT;
4544 break;
4545 case CT_LISTBOX:
4546 defaultstyle |= LBS_NOTIFY;
4547 break;
4548 case CT_COMBOBOX:
4549 defaultstyle |= CBS_SIMPLE | WS_TABSTOP;
4550 break;
4551 case CT_SCROLLBAR:
4552 defaultstyle |= SBS_HORZ;
4553 break;
4554 case CT_BUTTON:
4555 switch(special_style)
4556 {
4557 case BS_CHECKBOX:
4558 case BS_DEFPUSHBUTTON:
4559 case BS_PUSHBUTTON:
4560 /* case BS_PUSHBOX: */
4561 case BS_AUTORADIOBUTTON:
4562 case BS_AUTO3STATE:
4563 case BS_3STATE:
4564 case BS_AUTOCHECKBOX:
4565 defaultstyle |= WS_TABSTOP;
4566 break;
4567 default:
4568 yywarning("Unknown default button control-style 0x%08x", special_style);
4569 case BS_GROUPBOX:
4570 case BS_RADIOBUTTON:
4571 break;
4572 }
4573 break;
4574
4575 case CT_STATIC:
4576 switch(special_style)
4577 {
4578 case SS_LEFT:
4579 case SS_RIGHT:
4580 case SS_CENTER:
4581 defaultstyle |= WS_GROUP;
4582 break;
4583 case SS_ICON: /* Special case */
4584 break;
4585 default:
4586 yywarning("Unknown default static control-style 0x%08x", special_style);
4587 break;
4588 }
4589 break;
4590 case -1: /* Generic control */
4591 goto byebye;
4592
4593 default:
4594 yyerror("Internal error (report this): Got weird control type 0x%08x", type);
4595 }
4596 }
4597
4598 /* The SS_ICON flag is always forced in for icon controls */
4599 if(type == CT_STATIC && special_style == SS_ICON)
4600 defaultstyle |= SS_ICON;
4601
4602 if (!ctrl->gotstyle)
4603 ctrl->style = new_style(0,0);
4604
4605 /* combine all styles */
4606 ctrl->style->or_mask = ctrl->style->or_mask | defaultstyle | special_style;
4607 ctrl->gotstyle = TRUE;
4608 byebye:
4609 /* combine with NOT mask */
4610 if (ctrl->gotstyle)
4611 {
4612 ctrl->style->or_mask &= ~(ctrl->style->and_mask);
4613 ctrl->style->and_mask = 0;
4614 }
4615 if (ctrl->gotexstyle)
4616 {
4617 ctrl->exstyle->or_mask &= ~(ctrl->exstyle->and_mask);
4618 ctrl->exstyle->and_mask = 0;
4619 }
4620 return ctrl;
4621 }
4622
4623 static name_id_t *convert_ctlclass(name_id_t *cls)
4624 {
4625 char *cc = NULL;
4626 int iclass;
4627
4628 if(cls->type == name_ord)
4629 return cls;
4630 assert(cls->type == name_str);
4631 if(cls->type == str_unicode)
4632 {
4633 yyerror("Don't yet support unicode class comparison");
4634 }
4635 else
4636 cc = cls->name.s_name->str.cstr;
4637
4638 if(!strcasecmp("BUTTON", cc))
4639 iclass = CT_BUTTON;
4640 else if(!strcasecmp("COMBOBOX", cc))
4641 iclass = CT_COMBOBOX;
4642 else if(!strcasecmp("LISTBOX", cc))
4643 iclass = CT_LISTBOX;
4644 else if(!strcasecmp("EDIT", cc))
4645 iclass = CT_EDIT;
4646 else if(!strcasecmp("STATIC", cc))
4647 iclass = CT_STATIC;
4648 else if(!strcasecmp("SCROLLBAR", cc))
4649 iclass = CT_SCROLLBAR;
4650 else
4651 return cls; /* No default, return user controlclass */
4652
4653 free(cls->name.s_name->str.cstr);
4654 free(cls->name.s_name);
4655 cls->type = name_ord;
4656 cls->name.i_name = iclass;
4657 return cls;
4658 }
4659
4660 /* DialogEx specific functions */
4661 static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg)
4662 {
4663 assert(dlg != NULL);
4664 if(dlg->style == NULL)
4665 {
4666 dlg->style = new_style(0,0);
4667 }
4668
4669 if(dlg->gotstyle)
4670 {
4671 yywarning("Style already defined, or-ing together");
4672 }
4673 else
4674 {
4675 dlg->style->or_mask = 0;
4676 dlg->style->and_mask = 0;
4677 }
4678 dlg->style->or_mask |= st->or_mask;
4679 dlg->style->and_mask |= st->and_mask;
4680 dlg->gotstyle = TRUE;
4681 free(st);
4682 return dlg;
4683 }
4684
4685 static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg)
4686 {
4687 assert(dlg != NULL);
4688 if(dlg->exstyle == NULL)
4689 {
4690 dlg->exstyle = new_style(0,0);
4691 }
4692
4693 if(dlg->gotexstyle)
4694 {
4695 yywarning("ExStyle already defined, or-ing together");
4696 }
4697 else
4698 {
4699 dlg->exstyle->or_mask = 0;
4700 dlg->exstyle->and_mask = 0;
4701 }
4702 dlg->exstyle->or_mask |= st->or_mask;
4703 dlg->exstyle->and_mask |= st->and_mask;
4704 dlg->gotexstyle = TRUE;
4705 free(st);
4706 return dlg;
4707 }
4708
4709 static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg)
4710 {
4711 assert(dlg != NULL);
4712 if(dlg->title)
4713 yyerror("Caption already defined");
4714 dlg->title = s;
4715 return dlg;
4716 }
4717
4718 static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg)
4719 {
4720 assert(dlg != NULL);
4721 if(dlg->font)
4722 yyerror("Font already defined");
4723 dlg->font = f;
4724 return dlg;
4725 }
4726
4727 static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg)
4728 {
4729 assert(dlg != NULL);
4730 if(dlg->dlgclass)
4731 yyerror("Class already defined");
4732 dlg->dlgclass = n;
4733 return dlg;
4734 }
4735
4736 static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg)
4737 {
4738 assert(dlg != NULL);
4739 if(dlg->menu)
4740 yyerror("Menu already defined");
4741 dlg->menu = m;
4742 return dlg;
4743 }
4744
4745 static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg)
4746 {
4747 assert(dlg != NULL);
4748 if(dlg->lvc.language)
4749 yyerror("Language already defined");
4750 dlg->lvc.language = l;
4751 return dlg;
4752 }
4753
4754 static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg)
4755 {
4756 assert(dlg != NULL);
4757 if(dlg->lvc.characts)
4758 yyerror("Characteristics already defined");
4759 dlg->lvc.characts = c;
4760 return dlg;
4761 }
4762
4763 static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg)
4764 {
4765 assert(dlg != NULL);
4766 if(dlg->lvc.version)
4767 yyerror("Version already defined");
4768 dlg->lvc.version = v;
4769 return dlg;
4770 }
4771
4772 /* Accelerator specific functions */
4773 static event_t *add_event(int key, int id, int flags, event_t *prev)
4774 {
4775 event_t *ev = new_event();
4776
4777 if((flags & (WRC_AF_VIRTKEY | WRC_AF_ASCII)) == (WRC_AF_VIRTKEY | WRC_AF_ASCII))
4778 yyerror("Cannot use both ASCII and VIRTKEY");
4779
4780 ev->key = key;
4781 ev->id = id;
4782 ev->flags = flags & ~WRC_AF_ASCII;
4783 ev->prev = prev;
4784 if(prev)
4785 prev->next = ev;
4786 return ev;
4787 }
4788
4789 static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev)
4790 {
4791 int keycode = 0, keysym = 0;
4792 event_t *ev = new_event();
4793
4794 if(key->type == str_char)
4795 keysym = key->str.cstr[0];
4796 else
4797 keysym = key->str.wstr[0];
4798
4799 if((flags & WRC_AF_VIRTKEY) && (!isupper(keysym & 0xff) && !isdigit(keysym & 0xff)))
4800 yyerror("VIRTKEY code is not equal to ascii value");
4801
4802 if(keysym == '^' && (flags & WRC_AF_CONTROL) != 0)
4803 {
4804 yyerror("Cannot use both '^' and CONTROL modifier");
4805 }
4806 else if(keysym == '^')
4807 {
4808 if(key->type == str_char)
4809 keycode = toupper(key->str.cstr[1]) - '@';
4810 else
4811 keycode = toupper(key->str.wstr[1]) - '@';
4812 if(keycode >= ' ')
4813 yyerror("Control-code out of range");
4814 }
4815 else
4816 keycode = keysym;
4817 ev->key = keycode;
4818 ev->id = id;
4819 ev->flags = flags & ~WRC_AF_ASCII;
4820 ev->prev = prev;
4821 if(prev)
4822 prev->next = ev;
4823 return ev;
4824 }
4825
4826 /* MenuEx specific functions */
4827 static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
4828 {
4829 itemex_opt_t *opt = (itemex_opt_t *)xmalloc(sizeof(itemex_opt_t));
4830 opt->id = id;
4831 opt->type = type;
4832 opt->state = state;
4833 opt->helpid = helpid;
4834 return opt;
4835 }
4836
4837 /* Raw data functions */
4838 static raw_data_t *load_file(string_t *filename, language_t *lang)
4839 {
4840 FILE *fp = NULL;
4841 char *path;
4842 raw_data_t *rd;
4843 string_t *name;
4844 int codepage = get_language_codepage(lang->id, lang->sub);
4845
4846 /* FIXME: we may want to use utf-8 here */
4847 if (codepage <= 0 && filename->type != str_char)
4848 yyerror("Cannot convert filename to ASCII string");
4849 name = convert_string( filename, str_char, codepage );
4850 if (!(path = wpp_find_include(name->str.cstr, 1)))
4851 yyerror("Cannot open file %s", name->str.cstr);
4852 if (!(fp = fopen( path, "rb" )))
4853 yyerror("Cannot open file %s", name->str.cstr);
4854 free( path );
4855 rd = new_raw_data();
4856 fseek(fp, 0, SEEK_END);
4857 rd->size = ftell(fp);
4858 fseek(fp, 0, SEEK_SET);
4859 if (rd->size)
4860 {
4861 rd->data = (char *)xmalloc(rd->size);
4862 fread(rd->data, rd->size, 1, fp);
4863 }
4864 else rd->data = NULL;
4865 fclose(fp);
4866 rd->lvc.language = lang;
4867 free_string(name);
4868 return rd;
4869 }
4870
4871 static raw_data_t *int2raw_data(int i)
4872 {
4873 raw_data_t *rd;
4874
4875 if( ( i >= 0 && (int)((unsigned short)i) != i) ||
4876 ( i < 0 && (int)((short)i) != i) )
4877 yywarning("Integer constant out of 16bit range (%d), truncated to %d\n", i, (short)i);
4878
4879 rd = new_raw_data();
4880 rd->size = sizeof(short);
4881 rd->data = (char *)xmalloc(rd->size);
4882 switch(byteorder)
4883 {
4884 #ifdef WORDS_BIGENDIAN
4885 default:
4886 #endif
4887 case WRC_BO_BIG:
4888 rd->data[0] = HIBYTE(i);
4889 rd->data[1] = LOBYTE(i);
4890 break;
4891
4892 #ifndef WORDS_BIGENDIAN
4893 default:
4894 #endif
4895 case WRC_BO_LITTLE:
4896 rd->data[1] = HIBYTE(i);
4897 rd->data[0] = LOBYTE(i);
4898 break;
4899 }
4900 return rd;
4901 }
4902
4903 static raw_data_t *long2raw_data(int i)
4904 {
4905 raw_data_t *rd;
4906 rd = new_raw_data();
4907 rd->size = sizeof(int);
4908 rd->data = (char *)xmalloc(rd->size);
4909 switch(byteorder)
4910 {
4911 #ifdef WORDS_BIGENDIAN
4912 default:
4913 #endif
4914 case WRC_BO_BIG:
4915 rd->data[0] = HIBYTE(HIWORD(i));
4916 rd->data[1] = LOBYTE(HIWORD(i));
4917 rd->data[2] = HIBYTE(LOWORD(i));
4918 rd->data[3] = LOBYTE(LOWORD(i));
4919 break;
4920
4921 #ifndef WORDS_BIGENDIAN
4922 default:
4923 #endif
4924 case WRC_BO_LITTLE:
4925 rd->data[3] = HIBYTE(HIWORD(i));
4926 rd->data[2] = LOBYTE(HIWORD(i));
4927 rd->data[1] = HIBYTE(LOWORD(i));
4928 rd->data[0] = LOBYTE(LOWORD(i));
4929 break;
4930 }
4931 return rd;
4932 }
4933
4934 static raw_data_t *str2raw_data(string_t *str)
4935 {
4936 raw_data_t *rd;
4937 rd = new_raw_data();
4938 rd->size = str->size * (str->type == str_char ? 1 : 2);
4939 rd->data = (char *)xmalloc(rd->size);
4940 if(str->type == str_char)
4941 memcpy(rd->data, str->str.cstr, rd->size);
4942 else if(str->type == str_unicode)
4943 {
4944 int i;
4945 switch(byteorder)
4946 {
4947 #ifdef WORDS_BIGENDIAN
4948 default:
4949 #endif
4950 case WRC_BO_BIG:
4951 for(i = 0; i < str->size; i++)
4952 {
4953 rd->data[2*i + 0] = HIBYTE((WORD)str->str.wstr[i]);
4954 rd->data[2*i + 1] = LOBYTE((WORD)str->str.wstr[i]);
4955 }
4956 break;
4957 #ifndef WORDS_BIGENDIAN
4958 default:
4959 #endif
4960 case WRC_BO_LITTLE:
4961 for(i = 0; i < str->size; i++)
4962 {
4963 rd->data[2*i + 1] = HIBYTE((WORD)str->str.wstr[i]);
4964 rd->data[2*i + 0] = LOBYTE((WORD)str->str.wstr[i]);
4965 }
4966 break;
4967 }
4968 }
4969 else
4970 internal_error(__FILE__, __LINE__, "Invalid stringtype");
4971 return rd;
4972 }
4973
4974 static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2)
4975 {
4976 r1->data = xrealloc(r1->data, r1->size + r2->size);
4977 memcpy(r1->data + r1->size, r2->data, r2->size);
4978 r1->size += r2->size;
4979 return r1;
4980 }
4981
4982 static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i)
4983 {
4984 raw_data_t *t = int2raw_data(i);
4985 merge_raw_data(r1, t);
4986 free(t->data);
4987 free(t);
4988 return r1;
4989 }
4990
4991 static raw_data_t *merge_raw_data_long(raw_data_t *r1, int i)
4992 {
4993 raw_data_t *t = long2raw_data(i);
4994 merge_raw_data(r1, t);
4995 free(t->data);
4996 free(t);
4997 return r1;
4998 }
4999
5000 static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str)
5001 {
5002 raw_data_t *t = str2raw_data(str);
5003 merge_raw_data(r1, t);
5004 free(t->data);
5005 free(t);
5006 return r1;
5007 }
5008
5009 /* Function the go back in a list to get the head */
5010 static menu_item_t *get_item_head(menu_item_t *p)
5011 {
5012 if(!p)
5013 return NULL;
5014 while(p->prev)
5015 p = p->prev;
5016 return p;
5017 }
5018
5019 static menuex_item_t *get_itemex_head(menuex_item_t *p)
5020 {
5021 if(!p)
5022 return NULL;
5023 while(p->prev)
5024 p = p->prev;
5025 return p;
5026 }
5027
5028 static resource_t *get_resource_head(resource_t *p)
5029 {
5030 if(!p)
5031 return NULL;
5032 while(p->prev)
5033 p = p->prev;
5034 return p;
5035 }
5036
5037 static ver_block_t *get_ver_block_head(ver_block_t *p)
5038 {
5039 if(!p)
5040 return NULL;
5041 while(p->prev)
5042 p = p->prev;
5043 return p;
5044 }
5045
5046 static ver_value_t *get_ver_value_head(ver_value_t *p)
5047 {
5048 if(!p)
5049 return NULL;
5050 while(p->prev)
5051 p = p->prev;
5052 return p;
5053 }
5054
5055 static control_t *get_control_head(control_t *p)
5056 {
5057 if(!p)
5058 return NULL;
5059 while(p->prev)
5060 p = p->prev;
5061 return p;
5062 }
5063
5064 static event_t *get_event_head(event_t *p)
5065 {
5066 if(!p)
5067 return NULL;
5068 while(p->prev)
5069 p = p->prev;
5070 return p;
5071 }
5072
5073 /* Find a stringtable with given language */
5074 static stringtable_t *find_stringtable(lvc_t *lvc)
5075 {
5076 stringtable_t *stt;
5077
5078 assert(lvc != NULL);
5079
5080 if(!lvc->language)
5081 lvc->language = dup_language(currentlanguage);
5082
5083 for(stt = sttres; stt; stt = stt->next)
5084 {
5085 if(stt->lvc.language->id == lvc->language->id
5086 && stt->lvc.language->sub == lvc->language->sub)
5087 {
5088 /* Found a table with the same language */
5089 /* The version and characteristics are now handled
5090 * in the generation of the individual stringtables.
5091 * This enables localized analysis.
5092 if((stt->lvc.version && lvc->version && *(stt->lvc.version) != *(lvc->version))
5093 || (!stt->lvc.version && lvc->version)
5094 || (stt->lvc.version && !lvc->version))
5095 yywarning("Stringtable's versions are not the same, using first definition");
5096
5097 if((stt->lvc.characts && lvc->characts && *(stt->lvc.characts) != *(lvc->characts))
5098 || (!stt->lvc.characts && lvc->characts)
5099 || (stt->lvc.characts && !lvc->characts))
5100 yywarning("Stringtable's characteristics are not the same, using first definition");
5101 */
5102 return stt;
5103 }
5104 }
5105 return NULL;
5106 }
5107
5108 /* qsort sorting function for string table entries */
5109 #define STE(p) ((const stt_entry_t *)(p))
5110 static int sort_stt_entry(const void *e1, const void *e2)
5111 {
5112 return STE(e1)->id - STE(e2)->id;
5113 }
5114 #undef STE
5115
5116 static resource_t *build_stt_resources(stringtable_t *stthead)
5117 {
5118 stringtable_t *stt;
5119 stringtable_t *newstt;
5120 resource_t *rsc;
5121 resource_t *rsclist = NULL;
5122 resource_t *rsctail = NULL;
5123 int i;
5124 int j;
5125 DWORD andsum;
5126 DWORD orsum;
5127 characts_t *characts;
5128 version_t *version;
5129
5130 if(!stthead)
5131 return NULL;
5132
5133 /* For all languages defined */
5134 for(stt = stthead; stt; stt = stt->next)
5135 {
5136 assert(stt->nentries > 0);
5137
5138 /* Sort the entries */
5139 if(stt->nentries > 1)
5140 qsort(stt->entries, stt->nentries, sizeof(stt->entries[0]), sort_stt_entry);
5141
5142 for(i = 0; i < stt->nentries; )
5143 {
5144 newstt = new_stringtable(&stt->lvc);
5145 newstt->entries = (stt_entry_t *)xmalloc(16 * sizeof(stt_entry_t));
5146 newstt->nentries = 16;
5147 newstt->idbase = stt->entries[i].id & ~0xf;
5148 for(j = 0; j < 16 && i < stt->nentries; j++)
5149 {
5150 if(stt->entries[i].id - newstt->idbase == j)
5151 {
5152 newstt->entries[j] = stt->entries[i];
5153 i++;
5154 }
5155 }
5156 andsum = ~0;
5157 orsum = 0;
5158 characts = NULL;
5159 version = NULL;
5160 /* Check individual memory options and get
5161 * the first characteristics/version
5162 */
5163 for(j = 0; j < 16; j++)
5164 {
5165 if(!newstt->entries[j].str)
5166 continue;
5167 andsum &= newstt->entries[j].memopt;
5168 orsum |= newstt->entries[j].memopt;
5169 if(!characts)
5170 characts = newstt->entries[j].characts;
5171 if(!version)
5172 version = newstt->entries[j].version;
5173 }
5174 if(andsum != orsum)
5175 {
5176 warning("Stringtable's memory options are not equal (idbase: %d)", newstt->idbase);
5177 }
5178 /* Check version and characteristics */
5179 for(j = 0; j < 16; j++)
5180 {
5181 if(characts
5182 && newstt->entries[j].characts
5183 && *newstt->entries[j].characts != *characts)
5184 warning("Stringtable's characteristics are not the same (idbase: %d)", newstt->idbase);
5185 if(version
5186 && newstt->entries[j].version
5187 && *newstt->entries[j].version != *version)
5188 warning("Stringtable's versions are not the same (idbase: %d)", newstt->idbase);
5189 }
5190 rsc = new_resource(res_stt, newstt, newstt->memopt, newstt->lvc.language);
5191 rsc->name = new_name_id();
5192 rsc->name->type = name_ord;
5193 rsc->name->name.i_name = (newstt->idbase >> 4) + 1;
5194 rsc->memopt = andsum; /* Set to least common denominator */
5195 newstt->memopt = andsum;
5196 newstt->lvc.characts = characts;
5197 newstt->lvc.version = version;
5198 if(!rsclist)
5199 {
5200 rsclist = rsc;
5201 rsctail = rsc;
5202 }
5203 else
5204 {
5205 rsctail->next = rsc;
5206 rsc->prev = rsctail;
5207 rsctail = rsc;
5208 }
5209 }
5210 }
5211 return rsclist;
5212 }
5213
5214
5215 static toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec)
5216 {
5217 idrec->prev = prev;
5218 if(prev)
5219 prev->next = idrec;
5220
5221 return idrec;
5222 }
5223
5224 static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems)
5225 {
5226 if(!p)
5227 {
5228 *nitems = 0;
5229 return NULL;
5230 }
5231
5232 *nitems = 1;
5233
5234 while(p->prev)
5235 {
5236 (*nitems)++;
5237 p = p->prev;
5238 }
5239
5240 return p;
5241 }
5242
5243 static string_t *make_filename(string_t *str)
5244 {
5245 if(str->type == str_char)
5246 {
5247 char *cptr;
5248
5249 /* Remove escaped backslash and convert to forward */
5250 for(cptr = str->str.cstr; (cptr = strchr(cptr, '\\')) != NULL; cptr++)
5251 {
5252 if(cptr[1] == '\\')
5253 {
5254 memmove(cptr, cptr+1, strlen(cptr));
5255 str->size--;
5256 }
5257 *cptr = '/';
5258 }
5259 }
5260 else
5261 {
5262 WCHAR *wptr;
5263
5264 /* Remove escaped backslash and convert to forward */
5265 for(wptr = str->str.wstr; (wptr = strchrW(wptr, '\\')) != NULL; wptr++)
5266 {
5267 if(wptr[1] == '\\')
5268 {
5269 memmove(wptr, wptr+1, strlenW(wptr));
5270 str->size--;
5271 }
5272 *wptr = '/';
5273 }
5274 }
5275 return str;
5276 }
5277
5278 /*
5279 * Process all resources to extract fonts and build
5280 * a fontdir resource.
5281 *
5282 * Note: MS' resource compiler (build 1472) does not
5283 * handle font resources with different languages.
5284 * The fontdir is generated in the last active language
5285 * and font identifiers must be unique across the entire
5286 * source.
5287 * This is not logical considering the localization
5288 * constraints of all other resource types. MS has,
5289 * most probably, never testet localized fonts. However,
5290 * using fontresources is rare, so it might not occur
5291 * in normal applications.
5292 * Wine does require better localization because a lot
5293 * of languages are coded into the same executable.
5294 * Therefore, I will generate fontdirs for *each*
5295 * localized set of fonts.
5296 */
5297 static resource_t *build_fontdir(resource_t **fnt, int nfnt)
5298 {
5299 static int once = 0;
5300 if(!once)
5301 {
5302 warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)", fnt, nfnt);
5303 once++;
5304 }
5305 return NULL;
5306 }
5307
5308 static resource_t *build_fontdirs(resource_t *tail)
5309 {
5310 resource_t *rsc;
5311 resource_t *lst = NULL;
5312 resource_t **fnt = NULL; /* List of all fonts */
5313 int nfnt = 0;
5314 resource_t **fnd = NULL; /* List of all fontdirs */
5315 int nfnd = 0;
5316 resource_t **lanfnt = NULL;
5317 int nlanfnt = 0;
5318 int i;
5319 name_id_t nid;
5320 string_t str;
5321 int fntleft;
5322
5323 nid.type = name_str;
5324 nid.name.s_name = &str;
5325 str.type = str_char;
5326 str.str.cstr = xstrdup("FONTDIR");
5327 str.size = 7;
5328
5329 /* Extract all fonts and fontdirs */
5330 for(rsc = tail; rsc; rsc = rsc->prev)
5331 {
5332 if(rsc->type == res_fnt)
5333 {
5334 nfnt++;
5335 fnt = xrealloc(fnt, nfnt * sizeof(*fnt));
5336 fnt[nfnt-1] = rsc;
5337 }
5338 else if(rsc->type == res_fntdir)
5339 {
5340 nfnd++;
5341 fnd = xrealloc(fnd, nfnd * sizeof(*fnd));
5342 fnd[nfnd-1] = rsc;
5343 }
5344 }
5345
5346 /* Verify the name of the present fontdirs */
5347 for(i = 0; i < nfnd; i++)
5348 {
5349 if(compare_name_id(&nid, fnd[i]->name))
5350 {
5351 warning("User supplied FONTDIR entry has an invalid name '%s', ignored",
5352 get_nameid_str(fnd[i]->name));
5353 fnd[i] = NULL;
5354 }
5355 }
5356
5357 /* Sanity check */
5358 if(nfnt == 0)
5359 {
5360 if(nfnd != 0)
5361 warning("Found %d FONTDIR entries without any fonts present", nfnd);
5362 goto clean;
5363 }
5364
5365 /* Copy space */
5366 lanfnt = xmalloc(nfnt * sizeof(*lanfnt));
5367
5368 /* Get all fonts covered by fontdirs */
5369 for(i = 0; i < nfnd; i++)
5370 {
5371 int j;
5372 WORD cnt;
5373 int isswapped = 0;
5374
5375 if(!fnd[i])
5376 continue;
5377 for(j = 0; j < nfnt; j++)
5378 {
5379 if(!fnt[j])
5380 continue;
5381 if(fnt[j]->lan->id == fnd[i]->lan->id && fnt[j]->lan->sub == fnd[i]->lan->sub)
5382 {
5383 lanfnt[nlanfnt] = fnt[j];
5384 nlanfnt++;
5385 fnt[j] = NULL;
5386 }
5387 }
5388
5389 cnt = *(WORD *)fnd[i]->res.fnd->data->data;
5390 if(nlanfnt == cnt)
5391 isswapped = 0;
5392 else if(nlanfnt == BYTESWAP_WORD(cnt))
5393 isswapped = 1;
5394 else
5395 error("FONTDIR for language %d,%d has wrong count (%d, expected %d)",
5396 fnd[i]->lan->id, fnd[i]->lan->sub, cnt, nlanfnt);
5397 #ifdef WORDS_BIGENDIAN
5398 if((byteorder == WRC_BO_LITTLE && !isswapped) || (byteorder != WRC_BO_LITTLE && isswapped))
5399 #else
5400 if((byteorder == WRC_BO_BIG && !isswapped) || (byteorder != WRC_BO_BIG && isswapped))
5401 #endif
5402 {
5403 internal_error(__FILE__, __LINE__, "User supplied FONTDIR needs byteswapping");
5404 }
5405 }
5406
5407 /* We now have fonts left where we need to make a fontdir resource */
5408 for(i = fntleft = 0; i < nfnt; i++)
5409 {
5410 if(fnt[i])
5411 fntleft++;
5412 }
5413 while(fntleft)
5414 {
5415 /* Get fonts of same language in lanfnt[] */
5416 for(i = nlanfnt = 0; i < nfnt; i++)
5417 {
5418 if(fnt[i])
5419 {
5420 if(!nlanfnt)
5421 {
5422 addlanfnt:
5423 lanfnt[nlanfnt] = fnt[i];
5424 nlanfnt++;
5425 fnt[i] = NULL;
5426 fntleft--;
5427 }
5428 else if(fnt[i]->lan->id == lanfnt[0]->lan->id && fnt[i]->lan->sub == lanfnt[0]->lan->sub)
5429 goto addlanfnt;
5430 }
5431 }
5432 /* and build a fontdir */
5433 rsc = build_fontdir(lanfnt, nlanfnt);
5434 if(rsc)
5435 {
5436 if(lst)
5437 {
5438 lst->next = rsc;
5439 rsc->prev = lst;
5440 }
5441 lst = rsc;
5442 }
5443 }
5444
5445 free(lanfnt);
5446 clean:
5447 if(fnt)
5448 free(fnt);
5449 if(fnd)
5450 free(fnd);
5451 free(str.str.cstr);
5452 return lst;
5453 }
5454
5455 /*
5456 * This gets invoked to determine whether the next resource
5457 * is to be of a standard-type (e.g. bitmaps etc.), or should
5458 * be a user-type resource. This function is required because
5459 * there is the _possibility_ of a lookahead token in the
5460 * parser, which is generated from the "expr" state in the
5461 * "nameid" parsing.
5462 *
5463 * The general resource format is:
5464 * <identifier> <type> <flags> <resourcebody>
5465 *
5466 * The <identifier> can either be tIDENT or "expr". The latter
5467 * will always generate a lookahead, which is the <type> of the
5468 * resource to parse. Otherwise, we need to get a new token from
5469 * the scanner to determine the next step.
5470 *
5471 * The problem arrises when <type> is numerical. This case should
5472 * map onto default resource-types and be parsed as such instead
5473 * of being mapped onto user-type resources.
5474 *
5475 * The trick lies in the fact that yacc (bison) doesn't care about
5476 * intermediate changes of the lookahead while reducing a rule. We
5477 * simply replace the lookahead with a token that will result in
5478 * a shift to the appropriate rule for the specific resource-type.
5479 */
5480 static int rsrcid_to_token(int lookahead)
5481 {
5482 int token;
5483 const char *type = "?";
5484
5485 /* Get a token if we don't have one yet */
5486 if(lookahead == YYEMPTY)
5487 lookahead = YYLEX;
5488
5489 /* Only numbers are possibly interesting */
5490 switch(lookahead)
5491 {
5492 case tNUMBER:
5493 case tLNUMBER:
5494 break;
5495 default:
5496 return lookahead;
5497 }
5498
5499 token = lookahead;
5500
5501 switch(yylval.num)
5502 {
5503 case WRC_RT_CURSOR:
5504 type = "CURSOR";
5505 token = tCURSOR;
5506 break;
5507 case WRC_RT_ICON:
5508 type = "ICON";
5509 token = tICON;
5510 break;
5511 case WRC_RT_BITMAP:
5512 type = "BITMAP";
5513 token = tBITMAP;
5514 break;
5515 case WRC_RT_FONT:
5516 type = "FONT";
5517 token = tFONT;
5518 break;
5519 case WRC_RT_FONTDIR:
5520 type = "FONTDIR";
5521 token = tFONTDIR;
5522 break;
5523 case WRC_RT_RCDATA:
5524 type = "RCDATA";
5525 token = tRCDATA;
5526 break;
5527 case WRC_RT_MESSAGETABLE:
5528 type = "MESSAGETABLE";
5529 token = tMESSAGETABLE;
5530 break;
5531 case WRC_RT_DLGINIT:
5532 type = "DLGINIT";
5533 token = tDLGINIT;
5534 break;
5535 case WRC_RT_ACCELERATOR:
5536 type = "ACCELERATOR";
5537 token = tACCELERATORS;
5538 break;
5539 case WRC_RT_MENU:
5540 type = "MENU";
5541 token = tMENU;
5542 break;
5543 case WRC_RT_DIALOG:
5544 type = "DIALOG";
5545 token = tDIALOG;
5546 break;
5547 case WRC_RT_VERSION:
5548 type = "VERSION";
5549 token = tVERSIONINFO;
5550 break;
5551 case WRC_RT_TOOLBAR:
5552 type = "TOOLBAR";
5553 token = tTOOLBAR;
5554 break;
5555
5556 case WRC_RT_STRING:
5557 type = "STRINGTABLE";
5558 break;
5559
5560 case WRC_RT_ANICURSOR:
5561 case WRC_RT_ANIICON:
5562 case WRC_RT_GROUP_CURSOR:
5563 case WRC_RT_GROUP_ICON:
5564 yywarning("Usertype uses reserved type ID %d, which is auto-generated", yylval.num);
5565 return lookahead;
5566
5567 case WRC_RT_DLGINCLUDE:
5568 case WRC_RT_PLUGPLAY:
5569 case WRC_RT_VXD:
5570 case WRC_RT_HTML:
5571 yywarning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num);
5572 default:
5573 return lookahead;
5574 }
5575
5576 return token;
5577 }
5578