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