source: trunk/tools/wrc/y.tab.c@ 10367

Last change on this file since 10367 was 5523, checked in by sandervl, 24 years ago

updates

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