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