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