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