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