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