Switch to the new widl (Wine-20080118)
[reactos.git] / reactos / tools / widl / parser.tab.c
1 /* A Bison parser, made by GNU Bison 2.1. */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, 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 /* Bison version. */
40 #define YYBISON_VERSION "2.1"
41
42 /* Skeleton name. */
43 #define YYSKELETON_NAME "yacc.c"
44
45 /* Pure parsers. */
46 #define YYPURE 0
47
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
50
51 /* Substitute the variable and function names. */
52 #define yyparse parser_parse
53 #define yylex parser_lex
54 #define yyerror parser_error
55 #define yylval parser_lval
56 #define yychar parser_char
57 #define yydebug parser_debug
58 #define yynerrs parser_nerrs
59
60
61 /* Tokens. */
62 #ifndef YYTOKENTYPE
63 # define YYTOKENTYPE
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
65 know about them. */
66 enum yytokentype {
67 aIDENTIFIER = 258,
68 aKNOWNTYPE = 259,
69 aNUM = 260,
70 aHEXNUM = 261,
71 aDOUBLE = 262,
72 aSTRING = 263,
73 aUUID = 264,
74 aEOF = 265,
75 SHL = 266,
76 SHR = 267,
77 tAGGREGATABLE = 268,
78 tALLOCATE = 269,
79 tAPPOBJECT = 270,
80 tASYNC = 271,
81 tASYNCUUID = 272,
82 tAUTOHANDLE = 273,
83 tBINDABLE = 274,
84 tBOOLEAN = 275,
85 tBROADCAST = 276,
86 tBYTE = 277,
87 tBYTECOUNT = 278,
88 tCALLAS = 279,
89 tCALLBACK = 280,
90 tCASE = 281,
91 tCDECL = 282,
92 tCHAR = 283,
93 tCOCLASS = 284,
94 tCODE = 285,
95 tCOMMSTATUS = 286,
96 tCONST = 287,
97 tCONTEXTHANDLE = 288,
98 tCONTEXTHANDLENOSERIALIZE = 289,
99 tCONTEXTHANDLESERIALIZE = 290,
100 tCONTROL = 291,
101 tCPPQUOTE = 292,
102 tDEFAULT = 293,
103 tDEFAULTCOLLELEM = 294,
104 tDEFAULTVALUE = 295,
105 tDEFAULTVTABLE = 296,
106 tDISPLAYBIND = 297,
107 tDISPINTERFACE = 298,
108 tDLLNAME = 299,
109 tDOUBLE = 300,
110 tDUAL = 301,
111 tENDPOINT = 302,
112 tENTRY = 303,
113 tENUM = 304,
114 tERRORSTATUST = 305,
115 tEXPLICITHANDLE = 306,
116 tEXTERN = 307,
117 tFALSE = 308,
118 tFLOAT = 309,
119 tHANDLE = 310,
120 tHANDLET = 311,
121 tHELPCONTEXT = 312,
122 tHELPFILE = 313,
123 tHELPSTRING = 314,
124 tHELPSTRINGCONTEXT = 315,
125 tHELPSTRINGDLL = 316,
126 tHIDDEN = 317,
127 tHYPER = 318,
128 tID = 319,
129 tIDEMPOTENT = 320,
130 tIIDIS = 321,
131 tIMMEDIATEBIND = 322,
132 tIMPLICITHANDLE = 323,
133 tIMPORT = 324,
134 tIMPORTLIB = 325,
135 tIN = 326,
136 tINLINE = 327,
137 tINPUTSYNC = 328,
138 tINT = 329,
139 tINT64 = 330,
140 tINTERFACE = 331,
141 tLCID = 332,
142 tLENGTHIS = 333,
143 tLIBRARY = 334,
144 tLOCAL = 335,
145 tLONG = 336,
146 tMETHODS = 337,
147 tMODULE = 338,
148 tNONBROWSABLE = 339,
149 tNONCREATABLE = 340,
150 tNONEXTENSIBLE = 341,
151 tOBJECT = 342,
152 tODL = 343,
153 tOLEAUTOMATION = 344,
154 tOPTIONAL = 345,
155 tOUT = 346,
156 tPOINTERDEFAULT = 347,
157 tPROPERTIES = 348,
158 tPROPGET = 349,
159 tPROPPUT = 350,
160 tPROPPUTREF = 351,
161 tPTR = 352,
162 tPUBLIC = 353,
163 tRANGE = 354,
164 tREADONLY = 355,
165 tREF = 356,
166 tREQUESTEDIT = 357,
167 tRESTRICTED = 358,
168 tRETVAL = 359,
169 tSAFEARRAY = 360,
170 tSHORT = 361,
171 tSIGNED = 362,
172 tSINGLE = 363,
173 tSIZEIS = 364,
174 tSIZEOF = 365,
175 tSMALL = 366,
176 tSOURCE = 367,
177 tSTDCALL = 368,
178 tSTRICTCONTEXTHANDLE = 369,
179 tSTRING = 370,
180 tSTRUCT = 371,
181 tSWITCH = 372,
182 tSWITCHIS = 373,
183 tSWITCHTYPE = 374,
184 tTRANSMITAS = 375,
185 tTRUE = 376,
186 tTYPEDEF = 377,
187 tUNION = 378,
188 tUNIQUE = 379,
189 tUNSIGNED = 380,
190 tUUID = 381,
191 tV1ENUM = 382,
192 tVARARG = 383,
193 tVERSION = 384,
194 tVOID = 385,
195 tWCHAR = 386,
196 tWIREMARSHAL = 387,
197 CAST = 388,
198 PPTR = 389,
199 NEG = 390,
200 ADDRESSOF = 391
201 };
202 #endif
203 /* Tokens. */
204 #define aIDENTIFIER 258
205 #define aKNOWNTYPE 259
206 #define aNUM 260
207 #define aHEXNUM 261
208 #define aDOUBLE 262
209 #define aSTRING 263
210 #define aUUID 264
211 #define aEOF 265
212 #define SHL 266
213 #define SHR 267
214 #define tAGGREGATABLE 268
215 #define tALLOCATE 269
216 #define tAPPOBJECT 270
217 #define tASYNC 271
218 #define tASYNCUUID 272
219 #define tAUTOHANDLE 273
220 #define tBINDABLE 274
221 #define tBOOLEAN 275
222 #define tBROADCAST 276
223 #define tBYTE 277
224 #define tBYTECOUNT 278
225 #define tCALLAS 279
226 #define tCALLBACK 280
227 #define tCASE 281
228 #define tCDECL 282
229 #define tCHAR 283
230 #define tCOCLASS 284
231 #define tCODE 285
232 #define tCOMMSTATUS 286
233 #define tCONST 287
234 #define tCONTEXTHANDLE 288
235 #define tCONTEXTHANDLENOSERIALIZE 289
236 #define tCONTEXTHANDLESERIALIZE 290
237 #define tCONTROL 291
238 #define tCPPQUOTE 292
239 #define tDEFAULT 293
240 #define tDEFAULTCOLLELEM 294
241 #define tDEFAULTVALUE 295
242 #define tDEFAULTVTABLE 296
243 #define tDISPLAYBIND 297
244 #define tDISPINTERFACE 298
245 #define tDLLNAME 299
246 #define tDOUBLE 300
247 #define tDUAL 301
248 #define tENDPOINT 302
249 #define tENTRY 303
250 #define tENUM 304
251 #define tERRORSTATUST 305
252 #define tEXPLICITHANDLE 306
253 #define tEXTERN 307
254 #define tFALSE 308
255 #define tFLOAT 309
256 #define tHANDLE 310
257 #define tHANDLET 311
258 #define tHELPCONTEXT 312
259 #define tHELPFILE 313
260 #define tHELPSTRING 314
261 #define tHELPSTRINGCONTEXT 315
262 #define tHELPSTRINGDLL 316
263 #define tHIDDEN 317
264 #define tHYPER 318
265 #define tID 319
266 #define tIDEMPOTENT 320
267 #define tIIDIS 321
268 #define tIMMEDIATEBIND 322
269 #define tIMPLICITHANDLE 323
270 #define tIMPORT 324
271 #define tIMPORTLIB 325
272 #define tIN 326
273 #define tINLINE 327
274 #define tINPUTSYNC 328
275 #define tINT 329
276 #define tINT64 330
277 #define tINTERFACE 331
278 #define tLCID 332
279 #define tLENGTHIS 333
280 #define tLIBRARY 334
281 #define tLOCAL 335
282 #define tLONG 336
283 #define tMETHODS 337
284 #define tMODULE 338
285 #define tNONBROWSABLE 339
286 #define tNONCREATABLE 340
287 #define tNONEXTENSIBLE 341
288 #define tOBJECT 342
289 #define tODL 343
290 #define tOLEAUTOMATION 344
291 #define tOPTIONAL 345
292 #define tOUT 346
293 #define tPOINTERDEFAULT 347
294 #define tPROPERTIES 348
295 #define tPROPGET 349
296 #define tPROPPUT 350
297 #define tPROPPUTREF 351
298 #define tPTR 352
299 #define tPUBLIC 353
300 #define tRANGE 354
301 #define tREADONLY 355
302 #define tREF 356
303 #define tREQUESTEDIT 357
304 #define tRESTRICTED 358
305 #define tRETVAL 359
306 #define tSAFEARRAY 360
307 #define tSHORT 361
308 #define tSIGNED 362
309 #define tSINGLE 363
310 #define tSIZEIS 364
311 #define tSIZEOF 365
312 #define tSMALL 366
313 #define tSOURCE 367
314 #define tSTDCALL 368
315 #define tSTRICTCONTEXTHANDLE 369
316 #define tSTRING 370
317 #define tSTRUCT 371
318 #define tSWITCH 372
319 #define tSWITCHIS 373
320 #define tSWITCHTYPE 374
321 #define tTRANSMITAS 375
322 #define tTRUE 376
323 #define tTYPEDEF 377
324 #define tUNION 378
325 #define tUNIQUE 379
326 #define tUNSIGNED 380
327 #define tUUID 381
328 #define tV1ENUM 382
329 #define tVARARG 383
330 #define tVERSION 384
331 #define tVOID 385
332 #define tWCHAR 386
333 #define tWIREMARSHAL 387
334 #define CAST 388
335 #define PPTR 389
336 #define NEG 390
337 #define ADDRESSOF 391
338
339
340
341
342 /* Copy the first part of user declarations. */
343 #line 1 "parser.y"
344
345 /*
346 * IDL Compiler
347 *
348 * Copyright 2002 Ove Kaaven
349 *
350 * This library is free software; you can redistribute it and/or
351 * modify it under the terms of the GNU Lesser General Public
352 * License as published by the Free Software Foundation; either
353 * version 2.1 of the License, or (at your option) any later version.
354 *
355 * This library is distributed in the hope that it will be useful,
356 * but WITHOUT ANY WARRANTY; without even the implied warranty of
357 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
358 * Lesser General Public License for more details.
359 *
360 * You should have received a copy of the GNU Lesser General Public
361 * License along with this library; if not, write to the Free Software
362 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
363 */
364
365 #include "config.h"
366
367 #include <stdio.h>
368 #include <stdlib.h>
369 #include <stdarg.h>
370 #include <assert.h>
371 #include <ctype.h>
372 #include <string.h>
373 #ifdef HAVE_ALLOCA_H
374 #include <alloca.h>
375 #endif
376
377 #include "widl.h"
378 #include "utils.h"
379 #include "parser.h"
380 #include "header.h"
381 #include "typelib.h"
382 #include "typegen.h"
383
384 #if defined(YYBYACC)
385 /* Berkeley yacc (byacc) doesn't seem to know about these */
386 /* Some *BSD supplied versions do define these though */
387 # ifndef YYEMPTY
388 # define YYEMPTY (-1) /* Empty lookahead value of yychar */
389 # endif
390 # ifndef YYLEX
391 # define YYLEX yylex()
392 # endif
393
394 #elif defined(YYBISON)
395 /* Bison was used for original development */
396 /* #define YYEMPTY -2 */
397 /* #define YYLEX yylex() */
398
399 #else
400 /* No yacc we know yet */
401 # if !defined(YYEMPTY) || !defined(YYLEX)
402 # error Yacc version/type unknown. This version needs to be verified for settings of YYEMPTY and YYLEX.
403 # elif defined(__GNUC__) /* gcc defines the #warning directive */
404 # warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but is not tested
405 /* #else we just take a chance that it works... */
406 # endif
407 #endif
408
409 unsigned char pointer_default = RPC_FC_UP;
410
411 typedef struct list typelist_t;
412 struct typenode {
413 type_t *type;
414 struct list entry;
415 };
416
417 typelist_t incomplete_types = LIST_INIT(incomplete_types);
418
419 static void add_incomplete(type_t *t);
420 static void fix_incomplete(void);
421
422 static str_list_t *append_str(str_list_t *list, char *str);
423 static attr_list_t *append_attr(attr_list_t *list, attr_t *attr);
424 static attr_t *make_attr(enum attr_type type);
425 static attr_t *make_attrv(enum attr_type type, unsigned long val);
426 static attr_t *make_attrp(enum attr_type type, void *val);
427 static expr_t *make_expr(enum expr_type type);
428 static expr_t *make_exprl(enum expr_type type, long val);
429 static expr_t *make_exprd(enum expr_type type, double val);
430 static expr_t *make_exprs(enum expr_type type, char *val);
431 static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr);
432 static expr_t *make_expr1(enum expr_type type, expr_t *expr);
433 static expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2);
434 static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3);
435 static type_t *make_type(unsigned char type, type_t *ref);
436 static expr_list_t *append_expr(expr_list_t *list, expr_t *expr);
437 static array_dims_t *append_array(array_dims_t *list, expr_t *expr);
438 static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr, int top);
439 static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface);
440 static ifref_t *make_ifref(type_t *iface);
441 static var_list_t *append_var(var_list_t *list, var_t *var);
442 static var_t *make_var(char *name);
443 static pident_list_t *append_pident(pident_list_t *list, pident_t *p);
444 static pident_t *make_pident(var_t *var);
445 static func_list_t *append_func(func_list_t *list, func_t *func);
446 static func_t *make_func(var_t *def, var_list_t *args);
447 static type_t *make_class(char *name);
448 static type_t *make_safearray(type_t *type);
449 static type_t *make_builtin(char *name);
450 static type_t *make_int(int sign);
451
452 static type_t *reg_type(type_t *type, const char *name, int t);
453 static type_t *reg_typedefs(type_t *type, var_list_t *names, attr_list_t *attrs);
454 static type_t *find_type(const char *name, int t);
455 static type_t *find_type2(char *name, int t);
456 static type_t *get_type(unsigned char type, char *name, int t);
457 static type_t *get_typev(unsigned char type, var_t *name, int t);
458 static int get_struct_type(var_list_t *fields);
459
460 static var_t *reg_const(var_t *var);
461 static var_t *find_const(char *name, int f);
462
463 static void write_libid(const char *name, const attr_list_t *attr);
464 static void write_clsid(type_t *cls);
465 static void write_diid(type_t *iface);
466 static void write_iid(type_t *iface);
467
468 static int compute_method_indexes(type_t *iface);
469 static char *gen_name(void);
470 static void process_typedefs(var_list_t *names);
471 static void check_arg(var_t *arg);
472 static void check_all_user_types(ifref_list_t *ifaces);
473
474 #define tsENUM 1
475 #define tsSTRUCT 2
476 #define tsUNION 3
477
478
479
480 /* Enabling traces. */
481 #ifndef YYDEBUG
482 # define YYDEBUG 0
483 #endif
484
485 /* Enabling verbose error messages. */
486 #ifdef YYERROR_VERBOSE
487 # undef YYERROR_VERBOSE
488 # define YYERROR_VERBOSE 1
489 #else
490 # define YYERROR_VERBOSE 0
491 #endif
492
493 /* Enabling the token table. */
494 #ifndef YYTOKEN_TABLE
495 # define YYTOKEN_TABLE 0
496 #endif
497
498 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
499 #line 136 "parser.y"
500 typedef union YYSTYPE {
501 attr_t *attr;
502 attr_list_t *attr_list;
503 str_list_t *str_list;
504 expr_t *expr;
505 expr_list_t *expr_list;
506 array_dims_t *array_dims;
507 type_t *type;
508 var_t *var;
509 var_list_t *var_list;
510 pident_t *pident;
511 pident_list_t *pident_list;
512 func_t *func;
513 func_list_t *func_list;
514 ifref_t *ifref;
515 ifref_list_t *ifref_list;
516 char *str;
517 UUID *uuid;
518 unsigned int num;
519 double dbl;
520 interface_info_t ifinfo;
521 } YYSTYPE;
522 /* Line 196 of yacc.c. */
523 #line 524 "parser.tab.c"
524 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
525 # define YYSTYPE_IS_DECLARED 1
526 # define YYSTYPE_IS_TRIVIAL 1
527 #endif
528
529
530
531 /* Copy the second part of user declarations. */
532
533
534 /* Line 219 of yacc.c. */
535 #line 536 "parser.tab.c"
536
537 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
538 # define YYSIZE_T __SIZE_TYPE__
539 #endif
540 #if ! defined (YYSIZE_T) && defined (size_t)
541 # define YYSIZE_T size_t
542 #endif
543 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
544 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
545 # define YYSIZE_T size_t
546 #endif
547 #if ! defined (YYSIZE_T)
548 # define YYSIZE_T unsigned int
549 #endif
550
551 #ifndef YY_
552 # if YYENABLE_NLS
553 # if ENABLE_NLS
554 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
555 # define YY_(msgid) dgettext ("bison-runtime", msgid)
556 # endif
557 # endif
558 # ifndef YY_
559 # define YY_(msgid) msgid
560 # endif
561 #endif
562
563 #if ! defined (yyoverflow) || YYERROR_VERBOSE
564
565 /* The parser invokes alloca or malloc; define the necessary symbols. */
566
567 # ifdef YYSTACK_USE_ALLOCA
568 # if YYSTACK_USE_ALLOCA
569 # ifdef __GNUC__
570 # define YYSTACK_ALLOC __builtin_alloca
571 # else
572 # define YYSTACK_ALLOC alloca
573 # if defined (__STDC__) || defined (__cplusplus)
574 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
575 # define YYINCLUDED_STDLIB_H
576 # endif
577 # endif
578 # endif
579 # endif
580
581 # ifdef YYSTACK_ALLOC
582 /* Pacify GCC's `empty if-body' warning. */
583 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
584 # ifndef YYSTACK_ALLOC_MAXIMUM
585 /* The OS might guarantee only one guard page at the bottom of the stack,
586 and a page size can be as small as 4096 bytes. So we cannot safely
587 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
588 to allow for a few compiler-allocated temporary stack slots. */
589 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
590 # endif
591 # else
592 # define YYSTACK_ALLOC YYMALLOC
593 # define YYSTACK_FREE YYFREE
594 # ifndef YYSTACK_ALLOC_MAXIMUM
595 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
596 # endif
597 # ifdef __cplusplus
598 extern "C" {
599 # endif
600 # ifndef YYMALLOC
601 # define YYMALLOC malloc
602 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
603 && (defined (__STDC__) || defined (__cplusplus)))
604 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
605 # endif
606 # endif
607 # ifndef YYFREE
608 # define YYFREE free
609 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
610 && (defined (__STDC__) || defined (__cplusplus)))
611 void free (void *); /* INFRINGES ON USER NAME SPACE */
612 # endif
613 # endif
614 # ifdef __cplusplus
615 }
616 # endif
617 # endif
618 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
619
620
621 #if (! defined (yyoverflow) \
622 && (! defined (__cplusplus) \
623 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
624
625 /* A type that is properly aligned for any stack member. */
626 union yyalloc
627 {
628 short int yyss;
629 YYSTYPE yyvs;
630 };
631
632 /* The size of the maximum gap between one aligned stack and the next. */
633 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
634
635 /* The size of an array large to enough to hold all stacks, each with
636 N elements. */
637 # define YYSTACK_BYTES(N) \
638 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
639 + YYSTACK_GAP_MAXIMUM)
640
641 /* Copy COUNT objects from FROM to TO. The source and destination do
642 not overlap. */
643 # ifndef YYCOPY
644 # if defined (__GNUC__) && 1 < __GNUC__
645 # define YYCOPY(To, From, Count) \
646 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
647 # else
648 # define YYCOPY(To, From, Count) \
649 do \
650 { \
651 YYSIZE_T yyi; \
652 for (yyi = 0; yyi < (Count); yyi++) \
653 (To)[yyi] = (From)[yyi]; \
654 } \
655 while (0)
656 # endif
657 # endif
658
659 /* Relocate STACK from its old location to the new one. The
660 local variables YYSIZE and YYSTACKSIZE give the old and new number of
661 elements in the stack, and YYPTR gives the new location of the
662 stack. Advance YYPTR to a properly aligned location for the next
663 stack. */
664 # define YYSTACK_RELOCATE(Stack) \
665 do \
666 { \
667 YYSIZE_T yynewbytes; \
668 YYCOPY (&yyptr->Stack, Stack, yysize); \
669 Stack = &yyptr->Stack; \
670 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
671 yyptr += yynewbytes / sizeof (*yyptr); \
672 } \
673 while (0)
674
675 #endif
676
677 #if defined (__STDC__) || defined (__cplusplus)
678 typedef signed char yysigned_char;
679 #else
680 typedef short int yysigned_char;
681 #endif
682
683 /* YYFINAL -- State number of the termination state. */
684 #define YYFINAL 3
685 /* YYLAST -- Last index in YYTABLE. */
686 #define YYLAST 1019
687
688 /* YYNTOKENS -- Number of terminals. */
689 #define YYNTOKENS 156
690 /* YYNNTS -- Number of nonterminals. */
691 #define YYNNTS 76
692 /* YYNRULES -- Number of rules. */
693 #define YYNRULES 272
694 /* YYNRULES -- Number of states. */
695 #define YYNSTATES 500
696
697 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
698 #define YYUNDEFTOK 2
699 #define YYMAXUTOK 391
700
701 #define YYTRANSLATE(YYX) \
702 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
703
704 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
705 static const unsigned char yytranslate[] =
706 {
707 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
708 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
709 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
710 2, 2, 2, 2, 2, 2, 2, 2, 137, 2,
711 148, 149, 140, 139, 133, 138, 155, 141, 2, 2,
712 2, 2, 2, 2, 2, 2, 2, 2, 135, 147,
713 2, 154, 2, 134, 2, 2, 2, 2, 2, 2,
714 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
715 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
716 2, 152, 2, 153, 2, 2, 2, 2, 2, 2,
717 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
718 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
719 2, 2, 2, 150, 136, 151, 142, 2, 2, 2,
720 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
721 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
722 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
723 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
724 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
725 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
726 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
727 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
728 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
729 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
730 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
731 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
732 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
733 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
734 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
735 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
736 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
737 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
738 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
739 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
740 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
741 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
742 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
743 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
744 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
745 125, 126, 127, 128, 129, 130, 131, 132, 143, 144,
746 145, 146
747 };
748
749 #if YYDEBUG
750 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
751 YYRHS. */
752 static const unsigned short int yyprhs[] =
753 {
754 0, 0, 3, 5, 6, 9, 12, 16, 19, 22,
755 25, 28, 29, 32, 35, 39, 42, 45, 48, 51,
756 52, 56, 59, 61, 64, 66, 69, 72, 74, 77,
757 80, 83, 88, 92, 96, 101, 104, 108, 112, 113,
758 115, 117, 119, 123, 125, 130, 134, 141, 147, 148,
759 152, 156, 158, 162, 167, 168, 170, 174, 176, 180,
760 185, 187, 191, 192, 194, 196, 198, 200, 202, 207,
761 212, 214, 216, 218, 220, 222, 224, 229, 234, 236,
762 238, 243, 245, 250, 255, 260, 262, 264, 269, 274,
763 279, 284, 289, 291, 296, 298, 303, 305, 311, 313,
764 315, 320, 322, 324, 326, 328, 330, 332, 334, 336,
765 338, 343, 345, 347, 349, 351, 358, 360, 362, 364,
766 366, 371, 373, 375, 377, 382, 387, 392, 397, 399,
767 401, 406, 411, 413, 415, 417, 418, 420, 421, 424,
768 429, 433, 439, 440, 443, 445, 447, 451, 455, 457,
769 463, 465, 469, 470, 472, 474, 476, 478, 480, 482,
770 484, 490, 494, 498, 502, 506, 510, 514, 518, 522,
771 525, 528, 531, 534, 539, 544, 548, 550, 554, 556,
772 561, 562, 565, 568, 572, 575, 577, 582, 590, 591,
773 593, 594, 596, 598, 600, 602, 604, 606, 608, 611,
774 614, 616, 618, 620, 622, 624, 626, 628, 629, 631,
775 633, 636, 638, 641, 644, 646, 648, 651, 654, 657,
776 662, 663, 666, 669, 672, 675, 678, 681, 685, 688,
777 692, 698, 704, 705, 708, 711, 714, 717, 723, 731,
778 733, 736, 739, 742, 745, 748, 753, 756, 759, 761,
779 763, 767, 769, 773, 775, 777, 779, 785, 787, 789,
780 791, 794, 796, 799, 801, 804, 806, 809, 814, 819,
781 825, 836, 838
782 };
783
784 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
785 static const short int yyrhs[] =
786 {
787 157, 0, -1, 158, -1, -1, 158, 219, -1, 158,
788 218, -1, 158, 205, 147, -1, 158, 207, -1, 158,
789 222, -1, 158, 168, -1, 158, 161, -1, -1, 159,
790 219, -1, 159, 218, -1, 159, 205, 147, -1, 159,
791 207, -1, 159, 222, -1, 159, 161, -1, 159, 165,
792 -1, -1, 160, 198, 147, -1, 160, 161, -1, 147,
793 -1, 184, 147, -1, 162, -1, 188, 147, -1, 194,
794 147, -1, 164, -1, 227, 147, -1, 229, 147, -1,
795 230, 147, -1, 37, 148, 8, 149, -1, 69, 8,
796 147, -1, 163, 159, 10, -1, 70, 148, 8, 149,
797 -1, 79, 3, -1, 176, 166, 150, -1, 167, 159,
798 151, -1, -1, 171, -1, 130, -1, 172, -1, 171,
799 133, 172, -1, 170, -1, 176, 228, 224, 173, -1,
800 228, 224, 173, -1, 176, 228, 224, 148, 169, 149,
801 -1, 228, 224, 148, 169, 149, -1, -1, 152, 174,
802 153, -1, 152, 140, 153, -1, 190, -1, 174, 133,
803 191, -1, 174, 153, 152, 191, -1, -1, 176, -1,
804 152, 177, 153, -1, 179, -1, 177, 133, 179, -1,
805 177, 153, 152, 179, -1, 8, -1, 178, 133, 8,
806 -1, -1, 13, -1, 15, -1, 16, -1, 18, -1,
807 19, -1, 24, 148, 201, 149, -1, 26, 148, 192,
808 149, -1, 33, -1, 34, -1, 35, -1, 36, -1,
809 38, -1, 39, -1, 40, 148, 193, 149, -1, 40,
810 148, 8, 149, -1, 41, -1, 42, -1, 44, 148,
811 8, 149, -1, 46, -1, 47, 148, 178, 149, -1,
812 48, 148, 8, 149, -1, 48, 148, 193, 149, -1,
813 51, -1, 55, -1, 57, 148, 193, 149, -1, 58,
814 148, 8, 149, -1, 59, 148, 8, 149, -1, 60,
815 148, 193, 149, -1, 61, 148, 8, 149, -1, 62,
816 -1, 64, 148, 193, 149, -1, 65, -1, 66, 148,
817 191, 149, -1, 67, -1, 68, 148, 56, 3, 149,
818 -1, 71, -1, 73, -1, 78, 148, 189, 149, -1,
819 80, -1, 84, -1, 85, -1, 86, -1, 87, -1,
820 88, -1, 89, -1, 90, -1, 91, -1, 92, 148,
821 226, 149, -1, 94, -1, 95, -1, 96, -1, 98,
822 -1, 99, 148, 193, 133, 193, 149, -1, 100, -1,
823 102, -1, 103, -1, 104, -1, 109, 148, 189, 149,
824 -1, 112, -1, 114, -1, 115, -1, 118, 148, 191,
825 149, -1, 119, 148, 228, 149, -1, 120, 148, 228,
826 149, -1, 126, 148, 180, 149, -1, 127, -1, 128,
827 -1, 129, 148, 231, 149, -1, 132, 148, 228, 149,
828 -1, 226, -1, 9, -1, 8, -1, -1, 113, -1,
829 -1, 182, 183, -1, 26, 191, 135, 196, -1, 38,
830 135, 196, -1, 32, 228, 201, 154, 193, -1, -1,
831 186, 133, -1, 186, -1, 187, -1, 186, 133, 187,
832 -1, 201, 154, 193, -1, 201, -1, 49, 200, 150,
833 185, 151, -1, 190, -1, 189, 133, 190, -1, -1,
834 191, -1, 5, -1, 6, -1, 7, -1, 53, -1,
835 121, -1, 3, -1, 191, 134, 191, 135, 191, -1,
836 191, 136, 191, -1, 191, 137, 191, -1, 191, 139,
837 191, -1, 191, 138, 191, -1, 191, 140, 191, -1,
838 191, 141, 191, -1, 191, 11, 191, -1, 191, 12,
839 191, -1, 142, 191, -1, 138, 191, -1, 137, 191,
840 -1, 140, 191, -1, 148, 228, 149, 191, -1, 110,
841 148, 228, 149, -1, 148, 191, 149, -1, 193, -1,
842 192, 133, 193, -1, 191, -1, 52, 32, 228, 201,
843 -1, -1, 195, 196, -1, 197, 147, -1, 175, 230,
844 147, -1, 176, 147, -1, 147, -1, 175, 228, 224,
845 173, -1, 175, 228, 181, 224, 148, 169, 149, -1,
846 -1, 201, -1, -1, 3, -1, 4, -1, 3, -1,
847 4, -1, 22, -1, 131, -1, 204, -1, 107, 204,
848 -1, 125, 204, -1, 125, -1, 54, -1, 108, -1,
849 45, -1, 20, -1, 50, -1, 56, -1, -1, 74,
850 -1, 74, -1, 106, 203, -1, 111, -1, 81, 203,
851 -1, 63, 203, -1, 75, -1, 28, -1, 29, 3,
852 -1, 29, 4, -1, 176, 205, -1, 206, 150, 208,
853 151, -1, -1, 208, 209, -1, 175, 219, -1, 43,
854 3, -1, 43, 4, -1, 176, 210, -1, 93, 135,
855 -1, 212, 197, 147, -1, 82, 135, -1, 213, 198,
856 147, -1, 211, 150, 212, 213, 151, -1, 211, 150,
857 216, 147, 151, -1, -1, 135, 4, -1, 76, 3,
858 -1, 76, 4, -1, 176, 216, -1, 217, 215, 150,
859 160, 151, -1, 217, 135, 3, 150, 164, 160, 151,
860 -1, 214, -1, 216, 147, -1, 210, 147, -1, 83,
861 3, -1, 83, 4, -1, 176, 220, -1, 221, 150,
862 160, 151, -1, 140, 224, -1, 32, 223, -1, 201,
863 -1, 223, -1, 148, 224, 149, -1, 224, -1, 225,
864 133, 224, -1, 101, -1, 124, -1, 97, -1, 116,
865 200, 150, 195, 151, -1, 130, -1, 4, -1, 202,
866 -1, 32, 228, -1, 188, -1, 49, 3, -1, 227,
867 -1, 116, 3, -1, 230, -1, 123, 3, -1, 105,
868 148, 228, 149, -1, 122, 175, 228, 225, -1, 123,
869 200, 150, 195, 151, -1, 123, 200, 117, 148, 197,
870 149, 199, 150, 182, 151, -1, 5, -1, 5, 155,
871 5, -1
872 };
873
874 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
875 static const unsigned short int yyrline[] =
876 {
877 0, 286, 286, 295, 296, 297, 298, 302, 307, 308,
878 309, 312, 313, 314, 315, 316, 320, 321, 322, 325,
879 326, 327, 330, 331, 332, 333, 338, 339, 340, 345,
880 346, 353, 355, 358, 361, 364, 366, 371, 374, 375,
881 378, 381, 382, 383, 387, 392, 396, 402, 409, 410,
882 411, 414, 415, 416, 419, 420, 424, 430, 431, 432,
883 435, 436, 439, 440, 441, 442, 443, 444, 445, 446,
884 447, 448, 449, 450, 451, 452, 453, 454, 455, 456,
885 457, 458, 459, 460, 461, 462, 463, 464, 465, 466,
886 467, 468, 469, 470, 471, 472, 473, 474, 475, 476,
887 477, 478, 479, 480, 481, 482, 483, 484, 485, 486,
888 487, 488, 489, 490, 491, 492, 495, 496, 497, 498,
889 499, 500, 501, 502, 503, 504, 505, 506, 507, 508,
890 509, 510, 511, 515, 516, 521, 522, 525, 526, 529,
891 533, 539, 545, 546, 547, 550, 554, 563, 567, 572,
892 581, 582, 595, 596, 599, 600, 601, 602, 603, 604,
893 605, 606, 607, 608, 609, 610, 611, 612, 613, 614,
894 615, 616, 617, 618, 619, 620, 623, 624, 627, 633,
895 638, 639, 642, 643, 644, 645, 648, 656, 668, 669,
896 672, 673, 674, 677, 679, 682, 683, 684, 685, 686,
897 702, 703, 704, 705, 706, 707, 708, 711, 712, 715,
898 716, 717, 718, 719, 720, 721, 724, 725, 731, 740,
899 746, 747, 751, 754, 755, 758, 770, 771, 774, 775,
900 778, 787, 796, 797, 800, 801, 804, 815, 827, 838,
901 842, 843, 846, 847, 850, 855, 861, 862, 865, 866,
902 867, 871, 872, 876, 877, 878, 881, 892, 893, 894,
903 895, 896, 897, 898, 899, 900, 901, 902, 905, 910,
904 915, 932, 933
905 };
906 #endif
907
908 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
909 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
910 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
911 static const char *const yytname[] =
912 {
913 "$end", "error", "$undefined", "aIDENTIFIER", "aKNOWNTYPE", "aNUM",
914 "aHEXNUM", "aDOUBLE", "aSTRING", "aUUID", "aEOF", "SHL", "SHR",
915 "tAGGREGATABLE", "tALLOCATE", "tAPPOBJECT", "tASYNC", "tASYNCUUID",
916 "tAUTOHANDLE", "tBINDABLE", "tBOOLEAN", "tBROADCAST", "tBYTE",
917 "tBYTECOUNT", "tCALLAS", "tCALLBACK", "tCASE", "tCDECL", "tCHAR",
918 "tCOCLASS", "tCODE", "tCOMMSTATUS", "tCONST", "tCONTEXTHANDLE",
919 "tCONTEXTHANDLENOSERIALIZE", "tCONTEXTHANDLESERIALIZE", "tCONTROL",
920 "tCPPQUOTE", "tDEFAULT", "tDEFAULTCOLLELEM", "tDEFAULTVALUE",
921 "tDEFAULTVTABLE", "tDISPLAYBIND", "tDISPINTERFACE", "tDLLNAME",
922 "tDOUBLE", "tDUAL", "tENDPOINT", "tENTRY", "tENUM", "tERRORSTATUST",
923 "tEXPLICITHANDLE", "tEXTERN", "tFALSE", "tFLOAT", "tHANDLE", "tHANDLET",
924 "tHELPCONTEXT", "tHELPFILE", "tHELPSTRING", "tHELPSTRINGCONTEXT",
925 "tHELPSTRINGDLL", "tHIDDEN", "tHYPER", "tID", "tIDEMPOTENT", "tIIDIS",
926 "tIMMEDIATEBIND", "tIMPLICITHANDLE", "tIMPORT", "tIMPORTLIB", "tIN",
927 "tINLINE", "tINPUTSYNC", "tINT", "tINT64", "tINTERFACE", "tLCID",
928 "tLENGTHIS", "tLIBRARY", "tLOCAL", "tLONG", "tMETHODS", "tMODULE",
929 "tNONBROWSABLE", "tNONCREATABLE", "tNONEXTENSIBLE", "tOBJECT", "tODL",
930 "tOLEAUTOMATION", "tOPTIONAL", "tOUT", "tPOINTERDEFAULT", "tPROPERTIES",
931 "tPROPGET", "tPROPPUT", "tPROPPUTREF", "tPTR", "tPUBLIC", "tRANGE",
932 "tREADONLY", "tREF", "tREQUESTEDIT", "tRESTRICTED", "tRETVAL",
933 "tSAFEARRAY", "tSHORT", "tSIGNED", "tSINGLE", "tSIZEIS", "tSIZEOF",
934 "tSMALL", "tSOURCE", "tSTDCALL", "tSTRICTCONTEXTHANDLE", "tSTRING",
935 "tSTRUCT", "tSWITCH", "tSWITCHIS", "tSWITCHTYPE", "tTRANSMITAS", "tTRUE",
936 "tTYPEDEF", "tUNION", "tUNIQUE", "tUNSIGNED", "tUUID", "tV1ENUM",
937 "tVARARG", "tVERSION", "tVOID", "tWCHAR", "tWIREMARSHAL", "','", "'?'",
938 "':'", "'|'", "'&'", "'-'", "'+'", "'*'", "'/'", "'~'", "CAST", "PPTR",
939 "NEG", "ADDRESSOF", "';'", "'('", "')'", "'{'", "'}'", "'['", "']'",
940 "'='", "'.'", "$accept", "input", "gbl_statements", "imp_statements",
941 "int_statements", "statement", "cppquote", "import_start", "import",
942 "importlib", "libraryhdr", "library_start", "librarydef", "m_args",
943 "no_args", "args", "arg", "array", "array_list", "m_attributes",
944 "attributes", "attrib_list", "str_list", "attribute", "uuid_string",
945 "callconv", "cases", "case", "constdef", "enums", "enum_list", "enum",
946 "enumdef", "m_exprs", "m_expr", "expr", "expr_list_const", "expr_const",
947 "externdef", "fields", "field", "s_field", "funcdef", "m_ident",
948 "t_ident", "ident", "base_type", "m_int", "int_std", "coclass",
949 "coclasshdr", "coclassdef", "coclass_ints", "coclass_int",
950 "dispinterface", "dispinterfacehdr", "dispint_props", "dispint_meths",
951 "dispinterfacedef", "inherit", "interface", "interfacehdr",
952 "interfacedef", "interfacedec", "module", "modulehdr", "moduledef",
953 "p_ident", "pident", "pident_list", "pointer_type", "structdef", "type",
954 "typedef", "uniondef", "version", 0
955 };
956 #endif
957
958 # ifdef YYPRINT
959 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
960 token YYLEX-NUM. */
961 static const unsigned short int yytoknum[] =
962 {
963 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
964 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
965 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
966 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
967 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
968 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
969 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
970 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
971 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
972 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
973 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
974 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
975 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
976 385, 386, 387, 44, 63, 58, 124, 38, 45, 43,
977 42, 47, 126, 388, 389, 390, 391, 59, 40, 41,
978 123, 125, 91, 93, 61, 46
979 };
980 # endif
981
982 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
983 static const unsigned char yyr1[] =
984 {
985 0, 156, 157, 158, 158, 158, 158, 158, 158, 158,
986 158, 159, 159, 159, 159, 159, 159, 159, 159, 160,
987 160, 160, 161, 161, 161, 161, 161, 161, 161, 161,
988 161, 162, 163, 164, 165, 166, 167, 168, 169, 169,
989 170, 171, 171, 171, 172, 172, 172, 172, 173, 173,
990 173, 174, 174, 174, 175, 175, 176, 177, 177, 177,
991 178, 178, 179, 179, 179, 179, 179, 179, 179, 179,
992 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
993 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
994 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
995 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
996 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
997 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
998 179, 179, 179, 180, 180, 181, 181, 182, 182, 183,
999 183, 184, 185, 185, 185, 186, 186, 187, 187, 188,
1000 189, 189, 190, 190, 191, 191, 191, 191, 191, 191,
1001 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
1002 191, 191, 191, 191, 191, 191, 192, 192, 193, 194,
1003 195, 195, 196, 196, 196, 196, 197, 198, 199, 199,
1004 200, 200, 200, 201, 201, 202, 202, 202, 202, 202,
1005 202, 202, 202, 202, 202, 202, 202, 203, 203, 204,
1006 204, 204, 204, 204, 204, 204, 205, 205, 206, 207,
1007 208, 208, 209, 210, 210, 211, 212, 212, 213, 213,
1008 214, 214, 215, 215, 216, 216, 217, 218, 218, 218,
1009 219, 219, 220, 220, 221, 222, 223, 223, 224, 224,
1010 224, 225, 225, 226, 226, 226, 227, 228, 228, 228,
1011 228, 228, 228, 228, 228, 228, 228, 228, 229, 230,
1012 230, 231, 231
1013 };
1014
1015 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1016 static const unsigned char yyr2[] =
1017 {
1018 0, 2, 1, 0, 2, 2, 3, 2, 2, 2,
1019 2, 0, 2, 2, 3, 2, 2, 2, 2, 0,
1020 3, 2, 1, 2, 1, 2, 2, 1, 2, 2,
1021 2, 4, 3, 3, 4, 2, 3, 3, 0, 1,
1022 1, 1, 3, 1, 4, 3, 6, 5, 0, 3,
1023 3, 1, 3, 4, 0, 1, 3, 1, 3, 4,
1024 1, 3, 0, 1, 1, 1, 1, 1, 4, 4,
1025 1, 1, 1, 1, 1, 1, 4, 4, 1, 1,
1026 4, 1, 4, 4, 4, 1, 1, 4, 4, 4,
1027 4, 4, 1, 4, 1, 4, 1, 5, 1, 1,
1028 4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1029 4, 1, 1, 1, 1, 6, 1, 1, 1, 1,
1030 4, 1, 1, 1, 4, 4, 4, 4, 1, 1,
1031 4, 4, 1, 1, 1, 0, 1, 0, 2, 4,
1032 3, 5, 0, 2, 1, 1, 3, 3, 1, 5,
1033 1, 3, 0, 1, 1, 1, 1, 1, 1, 1,
1034 5, 3, 3, 3, 3, 3, 3, 3, 3, 2,
1035 2, 2, 2, 4, 4, 3, 1, 3, 1, 4,
1036 0, 2, 2, 3, 2, 1, 4, 7, 0, 1,
1037 0, 1, 1, 1, 1, 1, 1, 1, 2, 2,
1038 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
1039 2, 1, 2, 2, 1, 1, 2, 2, 2, 4,
1040 0, 2, 2, 2, 2, 2, 2, 3, 2, 3,
1041 5, 5, 0, 2, 2, 2, 2, 5, 7, 1,
1042 2, 2, 2, 2, 2, 4, 2, 2, 1, 1,
1043 3, 1, 3, 1, 1, 1, 5, 1, 1, 1,
1044 2, 1, 2, 1, 2, 1, 2, 4, 4, 5,
1045 10, 1, 3
1046 };
1047
1048 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1049 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1050 means the default is an error. */
1051 static const unsigned short int yydefact[] =
1052 {
1053 3, 0, 2, 1, 0, 0, 0, 0, 190, 0,
1054 0, 0, 190, 54, 190, 22, 62, 10, 24, 11,
1055 27, 11, 9, 0, 0, 0, 0, 0, 0, 7,
1056 0, 0, 239, 0, 232, 5, 4, 0, 8, 0,
1057 0, 0, 216, 217, 258, 204, 195, 215, 0, 203,
1058 190, 205, 201, 206, 207, 209, 214, 207, 0, 207,
1059 0, 202, 211, 190, 190, 200, 257, 196, 261, 259,
1060 197, 263, 0, 265, 0, 223, 224, 191, 192, 0,
1061 0, 0, 234, 235, 0, 0, 55, 0, 63, 64,
1062 65, 66, 67, 0, 0, 70, 71, 72, 73, 74,
1063 75, 0, 78, 79, 0, 81, 0, 0, 85, 86,
1064 0, 0, 0, 0, 0, 92, 0, 94, 0, 96,
1065 0, 98, 99, 0, 101, 102, 103, 104, 105, 106,
1066 107, 108, 109, 0, 111, 112, 113, 255, 114, 0,
1067 116, 253, 117, 118, 119, 0, 121, 122, 123, 0,
1068 0, 0, 254, 0, 128, 129, 0, 0, 0, 57,
1069 132, 0, 0, 0, 0, 0, 218, 225, 236, 244,
1070 23, 25, 26, 6, 220, 241, 0, 240, 0, 0,
1071 19, 28, 29, 30, 260, 262, 208, 213, 212, 0,
1072 210, 198, 264, 266, 199, 193, 194, 0, 0, 142,
1073 0, 32, 180, 0, 0, 180, 0, 0, 0, 0,
1074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1075 152, 0, 0, 152, 0, 0, 0, 0, 0, 0,
1076 62, 56, 33, 0, 17, 18, 0, 0, 15, 13,
1077 12, 16, 37, 35, 242, 243, 36, 54, 0, 54,
1078 0, 0, 233, 19, 54, 0, 0, 31, 0, 144,
1079 145, 148, 179, 54, 0, 0, 0, 248, 249, 251,
1080 268, 54, 54, 0, 159, 154, 155, 156, 157, 0,
1081 158, 0, 0, 0, 0, 0, 178, 0, 176, 0,
1082 0, 0, 60, 0, 0, 0, 0, 0, 0, 0,
1083 0, 0, 0, 0, 0, 150, 153, 0, 0, 0,
1084 0, 0, 0, 134, 133, 0, 271, 0, 0, 58,
1085 62, 0, 14, 219, 0, 221, 226, 0, 0, 0,
1086 54, 0, 0, 54, 245, 21, 0, 0, 267, 141,
1087 149, 143, 0, 185, 256, 0, 55, 181, 0, 247,
1088 246, 0, 0, 0, 269, 68, 0, 171, 170, 172,
1089 169, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1090 0, 0, 0, 69, 77, 76, 80, 0, 82, 83,
1091 84, 87, 88, 89, 90, 91, 93, 95, 0, 152,
1092 100, 110, 0, 120, 124, 125, 126, 127, 0, 130,
1093 131, 59, 0, 222, 228, 0, 227, 230, 0, 231,
1094 19, 237, 135, 20, 146, 147, 265, 184, 182, 250,
1095 252, 188, 0, 175, 0, 167, 168, 0, 161, 162,
1096 164, 163, 165, 166, 177, 61, 97, 151, 0, 272,
1097 34, 48, 229, 54, 136, 0, 183, 0, 189, 174,
1098 173, 0, 115, 152, 186, 238, 0, 137, 160, 0,
1099 0, 51, 38, 0, 50, 0, 49, 257, 0, 43,
1100 39, 41, 0, 0, 0, 0, 270, 138, 52, 0,
1101 187, 0, 0, 48, 0, 54, 53, 42, 48, 38,
1102 45, 54, 140, 38, 44, 0, 139, 0, 47, 46
1103 };
1104
1105 /* YYDEFGOTO[NTERM-NUM]. */
1106 static const short int yydefgoto[] =
1107 {
1108 -1, 1, 2, 161, 254, 335, 18, 19, 20, 235,
1109 165, 21, 22, 468, 469, 470, 471, 454, 460, 336,
1110 86, 158, 293, 159, 315, 445, 463, 477, 24, 258,
1111 259, 260, 68, 304, 305, 286, 287, 288, 26, 263,
1112 347, 348, 337, 447, 79, 267, 69, 187, 70, 166,
1113 28, 238, 247, 325, 30, 31, 249, 330, 32, 179,
1114 33, 34, 239, 240, 169, 37, 241, 268, 269, 270,
1115 160, 71, 473, 40, 73, 317
1116 };
1117
1118 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1119 STATE-NUM. */
1120 #define YYPACT_NINF -446
1121 static const short int yypact[] =
1122 {
1123 -446, 35, 724, -446, 46, 664, -106, 102, 146, 85,
1124 84, 186, 146, -18, 146, -446, 887, -446, -446, -446,
1125 -446, -446, -446, 40, 0, 22, 25, 44, -10, -446,
1126 54, 37, -446, 80, 58, -446, -446, 82, -446, 92,
1127 94, 97, -446, -446, -446, -446, -446, -446, 664, -446,
1128 200, -446, -446, -446, 77, -446, -446, 77, 104, 77,
1129 205, -446, -446, 202, 214, 205, -446, -446, -446, -446,
1130 -446, -446, 227, -446, 248, -446, -446, -446, -446, 110,
1131 664, 118, -446, -446, 117, 664, -446, -96, -446, -446,
1132 -446, -446, -446, 121, 129, -446, -446, -446, -446, -446,
1133 -446, 136, -446, -446, 154, -446, 156, 157, -446, -446,
1134 158, 159, 160, 162, 164, -446, 166, -446, 167, -446,
1135 170, -446, -446, 174, -446, -446, -446, -446, -446, -446,
1136 -446, -446, -446, 175, -446, -446, -446, -446, -446, 177,
1137 -446, -446, -446, -446, -446, 179, -446, -446, -446, 181,
1138 185, 191, -446, 192, -446, -446, 194, 195, -95, -446,
1139 -446, 72, 674, 344, 231, 198, -446, -446, -446, -446,
1140 -446, -446, -446, -446, -446, -446, -42, -446, 270, 199,
1141 -446, -446, -446, -446, -446, 204, -446, -446, -446, 664,
1142 -446, -446, 204, -93, -446, -446, -446, 196, 208, 227,
1143 227, -446, -446, 13, 210, -446, 227, 314, 243, 351,
1144 352, 292, 314, 353, 355, 314, 357, 314, 314, 310,
1145 314, -71, 314, 314, 314, 664, 664, 267, 363, 664,
1146 887, 217, -446, 222, -446, -446, 31, 224, -446, -446,
1147 -446, -446, -446, -446, -446, -446, -446, 131, 237, -63,
1148 226, 225, -446, -446, 663, 228, 314, -446, 223, 249,
1149 -446, 230, -446, -72, -7, 13, 13, -446, -446, -446,
1150 257, -18, -25, 244, -446, -446, -446, -446, -446, 246,
1151 -446, 314, 314, 314, 314, 511, 367, -85, -446, 247,
1152 250, 251, -446, -61, 252, 254, 256, 258, 259, 260,
1153 261, 265, 282, 373, -56, -446, 367, 266, 262, -46,
1154 474, 268, 277, -446, -446, 278, 273, 287, 288, -446,
1155 887, 390, -446, -446, -14, -446, -446, 303, 664, 295,
1156 137, 294, 370, 697, -446, -446, 664, 300, -446, -446,
1157 -446, 227, 314, -446, -446, 664, 308, -446, 311, -446,
1158 -446, 301, 13, 318, -446, -446, 664, -446, -446, -446,
1159 -446, 524, 320, 314, 314, 314, 314, 314, 314, 314,
1160 314, 314, 314, -446, -446, -446, -446, 449, -446, -446,
1161 -446, -446, -446, -446, -446, -446, -446, -446, 323, 314,
1162 -446, -446, 314, -446, -446, -446, -446, -446, 454, -446,
1163 -446, -446, 324, -446, -446, 13, -446, -446, 327, -446,
1164 -446, -446, 365, -446, -446, -446, 333, -446, -446, -446,
1165 -446, 227, 332, -446, 314, -446, -446, 73, 59, 16,
1166 -3, -3, 279, 279, -446, -446, -446, -446, 339, -446,
1167 -446, 338, -446, 785, -446, 13, -446, 342, -446, -446,
1168 -446, 314, -446, 458, -446, -446, 345, -446, 367, 105,
1169 -86, -446, 281, -6, -446, 314, 346, -31, 348, -446,
1170 361, -446, 664, 13, 314, 364, -446, -446, 367, 314,
1171 -446, 421, 13, -20, 542, -84, 367, -446, -17, 281,
1172 -446, -84, -446, 281, -446, 360, -446, 371, -446, -446
1173 };
1174
1175 /* YYPGOTO[NTERM-NUM]. */
1176 static const short int yypgoto[] =
1177 {
1178 -446, -446, -446, 479, -235, 9, -446, -446, 178, -446,
1179 -446, -446, -446, -350, -446, -446, 32, -410, -446, -9,
1180 -2, -446, -446, -207, -446, -446, -446, -446, -446, -446,
1181 -446, 171, 3, 296, -367, -187, -446, -156, -446, 316,
1182 -445, -206, 193, -446, 27, -70, -446, 87, 60, 12,
1183 -446, 520, -446, -446, -13, -446, -446, -446, -446, -446,
1184 -8, -446, 522, 4, -446, -446, 523, 274, -253, -446,
1185 309, 5, -4, -446, 1, -446
1186 };
1187
1188 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1189 positive, shift that token. If negative, reduce the rule which
1190 number is the opposite. If zero, do what YYDEFACT says.
1191 If YYTABLE_NINF, syntax error. */
1192 #define YYTABLE_NINF -192
1193 static const short int yytable[] =
1194 {
1195 23, 72, 197, 41, 85, 25, 36, 39, 363, 364,
1196 167, 17, 350, 351, 27, 168, 195, 196, 333, 327,
1197 474, 204, 437, 319, -191, 264, 137, 363, 364, 7,
1198 141, 302, 475, 306, 11, 3, 306, 310, 230, 84,
1199 492, 87, 74, 329, 184, 264, 496, 465, 372, 42,
1200 43, 248, 290, 152, 205, 295, 296, -191, 231, 299,
1201 4, 301, 11, 343, 373, 353, 308, 466, 16, 4,
1202 363, 364, 377, 490, 7, 343, 200, 389, 494, 344,
1203 16, 203, 232, 7, 363, 364, 461, 389, 378, 16,
1204 84, 87, 81, 390, 357, 358, 359, 360, 361, 420,
1205 339, 4, -40, 393, 5, 75, 76, 11, 274, 6,
1206 275, 276, 277, 401, 164, 7, 11, 80, -40, 163,
1207 191, 8, 343, 164, 9, 194, 354, 16, 489, 261,
1208 262, 493, 453, 265, 16, 453, 273, 370, 371, 495,
1209 174, 10, 233, 497, 188, 476, 190, 170, 11, 77,
1210 78, 186, 441, 265, 368, 369, 370, 371, 278, 236,
1211 236, 266, 41, 41, 25, 25, 39, 39, 250, 171,
1212 234, 234, 172, 237, 237, 443, 425, 426, 427, 428,
1213 429, 430, 431, 432, 433, 255, 415, 176, 12, 82,
1214 83, 173, 456, 178, 13, 14, 367, 368, 369, 370,
1215 371, 175, 306, 185, 78, 192, 78, 365, 451, 366,
1216 367, 368, 369, 370, 371, 279, 434, 193, 78, 15,
1217 483, 311, 312, 167, 16, 318, 280, 177, 168, 488,
1218 195, 196, 180, 47, 244, 245, 438, 450, 324, 181,
1219 328, 182, 281, 282, 183, 283, 274, 284, 275, 276,
1220 277, 289, 189, 285, 345, 41, 198, 25, 464, 39,
1221 199, 346, 328, 345, 458, 201, 306, 202, 54, 206,
1222 346, 261, 359, 251, 252, 313, 314, 207, 478, 55,
1223 56, 362, 323, 16, 208, 44, 57, 484, 407, 16,
1224 363, 364, 486, 363, 364, 274, 278, 275, 276, 277,
1225 294, 45, 209, 46, 210, 211, 212, 213, 214, 47,
1226 215, 59, 216, 48, 217, 218, 62, 274, 219, 275,
1227 276, 277, 220, 221, 405, 222, 49, 223, 403, 224,
1228 50, 51, 412, 225, 41, 52, 25, 53, 39, 226,
1229 227, 405, 228, 229, 54, 278, 416, 243, 246, 253,
1230 256, 448, 422, 279, -191, 55, 56, 257, 271, 291,
1231 292, 297, 57, 298, 280, 300, 303, 278, 316, 320,
1232 321, 322, 326, 331, 340, 332, 388, 338, 363, 364,
1233 281, 282, 341, 283, 342, 284, 58, 59, 60, 61,
1234 352, 285, 62, 355, 356, 392, 374, 63, 402, 375,
1235 376, 379, 279, 380, 64, 381, 65, 382, 383, 384,
1236 385, 467, 67, 280, 386, 391, 365, 395, 366, 367,
1237 368, 369, 370, 371, 279, 44, 396, 397, 398, 281,
1238 282, 387, 283, 16, 284, 280, 399, 400, 404, 10,
1239 285, 45, 406, 46, 41, 409, 25, 413, 39, 47,
1240 419, 281, 282, 48, 283, 417, 284, 435, 418, 439,
1241 472, 274, 285, 275, 276, 277, 49, 421, 482, 424,
1242 50, 51, 436, 440, 442, 52, 345, 53, 444, 472,
1243 446, 449, 345, 346, 54, 363, 364, 472, 452, 346,
1244 453, 472, 457, 462, 481, 55, 56, 480, 479, 485,
1245 162, 365, 57, 366, 367, 368, 369, 370, 371, 498,
1246 410, 278, 414, 487, 274, 44, 275, 276, 277, 309,
1247 499, 272, 29, 408, 35, 38, 58, 59, 60, 61,
1248 307, 45, 62, 46, 0, 363, 364, 63, 349, 47,
1249 0, 0, 0, 48, 64, 0, 65, 0, 0, 0,
1250 0, 66, 67, 363, 364, 0, 49, 0, 0, 0,
1251 50, 51, 0, 0, 278, 52, 0, 53, 279, 0,
1252 0, 0, 0, 16, 54, 0, 0, 0, 0, 280,
1253 0, 0, 0, 0, 0, 55, 56, 0, 0, 0,
1254 0, 0, 57, 0, 0, 281, 282, 0, 459, 0,
1255 284, 0, 0, 0, 0, 0, 285, 0, 365, 0,
1256 366, 367, 368, 369, 370, 371, 58, 59, 60, 61,
1257 0, 279, 62, 394, 0, 0, 0, 63, 0, 0,
1258 0, 0, 280, 0, 64, 0, 65, 0, 0, 0,
1259 0, 66, 67, 0, 0, 0, 0, 0, 281, 282,
1260 0, 283, 0, 284, 0, 0, 0, 0, 365, 285,
1261 366, 367, 368, 369, 370, 371, 0, 0, 44, 0,
1262 0, 0, 0, 423, 0, 0, 365, 491, 366, 367,
1263 368, 369, 370, 371, 45, 0, 46, 0, 0, 0,
1264 0, 0, 47, 0, 0, 5, 48, 0, 0, 0,
1265 6, 0, 0, 4, 0, 0, 5, 0, 0, 49,
1266 0, 6, 8, 50, 51, 9, 0, 7, 52, 0,
1267 53, 0, 0, 8, 0, 0, 9, 54, 0, 5,
1268 0, 0, 10, 0, 6, 0, 0, 0, 55, 56,
1269 0, 0, 0, 10, 233, 57, 8, 0, 0, 9,
1270 11, 0, 0, 4, 0, 0, 5, 0, 0, 0,
1271 0, 6, 0, 0, 0, 0, 10, 7, 0, 58,
1272 59, 60, 61, 8, 0, 62, 9, 0, 0, 12,
1273 63, 0, 0, 0, 0, 13, 14, 64, 0, 65,
1274 12, 0, 0, 10, 66, 67, 13, 14, 0, 0,
1275 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1276 15, 0, 0, 12, 334, 16, 0, 5, 0, 13,
1277 14, 15, 6, 0, 0, 242, 16, 0, 0, 0,
1278 0, 0, 0, 0, 8, 0, 0, 9, 0, 0,
1279 12, 0, 0, 0, 15, 0, 13, 14, 411, 16,
1280 0, 0, 0, 0, 10, 0, 0, 0, 0, 0,
1281 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1282 0, 15, 0, 0, 0, 0, 16, 0, 0, 0,
1283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1285 88, 12, 89, 90, 0, 91, 92, 13, 14, 0,
1286 0, 93, 0, 94, 0, 0, 0, 0, 0, 0,
1287 95, 96, 97, 98, 0, 99, 100, 101, 102, 103,
1288 0, 104, 15, 105, 106, 107, 455, 16, 108, 0,
1289 0, 0, 109, 0, 110, 111, 112, 113, 114, 115,
1290 0, 116, 117, 118, 119, 120, 0, 0, 121, 0,
1291 122, 0, 0, 0, 0, 123, 0, 124, 0, 0,
1292 0, 125, 126, 127, 128, 129, 130, 131, 132, 133,
1293 0, 134, 135, 136, 137, 138, 139, 140, 141, 142,
1294 143, 144, 0, 0, 0, 0, 145, 0, 0, 146,
1295 0, 147, 148, 0, 0, 149, 150, 151, 0, 0,
1296 0, 152, 0, 153, 154, 155, 156, 0, 0, 157
1297 };
1298
1299 static const short int yycheck[] =
1300 {
1301 2, 5, 72, 2, 13, 2, 2, 2, 11, 12,
1302 23, 2, 265, 266, 2, 23, 3, 4, 253, 82,
1303 26, 117, 389, 230, 117, 32, 97, 11, 12, 43,
1304 101, 218, 38, 220, 76, 0, 223, 224, 133, 12,
1305 485, 14, 148, 249, 48, 32, 491, 133, 133, 3,
1306 4, 93, 208, 124, 150, 211, 212, 150, 153, 215,
1307 29, 217, 76, 147, 149, 271, 222, 153, 152, 29,
1308 11, 12, 133, 483, 43, 147, 80, 133, 488, 151,
1309 152, 85, 10, 43, 11, 12, 453, 133, 149, 152,
1310 63, 64, 8, 149, 281, 282, 283, 284, 285, 352,
1311 256, 29, 133, 149, 32, 3, 4, 76, 3, 37,
1312 5, 6, 7, 320, 83, 43, 76, 32, 149, 79,
1313 60, 49, 147, 83, 52, 65, 151, 152, 148, 199,
1314 200, 148, 152, 140, 152, 152, 206, 140, 141, 489,
1315 150, 69, 70, 493, 57, 151, 59, 147, 76, 3,
1316 4, 74, 405, 140, 138, 139, 140, 141, 53, 161,
1317 162, 148, 161, 162, 161, 162, 161, 162, 176, 147,
1318 161, 162, 147, 161, 162, 410, 363, 364, 365, 366,
1319 367, 368, 369, 370, 371, 189, 342, 150, 116, 3,
1320 4, 147, 445, 135, 122, 123, 137, 138, 139, 140,
1321 141, 147, 389, 3, 4, 3, 4, 134, 135, 136,
1322 137, 138, 139, 140, 141, 110, 372, 3, 4, 147,
1323 473, 225, 226, 236, 152, 229, 121, 147, 236, 482,
1324 3, 4, 150, 28, 3, 4, 392, 424, 247, 147,
1325 249, 147, 137, 138, 147, 140, 3, 142, 5, 6,
1326 7, 8, 148, 148, 263, 254, 8, 254, 153, 254,
1327 150, 263, 271, 272, 451, 147, 453, 150, 63, 148,
1328 272, 341, 459, 3, 4, 8, 9, 148, 465, 74,
1329 75, 285, 151, 152, 148, 4, 81, 474, 151, 152,
1330 11, 12, 479, 11, 12, 3, 53, 5, 6, 7,
1331 8, 20, 148, 22, 148, 148, 148, 148, 148, 28,
1332 148, 106, 148, 32, 148, 148, 111, 3, 148, 5,
1333 6, 7, 148, 148, 328, 148, 45, 148, 324, 148,
1334 49, 50, 336, 148, 333, 54, 333, 56, 333, 148,
1335 148, 345, 148, 148, 63, 53, 345, 3, 150, 150,
1336 154, 421, 356, 110, 150, 74, 75, 149, 148, 8,
1337 8, 8, 81, 8, 121, 8, 56, 53, 5, 152,
1338 148, 147, 135, 147, 151, 150, 3, 149, 11, 12,
1339 137, 138, 133, 140, 154, 142, 105, 106, 107, 108,
1340 133, 148, 111, 149, 148, 133, 149, 116, 8, 149,
1341 149, 149, 110, 149, 123, 149, 125, 149, 149, 149,
1342 149, 130, 131, 121, 149, 149, 134, 149, 136, 137,
1343 138, 139, 140, 141, 110, 4, 149, 149, 155, 137,
1344 138, 149, 140, 152, 142, 121, 149, 149, 135, 69,
1345 148, 20, 147, 22, 443, 151, 443, 147, 443, 28,
1346 149, 137, 138, 32, 140, 147, 142, 8, 147, 5,
1347 462, 3, 148, 5, 6, 7, 45, 149, 472, 149,
1348 49, 50, 149, 149, 147, 54, 485, 56, 113, 481,
1349 147, 149, 491, 485, 63, 11, 12, 489, 149, 491,
1350 152, 493, 150, 148, 133, 74, 75, 149, 152, 135,
1351 21, 134, 81, 136, 137, 138, 139, 140, 141, 149,
1352 332, 53, 341, 481, 3, 4, 5, 6, 7, 223,
1353 149, 205, 2, 330, 2, 2, 105, 106, 107, 108,
1354 221, 20, 111, 22, -1, 11, 12, 116, 264, 28,
1355 -1, -1, -1, 32, 123, -1, 125, -1, -1, -1,
1356 -1, 130, 131, 11, 12, -1, 45, -1, -1, -1,
1357 49, 50, -1, -1, 53, 54, -1, 56, 110, -1,
1358 -1, -1, -1, 152, 63, -1, -1, -1, -1, 121,
1359 -1, -1, -1, -1, -1, 74, 75, -1, -1, -1,
1360 -1, -1, 81, -1, -1, 137, 138, -1, 140, -1,
1361 142, -1, -1, -1, -1, -1, 148, -1, 134, -1,
1362 136, 137, 138, 139, 140, 141, 105, 106, 107, 108,
1363 -1, 110, 111, 149, -1, -1, -1, 116, -1, -1,
1364 -1, -1, 121, -1, 123, -1, 125, -1, -1, -1,
1365 -1, 130, 131, -1, -1, -1, -1, -1, 137, 138,
1366 -1, 140, -1, 142, -1, -1, -1, -1, 134, 148,
1367 136, 137, 138, 139, 140, 141, -1, -1, 4, -1,
1368 -1, -1, -1, 149, -1, -1, 134, 135, 136, 137,
1369 138, 139, 140, 141, 20, -1, 22, -1, -1, -1,
1370 -1, -1, 28, -1, -1, 32, 32, -1, -1, -1,
1371 37, -1, -1, 29, -1, -1, 32, -1, -1, 45,
1372 -1, 37, 49, 49, 50, 52, -1, 43, 54, -1,
1373 56, -1, -1, 49, -1, -1, 52, 63, -1, 32,
1374 -1, -1, 69, -1, 37, -1, -1, -1, 74, 75,
1375 -1, -1, -1, 69, 70, 81, 49, -1, -1, 52,
1376 76, -1, -1, 29, -1, -1, 32, -1, -1, -1,
1377 -1, 37, -1, -1, -1, -1, 69, 43, -1, 105,
1378 106, 107, 108, 49, -1, 111, 52, -1, -1, 116,
1379 116, -1, -1, -1, -1, 122, 123, 123, -1, 125,
1380 116, -1, -1, 69, 130, 131, 122, 123, -1, -1,
1381 76, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1382 147, -1, -1, 116, 151, 152, -1, 32, -1, 122,
1383 123, 147, 37, -1, -1, 151, 152, -1, -1, -1,
1384 -1, -1, -1, -1, 49, -1, -1, 52, -1, -1,
1385 116, -1, -1, -1, 147, -1, 122, 123, 151, 152,
1386 -1, -1, -1, -1, 69, -1, -1, -1, -1, -1,
1387 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1388 -1, 147, -1, -1, -1, -1, 152, -1, -1, -1,
1389 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1390 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1391 13, 116, 15, 16, -1, 18, 19, 122, 123, -1,
1392 -1, 24, -1, 26, -1, -1, -1, -1, -1, -1,
1393 33, 34, 35, 36, -1, 38, 39, 40, 41, 42,
1394 -1, 44, 147, 46, 47, 48, 151, 152, 51, -1,
1395 -1, -1, 55, -1, 57, 58, 59, 60, 61, 62,
1396 -1, 64, 65, 66, 67, 68, -1, -1, 71, -1,
1397 73, -1, -1, -1, -1, 78, -1, 80, -1, -1,
1398 -1, 84, 85, 86, 87, 88, 89, 90, 91, 92,
1399 -1, 94, 95, 96, 97, 98, 99, 100, 101, 102,
1400 103, 104, -1, -1, -1, -1, 109, -1, -1, 112,
1401 -1, 114, 115, -1, -1, 118, 119, 120, -1, -1,
1402 -1, 124, -1, 126, 127, 128, 129, -1, -1, 132
1403 };
1404
1405 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1406 symbol of state STATE-NUM. */
1407 static const unsigned char yystos[] =
1408 {
1409 0, 157, 158, 0, 29, 32, 37, 43, 49, 52,
1410 69, 76, 116, 122, 123, 147, 152, 161, 162, 163,
1411 164, 167, 168, 176, 184, 188, 194, 205, 206, 207,
1412 210, 211, 214, 216, 217, 218, 219, 221, 222, 227,
1413 229, 230, 3, 4, 4, 20, 22, 28, 32, 45,
1414 49, 50, 54, 56, 63, 74, 75, 81, 105, 106,
1415 107, 108, 111, 116, 123, 125, 130, 131, 188, 202,
1416 204, 227, 228, 230, 148, 3, 4, 3, 4, 200,
1417 32, 8, 3, 4, 200, 175, 176, 200, 13, 15,
1418 16, 18, 19, 24, 26, 33, 34, 35, 36, 38,
1419 39, 40, 41, 42, 44, 46, 47, 48, 51, 55,
1420 57, 58, 59, 60, 61, 62, 64, 65, 66, 67,
1421 68, 71, 73, 78, 80, 84, 85, 86, 87, 88,
1422 89, 90, 91, 92, 94, 95, 96, 97, 98, 99,
1423 100, 101, 102, 103, 104, 109, 112, 114, 115, 118,
1424 119, 120, 124, 126, 127, 128, 129, 132, 177, 179,
1425 226, 159, 159, 79, 83, 166, 205, 210, 216, 220,
1426 147, 147, 147, 147, 150, 147, 150, 147, 135, 215,
1427 150, 147, 147, 147, 228, 3, 74, 203, 203, 148,
1428 203, 204, 3, 3, 204, 3, 4, 201, 8, 150,
1429 228, 147, 150, 228, 117, 150, 148, 148, 148, 148,
1430 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1431 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
1432 133, 153, 10, 70, 161, 165, 176, 205, 207, 218,
1433 219, 222, 151, 3, 3, 4, 150, 208, 93, 212,
1434 216, 3, 4, 150, 160, 228, 154, 149, 185, 186,
1435 187, 201, 201, 195, 32, 140, 148, 201, 223, 224,
1436 225, 148, 195, 201, 3, 5, 6, 7, 53, 110,
1437 121, 137, 138, 140, 142, 148, 191, 192, 193, 8,
1438 193, 8, 8, 178, 8, 193, 193, 8, 8, 193,
1439 8, 193, 191, 56, 189, 190, 191, 226, 193, 189,
1440 191, 228, 228, 8, 9, 180, 5, 231, 228, 179,
1441 152, 148, 147, 151, 175, 209, 135, 82, 175, 197,
1442 213, 147, 150, 160, 151, 161, 175, 198, 149, 193,
1443 151, 133, 154, 147, 151, 175, 176, 196, 197, 223,
1444 224, 224, 133, 197, 151, 149, 148, 191, 191, 191,
1445 191, 191, 228, 11, 12, 134, 136, 137, 138, 139,
1446 140, 141, 133, 149, 149, 149, 149, 133, 149, 149,
1447 149, 149, 149, 149, 149, 149, 149, 149, 3, 133,
1448 149, 149, 133, 149, 149, 149, 149, 149, 155, 149,
1449 149, 179, 8, 219, 135, 228, 147, 151, 198, 151,
1450 164, 151, 228, 147, 187, 193, 230, 147, 147, 149,
1451 224, 149, 228, 149, 149, 191, 191, 191, 191, 191,
1452 191, 191, 191, 191, 193, 8, 149, 190, 193, 5,
1453 149, 224, 147, 160, 113, 181, 147, 199, 201, 149,
1454 191, 135, 149, 152, 173, 151, 224, 150, 191, 140,
1455 174, 190, 148, 182, 153, 133, 153, 130, 169, 170,
1456 171, 172, 176, 228, 26, 38, 151, 183, 191, 152,
1457 149, 133, 228, 224, 191, 135, 191, 172, 224, 148,
1458 173, 135, 196, 148, 173, 169, 196, 169, 149, 149
1459 };
1460
1461 #define yyerrok (yyerrstatus = 0)
1462 #define yyclearin (yychar = YYEMPTY)
1463 #define YYEMPTY (-2)
1464 #define YYEOF 0
1465
1466 #define YYACCEPT goto yyacceptlab
1467 #define YYABORT goto yyabortlab
1468 #define YYERROR goto yyerrorlab
1469
1470
1471 /* Like YYERROR except do call yyerror. This remains here temporarily
1472 to ease the transition to the new meaning of YYERROR, for GCC.
1473 Once GCC version 2 has supplanted version 1, this can go. */
1474
1475 #define YYFAIL goto yyerrlab
1476
1477 #define YYRECOVERING() (!!yyerrstatus)
1478
1479 #define YYBACKUP(Token, Value) \
1480 do \
1481 if (yychar == YYEMPTY && yylen == 1) \
1482 { \
1483 yychar = (Token); \
1484 yylval = (Value); \
1485 yytoken = YYTRANSLATE (yychar); \
1486 YYPOPSTACK; \
1487 goto yybackup; \
1488 } \
1489 else \
1490 { \
1491 yyerror (YY_("syntax error: cannot back up")); \
1492 YYERROR; \
1493 } \
1494 while (0)
1495
1496
1497 #define YYTERROR 1
1498 #define YYERRCODE 256
1499
1500
1501 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1502 If N is 0, then set CURRENT to the empty location which ends
1503 the previous symbol: RHS[0] (always defined). */
1504
1505 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1506 #ifndef YYLLOC_DEFAULT
1507 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1508 do \
1509 if (N) \
1510 { \
1511 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1512 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1513 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1514 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1515 } \
1516 else \
1517 { \
1518 (Current).first_line = (Current).last_line = \
1519 YYRHSLOC (Rhs, 0).last_line; \
1520 (Current).first_column = (Current).last_column = \
1521 YYRHSLOC (Rhs, 0).last_column; \
1522 } \
1523 while (0)
1524 #endif
1525
1526
1527 /* YY_LOCATION_PRINT -- Print the location on the stream.
1528 This macro was not mandated originally: define only if we know
1529 we won't break user code: when these are the locations we know. */
1530
1531 #ifndef YY_LOCATION_PRINT
1532 # if YYLTYPE_IS_TRIVIAL
1533 # define YY_LOCATION_PRINT(File, Loc) \
1534 fprintf (File, "%d.%d-%d.%d", \
1535 (Loc).first_line, (Loc).first_column, \
1536 (Loc).last_line, (Loc).last_column)
1537 # else
1538 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1539 # endif
1540 #endif
1541
1542
1543 /* YYLEX -- calling `yylex' with the right arguments. */
1544
1545 #ifdef YYLEX_PARAM
1546 # define YYLEX yylex (YYLEX_PARAM)
1547 #else
1548 # define YYLEX yylex ()
1549 #endif
1550
1551 /* Enable debugging if requested. */
1552 #if YYDEBUG
1553
1554 # ifndef YYFPRINTF
1555 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1556 # define YYFPRINTF fprintf
1557 # endif
1558
1559 # define YYDPRINTF(Args) \
1560 do { \
1561 if (yydebug) \
1562 YYFPRINTF Args; \
1563 } while (0)
1564
1565 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1566 do { \
1567 if (yydebug) \
1568 { \
1569 YYFPRINTF (stderr, "%s ", Title); \
1570 yysymprint (stderr, \
1571 Type, Value); \
1572 YYFPRINTF (stderr, "\n"); \
1573 } \
1574 } while (0)
1575
1576 /*------------------------------------------------------------------.
1577 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1578 | TOP (included). |
1579 `------------------------------------------------------------------*/
1580
1581 #if defined (__STDC__) || defined (__cplusplus)
1582 static void
1583 yy_stack_print (short int *bottom, short int *top)
1584 #else
1585 static void
1586 yy_stack_print (bottom, top)
1587 short int *bottom;
1588 short int *top;
1589 #endif
1590 {
1591 YYFPRINTF (stderr, "Stack now");
1592 for (/* Nothing. */; bottom <= top; ++bottom)
1593 YYFPRINTF (stderr, " %d", *bottom);
1594 YYFPRINTF (stderr, "\n");
1595 }
1596
1597 # define YY_STACK_PRINT(Bottom, Top) \
1598 do { \
1599 if (yydebug) \
1600 yy_stack_print ((Bottom), (Top)); \
1601 } while (0)
1602
1603
1604 /*------------------------------------------------.
1605 | Report that the YYRULE is going to be reduced. |
1606 `------------------------------------------------*/
1607
1608 #if defined (__STDC__) || defined (__cplusplus)
1609 static void
1610 yy_reduce_print (int yyrule)
1611 #else
1612 static void
1613 yy_reduce_print (yyrule)
1614 int yyrule;
1615 #endif
1616 {
1617 int yyi;
1618 unsigned long int yylno = yyrline[yyrule];
1619 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
1620 yyrule - 1, yylno);
1621 /* Print the symbols being reduced, and their result. */
1622 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1623 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1624 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
1625 }
1626
1627 # define YY_REDUCE_PRINT(Rule) \
1628 do { \
1629 if (yydebug) \
1630 yy_reduce_print (Rule); \
1631 } while (0)
1632
1633 /* Nonzero means print parse trace. It is left uninitialized so that
1634 multiple parsers can coexist. */
1635 int yydebug;
1636 #else /* !YYDEBUG */
1637 # define YYDPRINTF(Args)
1638 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1639 # define YY_STACK_PRINT(Bottom, Top)
1640 # define YY_REDUCE_PRINT(Rule)
1641 #endif /* !YYDEBUG */
1642
1643
1644 /* YYINITDEPTH -- initial size of the parser's stacks. */
1645 #ifndef YYINITDEPTH
1646 # define YYINITDEPTH 200
1647 #endif
1648
1649 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1650 if the built-in stack extension method is used).
1651
1652 Do not make this value too large; the results are undefined if
1653 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1654 evaluated with infinite-precision integer arithmetic. */
1655
1656 #ifndef YYMAXDEPTH
1657 # define YYMAXDEPTH 10000
1658 #endif
1659
1660 \f
1661
1662 #if YYERROR_VERBOSE
1663
1664 # ifndef yystrlen
1665 # if defined (__GLIBC__) && defined (_STRING_H)
1666 # define yystrlen strlen
1667 # else
1668 /* Return the length of YYSTR. */
1669 static YYSIZE_T
1670 # if defined (__STDC__) || defined (__cplusplus)
1671 yystrlen (const char *yystr)
1672 # else
1673 yystrlen (yystr)
1674 const char *yystr;
1675 # endif
1676 {
1677 const char *yys = yystr;
1678
1679 while (*yys++ != '\0')
1680 continue;
1681
1682 return yys - yystr - 1;
1683 }
1684 # endif
1685 # endif
1686
1687 # ifndef yystpcpy
1688 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1689 # define yystpcpy stpcpy
1690 # else
1691 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1692 YYDEST. */
1693 static char *
1694 # if defined (__STDC__) || defined (__cplusplus)
1695 yystpcpy (char *yydest, const char *yysrc)
1696 # else
1697 yystpcpy (yydest, yysrc)
1698 char *yydest;
1699 const char *yysrc;
1700 # endif
1701 {
1702 char *yyd = yydest;
1703 const char *yys = yysrc;
1704
1705 while ((*yyd++ = *yys++) != '\0')
1706 continue;
1707
1708 return yyd - 1;
1709 }
1710 # endif
1711 # endif
1712
1713 # ifndef yytnamerr
1714 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1715 quotes and backslashes, so that it's suitable for yyerror. The
1716 heuristic is that double-quoting is unnecessary unless the string
1717 contains an apostrophe, a comma, or backslash (other than
1718 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1719 null, do not copy; instead, return the length of what the result
1720 would have been. */
1721 static YYSIZE_T
1722 yytnamerr (char *yyres, const char *yystr)
1723 {
1724 if (*yystr == '"')
1725 {
1726 size_t yyn = 0;
1727 char const *yyp = yystr;
1728
1729 for (;;)
1730 switch (*++yyp)
1731 {
1732 case '\'':
1733 case ',':
1734 goto do_not_strip_quotes;
1735
1736 case '\\':
1737 if (*++yyp != '\\')
1738 goto do_not_strip_quotes;
1739 /* Fall through. */
1740 default:
1741 if (yyres)
1742 yyres[yyn] = *yyp;
1743 yyn++;
1744 break;
1745
1746 case '"':
1747 if (yyres)
1748 yyres[yyn] = '\0';
1749 return yyn;
1750 }
1751 do_not_strip_quotes: ;
1752 }
1753
1754 if (! yyres)
1755 return yystrlen (yystr);
1756
1757 return yystpcpy (yyres, yystr) - yyres;
1758 }
1759 # endif
1760
1761 #endif /* YYERROR_VERBOSE */
1762
1763 \f
1764
1765 #if YYDEBUG
1766 /*--------------------------------.
1767 | Print this symbol on YYOUTPUT. |
1768 `--------------------------------*/
1769
1770 #if defined (__STDC__) || defined (__cplusplus)
1771 static void
1772 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1773 #else
1774 static void
1775 yysymprint (yyoutput, yytype, yyvaluep)
1776 FILE *yyoutput;
1777 int yytype;
1778 YYSTYPE *yyvaluep;
1779 #endif
1780 {
1781 /* Pacify ``unused variable'' warnings. */
1782 (void) yyvaluep;
1783
1784 if (yytype < YYNTOKENS)
1785 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1786 else
1787 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1788
1789
1790 # ifdef YYPRINT
1791 if (yytype < YYNTOKENS)
1792 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1793 # endif
1794 switch (yytype)
1795 {
1796 default:
1797 break;
1798 }
1799 YYFPRINTF (yyoutput, ")");
1800 }
1801
1802 #endif /* ! YYDEBUG */
1803 /*-----------------------------------------------.
1804 | Release the memory associated to this symbol. |
1805 `-----------------------------------------------*/
1806
1807 #if defined (__STDC__) || defined (__cplusplus)
1808 static void
1809 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1810 #else
1811 static void
1812 yydestruct (yymsg, yytype, yyvaluep)
1813 const char *yymsg;
1814 int yytype;
1815 YYSTYPE *yyvaluep;
1816 #endif
1817 {
1818 /* Pacify ``unused variable'' warnings. */
1819 (void) yyvaluep;
1820
1821 if (!yymsg)
1822 yymsg = "Deleting";
1823 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1824
1825 switch (yytype)
1826 {
1827
1828 default:
1829 break;
1830 }
1831 }
1832 \f
1833
1834 /* Prevent warnings from -Wmissing-prototypes. */
1835
1836 #ifdef YYPARSE_PARAM
1837 # if defined (__STDC__) || defined (__cplusplus)
1838 int yyparse (void *YYPARSE_PARAM);
1839 # else
1840 int yyparse ();
1841 # endif
1842 #else /* ! YYPARSE_PARAM */
1843 #if defined (__STDC__) || defined (__cplusplus)
1844 int yyparse (void);
1845 #else
1846 int yyparse ();
1847 #endif
1848 #endif /* ! YYPARSE_PARAM */
1849
1850
1851
1852 /* The look-ahead symbol. */
1853 int yychar;
1854
1855 /* The semantic value of the look-ahead symbol. */
1856 YYSTYPE yylval;
1857
1858 /* Number of syntax errors so far. */
1859 int yynerrs;
1860
1861
1862
1863 /*----------.
1864 | yyparse. |
1865 `----------*/
1866
1867 #ifdef YYPARSE_PARAM
1868 # if defined (__STDC__) || defined (__cplusplus)
1869 int yyparse (void *YYPARSE_PARAM)
1870 # else
1871 int yyparse (YYPARSE_PARAM)
1872 void *YYPARSE_PARAM;
1873 # endif
1874 #else /* ! YYPARSE_PARAM */
1875 #if defined (__STDC__) || defined (__cplusplus)
1876 int
1877 yyparse (void)
1878 #else
1879 int
1880 yyparse ()
1881 ;
1882 #endif
1883 #endif
1884 {
1885
1886 int yystate;
1887 int yyn;
1888 int yyresult;
1889 /* Number of tokens to shift before error messages enabled. */
1890 int yyerrstatus;
1891 /* Look-ahead token as an internal (translated) token number. */
1892 int yytoken = 0;
1893
1894 /* Three stacks and their tools:
1895 `yyss': related to states,
1896 `yyvs': related to semantic values,
1897 `yyls': related to locations.
1898
1899 Refer to the stacks thru separate pointers, to allow yyoverflow
1900 to reallocate them elsewhere. */
1901
1902 /* The state stack. */
1903 short int yyssa[YYINITDEPTH];
1904 short int *yyss = yyssa;
1905 short int *yyssp;
1906
1907 /* The semantic value stack. */
1908 YYSTYPE yyvsa[YYINITDEPTH];
1909 YYSTYPE *yyvs = yyvsa;
1910 YYSTYPE *yyvsp;
1911
1912
1913
1914 #define YYPOPSTACK (yyvsp--, yyssp--)
1915
1916 YYSIZE_T yystacksize = YYINITDEPTH;
1917
1918 /* The variables used to return semantic value and location from the
1919 action routines. */
1920 YYSTYPE yyval;
1921
1922
1923 /* When reducing, the number of symbols on the RHS of the reduced
1924 rule. */
1925 int yylen;
1926
1927 YYDPRINTF ((stderr, "Starting parse\n"));
1928
1929 yystate = 0;
1930 yyerrstatus = 0;
1931 yynerrs = 0;
1932 yychar = YYEMPTY; /* Cause a token to be read. */
1933
1934 /* Initialize stack pointers.
1935 Waste one element of value and location stack
1936 so that they stay on the same level as the state stack.
1937 The wasted elements are never initialized. */
1938
1939 yyssp = yyss;
1940 yyvsp = yyvs;
1941
1942 goto yysetstate;
1943
1944 /*------------------------------------------------------------.
1945 | yynewstate -- Push a new state, which is found in yystate. |
1946 `------------------------------------------------------------*/
1947 yynewstate:
1948 /* In all cases, when you get here, the value and location stacks
1949 have just been pushed. so pushing a state here evens the stacks.
1950 */
1951 yyssp++;
1952
1953 yysetstate:
1954 *yyssp = yystate;
1955
1956 if (yyss + yystacksize - 1 <= yyssp)
1957 {
1958 /* Get the current used size of the three stacks, in elements. */
1959 YYSIZE_T yysize = yyssp - yyss + 1;
1960
1961 #ifdef yyoverflow
1962 {
1963 /* Give user a chance to reallocate the stack. Use copies of
1964 these so that the &'s don't force the real ones into
1965 memory. */
1966 YYSTYPE *yyvs1 = yyvs;
1967 short int *yyss1 = yyss;
1968
1969
1970 /* Each stack pointer address is followed by the size of the
1971 data in use in that stack, in bytes. This used to be a
1972 conditional around just the two extra args, but that might
1973 be undefined if yyoverflow is a macro. */
1974 yyoverflow (YY_("memory exhausted"),
1975 &yyss1, yysize * sizeof (*yyssp),
1976 &yyvs1, yysize * sizeof (*yyvsp),
1977
1978 &yystacksize);
1979
1980 yyss = yyss1;
1981 yyvs = yyvs1;
1982 }
1983 #else /* no yyoverflow */
1984 # ifndef YYSTACK_RELOCATE
1985 goto yyexhaustedlab;
1986 # else
1987 /* Extend the stack our own way. */
1988 if (YYMAXDEPTH <= yystacksize)
1989 goto yyexhaustedlab;
1990 yystacksize *= 2;
1991 if (YYMAXDEPTH < yystacksize)
1992 yystacksize = YYMAXDEPTH;
1993
1994 {
1995 short int *yyss1 = yyss;
1996 union yyalloc *yyptr =
1997 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1998 if (! yyptr)
1999 goto yyexhaustedlab;
2000 YYSTACK_RELOCATE (yyss);
2001 YYSTACK_RELOCATE (yyvs);
2002
2003 # undef YYSTACK_RELOCATE
2004 if (yyss1 != yyssa)
2005 YYSTACK_FREE (yyss1);
2006 }
2007 # endif
2008 #endif /* no yyoverflow */
2009
2010 yyssp = yyss + yysize - 1;
2011 yyvsp = yyvs + yysize - 1;
2012
2013
2014 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2015 (unsigned long int) yystacksize));
2016
2017 if (yyss + yystacksize - 1 <= yyssp)
2018 YYABORT;
2019 }
2020
2021 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2022
2023 goto yybackup;
2024
2025 /*-----------.
2026 | yybackup. |
2027 `-----------*/
2028 yybackup:
2029
2030 /* Do appropriate processing given the current state. */
2031 /* Read a look-ahead token if we need one and don't already have one. */
2032 /* yyresume: */
2033
2034 /* First try to decide what to do without reference to look-ahead token. */
2035
2036 yyn = yypact[yystate];
2037 if (yyn == YYPACT_NINF)
2038 goto yydefault;
2039
2040 /* Not known => get a look-ahead token if don't already have one. */
2041
2042 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2043 if (yychar == YYEMPTY)
2044 {
2045 YYDPRINTF ((stderr, "Reading a token: "));
2046 yychar = YYLEX;
2047 }
2048
2049 if (yychar <= YYEOF)
2050 {
2051 yychar = yytoken = YYEOF;
2052 YYDPRINTF ((stderr, "Now at end of input.\n"));
2053 }
2054 else
2055 {
2056 yytoken = YYTRANSLATE (yychar);
2057 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2058 }
2059
2060 /* If the proper action on seeing token YYTOKEN is to reduce or to
2061 detect an error, take that action. */
2062 yyn += yytoken;
2063 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2064 goto yydefault;
2065 yyn = yytable[yyn];
2066 if (yyn <= 0)
2067 {
2068 if (yyn == 0 || yyn == YYTABLE_NINF)
2069 goto yyerrlab;
2070 yyn = -yyn;
2071 goto yyreduce;
2072 }
2073
2074 if (yyn == YYFINAL)
2075 YYACCEPT;
2076
2077 /* Shift the look-ahead token. */
2078 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2079
2080 /* Discard the token being shifted unless it is eof. */
2081 if (yychar != YYEOF)
2082 yychar = YYEMPTY;
2083
2084 *++yyvsp = yylval;
2085
2086
2087 /* Count tokens shifted since error; after three, turn off error
2088 status. */
2089 if (yyerrstatus)
2090 yyerrstatus--;
2091
2092 yystate = yyn;
2093 goto yynewstate;
2094
2095
2096 /*-----------------------------------------------------------.
2097 | yydefault -- do the default action for the current state. |
2098 `-----------------------------------------------------------*/
2099 yydefault:
2100 yyn = yydefact[yystate];
2101 if (yyn == 0)
2102 goto yyerrlab;
2103 goto yyreduce;
2104
2105
2106 /*-----------------------------.
2107 | yyreduce -- Do a reduction. |
2108 `-----------------------------*/
2109 yyreduce:
2110 /* yyn is the number of a rule to reduce with. */
2111 yylen = yyr2[yyn];
2112
2113 /* If YYLEN is nonzero, implement the default value of the action:
2114 `$$ = $1'.
2115
2116 Otherwise, the following line sets YYVAL to garbage.
2117 This behavior is undocumented and Bison
2118 users should not rely upon it. Assigning to YYVAL
2119 unconditionally makes the parser a bit smaller, and it avoids a
2120 GCC warning that YYVAL may be used uninitialized. */
2121 yyval = yyvsp[1-yylen];
2122
2123
2124 YY_REDUCE_PRINT (yyn);
2125 switch (yyn)
2126 {
2127 case 2:
2128 #line 286 "parser.y"
2129 { fix_incomplete();
2130 check_all_user_types((yyvsp[0].ifref_list));
2131 write_proxies((yyvsp[0].ifref_list));
2132 write_client((yyvsp[0].ifref_list));
2133 write_server((yyvsp[0].ifref_list));
2134 write_dlldata((yyvsp[0].ifref_list));
2135 ;}
2136 break;
2137
2138 case 3:
2139 #line 295 "parser.y"
2140 { (yyval.ifref_list) = NULL; ;}
2141 break;
2142
2143 case 4:
2144 #line 296 "parser.y"
2145 { (yyval.ifref_list) = (yyvsp[-1].ifref_list); ;}
2146 break;
2147
2148 case 5:
2149 #line 297 "parser.y"
2150 { (yyval.ifref_list) = append_ifref( (yyvsp[-1].ifref_list), make_ifref((yyvsp[0].type)) ); ;}
2151 break;
2152
2153 case 6:
2154 #line 298 "parser.y"
2155 { (yyval.ifref_list) = (yyvsp[-2].ifref_list);
2156 reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, 0);
2157 if (!parse_only && do_header) write_coclass_forward((yyvsp[-1].type));
2158 ;}
2159 break;
2160
2161 case 7:
2162 #line 302 "parser.y"
2163 { (yyval.ifref_list) = (yyvsp[-1].ifref_list);
2164 add_typelib_entry((yyvsp[0].type));
2165 reg_type((yyvsp[0].type), (yyvsp[0].type)->name, 0);
2166 if (!parse_only && do_header) write_coclass_forward((yyvsp[0].type));
2167 ;}
2168 break;
2169
2170 case 8:
2171 #line 307 "parser.y"
2172 { (yyval.ifref_list) = (yyvsp[-1].ifref_list); add_typelib_entry((yyvsp[0].type)); ;}
2173 break;
2174
2175 case 9:
2176 #line 308 "parser.y"
2177 { (yyval.ifref_list) = (yyvsp[-1].ifref_list); ;}
2178 break;
2179
2180 case 10:
2181 #line 309 "parser.y"
2182 { (yyval.ifref_list) = (yyvsp[-1].ifref_list); ;}
2183 break;
2184
2185 case 11:
2186 #line 312 "parser.y"
2187 {;}
2188 break;
2189
2190 case 12:
2191 #line 313 "parser.y"
2192 { if (!parse_only) add_typelib_entry((yyvsp[0].type)); ;}
2193 break;
2194
2195 case 13:
2196 #line 314 "parser.y"
2197 { if (!parse_only) add_typelib_entry((yyvsp[0].type)); ;}
2198 break;
2199
2200 case 14:
2201 #line 315 "parser.y"
2202 { reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, 0); if (!parse_only && do_header) write_coclass_forward((yyvsp[-1].type)); ;}
2203 break;
2204
2205 case 15:
2206 #line 316 "parser.y"
2207 { if (!parse_only) add_typelib_entry((yyvsp[0].type));
2208 reg_type((yyvsp[0].type), (yyvsp[0].type)->name, 0);
2209 if (!parse_only && do_header) write_coclass_forward((yyvsp[0].type));
2210 ;}
2211 break;
2212
2213 case 16:
2214 #line 320 "parser.y"
2215 { if (!parse_only) add_typelib_entry((yyvsp[0].type)); ;}
2216 break;
2217
2218 case 17:
2219 #line 321 "parser.y"
2220 {;}
2221 break;
2222
2223 case 18:
2224 #line 322 "parser.y"
2225 {;}
2226 break;
2227
2228 case 19:
2229 #line 325 "parser.y"
2230 { (yyval.func_list) = NULL; ;}
2231 break;
2232
2233 case 20:
2234 #line 326 "parser.y"
2235 { (yyval.func_list) = append_func( (yyvsp[-2].func_list), (yyvsp[-1].func) ); ;}
2236 break;
2237
2238 case 21:
2239 #line 327 "parser.y"
2240 { (yyval.func_list) = (yyvsp[-1].func_list); ;}
2241 break;
2242
2243 case 22:
2244 #line 330 "parser.y"
2245 {;}
2246 break;
2247
2248 case 23:
2249 #line 331 "parser.y"
2250 { if (!parse_only && do_header) { write_constdef((yyvsp[-1].var)); } ;}
2251 break;
2252
2253 case 24:
2254 #line 332 "parser.y"
2255 {;}
2256 break;
2257
2258 case 25:
2259 #line 333 "parser.y"
2260 { if (!parse_only && do_header) {
2261 write_type_def_or_decl(header, (yyvsp[-1].type), FALSE, NULL);
2262 fprintf(header, ";\n\n");
2263 }
2264 ;}
2265 break;
2266
2267 case 26:
2268 #line 338 "parser.y"
2269 { if (!parse_only && do_header) { write_externdef((yyvsp[-1].var)); } ;}
2270 break;
2271
2272 case 27:
2273 #line 339 "parser.y"
2274 {;}
2275 break;
2276
2277 case 28:
2278 #line 340 "parser.y"
2279 { if (!parse_only && do_header) {
2280 write_type_def_or_decl(header, (yyvsp[-1].type), FALSE, NULL);
2281 fprintf(header, ";\n\n");
2282 }
2283 ;}
2284 break;
2285
2286 case 29:
2287 #line 345 "parser.y"
2288 {;}
2289 break;
2290
2291 case 30:
2292 #line 346 "parser.y"
2293 { if (!parse_only && do_header) {
2294 write_type_def_or_decl(header, (yyvsp[-1].type), FALSE, NULL);
2295 fprintf(header, ";\n\n");
2296 }
2297 ;}
2298 break;
2299
2300 case 31:
2301 #line 353 "parser.y"
2302 { if (!parse_only && do_header) fprintf(header, "%s\n", (yyvsp[-1].str)); ;}
2303 break;
2304
2305 case 32:
2306 #line 355 "parser.y"
2307 { assert(yychar == YYEMPTY);
2308 if (!do_import((yyvsp[-1].str))) yychar = aEOF; ;}
2309 break;
2310
2311 case 33:
2312 #line 358 "parser.y"
2313 {;}
2314 break;
2315
2316 case 34:
2317 #line 361 "parser.y"
2318 { if(!parse_only) add_importlib((yyvsp[-1].str)); ;}
2319 break;
2320
2321 case 35:
2322 #line 364 "parser.y"
2323 { (yyval.str) = (yyvsp[0].str); ;}
2324 break;
2325
2326 case 36:
2327 #line 366 "parser.y"
2328 { start_typelib((yyvsp[-1].str), (yyvsp[-2].attr_list));
2329 if (!parse_only && do_header) write_library((yyvsp[-1].str), (yyvsp[-2].attr_list));
2330 if (!parse_only && do_idfile) write_libid((yyvsp[-1].str), (yyvsp[-2].attr_list));
2331 ;}
2332 break;
2333
2334 case 37:
2335 #line 371 "parser.y"
2336 { end_typelib(); ;}
2337 break;
2338
2339 case 38:
2340 #line 374 "parser.y"
2341 { (yyval.var_list) = NULL; ;}
2342 break;
2343
2344 case 40:
2345 #line 378 "parser.y"
2346 { (yyval.var_list) = NULL; ;}
2347 break;
2348
2349 case 41:
2350 #line 381 "parser.y"
2351 { check_arg((yyvsp[0].var)); (yyval.var_list) = append_var( NULL, (yyvsp[0].var) ); ;}
2352 break;
2353
2354 case 42:
2355 #line 382 "parser.y"
2356 { check_arg((yyvsp[0].var)); (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var)); ;}
2357 break;
2358
2359 case 44:
2360 #line 387 "parser.y"
2361 { (yyval.var) = (yyvsp[-1].pident)->var;
2362 (yyval.var)->attrs = (yyvsp[-3].attr_list);
2363 set_type((yyval.var), (yyvsp[-2].type), (yyvsp[-1].pident)->ptr_level, (yyvsp[0].array_dims), TRUE);
2364 free((yyvsp[-1].pident));
2365 ;}
2366 break;
2367
2368 case 45:
2369 #line 392 "parser.y"
2370 { (yyval.var) = (yyvsp[-1].pident)->var;
2371 set_type((yyval.var), (yyvsp[-2].type), (yyvsp[-1].pident)->ptr_level, (yyvsp[0].array_dims), TRUE);
2372 free((yyvsp[-1].pident));
2373 ;}
2374 break;
2375
2376 case 46:
2377 #line 396 "parser.y"
2378 { (yyval.var) = (yyvsp[-3].pident)->var;
2379 (yyval.var)->attrs = (yyvsp[-5].attr_list);
2380 set_type((yyval.var), (yyvsp[-4].type), (yyvsp[-3].pident)->ptr_level - 1, NULL, TRUE);
2381 free((yyvsp[-3].pident));
2382 (yyval.var)->args = (yyvsp[-1].var_list);
2383 ;}
2384 break;
2385
2386 case 47:
2387 #line 402 "parser.y"
2388 { (yyval.var) = (yyvsp[-3].pident)->var;
2389 set_type((yyval.var), (yyvsp[-4].type), (yyvsp[-3].pident)->ptr_level - 1, NULL, TRUE);
2390 free((yyvsp[-3].pident));
2391 (yyval.var)->args = (yyvsp[-1].var_list);
2392 ;}
2393 break;
2394
2395 case 48:
2396 #line 409 "parser.y"
2397 { (yyval.array_dims) = NULL; ;}
2398 break;
2399
2400 case 49:
2401 #line 410 "parser.y"
2402 { (yyval.array_dims) = (yyvsp[-1].array_dims); ;}
2403 break;
2404
2405 case 50:
2406 #line 411 "parser.y"
2407 { (yyval.array_dims) = append_array( NULL, make_expr(EXPR_VOID) ); ;}
2408 break;
2409
2410 case 51:
2411 #line 414 "parser.y"
2412 { (yyval.array_dims) = append_array( NULL, (yyvsp[0].expr) ); ;}
2413 break;
2414
2415 case 52:
2416 #line 415 "parser.y"
2417 { (yyval.array_dims) = append_array( (yyvsp[-2].array_dims), (yyvsp[0].expr) ); ;}
2418 break;
2419
2420 case 53:
2421 #line 416 "parser.y"
2422 { (yyval.array_dims) = append_array( (yyvsp[-3].array_dims), (yyvsp[0].expr) ); ;}
2423 break;
2424
2425 case 54:
2426 #line 419 "parser.y"
2427 { (yyval.attr_list) = NULL; ;}
2428 break;
2429
2430 case 56:
2431 #line 424 "parser.y"
2432 { (yyval.attr_list) = (yyvsp[-1].attr_list);
2433 if (!(yyval.attr_list))
2434 error_loc("empty attribute lists unsupported\n");
2435 ;}
2436 break;
2437
2438 case 57:
2439 #line 430 "parser.y"
2440 { (yyval.attr_list) = append_attr( NULL, (yyvsp[0].attr) ); ;}
2441 break;
2442
2443 case 58:
2444 #line 431 "parser.y"
2445 { (yyval.attr_list) = append_attr( (yyvsp[-2].attr_list), (yyvsp[0].attr) ); ;}
2446 break;
2447
2448 case 59:
2449 #line 432 "parser.y"
2450 { (yyval.attr_list) = append_attr( (yyvsp[-3].attr_list), (yyvsp[0].attr) ); ;}
2451 break;
2452
2453 case 60:
2454 #line 435 "parser.y"
2455 { (yyval.str_list) = append_str( NULL, (yyvsp[0].str) ); ;}
2456 break;
2457
2458 case 61:
2459 #line 436 "parser.y"
2460 { (yyval.str_list) = append_str( (yyvsp[-2].str_list), (yyvsp[0].str) ); ;}
2461 break;
2462
2463 case 62:
2464 #line 439 "parser.y"
2465 { (yyval.attr) = NULL; ;}
2466 break;
2467
2468 case 63:
2469 #line 440 "parser.y"
2470 { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); ;}
2471 break;
2472
2473 case 64:
2474 #line 441 "parser.y"
2475 { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;}
2476 break;
2477
2478 case 65:
2479 #line 442 "parser.y"
2480 { (yyval.attr) = make_attr(ATTR_ASYNC); ;}
2481 break;
2482
2483 case 66:
2484 #line 443 "parser.y"
2485 { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;}
2486 break;
2487
2488 case 67:
2489 #line 444 "parser.y"
2490 { (yyval.attr) = make_attr(ATTR_BINDABLE); ;}
2491 break;
2492
2493 case 68:
2494 #line 445 "parser.y"
2495 { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[-1].var)); ;}
2496 break;
2497
2498 case 69:
2499 #line 446 "parser.y"
2500 { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[-1].expr_list)); ;}
2501 break;
2502
2503 case 70:
2504 #line 447 "parser.y"
2505 { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;}
2506 break;
2507
2508 case 71:
2509 #line 448 "parser.y"
2510 { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;}
2511 break;
2512
2513 case 72:
2514 #line 449 "parser.y"
2515 { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;}
2516 break;
2517
2518 case 73:
2519 #line 450 "parser.y"
2520 { (yyval.attr) = make_attr(ATTR_CONTROL); ;}
2521 break;
2522
2523 case 74:
2524 #line 451 "parser.y"
2525 { (yyval.attr) = make_attr(ATTR_DEFAULT); ;}
2526 break;
2527
2528 case 75:
2529 #line 452 "parser.y"
2530 { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;}
2531 break;
2532
2533 case 76:
2534 #line 453 "parser.y"
2535 { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE_EXPR, (yyvsp[-1].expr)); ;}
2536 break;
2537
2538 case 77:
2539 #line 454 "parser.y"
2540 { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE_STRING, (yyvsp[-1].str)); ;}
2541 break;
2542
2543 case 78:
2544 #line 455 "parser.y"
2545 { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;}
2546 break;
2547
2548 case 79:
2549 #line 456 "parser.y"
2550 { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;}
2551 break;
2552
2553 case 80:
2554 #line 457 "parser.y"
2555 { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[-1].str)); ;}
2556 break;
2557
2558 case 81:
2559 #line 458 "parser.y"
2560 { (yyval.attr) = make_attr(ATTR_DUAL); ;}
2561 break;
2562
2563 case 82:
2564 #line 459 "parser.y"
2565 { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[-1].str_list)); ;}
2566 break;
2567
2568 case 83:
2569 #line 460 "parser.y"
2570 { (yyval.attr) = make_attrp(ATTR_ENTRY_STRING, (yyvsp[-1].str)); ;}
2571 break;
2572
2573 case 84:
2574 #line 461 "parser.y"
2575 { (yyval.attr) = make_attrp(ATTR_ENTRY_ORDINAL, (yyvsp[-1].expr)); ;}
2576 break;
2577
2578 case 85:
2579 #line 462 "parser.y"
2580 { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;}
2581 break;
2582
2583 case 86:
2584 #line 463 "parser.y"
2585 { (yyval.attr) = make_attr(ATTR_HANDLE); ;}
2586 break;
2587
2588 case 87:
2589 #line 464 "parser.y"
2590 { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[-1].expr)); ;}
2591 break;
2592
2593 case 88:
2594 #line 465 "parser.y"
2595 { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[-1].str)); ;}
2596 break;
2597
2598 case 89:
2599 #line 466 "parser.y"
2600 { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[-1].str)); ;}
2601 break;
2602
2603 case 90:
2604 #line 467 "parser.y"
2605 { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[-1].expr)); ;}
2606 break;
2607
2608 case 91:
2609 #line 468 "parser.y"
2610 { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[-1].str)); ;}
2611 break;
2612
2613 case 92:
2614 #line 469 "parser.y"
2615 { (yyval.attr) = make_attr(ATTR_HIDDEN); ;}
2616 break;
2617
2618 case 93:
2619 #line 470 "parser.y"
2620 { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[-1].expr)); ;}
2621 break;
2622
2623 case 94:
2624 #line 471 "parser.y"
2625 { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;}
2626 break;
2627
2628 case 95:
2629 #line 472 "parser.y"
2630 { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[-1].expr)); ;}
2631 break;
2632
2633 case 96:
2634 #line 473 "parser.y"
2635 { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;}
2636 break;
2637
2638 case 97:
2639 #line 474 "parser.y"
2640 { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[-1].str)); ;}
2641 break;
2642
2643 case 98:
2644 #line 475 "parser.y"
2645 { (yyval.attr) = make_attr(ATTR_IN); ;}
2646 break;
2647
2648 case 99:
2649 #line 476 "parser.y"
2650 { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;}
2651 break;
2652
2653 case 100:
2654 #line 477 "parser.y"
2655 { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[-1].expr_list)); ;}
2656 break;
2657
2658 case 101:
2659 #line 478 "parser.y"
2660 { (yyval.attr) = make_attr(ATTR_LOCAL); ;}
2661 break;
2662
2663 case 102:
2664 #line 479 "parser.y"
2665 { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;}
2666 break;
2667
2668 case 103:
2669 #line 480 "parser.y"
2670 { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;}
2671 break;
2672
2673 case 104:
2674 #line 481 "parser.y"
2675 { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;}
2676 break;
2677
2678 case 105:
2679 #line 482 "parser.y"
2680 { (yyval.attr) = make_attr(ATTR_OBJECT); ;}
2681 break;
2682
2683 case 106:
2684 #line 483 "parser.y"
2685 { (yyval.attr) = make_attr(ATTR_ODL); ;}
2686 break;
2687
2688 case 107:
2689 #line 484 "parser.y"
2690 { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;}
2691 break;
2692
2693 case 108:
2694 #line 485 "parser.y"
2695 { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;}
2696 break;
2697
2698 case 109:
2699 #line 486 "parser.y"
2700 { (yyval.attr) = make_attr(ATTR_OUT); ;}
2701 break;
2702
2703 case 110:
2704 #line 487 "parser.y"
2705 { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[-1].num)); ;}
2706 break;
2707
2708 case 111:
2709 #line 488 "parser.y"
2710 { (yyval.attr) = make_attr(ATTR_PROPGET); ;}
2711 break;
2712
2713 case 112:
2714 #line 489 "parser.y"
2715 { (yyval.attr) = make_attr(ATTR_PROPPUT); ;}
2716 break;
2717
2718 case 113:
2719 #line 490 "parser.y"
2720 { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;}
2721 break;
2722
2723 case 114:
2724 #line 491 "parser.y"
2725 { (yyval.attr) = make_attr(ATTR_PUBLIC); ;}
2726 break;
2727
2728 case 115:
2729 #line 492 "parser.y"
2730 { expr_list_t *list = append_expr( NULL, (yyvsp[-3].expr) );
2731 list = append_expr( list, (yyvsp[-1].expr) );
2732 (yyval.attr) = make_attrp(ATTR_RANGE, list); ;}
2733 break;
2734
2735 case 116:
2736 #line 495 "parser.y"
2737 { (yyval.attr) = make_attr(ATTR_READONLY); ;}
2738 break;
2739
2740 case 117:
2741 #line 496 "parser.y"
2742 { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); ;}
2743 break;
2744
2745 case 118:
2746 #line 497 "parser.y"
2747 { (yyval.attr) = make_attr(ATTR_RESTRICTED); ;}
2748 break;
2749
2750 case 119:
2751 #line 498 "parser.y"
2752 { (yyval.attr) = make_attr(ATTR_RETVAL); ;}
2753 break;
2754
2755 case 120:
2756 #line 499 "parser.y"
2757 { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[-1].expr_list)); ;}
2758 break;
2759
2760 case 121:
2761 #line 500 "parser.y"
2762 { (yyval.attr) = make_attr(ATTR_SOURCE); ;}
2763 break;
2764
2765 case 122:
2766 #line 501 "parser.y"
2767 { (yyval.attr) = make_attr(ATTR_STRICTCONTEXTHANDLE); ;}
2768 break;
2769
2770 case 123:
2771 #line 502 "parser.y"
2772 { (yyval.attr) = make_attr(ATTR_STRING); ;}
2773 break;
2774
2775 case 124:
2776 #line 503 "parser.y"
2777 { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[-1].expr)); ;}
2778 break;
2779
2780 case 125:
2781 #line 504 "parser.y"
2782 { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[-1].type)); ;}
2783 break;
2784
2785 case 126:
2786 #line 505 "parser.y"
2787 { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[-1].type)); ;}
2788 break;
2789
2790 case 127:
2791 #line 506 "parser.y"
2792 { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[-1].uuid)); ;}
2793 break;
2794
2795 case 128:
2796 #line 507 "parser.y"
2797 { (yyval.attr) = make_attr(ATTR_V1ENUM); ;}
2798 break;
2799
2800 case 129:
2801 #line 508 "parser.y"
2802 { (yyval.attr) = make_attr(ATTR_VARARG); ;}
2803 break;
2804
2805 case 130:
2806 #line 509 "parser.y"
2807 { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[-1].num)); ;}
2808 break;
2809
2810 case 131:
2811 #line 510 "parser.y"
2812 { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[-1].type)); ;}
2813 break;
2814
2815 case 132:
2816 #line 511 "parser.y"
2817 { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[0].num)); ;}
2818 break;
2819
2820 case 134:
2821 #line 516 "parser.y"
2822 { if (!is_valid_uuid((yyvsp[0].str)))
2823 error_loc("invalid UUID: %s\n", (yyvsp[0].str));
2824 (yyval.uuid) = parse_uuid((yyvsp[0].str)); ;}
2825 break;
2826
2827 case 137:
2828 #line 525 "parser.y"
2829 { (yyval.var_list) = NULL; ;}
2830 break;
2831
2832 case 138:
2833 #line 526 "parser.y"
2834 { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); ;}
2835 break;
2836
2837 case 139:
2838 #line 529 "parser.y"
2839 { attr_t *a = make_attrp(ATTR_CASE, append_expr( NULL, (yyvsp[-2].expr) ));
2840 (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL);
2841 (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a );
2842 ;}
2843 break;
2844
2845 case 140:
2846 #line 533 "parser.y"
2847 { attr_t *a = make_attr(ATTR_DEFAULT);
2848 (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL);
2849 (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a );
2850 ;}
2851 break;
2852
2853 case 141:
2854 #line 539 "parser.y"
2855 { (yyval.var) = reg_const((yyvsp[-2].var));
2856 set_type((yyval.var), (yyvsp[-3].type), 0, NULL, FALSE);
2857 (yyval.var)->eval = (yyvsp[0].expr);
2858 ;}
2859 break;
2860
2861 case 142:
2862 #line 545 "parser.y"
2863 { (yyval.var_list) = NULL; ;}
2864 break;
2865
2866 case 143:
2867 #line 546 "parser.y"
2868 { (yyval.var_list) = (yyvsp[-1].var_list); ;}
2869 break;
2870
2871 case 145:
2872 #line 550 "parser.y"
2873 { if (!(yyvsp[0].var)->eval)
2874 (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */);
2875 (yyval.var_list) = append_var( NULL, (yyvsp[0].var) );
2876 ;}
2877 break;
2878
2879 case 146:
2880 #line 554 "parser.y"
2881 { if (!(yyvsp[0].var)->eval)
2882 {
2883 var_t *last = LIST_ENTRY( list_tail((yyval.var_list)), var_t, entry );
2884 (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, last->eval->cval + 1);
2885 }
2886 (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var) );
2887 ;}
2888 break;
2889
2890 case 147:
2891 #line 563 "parser.y"
2892 { (yyval.var) = reg_const((yyvsp[-2].var));
2893 (yyval.var)->eval = (yyvsp[0].expr);
2894 (yyval.var)->type = make_int(0);
2895 ;}
2896 break;
2897
2898 case 148:
2899 #line 567 "parser.y"
2900 { (yyval.var) = reg_const((yyvsp[0].var));
2901 (yyval.var)->type = make_int(0);
2902 ;}
2903 break;
2904
2905 case 149:
2906 #line 572 "parser.y"
2907 { (yyval.type) = get_typev(RPC_FC_ENUM16, (yyvsp[-3].var), tsENUM);
2908 (yyval.type)->kind = TKIND_ENUM;
2909 (yyval.type)->fields = (yyvsp[-1].var_list);
2910 (yyval.type)->defined = TRUE;
2911 if(in_typelib)
2912 add_typelib_entry((yyval.type));
2913 ;}
2914 break;
2915
2916 case 150:
2917 #line 581 "parser.y"
2918 { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); ;}
2919 break;
2920
2921 case 151:
2922 #line 582 "parser.y"
2923 { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); ;}
2924 break;
2925
2926 case 152:
2927 #line 595 "parser.y"
2928 { (yyval.expr) = make_expr(EXPR_VOID); ;}
2929 break;
2930
2931 case 154:
2932 #line 599 "parser.y"
2933 { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[0].num)); ;}
2934 break;
2935
2936 case 155:
2937 #line 600 "parser.y"
2938 { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[0].num)); ;}
2939 break;
2940
2941 case 156:
2942 #line 601 "parser.y"
2943 { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[0].dbl)); ;}
2944 break;
2945
2946 case 157:
2947 #line 602 "parser.y"
2948 { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); ;}
2949 break;
2950
2951 case 158:
2952 #line 603 "parser.y"
2953 { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); ;}
2954 break;
2955
2956 case 159:
2957 #line 604 "parser.y"
2958 { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str)); ;}
2959 break;
2960
2961 case 160:
2962 #line 605 "parser.y"
2963 { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2964 break;
2965
2966 case 161:
2967 #line 606 "parser.y"
2968 { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2969 break;
2970
2971 case 162:
2972 #line 607 "parser.y"
2973 { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2974 break;
2975
2976 case 163:
2977 #line 608 "parser.y"
2978 { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2979 break;
2980
2981 case 164:
2982 #line 609 "parser.y"
2983 { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2984 break;
2985
2986 case 165:
2987 #line 610 "parser.y"
2988 { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2989 break;
2990
2991 case 166:
2992 #line 611 "parser.y"
2993 { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2994 break;
2995
2996 case 167:
2997 #line 612 "parser.y"
2998 { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
2999 break;
3000
3001 case 168:
3002 #line 613 "parser.y"
3003 { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
3004 break;
3005
3006 case 169:
3007 #line 614 "parser.y"
3008 { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[0].expr)); ;}
3009 break;
3010
3011 case 170:
3012 #line 615 "parser.y"
3013 { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[0].expr)); ;}
3014 break;
3015
3016 case 171:
3017 #line 616 "parser.y"
3018 { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[0].expr)); ;}
3019 break;
3020
3021 case 172:
3022 #line 617 "parser.y"
3023 { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[0].expr)); ;}
3024 break;
3025
3026 case 173:
3027 #line 618 "parser.y"
3028 { (yyval.expr) = make_exprt(EXPR_CAST, (yyvsp[-2].type), (yyvsp[0].expr)); ;}
3029 break;
3030
3031 case 174:
3032 #line 619 "parser.y"
3033 { (yyval.expr) = make_exprt(EXPR_SIZEOF, (yyvsp[-1].type), NULL); ;}
3034 break;
3035
3036 case 175:
3037 #line 620 "parser.y"
3038 { (yyval.expr) = (yyvsp[-1].expr); ;}
3039 break;
3040
3041 case 176:
3042 #line 623 "parser.y"
3043 { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); ;}
3044 break;
3045
3046 case 177:
3047 #line 624 "parser.y"
3048 { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); ;}
3049 break;
3050
3051 case 178:
3052 #line 627 "parser.y"
3053 { (yyval.expr) = (yyvsp[0].expr);
3054 if (!(yyval.expr)->is_const)
3055 error_loc("expression is not constant\n");
3056 ;}
3057 break;
3058
3059 case 179:
3060 #line 633 "parser.y"
3061 { (yyval.var) = (yyvsp[0].var);
3062 set_type((yyval.var), (yyvsp[-1].type), 0, NULL, FALSE);
3063 ;}
3064 break;
3065
3066 case 180:
3067 #line 638 "parser.y"
3068 { (yyval.var_list) = NULL; ;}
3069 break;
3070
3071 case 181:
3072 #line 639 "parser.y"
3073 { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); ;}
3074 break;
3075
3076 case 182:
3077 #line 642 "parser.y"
3078 { (yyval.var) = (yyvsp[-1].var); ;}
3079 break;
3080
3081 case 183:
3082 #line 643 "parser.y"
3083 { (yyval.var) = make_var(NULL); (yyval.var)->type = (yyvsp[-1].type); (yyval.var)->attrs = (yyvsp[-2].attr_list); ;}
3084 break;
3085
3086 case 184:
3087 #line 644 "parser.y"
3088 { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[-1].attr_list); ;}
3089 break;
3090
3091 case 185:
3092 #line 645 "parser.y"
3093 { (yyval.var) = NULL; ;}
3094 break;
3095
3096 case 186:
3097 #line 648 "parser.y"
3098 { (yyval.var) = (yyvsp[-1].pident)->var;
3099 (yyval.var)->attrs = (yyvsp[-3].attr_list);
3100 set_type((yyval.var), (yyvsp[-2].type), (yyvsp[-1].pident)->ptr_level, (yyvsp[0].array_dims), FALSE);
3101 free((yyvsp[-1].pident));
3102 ;}
3103 break;
3104
3105 case 187:
3106 #line 657 "parser.y"
3107 { var_t *v = (yyvsp[-3].pident)->var;
3108 v->attrs = (yyvsp[-6].attr_list);
3109 set_type(v, (yyvsp[-5].type), (yyvsp[-3].pident)->ptr_level, NULL, FALSE);
3110 free((yyvsp[-3].pident));
3111 (yyval.func) = make_func(v, (yyvsp[-1].var_list));
3112 if (is_attr(v->attrs, ATTR_IN)) {
3113 error_loc("inapplicable attribute [in] for function '%s'\n",(yyval.func)->def->name);
3114 }
3115 ;}
3116 break;
3117
3118 case 188:
3119 #line 668 "parser.y"
3120 { (yyval.var) = NULL; ;}
3121 break;
3122
3123 case 190:
3124 #line 672 "parser.y"
3125 { (yyval.var) = NULL; ;}
3126 break;
3127
3128 case 191:
3129 #line 673 "parser.y"
3130 { (yyval.var) = make_var((yyvsp[0].str)); ;}
3131 break;
3132
3133 case 192:
3134 #line 674 "parser.y"
3135 { (yyval.var) = make_var((yyvsp[0].str)); ;}
3136 break;
3137
3138 case 193:
3139 #line 677 "parser.y"
3140 { (yyval.var) = make_var((yyvsp[0].str)); ;}
3141 break;
3142
3143 case 194:
3144 #line 679 "parser.y"
3145 { (yyval.var) = make_var((yyvsp[0].str)); ;}
3146 break;
3147
3148 case 195:
3149 #line 682 "parser.y"
3150 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3151 break;
3152
3153 case 196:
3154 #line 683 "parser.y"
3155 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3156 break;
3157
3158 case 198:
3159 #line 685 "parser.y"
3160 { (yyval.type) = (yyvsp[0].type); (yyval.type)->sign = 1; ;}
3161 break;
3162
3163 case 199:
3164 #line 686 "parser.y"
3165 { (yyval.type) = (yyvsp[0].type); (yyval.type)->sign = -1;
3166 switch ((yyval.type)->type) {
3167 case RPC_FC_CHAR: break;
3168 case RPC_FC_SMALL: (yyval.type)->type = RPC_FC_USMALL; break;
3169 case RPC_FC_SHORT: (yyval.type)->type = RPC_FC_USHORT; break;
3170 case RPC_FC_LONG: (yyval.type)->type = RPC_FC_ULONG; break;
3171 case RPC_FC_HYPER:
3172 if ((yyval.type)->name[0] == 'h') /* hyper, as opposed to __int64 */
3173 {
3174 (yyval.type) = alias((yyval.type), "MIDL_uhyper");
3175 (yyval.type)->sign = 0;
3176 }
3177 break;
3178 default: break;
3179 }
3180 ;}
3181 break;
3182
3183 case 200:
3184 #line 702 "parser.y"
3185 { (yyval.type) = make_int(-1); ;}
3186 break;
3187
3188 case 201:
3189 #line 703 "parser.y"
3190 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3191 break;
3192
3193 case 202:
3194 #line 704 "parser.y"
3195 { (yyval.type) = duptype(find_type("float", 0), 1); ;}
3196 break;
3197
3198 case 203:
3199 #line 705 "parser.y"
3200 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3201 break;
3202
3203 case 204:
3204 #line 706 "parser.y"
3205 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3206 break;
3207
3208 case 205:
3209 #line 707 "parser.y"
3210 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3211 break;
3212
3213 case 206:
3214 #line 708 "parser.y"
3215 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3216 break;
3217
3218 case 209:
3219 #line 715 "parser.y"
3220 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3221 break;
3222
3223 case 210:
3224 #line 716 "parser.y"
3225 { (yyval.type) = make_builtin((yyvsp[-1].str)); ;}
3226 break;
3227
3228 case 211:
3229 #line 717 "parser.y"
3230 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3231 break;
3232
3233 case 212:
3234 #line 718 "parser.y"
3235 { (yyval.type) = make_builtin((yyvsp[-1].str)); ;}
3236 break;
3237
3238 case 213:
3239 #line 719 "parser.y"
3240 { (yyval.type) = make_builtin((yyvsp[-1].str)); ;}
3241 break;
3242
3243 case 214:
3244 #line 720 "parser.y"
3245 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3246 break;
3247
3248 case 215:
3249 #line 721 "parser.y"
3250 { (yyval.type) = make_builtin((yyvsp[0].str)); ;}
3251 break;
3252
3253 case 216:
3254 #line 724 "parser.y"
3255 { (yyval.type) = make_class((yyvsp[0].str)); ;}
3256 break;
3257
3258 case 217:
3259 #line 725 "parser.y"
3260 { (yyval.type) = find_type((yyvsp[0].str), 0);
3261 if ((yyval.type)->defined) error_loc("multiple definition error\n");
3262 if ((yyval.type)->kind != TKIND_COCLASS) error_loc("%s was not declared a coclass\n", (yyvsp[0].str));
3263 ;}
3264 break;
3265
3266 case 218:
3267 #line 731 "parser.y"
3268 { (yyval.type) = (yyvsp[0].type);
3269 (yyval.type)->attrs = (yyvsp[-1].attr_list);
3270 if (!parse_only && do_header)
3271 write_coclass((yyval.type));
3272 if (!parse_only && do_idfile)
3273 write_clsid((yyval.type));
3274 ;}
3275 break;
3276
3277 case 219:
3278 #line 740 "parser.y"
3279 { (yyval.type) = (yyvsp[-3].type);
3280 (yyval.type)->ifaces = (yyvsp[-1].ifref_list);
3281 (yyval.type)->defined = TRUE;
3282 ;}
3283 break;
3284
3285 case 220:
3286 #line 746 "parser.y"
3287 { (yyval.ifref_list) = NULL; ;}
3288 break;
3289
3290 case 221:
3291 #line 747 "parser.y"
3292 { (yyval.ifref_list) = append_ifref( (yyvsp[-1].ifref_list), (yyvsp[0].ifref) ); ;}
3293 break;
3294
3295 case 222:
3296 #line 751 "parser.y"
3297 { (yyval.ifref) = make_ifref((yyvsp[0].type)); (yyval.ifref)->attrs = (yyvsp[-1].attr_list); ;}
3298 break;
3299
3300 case 223:
3301 #line 754 "parser.y"
3302 { (yyval.type) = get_type(0, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_DISPATCH; ;}
3303 break;
3304
3305 case 224:
3306 #line 755 "parser.y"
3307 { (yyval.type) = get_type(0, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_DISPATCH; ;}
3308 break;
3309
3310 case 225:
3311 #line 758 "parser.y"
3312 { attr_t *attrs;
3313 (yyval.type) = (yyvsp[0].type);
3314 if ((yyval.type)->defined) error_loc("multiple definition error\n");
3315 attrs = make_attr(ATTR_DISPINTERFACE);
3316 (yyval.type)->attrs = append_attr( (yyvsp[-1].attr_list), attrs );
3317 (yyval.type)->ref = find_type("IDispatch", 0);
3318 if (!(yyval.type)->ref) error_loc("IDispatch is undefined\n");
3319 (yyval.type)->defined = TRUE;
3320 if (!parse_only && do_header) write_forward((yyval.type));
3321 ;}
3322 break;
3323
3324 case 226:
3325 #line 770 "parser.y"
3326 { (yyval.var_list) = NULL; ;}
3327 break;
3328
3329 case 227:
3330 #line 771 "parser.y"
3331 { (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[-1].var) ); ;}
3332 break;
3333
3334 case 228:
3335 #line 774 "parser.y"
3336 { (yyval.func_list) = NULL; ;}
3337 break;
3338
3339 case 229:
3340 #line 775 "parser.y"
3341 { (yyval.func_list) = append_func( (yyvsp[-2].func_list), (yyvsp[-1].func) ); ;}
3342 break;
3343
3344 case 230:
3345 #line 781 "parser.y"
3346 { (yyval.type) = (yyvsp[-4].type);
3347 (yyval.type)->fields = (yyvsp[-2].var_list);
3348 (yyval.type)->funcs = (yyvsp[-1].func_list);
3349 if (!parse_only && do_header) write_dispinterface((yyval.type));
3350 if (!parse_only && do_idfile) write_diid((yyval.type));
3351 ;}
3352 break;
3353
3354 case 231:
3355 #line 788 "parser.y"
3356 { (yyval.type) = (yyvsp[-4].type);
3357 (yyval.type)->fields = (yyvsp[-2].type)->fields;
3358 (yyval.type)->funcs = (yyvsp[-2].type)->funcs;
3359 if (!parse_only && do_header) write_dispinterface((yyval.type));
3360 if (!parse_only && do_idfile) write_diid((yyval.type));
3361 ;}
3362 break;
3363
3364 case 232:
3365 #line 796 "parser.y"
3366 { (yyval.type) = NULL; ;}
3367 break;
3368
3369 case 233:
3370 #line 797 "parser.y"
3371 { (yyval.type) = find_type2((yyvsp[0].str), 0); ;}
3372 break;
3373
3374 case 234:
3375 #line 800 "parser.y"
3376 { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_INTERFACE; ;}
3377 break;
3378
3379 case 235:
3380 #line 801 "parser.y"
3381 { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); (yyval.type)->kind = TKIND_INTERFACE; ;}
3382 break;
3383
3384 case 236:
3385 #line 804 "parser.y"
3386 { (yyval.ifinfo).interface = (yyvsp[0].type);
3387 (yyval.ifinfo).old_pointer_default = pointer_default;
3388 if (is_attr((yyvsp[-1].attr_list), ATTR_POINTERDEFAULT))
3389 pointer_default = get_attrv((yyvsp[-1].attr_list), ATTR_POINTERDEFAULT);
3390 if ((yyvsp[0].type)->defined) error_loc("multiple definition error\n");
3391 (yyvsp[0].type)->attrs = (yyvsp[-1].attr_list);
3392 (yyvsp[0].type)->defined = TRUE;
3393 if (!parse_only && do_header) write_forward((yyvsp[0].type));
3394 ;}
3395 break;
3396
3397 case 237:
3398 #line 816 "parser.y"
3399 { (yyval.type) = (yyvsp[-4].ifinfo).interface;
3400 (yyval.type)->ref = (yyvsp[-3].type);
3401 (yyval.type)->funcs = (yyvsp[-1].func_list);
3402 compute_method_indexes((yyval.type));
3403 if (!parse_only && do_header) write_interface((yyval.type));
3404 if (!parse_only && local_stubs) write_locals(local_stubs, (yyval.type), TRUE);
3405 if (!parse_only && do_idfile) write_iid((yyval.type));
3406 pointer_default = (yyvsp[-4].ifinfo).old_pointer_default;
3407 ;}
3408 break;
3409
3410 case 238:
3411 #line 828 "parser.y"
3412 { (yyval.type) = (yyvsp[-6].ifinfo).interface;
3413 (yyval.type)->ref = find_type2((yyvsp[-4].str), 0);
3414 if (!(yyval.type)->ref) error_loc("base class '%s' not found in import\n", (yyvsp[-4].str));
3415 (yyval.type)->funcs = (yyvsp[-1].func_list);
3416 compute_method_indexes((yyval.type));
3417 if (!parse_only && do_header) write_interface((yyval.type));
3418 if (!parse_only && local_stubs) write_locals(local_stubs, (yyval.type), TRUE);
3419 if (!parse_only && do_idfile) write_iid((yyval.type));
3420 pointer_default = (yyvsp[-6].ifinfo).old_pointer_default;
3421 ;}
3422 break;
3423
3424 case 239:
3425 #line 838 "parser.y"
3426 { (yyval.type) = (yyvsp[0].type); ;}
3427 break;
3428
3429 case 240:
3430 #line 842 "parser.y"
3431 { (yyval.type) = (yyvsp[-1].type); if (!parse_only && do_header) write_forward((yyval.type)); ;}
3432 break;
3433
3434 case 241:
3435 #line 843 "parser.y"
3436 { (yyval.type) = (yyvsp[-1].type); if (!parse_only && do_header) write_forward((yyval.type)); ;}
3437 break;
3438
3439 case 242:
3440 #line 846 "parser.y"
3441 { (yyval.type) = make_type(0, NULL); (yyval.type)->name = (yyvsp[0].str); (yyval.type)->kind = TKIND_MODULE; ;}
3442 break;
3443
3444 case 243:
3445 #line 847 "parser.y"
3446 { (yyval.type) = make_type(0, NULL); (yyval.type)->name = (yyvsp[0].str); (yyval.type)->kind = TKIND_MODULE; ;}
3447 break;
3448
3449 case 244:
3450 #line 850 "parser.y"
3451 { (yyval.type) = (yyvsp[0].type);
3452 (yyval.type)->attrs = (yyvsp[-1].attr_list);
3453 ;}
3454 break;
3455
3456 case 245:
3457 #line 855 "parser.y"
3458 { (yyval.type) = (yyvsp[-3].type);
3459 (yyval.type)->funcs = (yyvsp[-1].func_list);
3460 /* FIXME: if (!parse_only && do_header) write_module($$); */
3461 ;}
3462 break;
3463
3464 case 246:
3465 #line 861 "parser.y"
3466 { (yyval.pident) = (yyvsp[0].pident); (yyval.pident)->ptr_level++; ;}
3467 break;
3468
3469 case 247:
3470 #line 862 "parser.y"
3471 { (yyval.pident) = (yyvsp[0].pident); /* FIXME */ ;}
3472 break;
3473
3474 case 248:
3475 #line 865 "parser.y"
3476 { (yyval.pident) = make_pident((yyvsp[0].var)); ;}
3477 break;
3478
3479 case 250:
3480 #line 867 "parser.y"
3481 { (yyval.pident) = (yyvsp[-1].pident); ;}
3482 break;
3483
3484 case 251:
3485 #line 871 "parser.y"
3486 { (yyval.pident_list) = append_pident( NULL, (yyvsp[0].pident) ); ;}
3487 break;
3488
3489 case 252:
3490 #line 872 "parser.y"
3491 { (yyval.pident_list) = append_pident( (yyvsp[-2].pident_list), (yyvsp[0].pident) ); ;}
3492 break;
3493
3494 case 253:
3495 #line 876 "parser.y"
3496 { (yyval.num) = RPC_FC_RP; ;}
3497 break;
3498
3499 case 254:
3500 #line 877 "parser.y"
3501 { (yyval.num) = RPC_FC_UP; ;}
3502 break;
3503
3504 case 255:
3505 #line 878 "parser.y"
3506 { (yyval.num) = RPC_FC_FP; ;}
3507 break;
3508
3509 case 256:
3510 #line 881 "parser.y"
3511 { (yyval.type) = get_typev(RPC_FC_STRUCT, (yyvsp[-3].var), tsSTRUCT);
3512 /* overwrite RPC_FC_STRUCT with a more exact type */
3513 (yyval.type)->type = get_struct_type( (yyvsp[-1].var_list) );
3514 (yyval.type)->kind = TKIND_RECORD;
3515 (yyval.type)->fields = (yyvsp[-1].var_list);
3516 (yyval.type)->defined = TRUE;
3517 if(in_typelib)
3518 add_typelib_entry((yyval.type));
3519 ;}
3520 break;
3521
3522 case 257:
3523 #line 892 "parser.y"
3524 { (yyval.type) = duptype(find_type("void", 0), 1); ;}
3525 break;
3526
3527 case 258:
3528 #line 893 "parser.y"
3529 { (yyval.type) = find_type((yyvsp[0].str), 0); ;}
3530 break;
3531
3532 case 259:
3533 #line 894 "parser.y"
3534 { (yyval.type) = (yyvsp[0].type); ;}
3535 break;
3536
3537 case 260:
3538 #line 895 "parser.y"
3539 { (yyval.type) = duptype((yyvsp[0].type), 1); (yyval.type)->is_const = TRUE; ;}
3540 break;
3541
3542 case 261:
3543 #line 896 "parser.y"
3544 { (yyval.type) = (yyvsp[0].type); ;}
3545 break;
3546
3547 case 262:
3548 #line 897 "parser.y"
3549 { (yyval.type) = find_type2((yyvsp[0].str), tsENUM); ;}
3550 break;
3551
3552 case 263:
3553 #line 898 "parser.y"
3554 { (yyval.type) = (yyvsp[0].type); ;}
3555 break;
3556
3557 case 264:
3558 #line 899 "parser.y"
3559 { (yyval.type) = get_type(RPC_FC_STRUCT, (yyvsp[0].str), tsSTRUCT); ;}
3560 break;
3561
3562 case 265:
3563 #line 900 "parser.y"
3564 { (yyval.type) = (yyvsp[0].type); ;}
3565 break;
3566
3567 case 266:
3568 #line 901 "parser.y"
3569 { (yyval.type) = find_type2((yyvsp[0].str), tsUNION); ;}
3570 break;
3571
3572 case 267:
3573 #line 902 "parser.y"
3574 { (yyval.type) = make_safearray((yyvsp[-1].type)); ;}
3575 break;
3576
3577 case 268:
3578 #line 905 "parser.y"
3579 { reg_typedefs((yyvsp[-1].type), (yyvsp[0].pident_list), (yyvsp[-2].attr_list));
3580 process_typedefs((yyvsp[0].pident_list));
3581 ;}
3582 break;
3583
3584 case 269:
3585 #line 910 "parser.y"
3586 { (yyval.type) = get_typev(RPC_FC_NON_ENCAPSULATED_UNION, (yyvsp[-3].var), tsUNION);
3587 (yyval.type)->kind = TKIND_UNION;
3588 (yyval.type)->fields = (yyvsp[-1].var_list);
3589 (yyval.type)->defined = TRUE;
3590 ;}
3591 break;
3592
3593 case 270:
3594 #line 917 "parser.y"
3595 { var_t *u = (yyvsp[-3].var);
3596 (yyval.type) = get_typev(RPC_FC_ENCAPSULATED_UNION, (yyvsp[-8].var), tsUNION);
3597 (yyval.type)->kind = TKIND_UNION;
3598 if (!u) u = make_var( xstrdup("tagged_union") );
3599 u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL);
3600 u->type->kind = TKIND_UNION;
3601 u->type->fields = (yyvsp[-1].var_list);
3602 u->type->defined = TRUE;
3603 (yyval.type)->fields = append_var( (yyval.type)->fields, (yyvsp[-5].var) );
3604 (yyval.type)->fields = append_var( (yyval.type)->fields, u );
3605 (yyval.type)->defined = TRUE;
3606 ;}
3607 break;
3608
3609 case 271:
3610 #line 932 "parser.y"
3611 { (yyval.num) = MAKEVERSION((yyvsp[0].num), 0); ;}
3612 break;
3613
3614 case 272:
3615 #line 933 "parser.y"
3616 { (yyval.num) = MAKEVERSION((yyvsp[-2].num), (yyvsp[0].num)); ;}
3617 break;
3618
3619
3620 default: break;
3621 }
3622
3623 /* Line 1126 of yacc.c. */
3624 #line 3625 "parser.tab.c"
3625 \f
3626 yyvsp -= yylen;
3627 yyssp -= yylen;
3628
3629
3630 YY_STACK_PRINT (yyss, yyssp);
3631
3632 *++yyvsp = yyval;
3633
3634
3635 /* Now `shift' the result of the reduction. Determine what state
3636 that goes to, based on the state we popped back to and the rule
3637 number reduced by. */
3638
3639 yyn = yyr1[yyn];
3640
3641 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
3642 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3643 yystate = yytable[yystate];
3644 else
3645 yystate = yydefgoto[yyn - YYNTOKENS];
3646
3647 goto yynewstate;
3648
3649
3650 /*------------------------------------.
3651 | yyerrlab -- here on detecting error |
3652 `------------------------------------*/
3653 yyerrlab:
3654 /* If not already recovering from an error, report this error. */
3655 if (!yyerrstatus)
3656 {
3657 ++yynerrs;
3658 #if YYERROR_VERBOSE
3659 yyn = yypact[yystate];
3660
3661 if (YYPACT_NINF < yyn && yyn < YYLAST)
3662 {
3663 int yytype = YYTRANSLATE (yychar);
3664 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3665 YYSIZE_T yysize = yysize0;
3666 YYSIZE_T yysize1;
3667 int yysize_overflow = 0;
3668 char *yymsg = 0;
3669 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
3670 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3671 int yyx;
3672
3673 #if 0
3674 /* This is so xgettext sees the translatable formats that are
3675 constructed on the fly. */
3676 YY_("syntax error, unexpected %s");
3677 YY_("syntax error, unexpected %s, expecting %s");
3678 YY_("syntax error, unexpected %s, expecting %s or %s");
3679 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3680 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3681 #endif
3682 char *yyfmt;
3683 char const *yyf;
3684 static char const yyunexpected[] = "syntax error, unexpected %s";
3685 static char const yyexpecting[] = ", expecting %s";
3686 static char const yyor[] = " or %s";
3687 char yyformat[sizeof yyunexpected
3688 + sizeof yyexpecting - 1
3689 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3690 * (sizeof yyor - 1))];
3691 char const *yyprefix = yyexpecting;
3692
3693 /* Start YYX at -YYN if negative to avoid negative indexes in
3694 YYCHECK. */
3695 int yyxbegin = yyn < 0 ? -yyn : 0;
3696
3697 /* Stay within bounds of both yycheck and yytname. */
3698 int yychecklim = YYLAST - yyn;
3699 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3700 int yycount = 1;
3701
3702 yyarg[0] = yytname[yytype];
3703 yyfmt = yystpcpy (yyformat, yyunexpected);
3704
3705 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3706 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3707 {
3708 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3709 {
3710 yycount = 1;
3711 yysize = yysize0;
3712 yyformat[sizeof yyunexpected - 1] = '\0';
3713 break;
3714 }
3715 yyarg[yycount++] = yytname[yyx];
3716 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3717 yysize_overflow |= yysize1 < yysize;
3718 yysize = yysize1;
3719 yyfmt = yystpcpy (yyfmt, yyprefix);
3720 yyprefix = yyor;
3721 }
3722
3723 yyf = YY_(yyformat);
3724 yysize1 = yysize + yystrlen (yyf);
3725 yysize_overflow |= yysize1 < yysize;
3726 yysize = yysize1;
3727
3728 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
3729 yymsg = (char *) YYSTACK_ALLOC (yysize);
3730 if (yymsg)
3731 {
3732 /* Avoid sprintf, as that infringes on the user's name space.
3733 Don't have undefined behavior even if the translation
3734 produced a string with the wrong number of "%s"s. */
3735 char *yyp = yymsg;
3736 int yyi = 0;
3737 while ((*yyp = *yyf))
3738 {
3739 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3740 {
3741 yyp += yytnamerr (yyp, yyarg[yyi++]);
3742 yyf += 2;
3743 }
3744 else
3745 {
3746 yyp++;
3747 yyf++;
3748 }
3749 }
3750 yyerror (yymsg);
3751 YYSTACK_FREE (yymsg);
3752 }
3753 else
3754 {
3755 yyerror (YY_("syntax error"));
3756 goto yyexhaustedlab;
3757 }
3758 }
3759 else
3760 #endif /* YYERROR_VERBOSE */
3761 yyerror (YY_("syntax error"));
3762 }
3763
3764
3765
3766 if (yyerrstatus == 3)
3767 {
3768 /* If just tried and failed to reuse look-ahead token after an
3769 error, discard it. */
3770
3771 if (yychar <= YYEOF)
3772 {
3773 /* Return failure if at end of input. */
3774 if (yychar == YYEOF)
3775 YYABORT;
3776 }
3777 else
3778 {
3779 yydestruct ("Error: discarding", yytoken, &yylval);
3780 yychar = YYEMPTY;
3781 }
3782 }
3783
3784 /* Else will try to reuse look-ahead token after shifting the error
3785 token. */
3786 goto yyerrlab1;
3787
3788
3789 /*---------------------------------------------------.
3790 | yyerrorlab -- error raised explicitly by YYERROR. |
3791 `---------------------------------------------------*/
3792 yyerrorlab:
3793
3794 /* Pacify compilers like GCC when the user code never invokes
3795 YYERROR and the label yyerrorlab therefore never appears in user
3796 code. */
3797 if (0)
3798 goto yyerrorlab;
3799
3800 yyvsp -= yylen;
3801 yyssp -= yylen;
3802 yystate = *yyssp;
3803 goto yyerrlab1;
3804
3805
3806 /*-------------------------------------------------------------.
3807 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3808 `-------------------------------------------------------------*/
3809 yyerrlab1:
3810 yyerrstatus = 3; /* Each real token shifted decrements this. */
3811
3812 for (;;)
3813 {
3814 yyn = yypact[yystate];
3815 if (yyn != YYPACT_NINF)
3816 {
3817 yyn += YYTERROR;
3818 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3819 {
3820 yyn = yytable[yyn];
3821 if (0 < yyn)
3822 break;
3823 }
3824 }
3825
3826 /* Pop the current state because it cannot handle the error token. */
3827 if (yyssp == yyss)
3828 YYABORT;
3829
3830
3831 yydestruct ("Error: popping", yystos[yystate], yyvsp);
3832 YYPOPSTACK;
3833 yystate = *yyssp;
3834 YY_STACK_PRINT (yyss, yyssp);
3835 }
3836
3837 if (yyn == YYFINAL)
3838 YYACCEPT;
3839
3840 *++yyvsp = yylval;
3841
3842
3843 /* Shift the error token. */
3844 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3845
3846 yystate = yyn;
3847 goto yynewstate;
3848
3849
3850 /*-------------------------------------.
3851 | yyacceptlab -- YYACCEPT comes here. |
3852 `-------------------------------------*/
3853 yyacceptlab:
3854 yyresult = 0;
3855 goto yyreturn;
3856
3857 /*-----------------------------------.
3858 | yyabortlab -- YYABORT comes here. |
3859 `-----------------------------------*/
3860 yyabortlab:
3861 yyresult = 1;
3862 goto yyreturn;
3863
3864 #ifndef yyoverflow
3865 /*-------------------------------------------------.
3866 | yyexhaustedlab -- memory exhaustion comes here. |
3867 `-------------------------------------------------*/
3868 yyexhaustedlab:
3869 yyerror (YY_("memory exhausted"));
3870 yyresult = 2;
3871 /* Fall through. */
3872 #endif
3873
3874 yyreturn:
3875 if (yychar != YYEOF && yychar != YYEMPTY)
3876 yydestruct ("Cleanup: discarding lookahead",
3877 yytoken, &yylval);
3878 while (yyssp != yyss)
3879 {
3880 yydestruct ("Cleanup: popping",
3881 yystos[*yyssp], yyvsp);
3882 YYPOPSTACK;
3883 }
3884 #ifndef yyoverflow
3885 if (yyss != yyssa)
3886 YYSTACK_FREE (yyss);
3887 #endif
3888 return yyresult;
3889 }
3890
3891
3892 #line 936 "parser.y"
3893
3894
3895 static void decl_builtin(const char *name, unsigned char type)
3896 {
3897 type_t *t = make_type(type, NULL);
3898 t->name = xstrdup(name);
3899 reg_type(t, name, 0);
3900 }
3901
3902 static type_t *make_builtin(char *name)
3903 {
3904 /* NAME is strdup'd in the lexer */
3905 type_t *t = duptype(find_type(name, 0), 0);
3906 t->name = name;
3907 return t;
3908 }
3909
3910 static type_t *make_int(int sign)
3911 {
3912 type_t *t = duptype(find_type("int", 0), 1);
3913
3914 t->sign = sign;
3915 if (sign < 0)
3916 t->type = t->type == RPC_FC_LONG ? RPC_FC_ULONG : RPC_FC_USHORT;
3917
3918 return t;
3919 }
3920
3921 void init_types(void)
3922 {
3923 decl_builtin("void", 0);
3924 decl_builtin("byte", RPC_FC_BYTE);
3925 decl_builtin("wchar_t", RPC_FC_WCHAR);
3926 decl_builtin("int", RPC_FC_LONG); /* win32 */
3927 decl_builtin("short", RPC_FC_SHORT);
3928 decl_builtin("small", RPC_FC_SMALL);
3929 decl_builtin("long", RPC_FC_LONG);
3930 decl_builtin("hyper", RPC_FC_HYPER);
3931 decl_builtin("__int64", RPC_FC_HYPER);
3932 decl_builtin("char", RPC_FC_CHAR);
3933 decl_builtin("float", RPC_FC_FLOAT);
3934 decl_builtin("double", RPC_FC_DOUBLE);
3935 decl_builtin("boolean", RPC_FC_BYTE);
3936 decl_builtin("error_status_t", RPC_FC_ERROR_STATUS_T);
3937 decl_builtin("handle_t", RPC_FC_BIND_PRIMITIVE);
3938 }
3939
3940 static str_list_t *append_str(str_list_t *list, char *str)
3941 {
3942 struct str_list_entry_t *entry;
3943
3944 if (!str) return list;
3945 if (!list)
3946 {
3947 list = xmalloc( sizeof(*list) );
3948 list_init( list );
3949 }
3950 entry = xmalloc( sizeof(*entry) );
3951 entry->str = str;
3952 list_add_tail( list, &entry->entry );
3953 return list;
3954 }
3955
3956 static attr_list_t *append_attr(attr_list_t *list, attr_t *attr)
3957 {
3958 if (!attr) return list;
3959 if (!list)
3960 {
3961 list = xmalloc( sizeof(*list) );
3962 list_init( list );
3963 }
3964 list_add_tail( list, &attr->entry );
3965 return list;
3966 }
3967
3968 static attr_t *make_attr(enum attr_type type)
3969 {
3970 attr_t *a = xmalloc(sizeof(attr_t));
3971 a->type = type;
3972 a->u.ival = 0;
3973 return a;
3974 }
3975
3976 static attr_t *make_attrv(enum attr_type type, unsigned long val)
3977 {
3978 attr_t *a = xmalloc(sizeof(attr_t));
3979 a->type = type;
3980 a->u.ival = val;
3981 return a;
3982 }
3983
3984 static attr_t *make_attrp(enum attr_type type, void *val)
3985 {
3986 attr_t *a = xmalloc(sizeof(attr_t));
3987 a->type = type;
3988 a->u.pval = val;
3989 return a;
3990 }
3991
3992 static expr_t *make_expr(enum expr_type type)
3993 {
3994 expr_t *e = xmalloc(sizeof(expr_t));
3995 e->type = type;
3996 e->ref = NULL;
3997 e->u.lval = 0;
3998 e->is_const = FALSE;
3999 e->cval = 0;
4000 return e;
4001 }
4002
4003 static expr_t *make_exprl(enum expr_type type, long val)
4004 {
4005 expr_t *e = xmalloc(sizeof(expr_t));
4006 e->type = type;
4007 e->ref = NULL;
4008 e->u.lval = val;
4009 e->is_const = FALSE;
4010 /* check for numeric constant */
4011 if (type == EXPR_NUM || type == EXPR_HEXNUM || type == EXPR_TRUEFALSE) {
4012 /* make sure true/false value is valid */
4013 assert(type != EXPR_TRUEFALSE || val == 0 || val == 1);
4014 e->is_const = TRUE;
4015 e->cval = val;
4016 }
4017 return e;
4018 }
4019
4020 static expr_t *make_exprd(enum expr_type type, double val)
4021 {
4022 expr_t *e = xmalloc(sizeof(expr_t));
4023 e->type = type;
4024 e->ref = NULL;
4025 e->u.dval = val;
4026 e->is_const = TRUE;
4027 e->cval = val;
4028 return e;
4029 }
4030
4031 static expr_t *make_exprs(enum expr_type type, char *val)
4032 {
4033 expr_t *e;
4034 e = xmalloc(sizeof(expr_t));
4035 e->type = type;
4036 e->ref = NULL;
4037 e->u.sval = val;
4038 e->is_const = FALSE;
4039 /* check for predefined constants */
4040 if (type == EXPR_IDENTIFIER) {
4041 var_t *c = find_const(val, 0);
4042 if (c) {
4043 e->u.sval = c->name;
4044 free(val);
4045 e->is_const = TRUE;
4046 e->cval = c->eval->cval;
4047 }
4048 }
4049 return e;
4050 }
4051
4052 static expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr)
4053 {
4054 expr_t *e;
4055 e = xmalloc(sizeof(expr_t));
4056 e->type = type;
4057 e->ref = expr;
4058 e->u.tref = tref;
4059 e->is_const = FALSE;
4060 /* check for cast of constant expression */
4061 if (type == EXPR_SIZEOF) {
4062 switch (tref->type) {
4063 case RPC_FC_BYTE:
4064 case RPC_FC_CHAR:
4065 case RPC_FC_SMALL:
4066 case RPC_FC_USMALL:
4067 e->is_const = TRUE;
4068 e->cval = 1;
4069 break;
4070 case RPC_FC_WCHAR:
4071 case RPC_FC_USHORT:
4072 case RPC_FC_SHORT:
4073 e->is_const = TRUE;
4074 e->cval = 2;
4075 break;
4076 case RPC_FC_LONG:
4077 case RPC_FC_ULONG:
4078 case RPC_FC_FLOAT:
4079 case RPC_FC_ERROR_STATUS_T:
4080 e->is_const = TRUE;
4081 e->cval = 4;
4082 break;
4083 case RPC_FC_HYPER:
4084 case RPC_FC_DOUBLE:
4085 e->is_const = TRUE;
4086 e->cval = 8;
4087 break;
4088 }
4089 }
4090 if (type == EXPR_CAST && expr->is_const) {
4091 e->is_const = TRUE;
4092 e->cval = expr->cval;
4093 }
4094 return e;
4095 }
4096
4097 static expr_t *make_expr1(enum expr_type type, expr_t *expr)
4098 {
4099 expr_t *e;
4100 if (type == EXPR_ADDRESSOF && expr->type != EXPR_IDENTIFIER)
4101 error("address-of operator applied to invalid expression\n");
4102 e = xmalloc(sizeof(expr_t));
4103 e->type = type;
4104 e->ref = expr;
4105 e->u.lval = 0;
4106 e->is_const = FALSE;
4107 /* check for compile-time optimization */
4108 if (expr->is_const) {
4109 e->is_const = TRUE;
4110 switch (type) {
4111 case EXPR_NEG:
4112 e->cval = -expr->cval;
4113 break;
4114 case EXPR_NOT:
4115 e->cval = ~expr->cval;
4116 break;
4117 default:
4118 e->is_const = FALSE;
4119 break;
4120 }
4121 }
4122 return e;
4123 }
4124
4125 static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2)
4126 {
4127 expr_t *e;
4128 e = xmalloc(sizeof(expr_t));
4129 e->type = type;
4130 e->ref = expr1;
4131 e->u.ext = expr2;
4132 e->is_const = FALSE;
4133 /* check for compile-time optimization */
4134 if (expr1->is_const && expr2->is_const) {
4135 e->is_const = TRUE;
4136 switch (type) {
4137 case EXPR_ADD:
4138 e->cval = expr1->cval + expr2->cval;
4139 break;
4140 case EXPR_SUB:
4141 e->cval = expr1->cval - expr2->cval;
4142 break;
4143 case EXPR_MUL:
4144 e->cval = expr1->cval * expr2->cval;
4145 break;
4146 case EXPR_DIV:
4147 e->cval = expr1->cval / expr2->cval;
4148 break;
4149 case EXPR_OR:
4150 e->cval = expr1->cval | expr2->cval;
4151 break;
4152 case EXPR_AND:
4153 e->cval = expr1->cval & expr2->cval;
4154 break;
4155 case EXPR_SHL:
4156 e->cval = expr1->cval << expr2->cval;
4157 break;
4158 case EXPR_SHR:
4159 e->cval = expr1->cval >> expr2->cval;
4160 break;
4161 default:
4162 e->is_const = FALSE;
4163 break;
4164 }
4165 }
4166 return e;
4167 }
4168
4169 static expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3)
4170 {
4171 expr_t *e;
4172 e = xmalloc(sizeof(expr_t));
4173 e->type = type;
4174 e->ref = expr1;
4175 e->u.ext = expr2;
4176 e->ext2 = expr3;
4177 e->is_const = FALSE;
4178 /* check for compile-time optimization */
4179 if (expr1->is_const && expr2->is_const && expr3->is_const) {
4180 e->is_const = TRUE;
4181 switch (type) {
4182 case EXPR_COND:
4183 e->cval = expr1->cval ? expr2->cval : expr3->cval;
4184 break;
4185 default:
4186 e->is_const = FALSE;
4187 break;
4188 }
4189 }
4190 return e;
4191 }
4192
4193 static expr_list_t *append_expr(expr_list_t *list, expr_t *expr)
4194 {
4195 if (!expr) return list;
4196 if (!list)
4197 {
4198 list = xmalloc( sizeof(*list) );
4199 list_init( list );
4200 }
4201 list_add_tail( list, &expr->entry );
4202 return list;
4203 }
4204
4205 static array_dims_t *append_array(array_dims_t *list, expr_t *expr)
4206 {
4207 if (!expr) return list;
4208 if (!list)
4209 {
4210 list = xmalloc( sizeof(*list) );
4211 list_init( list );
4212 }
4213 list_add_tail( list, &expr->entry );
4214 return list;
4215 }
4216
4217 static struct list type_pool = LIST_INIT(type_pool);
4218 typedef struct
4219 {
4220 type_t data;
4221 struct list link;
4222 } type_pool_node_t;
4223
4224 type_t *alloc_type(void)
4225 {
4226 type_pool_node_t *node = xmalloc(sizeof *node);
4227 list_add_tail(&type_pool, &node->link);
4228 return &node->data;
4229 }
4230
4231 void set_all_tfswrite(int val)
4232 {
4233 type_pool_node_t *node;
4234 LIST_FOR_EACH_ENTRY(node, &type_pool, type_pool_node_t, link)
4235 node->data.tfswrite = val;
4236 }
4237
4238 static type_t *make_type(unsigned char type, type_t *ref)
4239 {
4240 type_t *t = alloc_type();
4241 t->name = NULL;
4242 t->kind = TKIND_PRIMITIVE;
4243 t->type = type;
4244 t->ref = ref;
4245 t->attrs = NULL;
4246 t->orig = NULL;
4247 t->funcs = NULL;
4248 t->fields = NULL;
4249 t->ifaces = NULL;
4250 t->dim = 0;
4251 t->size_is = NULL;
4252 t->length_is = NULL;
4253 t->typestring_offset = 0;
4254 t->ptrdesc = 0;
4255 t->declarray = FALSE;
4256 t->ignore = (parse_only != 0);
4257 t->is_const = FALSE;
4258 t->sign = 0;
4259 t->defined = FALSE;
4260 t->written = FALSE;
4261 t->user_types_registered = FALSE;
4262 t->tfswrite = FALSE;
4263 t->typelib_idx = -1;
4264 return t;
4265 }
4266
4267 static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr,
4268 int top)
4269 {
4270 expr_list_t *sizes = get_attrp(v->attrs, ATTR_SIZEIS);
4271 expr_list_t *lengs = get_attrp(v->attrs, ATTR_LENGTHIS);
4272 int ptr_attr = get_attrv(v->attrs, ATTR_POINTERTYPE);
4273 int ptr_type = ptr_attr;
4274 int sizeless, has_varconf;
4275 expr_t *dim;
4276 type_t *atype, **ptype;
4277
4278 v->type = type;
4279
4280 if (!ptr_type && top)
4281 ptr_type = RPC_FC_RP;
4282
4283 for ( ; 0 < ptr_level; --ptr_level)
4284 {
4285 v->type = make_type(pointer_default, v->type);
4286 if (ptr_level == 1 && ptr_type && !arr)
4287 {
4288 v->type->type = ptr_type;
4289 ptr_type = 0;
4290 }
4291 }
4292
4293 if (ptr_type && !arr)
4294 {
4295 if (is_ptr(v->type))
4296 {
4297 if (v->type->type != ptr_type)
4298 {
4299 v->type = duptype(v->type, 1);
4300 v->type->type = ptr_type;
4301 }
4302 }
4303 else if (!arr && ptr_attr)
4304 error("%s: pointer attribute applied to non-pointer type\n", v->name);
4305 }
4306
4307 sizeless = FALSE;
4308 if (arr) LIST_FOR_EACH_ENTRY_REV(dim, arr, expr_t, entry)
4309 {
4310 if (sizeless)
4311 error("%s: only the first array dimension can be unspecified\n", v->name);
4312
4313 if (dim->is_const)
4314 {
4315 unsigned int align = 0;
4316 size_t size = type_memsize(v->type, &align);
4317
4318 if (dim->cval <= 0)
4319 error("%s: array dimension must be positive\n", v->name);
4320
4321 if (0xffffffffuL / size < (unsigned long) dim->cval)
4322 error("%s: total array size is too large\n", v->name);
4323 else if (0xffffuL < size * dim->cval)
4324 v->type = make_type(RPC_FC_LGFARRAY, v->type);
4325 else
4326 v->type = make_type(RPC_FC_SMFARRAY, v->type);
4327 }
4328 else
4329 {
4330 sizeless = TRUE;
4331 v->type = make_type(RPC_FC_CARRAY, v->type);
4332 }
4333
4334 v->type->declarray = TRUE;
4335 v->type->dim = dim->cval;
4336 }
4337
4338 ptype = &v->type;
4339 has_varconf = FALSE;
4340 if (sizes) LIST_FOR_EACH_ENTRY(dim, sizes, expr_t, entry)
4341 {
4342 if (dim->type != EXPR_VOID)
4343 {
4344 has_varconf = TRUE;
4345 atype = *ptype = duptype(*ptype, 0);
4346
4347 if (atype->type == RPC_FC_SMFARRAY || atype->type == RPC_FC_LGFARRAY)
4348 error("%s: cannot specify size_is for a fixed sized array\n", v->name);
4349
4350 if (atype->type != RPC_FC_CARRAY && !is_ptr(atype))
4351 error("%s: size_is attribute applied to illegal type\n", v->name);
4352
4353 atype->type = RPC_FC_CARRAY;
4354 atype->size_is = dim;
4355 }
4356
4357 ptype = &(*ptype)->ref;
4358 if (*ptype == NULL)
4359 error("%s: too many expressions in size_is attribute\n", v->name);
4360 }
4361
4362 ptype = &v->type;
4363 if (lengs) LIST_FOR_EACH_ENTRY(dim, lengs, expr_t, entry)
4364 {
4365 if (dim->type != EXPR_VOID)
4366 {
4367 has_varconf = TRUE;
4368 atype = *ptype = duptype(*ptype, 0);
4369
4370 if (atype->type == RPC_FC_SMFARRAY)
4371 atype->type = RPC_FC_SMVARRAY;
4372 else if (atype->type == RPC_FC_LGFARRAY)
4373 atype->type = RPC_FC_LGVARRAY;
4374 else if (atype->type == RPC_FC_CARRAY)
4375 atype->type = RPC_FC_CVARRAY;
4376 else
4377 error("%s: length_is attribute applied to illegal type\n", v->name);
4378
4379 atype->length_is = dim;
4380 }
4381
4382 ptype = &(*ptype)->ref;
4383 if (*ptype == NULL)
4384 error("%s: too many expressions in length_is attribute\n", v->name);
4385 }
4386
4387 if (has_varconf && !last_array(v->type))
4388 {
4389 ptype = &v->type;
4390 for (ptype = &v->type; is_array(*ptype); ptype = &(*ptype)->ref)
4391 {
4392 *ptype = duptype(*ptype, 0);
4393 (*ptype)->type = RPC_FC_BOGUS_ARRAY;
4394 }
4395 }
4396
4397 if (is_array(v->type))
4398 {
4399 const type_t *rt = v->type->ref;
4400 if (is_user_type(rt))
4401 v->type->type = RPC_FC_BOGUS_ARRAY;
4402 else
4403 switch (rt->type)
4404 {
4405 case RPC_FC_BOGUS_STRUCT:
4406 case RPC_FC_NON_ENCAPSULATED_UNION:
4407 case RPC_FC_ENCAPSULATED_UNION:
4408 case RPC_FC_ENUM16:
4409 v->type->type = RPC_FC_BOGUS_ARRAY;
4410 break;
4411 /* FC_RP should be above, but widl overuses these, and will break things. */
4412 case RPC_FC_UP:
4413 case RPC_FC_RP:
4414 if (rt->ref->type == RPC_FC_IP)
4415 v->type->type = RPC_FC_BOGUS_ARRAY;
4416 break;
4417 }
4418 }
4419 }
4420
4421 static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface)
4422 {
4423 if (!iface) return list;
4424 if (!list)
4425 {
4426 list = xmalloc( sizeof(*list) );
4427 list_init( list );
4428 }
4429 list_add_tail( list, &iface->entry );
4430 return list;
4431 }
4432
4433 static ifref_t *make_ifref(type_t *iface)
4434 {
4435 ifref_t *l = xmalloc(sizeof(ifref_t));
4436 l->iface = iface;
4437 l->attrs = NULL;
4438 return l;
4439 }
4440
4441 static var_list_t *append_var(var_list_t *list, var_t *var)
4442 {
4443 if (!var) return list;
4444 if (!list)
4445 {
4446 list = xmalloc( sizeof(*list) );
4447 list_init( list );
4448 }
4449 list_add_tail( list, &var->entry );
4450 return list;
4451 }
4452
4453 static var_t *make_var(char *name)
4454 {
4455 var_t *v = xmalloc(sizeof(var_t));
4456 v->name = name;
4457 v->type = NULL;
4458 v->args = NULL;
4459 v->attrs = NULL;
4460 v->eval = NULL;
4461 return v;
4462 }
4463
4464 static pident_list_t *append_pident(pident_list_t *list, pident_t *p)
4465 {
4466 if (!p) return list;
4467 if (!list) {
4468 list = xmalloc(sizeof(*list));
4469 list_init(list);
4470 }
4471 list_add_tail(list, &p->entry);
4472 return list;
4473 }
4474
4475 static pident_t *make_pident(var_t *var)
4476 {
4477 pident_t *p = xmalloc(sizeof(*p));
4478 p->var = var;
4479 p->ptr_level = 0;
4480 return p;
4481 }
4482
4483 static func_list_t *append_func(func_list_t *list, func_t *func)
4484 {
4485 if (!func) return list;
4486 if (!list)
4487 {
4488 list = xmalloc( sizeof(*list) );
4489 list_init( list );
4490 }
4491 list_add_tail( list, &func->entry );
4492 return list;
4493 }
4494
4495 static func_t *make_func(var_t *def, var_list_t *args)
4496 {
4497 func_t *f = xmalloc(sizeof(func_t));
4498 f->def = def;
4499 f->args = args;
4500 f->ignore = parse_only;
4501 f->idx = -1;
4502 return f;
4503 }
4504
4505 static type_t *make_class(char *name)
4506 {
4507 type_t *c = make_type(0, NULL);
4508 c->name = name;
4509 c->kind = TKIND_COCLASS;
4510 return c;
4511 }
4512
4513 static type_t *make_safearray(type_t *type)
4514 {
4515 type_t *sa = duptype(find_type("SAFEARRAY", 0), 1);
4516 sa->ref = type;
4517 return make_type(pointer_default, sa);
4518 }
4519
4520 #define HASHMAX 64
4521
4522 static int hash_ident(const char *name)
4523 {
4524 const char *p = name;
4525 int sum = 0;
4526 /* a simple sum hash is probably good enough */
4527 while (*p) {
4528 sum += *p;
4529 p++;
4530 }
4531 return sum & (HASHMAX-1);
4532 }
4533
4534 /***** type repository *****/
4535
4536 struct rtype {
4537 const char *name;
4538 type_t *type;
4539 int t;
4540 struct rtype *next;
4541 };
4542
4543 struct rtype *type_hash[HASHMAX];
4544
4545 static type_t *reg_type(type_t *type, const char *name, int t)
4546 {
4547 struct rtype *nt;
4548 int hash;
4549 if (!name) {
4550 error_loc("registering named type without name\n");
4551 return type;
4552 }
4553 hash = hash_ident(name);
4554 nt = xmalloc(sizeof(struct rtype));
4555 nt->name = name;
4556 nt->type = type;
4557 nt->t = t;
4558 nt->next = type_hash[hash];
4559 type_hash[hash] = nt;
4560 return type;
4561 }
4562
4563 static int is_incomplete(const type_t *t)
4564 {
4565 return !t->defined && (is_struct(t->type) || is_union(t->type));
4566 }
4567
4568 static void add_incomplete(type_t *t)
4569 {
4570 struct typenode *tn = xmalloc(sizeof *tn);
4571 tn->type = t;
4572 list_add_tail(&incomplete_types, &tn->entry);
4573 }
4574
4575 static void fix_type(type_t *t)
4576 {
4577 if (t->kind == TKIND_ALIAS && is_incomplete(t)) {
4578 type_t *ot = t->orig;
4579 fix_type(ot);
4580 t->fields = ot->fields;
4581 t->defined = ot->defined;
4582 }
4583 }
4584
4585 static void fix_incomplete(void)
4586 {
4587 struct typenode *tn, *next;
4588
4589 LIST_FOR_EACH_ENTRY_SAFE(tn, next, &incomplete_types, struct typenode, entry) {
4590 fix_type(tn->type);
4591 free(tn);
4592 }
4593 }
4594
4595 static type_t *reg_typedefs(type_t *type, pident_list_t *pidents, attr_list_t *attrs)
4596 {
4597 type_t *ptr = type;
4598 const pident_t *pident;
4599 int ptrc = 0;
4600 int is_str = is_attr(attrs, ATTR_STRING);
4601 unsigned char ptr_type = get_attrv(attrs, ATTR_POINTERTYPE);
4602
4603 if (is_str)
4604 {
4605 type_t *t = type;
4606 unsigned char c;
4607
4608 while (is_ptr(t))
4609 t = t->ref;
4610
4611 c = t->type;
4612 if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR)
4613 {
4614 pident = LIST_ENTRY( list_head( pidents ), const pident_t, entry );
4615 error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
4616 pident->var->name);
4617 }
4618 }
4619
4620 /* We must generate names for tagless enum, struct or union.
4621 Typedef-ing a tagless enum, struct or union means we want the typedef
4622 to be included in a library whether it has other attributes or not,
4623 hence the public attribute. */
4624 if ((type->kind == TKIND_ENUM || type->kind == TKIND_RECORD
4625 || type->kind == TKIND_UNION) && ! type->name && ! parse_only)
4626 {
4627 if (! is_attr(attrs, ATTR_PUBLIC))
4628 attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
4629 type->name = gen_name();
4630 }
4631
4632 LIST_FOR_EACH_ENTRY( pident, pidents, const pident_t, entry )
4633 {
4634 var_t *name = pident->var;
4635
4636 if (name->name) {
4637 type_t *cur = ptr;
4638 int cptr = pident->ptr_level;
4639 if (cptr > ptrc) {
4640 while (cptr > ptrc) {
4641 cur = ptr = make_type(pointer_default, cur);
4642 ptrc++;
4643 }
4644 } else {
4645 while (cptr < ptrc) {
4646 cur = cur->ref;
4647 cptr++;
4648 }
4649 }
4650 cur = alias(cur, name->name);
4651 cur->attrs = attrs;
4652 if (ptr_type)
4653 {
4654 if (is_ptr(cur))
4655 cur->type = ptr_type;
4656 else
4657 error_loc("'%s': pointer attribute applied to non-pointer type\n",
4658 cur->name);
4659 }
4660 else if (is_str && ! is_ptr(cur))
4661 error_loc("'%s': [string] attribute applied to non-pointer type\n",
4662 cur->name);
4663
4664 if (is_incomplete(cur))
4665 add_incomplete(cur);
4666 reg_type(cur, cur->name, 0);
4667 }
4668 }
4669 return type;
4670 }
4671
4672 static type_t *find_type(const char *name, int t)
4673 {
4674 struct rtype *cur = type_hash[hash_ident(name)];
4675 while (cur && (cur->t != t || strcmp(cur->name, name)))
4676 cur = cur->next;
4677 if (!cur) {
4678 error_loc("type '%s' not found\n", name);
4679 return NULL;
4680 }
4681 return cur->type;
4682 }
4683
4684 static type_t *find_type2(char *name, int t)
4685 {
4686 type_t *tp = find_type(name, t);
4687 free(name);
4688 return tp;
4689 }
4690
4691 int is_type(const char *name)
4692 {
4693 struct rtype *cur = type_hash[hash_ident(name)];
4694 while (cur && (cur->t || strcmp(cur->name, name)))
4695 cur = cur->next;
4696 if (cur) return TRUE;
4697 return FALSE;
4698 }
4699
4700 static type_t *get_type(unsigned char type, char *name, int t)
4701 {
4702 struct rtype *cur = NULL;
4703 type_t *tp;
4704 if (name) {
4705 cur = type_hash[hash_ident(name)];
4706 while (cur && (cur->t != t || strcmp(cur->name, name)))
4707 cur = cur->next;
4708 }
4709 if (cur) {
4710 free(name);
4711 return cur->type;
4712 }
4713 tp = make_type(type, NULL);
4714 tp->name = name;
4715 if (!name) return tp;
4716 return reg_type(tp, name, t);
4717 }
4718
4719 static type_t *get_typev(unsigned char type, var_t *name, int t)
4720 {
4721 char *sname = NULL;
4722 if (name) {
4723 sname = name->name;
4724 free(name);
4725 }
4726 return get_type(type, sname, t);
4727 }
4728
4729 static int get_struct_type(var_list_t *fields)
4730 {
4731 int has_pointer = 0;
4732 int has_conformance = 0;
4733 int has_variance = 0;
4734 var_t *field;
4735
4736 if (get_padding(fields))
4737 return RPC_FC_BOGUS_STRUCT;
4738
4739 if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry )
4740 {
4741 type_t *t = field->type;
4742
4743 if (is_user_type(t))
4744 return RPC_FC_BOGUS_STRUCT;
4745
4746 if (is_ptr(t))
4747 {
4748 do
4749 t = t->ref;
4750 while (is_ptr(t));
4751
4752 switch (t->type)
4753 {
4754 case RPC_FC_IP:
4755 case RPC_FC_ENCAPSULATED_UNION:
4756 case RPC_FC_NON_ENCAPSULATED_UNION:
4757 case RPC_FC_BOGUS_STRUCT:
4758 return RPC_FC_BOGUS_STRUCT;
4759 }
4760
4761 has_pointer = 1;
4762 continue;
4763 }
4764
4765 if (field->type->declarray)
4766 {
4767 if (is_string_type(field->attrs, field->type))
4768 {
4769 if (is_conformant_array(field->type))
4770 has_conformance = 1;
4771 has_variance = 1;
4772 continue;
4773 }
4774
4775 if (is_array(field->type->ref))
4776 return RPC_FC_BOGUS_STRUCT;
4777
4778 if (is_conformant_array(field->type))
4779 {
4780 has_conformance = 1;
4781 if (field->type->declarray && list_next(fields, &field->entry))
4782 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
4783 field->name);
4784 }
4785 if (field->type->length_is)
4786 has_variance = 1;
4787
4788 t = field->type->ref;
4789 }
4790
4791 switch (t->type)
4792 {
4793 /*
4794 * RPC_FC_BYTE, RPC_FC_STRUCT, etc
4795 * Simple types don't effect the type of struct.
4796 * A struct containing a simple struct is still a simple struct.
4797 * So long as we can block copy the data, we return RPC_FC_STRUCT.
4798 */
4799 case 0: /* void pointer */
4800 case RPC_FC_BYTE:
4801 case RPC_FC_CHAR:
4802 case RPC_FC_SMALL:
4803 case RPC_FC_USMALL:
4804 case RPC_FC_WCHAR:
4805 case RPC_FC_SHORT:
4806 case RPC_FC_USHORT:
4807 case RPC_FC_LONG:
4808 case RPC_FC_ULONG:
4809 case RPC_FC_INT3264:
4810 case RPC_FC_UINT3264:
4811 case RPC_FC_HYPER:
4812 case RPC_FC_FLOAT:
4813 case RPC_FC_DOUBLE:
4814 case RPC_FC_STRUCT:
4815 case RPC_FC_ENUM16:
4816 case RPC_FC_ENUM32:
4817 break;
4818
4819 case RPC_FC_RP:
4820 case RPC_FC_UP:
4821 case RPC_FC_FP:
4822 case RPC_FC_OP:
4823 case RPC_FC_CARRAY:
4824 case RPC_FC_CVARRAY:
4825 case RPC_FC_BOGUS_ARRAY:
4826 has_pointer = 1;
4827 break;
4828
4829 /*
4830 * Propagate member attributes
4831 * a struct should be at least as complex as its member
4832 */
4833 case RPC_FC_CVSTRUCT:
4834 has_conformance = 1;
4835 has_variance = 1;
4836 has_pointer = 1;
4837 break;
4838
4839 case RPC_FC_CPSTRUCT:
4840 has_conformance = 1;
4841 if (list_next( fields, &field->entry ))
4842 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
4843 field->name);
4844 has_pointer = 1;
4845 break;
4846
4847 case RPC_FC_CSTRUCT:
4848 has_conformance = 1;
4849 if (list_next( fields, &field->entry ))
4850 error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
4851 field->name);
4852 break;
4853
4854 case RPC_FC_PSTRUCT:
4855 has_pointer = 1;
4856 break;
4857
4858 default:
4859 error_loc("Unknown struct member %s with type (0x%02x)\n", field->name, t->type);
4860 /* fallthru - treat it as complex */
4861
4862 /* as soon as we see one of these these members, it's bogus... */
4863 case RPC_FC_ENCAPSULATED_UNION:
4864 case RPC_FC_NON_ENCAPSULATED_UNION:
4865 case RPC_FC_BOGUS_STRUCT:
4866 return RPC_FC_BOGUS_STRUCT;
4867 }
4868 }
4869
4870 if( has_variance )
4871 {
4872 if ( has_conformance )
4873 return RPC_FC_CVSTRUCT;
4874 else
4875 return RPC_FC_BOGUS_STRUCT;
4876 }
4877 if( has_conformance && has_pointer )
4878 return RPC_FC_CPSTRUCT;
4879 if( has_conformance )
4880 return RPC_FC_CSTRUCT;
4881 if( has_pointer )
4882 return RPC_FC_PSTRUCT;
4883 return RPC_FC_STRUCT;
4884 }
4885
4886 /***** constant repository *****/
4887
4888 struct rconst {
4889 char *name;
4890 var_t *var;
4891 struct rconst *next;
4892 };
4893
4894 struct rconst *const_hash[HASHMAX];
4895
4896 static var_t *reg_const(var_t *var)
4897 {
4898 struct rconst *nc;
4899 int hash;
4900 if (!var->name) {
4901 error_loc("registering constant without name\n");
4902 return var;
4903 }
4904 hash = hash_ident(var->name);
4905 nc = xmalloc(sizeof(struct rconst));
4906 nc->name = var->name;
4907 nc->var = var;
4908 nc->next = const_hash[hash];
4909 const_hash[hash] = nc;
4910 return var;
4911 }
4912
4913 static var_t *find_const(char *name, int f)
4914 {
4915 struct rconst *cur = const_hash[hash_ident(name)];
4916 while (cur && strcmp(cur->name, name))
4917 cur = cur->next;
4918 if (!cur) {
4919 if (f) error_loc("constant '%s' not found\n", name);
4920 return NULL;
4921 }
4922 return cur->var;
4923 }
4924
4925 static void write_libid(const char *name, const attr_list_t *attr)
4926 {
4927 const UUID *uuid = get_attrp(attr, ATTR_UUID);
4928 write_guid(idfile, "LIBID", name, uuid);
4929 }
4930
4931 static void write_clsid(type_t *cls)
4932 {
4933 const UUID *uuid = get_attrp(cls->attrs, ATTR_UUID);
4934 write_guid(idfile, "CLSID", cls->name, uuid);
4935 }
4936
4937 static void write_diid(type_t *iface)
4938 {
4939 const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
4940 write_guid(idfile, "DIID", iface->name, uuid);
4941 }
4942
4943 static void write_iid(type_t *iface)
4944 {
4945 const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
4946 write_guid(idfile, "IID", iface->name, uuid);
4947 }
4948
4949 static int compute_method_indexes(type_t *iface)
4950 {
4951 int idx;
4952 func_t *f;
4953
4954 if (iface->ref)
4955 idx = compute_method_indexes(iface->ref);
4956 else
4957 idx = 0;
4958
4959 if (!iface->funcs)
4960 return idx;
4961
4962 LIST_FOR_EACH_ENTRY( f, iface->funcs, func_t, entry )
4963 if (! is_callas(f->def->attrs))
4964 f->idx = idx++;
4965
4966 return idx;
4967 }
4968
4969 static char *gen_name(void)
4970 {
4971 static const char format[] = "__WIDL_%s_generated_name_%08lX";
4972 static unsigned long n = 0;
4973 static const char *file_id;
4974 static size_t size;
4975 char *name;
4976
4977 if (! file_id)
4978 {
4979 char *dst = dup_basename(input_name, ".idl");
4980 file_id = dst;
4981
4982 for (; *dst; ++dst)
4983 if (! isalnum((unsigned char) *dst))
4984 *dst = '_';
4985
4986 size = sizeof format - 7 + strlen(file_id) + 8;
4987 }
4988
4989 name = xmalloc(size);
4990 sprintf(name, format, file_id, n++);
4991 return name;
4992 }
4993
4994 static void process_typedefs(pident_list_t *pidents)
4995 {
4996 pident_t *pident, *next;
4997
4998 if (!pidents) return;
4999 LIST_FOR_EACH_ENTRY_SAFE( pident, next, pidents, pident_t, entry )
5000 {
5001 var_t *var = pident->var;
5002 type_t *type = find_type(var->name, 0);
5003
5004 if (! parse_only && do_header)
5005 write_typedef(type);
5006 if (in_typelib && type->attrs)
5007 add_typelib_entry(type);
5008
5009 free(pident);
5010 free(var);
5011 }
5012 }
5013
5014 static void check_arg(var_t *arg)
5015 {
5016 type_t *t = arg->type;
5017
5018 if (t->type == 0 && ! is_var_ptr(arg))
5019 error_loc("argument '%s' has void type\n", arg->name);
5020 }
5021
5022 static void check_all_user_types(ifref_list_t *ifrefs)
5023 {
5024 const ifref_t *ifref;
5025 const func_t *f;
5026
5027 if (ifrefs) LIST_FOR_EACH_ENTRY(ifref, ifrefs, const ifref_t, entry)
5028 {
5029 const func_list_t *fs = ifref->iface->funcs;
5030 if (fs) LIST_FOR_EACH_ENTRY(f, fs, const func_t, entry)
5031 check_for_user_types_and_context_handles(f->args);
5032 }
5033 }
5034
5035 int is_valid_uuid(const char *s)
5036 {
5037 int i;
5038
5039 for (i = 0; i < 36; ++i)
5040 if (i == 8 || i == 13 || i == 18 || i == 23)
5041 {
5042 if (s[i] != '-')
5043 return FALSE;
5044 }
5045 else
5046 if (!isxdigit(s[i]))
5047 return FALSE;
5048
5049 return s[i] == '\0';
5050 }
5051