]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - usr.bin/yacc/tests/regress.08.out
MFC various moves of tools/regressions/ tests to the new infrastructure.
[FreeBSD/stable/10.git] / usr.bin / yacc / tests / regress.08.out
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar     1.9 (Berkeley) 02/21/93";
3 #endif
4
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYPATCH 20140101
9
10 #define YYEMPTY        (-1)
11 #define yyclearin      (yychar = YYEMPTY)
12 #define yyerrok        (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14
15 #define YYPREFIX "yy"
16
17 #define YYPURE 0
18
19 #line 9 "grammar.y"
20 #ifdef YYBISON
21 #include <stdlib.h>
22 #define YYSTYPE_IS_DECLARED
23 #define yyerror yaccError
24 #endif
25
26 #if defined(YYBISON) || !defined(YYBYACC)
27 static void yyerror(const char *s);
28 #endif
29 #line 81 "grammar.y"
30 #include <stdio.h>
31 #include <ctype.h>
32 #include <string.h>
33
34 #define OPT_LINTLIBRARY 1
35
36 #ifndef TRUE
37 #define TRUE    (1)
38 #endif
39
40 #ifndef FALSE
41 #define FALSE   (0)
42 #endif
43
44 /* #include "cproto.h" */
45 #define MAX_TEXT_SIZE 1024
46
47 /* Prototype styles */
48 #if OPT_LINTLIBRARY
49 #define PROTO_ANSI_LLIB         -2      /* form ANSI lint-library source */
50 #define PROTO_LINTLIBRARY       -1      /* form lint-library source */
51 #endif
52 #define PROTO_NONE              0       /* do not output any prototypes */
53 #define PROTO_TRADITIONAL       1       /* comment out parameters */
54 #define PROTO_ABSTRACT          2       /* comment out parameter names */
55 #define PROTO_ANSI              3       /* ANSI C prototype */
56
57 typedef int PrototypeStyle;
58
59 typedef char boolean;
60
61 extern boolean types_out;
62 extern PrototypeStyle proto_style;
63
64 #define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
65 #define knrLintLibrary()  (proto_style == PROTO_LINTLIBRARY)
66 #define lintLibrary()     (knrLintLibrary() || ansiLintLibrary())
67
68 #if OPT_LINTLIBRARY
69 #define FUNC_UNKNOWN            -1      /* unspecified */
70 #else
71 #define FUNC_UNKNOWN            0       /* unspecified (same as FUNC_NONE) */
72 #endif
73 #define FUNC_NONE               0       /* not a function definition */
74 #define FUNC_TRADITIONAL        1       /* traditional style */
75 #define FUNC_ANSI               2       /* ANSI style */
76 #define FUNC_BOTH               3       /* both styles */
77
78 typedef int FuncDefStyle;
79
80 /* Source file text */
81 typedef struct text {
82     char text[MAX_TEXT_SIZE];   /* source text */
83     long begin;                 /* offset in temporary file */
84 } Text;
85
86 /* Declaration specifier flags */
87 #define DS_NONE         0       /* default */
88 #define DS_EXTERN       1       /* contains "extern" specifier */
89 #define DS_STATIC       2       /* contains "static" specifier */
90 #define DS_CHAR         4       /* contains "char" type specifier */
91 #define DS_SHORT        8       /* contains "short" type specifier */
92 #define DS_FLOAT        16      /* contains "float" type specifier */
93 #define DS_INLINE       32      /* contains "inline" specifier */
94 #define DS_JUNK         64      /* we're not interested in this declaration */
95
96 /* This structure stores information about a declaration specifier. */
97 typedef struct decl_spec {
98     unsigned short flags;       /* flags defined above */
99     char *text;                 /* source text */
100     long begin;                 /* offset in temporary file */
101 } DeclSpec;
102
103 /* This is a list of function parameters. */
104 typedef struct _ParameterList {
105     struct parameter *first;    /* pointer to first parameter in list */
106     struct parameter *last;     /* pointer to last parameter in list */  
107     long begin_comment;         /* begin offset of comment */
108     long end_comment;           /* end offset of comment */
109     char *comment;              /* comment at start of parameter list */
110 } ParameterList;
111
112 /* This structure stores information about a declarator. */
113 typedef struct _Declarator {
114     char *name;                         /* name of variable or function */
115     char *text;                         /* source text */
116     long begin;                         /* offset in temporary file */
117     long begin_comment;                 /* begin offset of comment */
118     long end_comment;                   /* end offset of comment */
119     FuncDefStyle func_def;              /* style of function definition */
120     ParameterList params;               /* function parameters */
121     boolean pointer;                    /* TRUE if it declares a pointer */
122     struct _Declarator *head;           /* head function declarator */
123     struct _Declarator *func_stack;     /* stack of function declarators */
124     struct _Declarator *next;           /* next declarator in list */
125 } Declarator;
126
127 /* This structure stores information about a function parameter. */
128 typedef struct parameter {
129     struct parameter *next;     /* next parameter in list */
130     DeclSpec decl_spec;
131     Declarator *declarator;
132     char *comment;              /* comment following the parameter */
133 } Parameter;
134
135 /* This is a list of declarators. */
136 typedef struct declarator_list {
137     Declarator *first;          /* pointer to first declarator in list */
138     Declarator *last;           /* pointer to last declarator in list */  
139 } DeclaratorList;
140
141 /* #include "symbol.h" */
142 typedef struct symbol {
143     struct symbol *next;        /* next symbol in list */
144     char *name;                 /* name of symbol */
145     char *value;                /* value of symbol (for defines) */
146     short flags;                /* symbol attributes */
147 } Symbol;
148
149 /* parser stack entry type */
150 typedef union {
151     Text text;
152     DeclSpec decl_spec;
153     Parameter *parameter;
154     ParameterList param_list;
155     Declarator *declarator;
156     DeclaratorList decl_list;
157 } YYSTYPE;
158
159 /* The hash table length should be a prime number. */
160 #define SYM_MAX_HASH 251
161
162 typedef struct symbol_table {
163     Symbol *bucket[SYM_MAX_HASH];       /* hash buckets */
164 } SymbolTable;
165
166 extern SymbolTable *new_symbol_table    /* Create symbol table */
167         (void);
168 extern void free_symbol_table           /* Destroy symbol table */
169         (SymbolTable *s);
170 extern Symbol *find_symbol              /* Lookup symbol name */
171         (SymbolTable *s, const char *n);
172 extern Symbol *new_symbol               /* Define new symbol */
173         (SymbolTable *s, const char *n, const char *v, int f);
174
175 /* #include "semantic.h" */
176 extern void new_decl_spec (DeclSpec *, const char *, long, int);
177 extern void free_decl_spec (DeclSpec *);
178 extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
179 extern void check_untagged (DeclSpec *);
180 extern Declarator *new_declarator (const char *, const char *, long);
181 extern void free_declarator (Declarator *);
182 extern void new_decl_list (DeclaratorList *, Declarator *);
183 extern void free_decl_list (DeclaratorList *);
184 extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
185 extern Parameter *new_parameter (DeclSpec *, Declarator *);
186 extern void free_parameter (Parameter *);
187 extern void new_param_list (ParameterList *, Parameter *);
188 extern void free_param_list (ParameterList *);
189 extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
190 extern void new_ident_list (ParameterList *);
191 extern void add_ident_list (ParameterList *, ParameterList *, const char *);
192 extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
193 extern void gen_declarations (DeclSpec *, DeclaratorList *);
194 extern void gen_prototype (DeclSpec *, Declarator *);
195 extern void gen_func_declarator (Declarator *);
196 extern void gen_func_definition (DeclSpec *, Declarator *);
197
198 extern void init_parser     (void);
199 extern void process_file    (FILE *infile, char *name);
200 extern char *cur_text       (void);
201 extern char *cur_file_name  (void);
202 extern char *implied_typedef (void);
203 extern void include_file    (char *name, int convert);
204 extern char *supply_parm    (int count);
205 extern char *xstrdup        (const char *);
206 extern int already_declared (char *name);
207 extern int is_actual_func   (Declarator *d);
208 extern int lint_ellipsis    (Parameter *p);
209 extern int want_typedef     (void);
210 extern void begin_tracking  (void);
211 extern void begin_typedef   (void);
212 extern void copy_typedef    (char *s);
213 extern void ellipsis_varargs (Declarator *d);
214 extern void end_typedef     (void);
215 extern void flush_varargs   (void);
216 extern void fmt_library     (int code);
217 extern void imply_typedef   (const char *s);
218 extern void indent          (FILE *outf);
219 extern void put_blankline   (FILE *outf);
220 extern void put_body        (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
221 extern void put_char        (FILE *outf, int c);
222 extern void put_error       (void);
223 extern void put_newline     (FILE *outf);
224 extern void put_padded      (FILE *outf, const char *s);
225 extern void put_string      (FILE *outf, const char *s);
226 extern void track_in        (void);
227
228 extern boolean file_comments;
229 extern FuncDefStyle func_style;
230 extern char base_file[];
231
232 extern  int     yylex (void);
233
234 /* declaration specifier attributes for the typedef statement currently being
235  * scanned
236  */
237 static int cur_decl_spec_flags;
238
239 /* pointer to parameter list for the current function definition */
240 static ParameterList *func_params;
241
242 /* A parser semantic action sets this pointer to the current declarator in
243  * a function parameter declaration in order to catch any comments following
244  * the parameter declaration on the same line.  If the lexer scans a comment
245  * and <cur_declarator> is not NULL, then the comment is attached to the
246  * declarator.  To ignore subsequent comments, the lexer sets this to NULL
247  * after scanning a comment or end of line.
248  */
249 static Declarator *cur_declarator;
250
251 /* temporary string buffer */
252 static char buf[MAX_TEXT_SIZE];
253
254 /* table of typedef names */
255 static SymbolTable *typedef_names;
256
257 /* table of define names */
258 static SymbolTable *define_names;
259
260 /* table of type qualifiers */
261 static SymbolTable *type_qualifiers;
262
263 /* information about the current input file */
264 typedef struct {
265     char *base_name;            /* base input file name */
266     char *file_name;            /* current file name */
267     FILE *file;                 /* input file */
268     unsigned line_num;          /* current line number in input file */
269     FILE *tmp_file;             /* temporary file */
270     long begin_comment;         /* tmp file offset after last written ) or ; */
271     long end_comment;           /* tmp file offset after last comment */
272     boolean convert;            /* if TRUE, convert function definitions */
273     boolean changed;            /* TRUE if conversion done in this file */
274 } IncludeStack;
275
276 static IncludeStack *cur_file;  /* current input file */
277
278 /* #include "yyerror.c" */
279
280 static int haveAnsiParam (void);
281
282
283 /* Flags to enable us to find if a procedure returns a value.
284  */
285 static int return_val;  /* nonzero on BRACES iff return-expression found */
286
287 static const char *
288 dft_decl_spec (void)
289 {
290     return (lintLibrary() && !return_val) ? "void" : "int";
291 }
292
293 static int
294 haveAnsiParam (void)
295 {
296     Parameter *p;
297     if (func_params != 0) {
298         for (p = func_params->first; p != 0; p = p->next) {
299             if (p->declarator->func_def == FUNC_ANSI) {
300                 return TRUE;
301             }
302         }
303     }
304     return FALSE;
305 }
306 #line 306 "/dev/stdout"
307
308 /* compatibility with bison */
309 #ifdef YYPARSE_PARAM
310 /* compatibility with FreeBSD */
311 # ifdef YYPARSE_PARAM_TYPE
312 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
313 # else
314 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
315 # endif
316 #else
317 # define YYPARSE_DECL() yyparse(void)
318 #endif
319
320 /* Parameters sent to lex. */
321 #ifdef YYLEX_PARAM
322 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
323 # define YYLEX yylex(YYLEX_PARAM)
324 #else
325 # define YYLEX_DECL() yylex(void)
326 # define YYLEX yylex()
327 #endif
328
329 /* Parameters sent to yyerror. */
330 #ifndef YYERROR_DECL
331 #define YYERROR_DECL() yyerror(const char *s)
332 #endif
333 #ifndef YYERROR_CALL
334 #define YYERROR_CALL(msg) yyerror(msg)
335 #endif
336
337 extern int YYPARSE_DECL();
338
339 #define T_IDENTIFIER 257
340 #define T_TYPEDEF_NAME 258
341 #define T_DEFINE_NAME 259
342 #define T_AUTO 260
343 #define T_EXTERN 261
344 #define T_REGISTER 262
345 #define T_STATIC 263
346 #define T_TYPEDEF 264
347 #define T_INLINE 265
348 #define T_EXTENSION 266
349 #define T_CHAR 267
350 #define T_DOUBLE 268
351 #define T_FLOAT 269
352 #define T_INT 270
353 #define T_VOID 271
354 #define T_LONG 272
355 #define T_SHORT 273
356 #define T_SIGNED 274
357 #define T_UNSIGNED 275
358 #define T_ENUM 276
359 #define T_STRUCT 277
360 #define T_UNION 278
361 #define T_Bool 279
362 #define T_Complex 280
363 #define T_Imaginary 281
364 #define T_TYPE_QUALIFIER 282
365 #define T_BRACKETS 283
366 #define T_LBRACE 284
367 #define T_MATCHRBRACE 285
368 #define T_ELLIPSIS 286
369 #define T_INITIALIZER 287
370 #define T_STRING_LITERAL 288
371 #define T_ASM 289
372 #define T_ASMARG 290
373 #define T_VA_DCL 291
374 #define YYERRCODE 256
375 static const short yylhs[] = {                           -1,
376     0,    0,   26,   26,   27,   27,   27,   27,   27,   27,
377    27,   31,   30,   30,   28,   28,   34,   28,   32,   32,
378    33,   33,   35,   35,   37,   38,   29,   39,   29,   36,
379    36,   36,   40,   40,    1,    1,    2,    2,    2,    3,
380     3,    3,    3,    3,    3,    4,    4,    4,    4,    4,
381     4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
382     5,    5,    6,    6,    6,   19,   19,    8,    8,    9,
383    41,    9,    7,    7,    7,   25,   23,   23,   10,   10,
384    11,   11,   11,   11,   11,   20,   20,   21,   21,   22,
385    22,   14,   14,   15,   15,   16,   16,   16,   17,   17,
386    18,   18,   24,   24,   12,   12,   12,   13,   13,   13,
387    13,   13,   13,   13,
388 };
389 static const short yylen[] = {                            2,
390     0,    1,    1,    2,    1,    1,    1,    1,    3,    2,
391     2,    2,    3,    3,    2,    3,    0,    5,    2,    1,
392     0,    1,    1,    3,    0,    0,    7,    0,    5,    0,
393     1,    1,    1,    2,    1,    2,    1,    1,    1,    1,
394     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
395     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
396     1,    1,    3,    2,    2,    1,    1,    1,    3,    1,
397     0,    4,    3,    2,    2,    1,    1,    1,    2,    1,
398     1,    3,    2,    4,    4,    2,    3,    0,    1,    1,
399     2,    1,    3,    1,    3,    2,    2,    1,    0,    1,
400     1,    3,    1,    2,    1,    2,    1,    3,    2,    1,
401     4,    3,    3,    2,
402 };
403 static const short yydefred[] = {                         0,
404     0,    0,    0,    0,   77,    0,   62,   40,    0,   42,
405    43,   20,   44,    0,   46,   47,   48,   49,   54,   50,
406    51,   52,   53,   76,   66,   67,   55,   56,   57,   61,
407     0,    7,    0,    0,   35,   37,   38,   39,   59,   60,
408    28,    0,    0,    0,  103,   81,    0,    0,    3,    5,
409     6,    8,    0,   10,   11,   78,    0,   90,    0,    0,
410   104,    0,   19,    0,   41,   45,   15,   36,    0,   68,
411     0,    0,    0,   83,    0,    0,   64,    0,    0,   74,
412     4,   58,    0,   82,   87,   91,    0,   14,   13,    9,
413    16,    0,   71,    0,   31,   33,    0,    0,    0,    0,
414     0,   94,    0,    0,  101,   12,   63,   73,    0,    0,
415    69,    0,    0,    0,   34,    0,  110,   96,   97,    0,
416     0,   84,    0,   85,    0,   23,    0,    0,   72,   26,
417    29,  114,    0,    0,    0,  109,    0,   93,   95,  102,
418    18,    0,    0,  108,  113,  112,    0,   24,   27,  111,
419 };
420 static const short yydgoto[] = {                         33,
421    87,   35,   36,   37,   38,   39,   40,   69,   70,   41,
422    42,  119,  120,  100,  101,  102,  103,  104,   43,   44,
423    59,   60,   45,   46,   47,   48,   49,   50,   51,   52,
424    77,   53,  127,  109,  128,   97,   94,  143,   72,   98,
425   112,
426 };
427 static const short yysindex[] = {                        -2,
428    -3,   27, -239, -177,    0,    0,    0,    0, -274,    0,
429     0,    0,    0, -246,    0,    0,    0,    0,    0,    0,
430     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
431  -266,    0,    0,  455,    0,    0,    0,    0,    0,    0,
432     0,  -35, -245,  128,    0,    0, -245,   -2,    0,    0,
433     0,    0,  642,    0,    0,    0,  -15,    0,  -12, -239,
434     0,  590,    0,  -27,    0,    0,    0,    0,  -10,    0,
435   -11,  534,  -72,    0, -237, -232,    0,  -35, -232,    0,
436     0,    0,  642,    0,    0,    0,  455,    0,    0,    0,
437     0,   27,    0,  534,    0,    0, -222,  617,  209,   34,
438    39,    0,   44,   42,    0,    0,    0,    0,   27,  -11,
439     0, -200, -196, -195,    0,  174,    0,    0,    0,  -33,
440   243,    0,  561,    0, -177,    0,   33,   49,    0,    0,
441     0,    0,   53,   55,  417,    0,  -33,    0,    0,    0,
442     0,   27, -188,    0,    0,    0,   57,    0,    0,    0,
443 };
444 static const short yyrindex[] = {                        99,
445     0,    0,  275,    0,    0,  -38,    0,    0,  481,    0,
446     0,    0,    0,  509,    0,    0,    0,    0,    0,    0,
447     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
448     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
449     0,   30,    0,    0,    0,    0,    0,  101,    0,    0,
450     0,    0,    0,    0,    0,    0,    0,    0,  343,  309,
451     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
452    98, -182,   62,    0,    0,  133,    0,   64,  379,    0,
453     0,    0,   -5,    0,    0,    0,    0,    0,    0,    0,
454     0,    0,    0, -182,    0,    0,    0, -180,  -19,    0,
455    65,    0,    0,   68,    0,    0,    0,    0,   51,    9,
456     0,    0,    0,    0,    0,    0,    0,    0,    0,  -13,
457    19,    0,    0,    0,    0,    0,    0,   52,    0,    0,
458     0,    0,    0,    0,    0,    0,   35,    0,    0,    0,
459     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
460 };
461 static const short yygindex[] = {                         0,
462    11,  -17,    0,    0,   13,    0,    0,    0,   20,    8,
463   -43,   -1,   -8,  -89,    0,   -9,    0,    0,    0,  -44,
464     0,    0,    4,    0,    0,    0,   70,  -53,    0,    0,
465   -18,    0,    0,    0,    0,   22,    0,    0,    0,    0,
466     0,
467 };
468 #define YYTABLESIZE 924
469 static const short yytable[] = {                         58,
470    78,   58,   58,   58,   73,   58,  135,   61,   88,   57,
471    34,    5,   56,   62,   85,   58,   68,   63,   96,    7,
472    58,   98,   78,   64,   98,   84,  134,  107,   80,    3,
473   107,   90,   17,   92,   17,    4,   17,    2,   75,    3,
474    96,   71,   30,   89,  115,  147,   76,  106,   91,   93,
475    79,   75,   70,   17,  121,   55,   32,  107,   34,  105,
476   108,  114,  105,   83,    4,   68,    2,   70,    3,   68,
477    80,  121,   86,   80,  122,  106,  105,   78,  106,    5,
478    56,   68,  123,   99,  124,  125,  129,  130,   80,  131,
479    80,  141,  142,  144,  110,  145,  149,  150,    1,  110,
480     2,   30,   99,   32,   79,   92,  118,   79,  100,   21,
481    22,  111,  137,  139,  133,  113,  126,   81,    0,    0,
482     0,    0,   79,   57,   79,    0,   99,    0,  140,    0,
483     0,    0,    0,   99,    0,    0,    0,    0,    0,    0,
484     0,   70,    0,    0,    0,   99,    0,    0,    0,  148,
485     0,    0,    0,    0,    0,    0,   70,    0,    0,    0,
486     0,    0,    0,    0,    0,    4,    0,    2,    0,    0,
487    65,    0,   65,   65,   65,    0,   65,    0,    0,    0,
488     0,    0,    0,    0,    5,    6,    7,    8,   65,   10,
489    11,   65,   13,   66,   15,   16,   17,   18,   19,   20,
490    21,   22,   23,   24,   25,   26,   27,   28,   29,   30,
491     0,    4,    0,  116,  132,    3,    0,    0,   58,   58,
492    58,   58,   58,   58,   58,   78,   58,   58,   58,   58,
493    58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
494    58,   58,   58,   58,   58,   78,    4,   74,  116,  136,
495     3,   17,   78,    1,    5,    6,    7,    8,    9,   10,
496    11,   12,   13,   14,   15,   16,   17,   18,   19,   20,
497    21,   22,   23,   24,   25,   26,   27,   28,   29,   30,
498     4,   54,  116,    5,   56,    0,   31,   80,   80,   80,
499    80,   80,   80,   80,   80,   80,   80,   80,   80,   80,
500    80,   80,   80,   80,   80,   80,   80,   80,   80,   80,
501    80,   80,   88,   80,   88,   88,   88,    0,   88,    0,
502    80,   79,   79,   79,   79,   79,   79,   79,   79,   79,
503    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
504    79,   79,   79,   79,   79,   79,   89,   79,   89,   89,
505    89,    0,   89,    0,   79,   25,   25,   25,   25,   25,
506    25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
507    25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
508    86,   25,   86,   86,    5,   56,   86,    0,   25,   65,
509    65,   65,   65,   65,   65,   65,    0,   65,   65,   65,
510    65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
511    65,   65,   65,   65,   65,   65,   75,    0,   75,   75,
512    75,    0,   75,    0,    0,    0,    0,    0,    0,    0,
513     5,    6,    7,    8,   65,   10,   11,   75,   13,   66,
514    15,   16,   17,   18,   19,   20,   21,   22,   23,   24,
515    25,   26,   27,   28,   29,   30,  117,  146,    0,    0,
516     0,    0,    0,    0,    0,    5,    6,    7,    8,   65,
517    10,   11,    0,   13,   66,   15,   16,   17,   18,   19,
518    20,   21,   22,   23,   24,   25,   26,   27,   28,   29,
519    30,  117,    4,    0,    2,    0,    3,    0,    0,    5,
520    56,    0,    0,    0,    0,    0,    0,    0,    0,    0,
521     0,    0,    0,   67,    0,    0,    0,    0,   41,    0,
522    41,    0,   41,    0,    0,  117,    0,    0,    0,    0,
523     0,   88,   88,    0,    0,    0,    0,    0,    0,   41,
524     0,    0,    0,    0,    0,    0,   45,    0,   45,    0,
525    45,    0,    0,    0,    0,    0,    0,   88,    0,    0,
526     0,    0,    0,    0,    0,   89,   89,   45,    0,    0,
527     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
528     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
529     0,   89,    0,    0,    0,    0,    0,    0,    0,   86,
530    86,    0,    0,    0,    0,    0,    0,    0,    0,    0,
531     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
532     0,    0,    0,    0,    0,   86,    0,    0,    0,    0,
533     0,    0,    0,    0,    0,   75,   75,   75,   75,   75,
534    75,   75,    0,   75,   75,   75,   75,   75,   75,   75,
535    75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
536    75,   75,    0,    0,    0,    0,    0,    0,    0,    0,
537     0,    0,    0,    0,   82,    7,    8,   65,   10,   11,
538     0,   13,   66,   15,   16,   17,   18,   19,   20,   21,
539    22,   23,   24,   25,   26,   27,   28,   29,   30,    0,
540     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
541     0,    5,    6,    7,    8,   65,   10,   11,    0,   13,
542    66,   15,   16,   17,   18,   19,   20,   21,   22,   23,
543    24,   25,   26,   27,   28,   29,   30,   41,   41,   41,
544    41,   41,   41,   41,    0,   41,   41,   41,   41,   41,
545    41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
546    41,   41,   41,    0,    0,   45,   45,   45,   45,   45,
547    45,   45,    0,   45,   45,   45,   45,   45,   45,   45,
548    45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
549    45,   82,    7,    8,   65,   10,   11,   12,   13,   14,
550    15,   16,   17,   18,   19,   20,   21,   22,   23,   24,
551    25,   26,   27,   28,   29,   30,    0,    0,   82,    7,
552     8,   65,   10,   11,   95,   13,   66,   15,   16,   17,
553    18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
554    28,   29,   30,    0,    0,    0,  138,   82,    7,    8,
555    65,   10,   11,   12,   13,   14,   15,   16,   17,   18,
556    19,   20,   21,   22,   23,   24,   25,   26,   27,   28,
557    29,   30,    0,   75,   82,    7,    8,   65,   10,   11,
558    12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
559    22,   23,   24,   25,   26,   27,   28,   29,   30,   82,
560     7,    8,   65,   10,   11,    0,   13,   66,   15,   16,
561    17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
562    27,   28,   29,   30,
563 };
564 static const short yycheck[] = {                         38,
565    44,   40,   41,   42,   40,   44,   40,    4,   62,    2,
566     0,  257,  258,  288,   59,    3,   34,  264,   72,  259,
567    59,   41,   61,  290,   44,   41,  116,   41,   47,   42,
568    44,   59,   38,   44,   40,   38,   42,   40,  284,   42,
569    94,   34,  282,   62,   98,  135,   43,  285,   59,   61,
570    47,  284,   44,   59,   99,   59,   59,   76,   48,   41,
571    79,  284,   44,   53,   38,   83,   40,   59,   42,   87,
572    41,  116,   60,   44,   41,   41,   73,  121,   44,  257,
573   258,   99,   44,   73,   41,   44,  287,  284,   59,  285,
574    61,   59,   44,   41,   87,   41,  285,   41,    0,   92,
575     0,  284,   41,  284,   41,   41,   99,   44,   41,   59,
576    59,   92,  121,  123,  116,   94,  109,   48,   -1,   -1,
577    -1,   -1,   59,  116,   61,   -1,  116,   -1,  125,   -1,
578    -1,   -1,   -1,  123,   -1,   -1,   -1,   -1,   -1,   -1,
579    -1,   44,   -1,   -1,   -1,  135,   -1,   -1,   -1,  142,
580    -1,   -1,   -1,   -1,   -1,   -1,   59,   -1,   -1,   -1,
581    -1,   -1,   -1,   -1,   -1,   38,   -1,   40,   -1,   -1,
582    38,   -1,   40,   41,   42,   -1,   44,   -1,   -1,   -1,
583    -1,   -1,   -1,   -1,  257,  258,  259,  260,  261,  262,
584   263,   59,  265,  266,  267,  268,  269,  270,  271,  272,
585   273,  274,  275,  276,  277,  278,  279,  280,  281,  282,
586    -1,   38,   -1,   40,   41,   42,   -1,   -1,  257,  258,
587   259,  260,  261,  262,  263,  264,  265,  266,  267,  268,
588   269,  270,  271,  272,  273,  274,  275,  276,  277,  278,
589   279,  280,  281,  282,  283,  284,   38,  283,   40,  283,
590    42,  257,  291,  256,  257,  258,  259,  260,  261,  262,
591   263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
592   273,  274,  275,  276,  277,  278,  279,  280,  281,  282,
593    38,  285,   40,  257,  258,   -1,  289,  258,  259,  260,
594   261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
595   271,  272,  273,  274,  275,  276,  277,  278,  279,  280,
596   281,  282,   38,  284,   40,   41,   42,   -1,   44,   -1,
597   291,  258,  259,  260,  261,  262,  263,  264,  265,  266,
598   267,  268,  269,  270,  271,  272,  273,  274,  275,  276,
599   277,  278,  279,  280,  281,  282,   38,  284,   40,   41,
600    42,   -1,   44,   -1,  291,  258,  259,  260,  261,  262,
601   263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
602   273,  274,  275,  276,  277,  278,  279,  280,  281,  282,
603    38,  284,   40,   41,  257,  258,   44,   -1,  291,  257,
604   258,  259,  260,  261,  262,  263,   -1,  265,  266,  267,
605   268,  269,  270,  271,  272,  273,  274,  275,  276,  277,
606   278,  279,  280,  281,  282,  283,   38,   -1,   40,   41,
607    42,   -1,   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
608   257,  258,  259,  260,  261,  262,  263,   59,  265,  266,
609   267,  268,  269,  270,  271,  272,  273,  274,  275,  276,
610   277,  278,  279,  280,  281,  282,  283,   41,   -1,   -1,
611    -1,   -1,   -1,   -1,   -1,  257,  258,  259,  260,  261,
612   262,  263,   -1,  265,  266,  267,  268,  269,  270,  271,
613   272,  273,  274,  275,  276,  277,  278,  279,  280,  281,
614   282,  283,   38,   -1,   40,   -1,   42,   -1,   -1,  257,
615   258,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
616    -1,   -1,   -1,   59,   -1,   -1,   -1,   -1,   38,   -1,
617    40,   -1,   42,   -1,   -1,  283,   -1,   -1,   -1,   -1,
618    -1,  257,  258,   -1,   -1,   -1,   -1,   -1,   -1,   59,
619    -1,   -1,   -1,   -1,   -1,   -1,   38,   -1,   40,   -1,
620    42,   -1,   -1,   -1,   -1,   -1,   -1,  283,   -1,   -1,
621    -1,   -1,   -1,   -1,   -1,  257,  258,   59,   -1,   -1,
622    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
623    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
624    -1,  283,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  257,
625   258,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
626    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
627    -1,   -1,   -1,   -1,   -1,  283,   -1,   -1,   -1,   -1,
628    -1,   -1,   -1,   -1,   -1,  257,  258,  259,  260,  261,
629   262,  263,   -1,  265,  266,  267,  268,  269,  270,  271,
630   272,  273,  274,  275,  276,  277,  278,  279,  280,  281,
631   282,  283,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
632    -1,   -1,   -1,   -1,  258,  259,  260,  261,  262,  263,
633    -1,  265,  266,  267,  268,  269,  270,  271,  272,  273,
634   274,  275,  276,  277,  278,  279,  280,  281,  282,   -1,
635    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
636    -1,  257,  258,  259,  260,  261,  262,  263,   -1,  265,
637   266,  267,  268,  269,  270,  271,  272,  273,  274,  275,
638   276,  277,  278,  279,  280,  281,  282,  257,  258,  259,
639   260,  261,  262,  263,   -1,  265,  266,  267,  268,  269,
640   270,  271,  272,  273,  274,  275,  276,  277,  278,  279,
641   280,  281,  282,   -1,   -1,  257,  258,  259,  260,  261,
642   262,  263,   -1,  265,  266,  267,  268,  269,  270,  271,
643   272,  273,  274,  275,  276,  277,  278,  279,  280,  281,
644   282,  258,  259,  260,  261,  262,  263,  264,  265,  266,
645   267,  268,  269,  270,  271,  272,  273,  274,  275,  276,
646   277,  278,  279,  280,  281,  282,   -1,   -1,  258,  259,
647   260,  261,  262,  263,  291,  265,  266,  267,  268,  269,
648   270,  271,  272,  273,  274,  275,  276,  277,  278,  279,
649   280,  281,  282,   -1,   -1,   -1,  286,  258,  259,  260,
650   261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
651   271,  272,  273,  274,  275,  276,  277,  278,  279,  280,
652   281,  282,   -1,  284,  258,  259,  260,  261,  262,  263,
653   264,  265,  266,  267,  268,  269,  270,  271,  272,  273,
654   274,  275,  276,  277,  278,  279,  280,  281,  282,  258,
655   259,  260,  261,  262,  263,   -1,  265,  266,  267,  268,
656   269,  270,  271,  272,  273,  274,  275,  276,  277,  278,
657   279,  280,  281,  282,
658 };
659 #define YYFINAL 33
660 #ifndef YYDEBUG
661 #define YYDEBUG 0
662 #endif
663 #define YYMAXTOKEN 291
664 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a))
665 #if YYDEBUG
666 static const char *yyname[] = {
667
668 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
669 0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
670 "'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
671 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
672 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
673 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
674 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
675 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
676 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
677 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
678 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
679 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
680 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
681 "illegal-symbol",
682 };
683 static const char *yyrule[] = {
684 "$accept : program",
685 "program :",
686 "program : translation_unit",
687 "translation_unit : external_declaration",
688 "translation_unit : translation_unit external_declaration",
689 "external_declaration : declaration",
690 "external_declaration : function_definition",
691 "external_declaration : ';'",
692 "external_declaration : linkage_specification",
693 "external_declaration : T_ASM T_ASMARG ';'",
694 "external_declaration : error T_MATCHRBRACE",
695 "external_declaration : error ';'",
696 "braces : T_LBRACE T_MATCHRBRACE",
697 "linkage_specification : T_EXTERN T_STRING_LITERAL braces",
698 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
699 "declaration : decl_specifiers ';'",
700 "declaration : decl_specifiers init_declarator_list ';'",
701 "$$1 :",
702 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
703 "any_typedef : T_EXTENSION T_TYPEDEF",
704 "any_typedef : T_TYPEDEF",
705 "opt_declarator_list :",
706 "opt_declarator_list : declarator_list",
707 "declarator_list : declarator",
708 "declarator_list : declarator_list ',' declarator",
709 "$$2 :",
710 "$$3 :",
711 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
712 "$$4 :",
713 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
714 "opt_declaration_list :",
715 "opt_declaration_list : T_VA_DCL",
716 "opt_declaration_list : declaration_list",
717 "declaration_list : declaration",
718 "declaration_list : declaration_list declaration",
719 "decl_specifiers : decl_specifier",
720 "decl_specifiers : decl_specifiers decl_specifier",
721 "decl_specifier : storage_class",
722 "decl_specifier : type_specifier",
723 "decl_specifier : type_qualifier",
724 "storage_class : T_AUTO",
725 "storage_class : T_EXTERN",
726 "storage_class : T_REGISTER",
727 "storage_class : T_STATIC",
728 "storage_class : T_INLINE",
729 "storage_class : T_EXTENSION",
730 "type_specifier : T_CHAR",
731 "type_specifier : T_DOUBLE",
732 "type_specifier : T_FLOAT",
733 "type_specifier : T_INT",
734 "type_specifier : T_LONG",
735 "type_specifier : T_SHORT",
736 "type_specifier : T_SIGNED",
737 "type_specifier : T_UNSIGNED",
738 "type_specifier : T_VOID",
739 "type_specifier : T_Bool",
740 "type_specifier : T_Complex",
741 "type_specifier : T_Imaginary",
742 "type_specifier : T_TYPEDEF_NAME",
743 "type_specifier : struct_or_union_specifier",
744 "type_specifier : enum_specifier",
745 "type_qualifier : T_TYPE_QUALIFIER",
746 "type_qualifier : T_DEFINE_NAME",
747 "struct_or_union_specifier : struct_or_union any_id braces",
748 "struct_or_union_specifier : struct_or_union braces",
749 "struct_or_union_specifier : struct_or_union any_id",
750 "struct_or_union : T_STRUCT",
751 "struct_or_union : T_UNION",
752 "init_declarator_list : init_declarator",
753 "init_declarator_list : init_declarator_list ',' init_declarator",
754 "init_declarator : declarator",
755 "$$5 :",
756 "init_declarator : declarator '=' $$5 T_INITIALIZER",
757 "enum_specifier : enumeration any_id braces",
758 "enum_specifier : enumeration braces",
759 "enum_specifier : enumeration any_id",
760 "enumeration : T_ENUM",
761 "any_id : T_IDENTIFIER",
762 "any_id : T_TYPEDEF_NAME",
763 "declarator : pointer direct_declarator",
764 "declarator : direct_declarator",
765 "direct_declarator : identifier_or_ref",
766 "direct_declarator : '(' declarator ')'",
767 "direct_declarator : direct_declarator T_BRACKETS",
768 "direct_declarator : direct_declarator '(' parameter_type_list ')'",
769 "direct_declarator : direct_declarator '(' opt_identifier_list ')'",
770 "pointer : '*' opt_type_qualifiers",
771 "pointer : '*' opt_type_qualifiers pointer",
772 "opt_type_qualifiers :",
773 "opt_type_qualifiers : type_qualifier_list",
774 "type_qualifier_list : type_qualifier",
775 "type_qualifier_list : type_qualifier_list type_qualifier",
776 "parameter_type_list : parameter_list",
777 "parameter_type_list : parameter_list ',' T_ELLIPSIS",
778 "parameter_list : parameter_declaration",
779 "parameter_list : parameter_list ',' parameter_declaration",
780 "parameter_declaration : decl_specifiers declarator",
781 "parameter_declaration : decl_specifiers abs_declarator",
782 "parameter_declaration : decl_specifiers",
783 "opt_identifier_list :",
784 "opt_identifier_list : identifier_list",
785 "identifier_list : any_id",
786 "identifier_list : identifier_list ',' any_id",
787 "identifier_or_ref : any_id",
788 "identifier_or_ref : '&' any_id",
789 "abs_declarator : pointer",
790 "abs_declarator : pointer direct_abs_declarator",
791 "abs_declarator : direct_abs_declarator",
792 "direct_abs_declarator : '(' abs_declarator ')'",
793 "direct_abs_declarator : direct_abs_declarator T_BRACKETS",
794 "direct_abs_declarator : T_BRACKETS",
795 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
796 "direct_abs_declarator : direct_abs_declarator '(' ')'",
797 "direct_abs_declarator : '(' parameter_type_list ')'",
798 "direct_abs_declarator : '(' ')'",
799
800 };
801 #endif
802
803 int      yydebug;
804 int      yynerrs;
805
806 int      yyerrflag;
807 int      yychar;
808 YYSTYPE  yyval;
809 YYSTYPE  yylval;
810
811 /* define the initial stack-sizes */
812 #ifdef YYSTACKSIZE
813 #undef YYMAXDEPTH
814 #define YYMAXDEPTH  YYSTACKSIZE
815 #else
816 #ifdef YYMAXDEPTH
817 #define YYSTACKSIZE YYMAXDEPTH
818 #else
819 #define YYSTACKSIZE 10000
820 #define YYMAXDEPTH  10000
821 #endif
822 #endif
823
824 #define YYINITSTACKSIZE 200
825
826 typedef struct {
827     unsigned stacksize;
828     short    *s_base;
829     short    *s_mark;
830     short    *s_last;
831     YYSTYPE  *l_base;
832     YYSTYPE  *l_mark;
833 } YYSTACKDATA;
834 /* variables for the parser stack */
835 static YYSTACKDATA yystack;
836 #line 1014 "grammar.y"
837
838 /* lex.yy.c */
839 #define BEGIN yy_start = 1 + 2 *
840
841 #define CPP1 1
842 #define INIT1 2
843 #define INIT2 3
844 #define CURLY 4
845 #define LEXYACC 5
846 #define ASM 6
847 #define CPP_INLINE 7
848
849 extern char *yytext;
850 extern FILE *yyin, *yyout;
851
852 static int curly;                       /* number of curly brace nesting levels */
853 static int ly_count;                    /* number of occurrences of %% */
854 static int inc_depth;                   /* include nesting level */
855 static SymbolTable *included_files;     /* files already included */
856 static int yy_start = 0;                /* start state number */
857
858 #define grammar_error(s) yaccError(s)
859
860 static void
861 yaccError (const char *msg)
862 {
863     func_params = NULL;
864     put_error();                /* tell what line we're on, and what file */
865     fprintf(stderr, "%s at token '%s'\n", msg, yytext);
866 }
867
868 /* Initialize the table of type qualifier keywords recognized by the lexical
869  * analyzer.
870  */
871 void
872 init_parser (void)
873 {
874     static const char *keywords[] = {
875         "const",
876         "restrict",
877         "volatile",
878         "interrupt",
879 #ifdef vms
880         "noshare",
881         "readonly",
882 #endif
883 #if defined(MSDOS) || defined(OS2)
884         "__cdecl",
885         "__export",
886         "__far",
887         "__fastcall",
888         "__fortran",
889         "__huge",
890         "__inline",
891         "__interrupt",
892         "__loadds",
893         "__near",
894         "__pascal",
895         "__saveregs",
896         "__segment",
897         "__stdcall",
898         "__syscall",
899         "_cdecl",
900         "_cs",
901         "_ds",
902         "_es",
903         "_export",
904         "_far",
905         "_fastcall",
906         "_fortran",
907         "_huge",
908         "_interrupt",
909         "_loadds",
910         "_near",
911         "_pascal",
912         "_saveregs",
913         "_seg",
914         "_segment",
915         "_ss",
916         "cdecl",
917         "far",
918         "huge",
919         "near",
920         "pascal",
921 #ifdef OS2
922         "__far16",
923 #endif
924 #endif
925 #ifdef __GNUC__
926         /* gcc aliases */
927         "__builtin_va_arg",
928         "__builtin_va_list",
929         "__const",
930         "__const__",
931         "__inline",
932         "__inline__",
933         "__restrict",
934         "__restrict__",
935         "__volatile",
936         "__volatile__",
937 #endif
938     };
939     unsigned i;
940
941     /* Initialize type qualifier table. */
942     type_qualifiers = new_symbol_table();
943     for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
944         new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
945     }
946 }
947
948 /* Process the C source file.  Write function prototypes to the standard
949  * output.  Convert function definitions and write the converted source
950  * code to a temporary file.
951  */
952 void
953 process_file (FILE *infile, char *name)
954 {
955     char *s;
956
957     if (strlen(name) > 2) {
958         s = name + strlen(name) - 2;
959         if (*s == '.') {
960             ++s;
961             if (*s == 'l' || *s == 'y')
962                 BEGIN LEXYACC;
963 #if defined(MSDOS) || defined(OS2)
964             if (*s == 'L' || *s == 'Y')
965                 BEGIN LEXYACC;
966 #endif
967         }
968     }
969
970     included_files = new_symbol_table();
971     typedef_names = new_symbol_table();
972     define_names = new_symbol_table();
973     inc_depth = -1;
974     curly = 0;
975     ly_count = 0;
976     func_params = NULL;
977     yyin = infile;
978     include_file(strcpy(base_file, name), func_style != FUNC_NONE);
979     if (file_comments) {
980 #if OPT_LINTLIBRARY
981         if (lintLibrary()) {
982             put_blankline(stdout);
983             begin_tracking();
984         }
985 #endif
986         put_string(stdout, "/* ");
987         put_string(stdout, cur_file_name());
988         put_string(stdout, " */\n");
989     }
990     yyparse();
991     free_symbol_table(define_names);
992     free_symbol_table(typedef_names);
993     free_symbol_table(included_files);
994 }
995
996 #ifdef NO_LEAKS
997 void
998 free_parser(void)
999 {
1000     free_symbol_table (type_qualifiers);
1001 #ifdef FLEX_SCANNER
1002     if (yy_current_buffer != 0)
1003         yy_delete_buffer(yy_current_buffer);
1004 #endif
1005 }
1006 #endif
1007 #line 1006 "/dev/stdout"
1008
1009 #if YYDEBUG
1010 #include <stdio.h>              /* needed for printf */
1011 #endif
1012
1013 #include <stdlib.h>     /* needed for malloc, etc */
1014 #include <string.h>     /* needed for memset */
1015
1016 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1017 static int yygrowstack(YYSTACKDATA *data)
1018 {
1019     int i;
1020     unsigned newsize;
1021     short *newss;
1022     YYSTYPE *newvs;
1023
1024     if ((newsize = data->stacksize) == 0)
1025         newsize = YYINITSTACKSIZE;
1026     else if (newsize >= YYMAXDEPTH)
1027         return -1;
1028     else if ((newsize *= 2) > YYMAXDEPTH)
1029         newsize = YYMAXDEPTH;
1030
1031     i = (int) (data->s_mark - data->s_base);
1032     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
1033     if (newss == 0)
1034         return -1;
1035
1036     data->s_base = newss;
1037     data->s_mark = newss + i;
1038
1039     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1040     if (newvs == 0)
1041         return -1;
1042
1043     data->l_base = newvs;
1044     data->l_mark = newvs + i;
1045
1046     data->stacksize = newsize;
1047     data->s_last = data->s_base + newsize - 1;
1048     return 0;
1049 }
1050
1051 #if YYPURE || defined(YY_NO_LEAKS)
1052 static void yyfreestack(YYSTACKDATA *data)
1053 {
1054     free(data->s_base);
1055     free(data->l_base);
1056     memset(data, 0, sizeof(*data));
1057 }
1058 #else
1059 #define yyfreestack(data) /* nothing */
1060 #endif
1061
1062 #define YYABORT  goto yyabort
1063 #define YYREJECT goto yyabort
1064 #define YYACCEPT goto yyaccept
1065 #define YYERROR  goto yyerrlab
1066
1067 int
1068 YYPARSE_DECL()
1069 {
1070     int yym, yyn, yystate;
1071 #if YYDEBUG
1072     const char *yys;
1073
1074     if ((yys = getenv("YYDEBUG")) != 0)
1075     {
1076         yyn = *yys;
1077         if (yyn >= '0' && yyn <= '9')
1078             yydebug = yyn - '0';
1079     }
1080 #endif
1081
1082     yynerrs = 0;
1083     yyerrflag = 0;
1084     yychar = YYEMPTY;
1085     yystate = 0;
1086
1087 #if YYPURE
1088     memset(&yystack, 0, sizeof(yystack));
1089 #endif
1090
1091     if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
1092     yystack.s_mark = yystack.s_base;
1093     yystack.l_mark = yystack.l_base;
1094     yystate = 0;
1095     *yystack.s_mark = 0;
1096
1097 yyloop:
1098     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1099     if (yychar < 0)
1100     {
1101         if ((yychar = YYLEX) < 0) yychar = 0;
1102 #if YYDEBUG
1103         if (yydebug)
1104         {
1105             yys = yyname[YYTRANSLATE(yychar)];
1106             printf("%sdebug: state %d, reading %d (%s)\n",
1107                     YYPREFIX, yystate, yychar, yys);
1108         }
1109 #endif
1110     }
1111     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
1112             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1113     {
1114 #if YYDEBUG
1115         if (yydebug)
1116             printf("%sdebug: state %d, shifting to state %d\n",
1117                     YYPREFIX, yystate, yytable[yyn]);
1118 #endif
1119         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
1120         {
1121             goto yyoverflow;
1122         }
1123         yystate = yytable[yyn];
1124         *++yystack.s_mark = yytable[yyn];
1125         *++yystack.l_mark = yylval;
1126         yychar = YYEMPTY;
1127         if (yyerrflag > 0)  --yyerrflag;
1128         goto yyloop;
1129     }
1130     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
1131             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
1132     {
1133         yyn = yytable[yyn];
1134         goto yyreduce;
1135     }
1136     if (yyerrflag) goto yyinrecovery;
1137
1138     yyerror("syntax error");
1139
1140     goto yyerrlab;
1141
1142 yyerrlab:
1143     ++yynerrs;
1144
1145 yyinrecovery:
1146     if (yyerrflag < 3)
1147     {
1148         yyerrflag = 3;
1149         for (;;)
1150         {
1151             if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
1152                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
1153             {
1154 #if YYDEBUG
1155                 if (yydebug)
1156                     printf("%sdebug: state %d, error recovery shifting\
1157  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
1158 #endif
1159                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
1160                 {
1161                     goto yyoverflow;
1162                 }
1163                 yystate = yytable[yyn];
1164                 *++yystack.s_mark = yytable[yyn];
1165                 *++yystack.l_mark = yylval;
1166                 goto yyloop;
1167             }
1168             else
1169             {
1170 #if YYDEBUG
1171                 if (yydebug)
1172                     printf("%sdebug: error recovery discarding state %d\n",
1173                             YYPREFIX, *yystack.s_mark);
1174 #endif
1175                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1176                 --yystack.s_mark;
1177                 --yystack.l_mark;
1178             }
1179         }
1180     }
1181     else
1182     {
1183         if (yychar == 0) goto yyabort;
1184 #if YYDEBUG
1185         if (yydebug)
1186         {
1187             yys = yyname[YYTRANSLATE(yychar)];
1188             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1189                     YYPREFIX, yystate, yychar, yys);
1190         }
1191 #endif
1192         yychar = YYEMPTY;
1193         goto yyloop;
1194     }
1195
1196 yyreduce:
1197 #if YYDEBUG
1198     if (yydebug)
1199         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1200                 YYPREFIX, yystate, yyn, yyrule[yyn]);
1201 #endif
1202     yym = yylen[yyn];
1203     if (yym)
1204         yyval = yystack.l_mark[1-yym];
1205     else
1206         memset(&yyval, 0, sizeof yyval);
1207     switch (yyn)
1208     {
1209 case 10:
1210 #line 377 "grammar.y"
1211         {
1212             yyerrok;
1213         }
1214 break;
1215 case 11:
1216 #line 381 "grammar.y"
1217         {
1218             yyerrok;
1219         }
1220 break;
1221 case 13:
1222 #line 392 "grammar.y"
1223         {
1224             /* Provide an empty action here so bison will not complain about
1225              * incompatible types in the default action it normally would
1226              * have generated.
1227              */
1228         }
1229 break;
1230 case 14:
1231 #line 399 "grammar.y"
1232         {
1233             /* empty */
1234         }
1235 break;
1236 case 15:
1237 #line 406 "grammar.y"
1238         {
1239 #if OPT_LINTLIBRARY
1240             if (types_out && want_typedef()) {
1241                 gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
1242                 flush_varargs();
1243             }
1244 #endif
1245             free_decl_spec(&yystack.l_mark[-1].decl_spec);
1246             end_typedef();
1247         }
1248 break;
1249 case 16:
1250 #line 417 "grammar.y"
1251         {
1252             if (func_params != NULL) {
1253                 set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
1254             } else {
1255                 gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
1256 #if OPT_LINTLIBRARY
1257                 flush_varargs();
1258 #endif
1259                 free_decl_list(&yystack.l_mark[-1].decl_list);
1260             }
1261             free_decl_spec(&yystack.l_mark[-2].decl_spec);
1262             end_typedef();
1263         }
1264 break;
1265 case 17:
1266 #line 431 "grammar.y"
1267         {
1268             cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
1269             free_decl_spec(&yystack.l_mark[0].decl_spec);
1270         }
1271 break;
1272 case 18:
1273 #line 436 "grammar.y"
1274         {
1275             end_typedef();
1276         }
1277 break;
1278 case 19:
1279 #line 443 "grammar.y"
1280         {
1281             begin_typedef();
1282         }
1283 break;
1284 case 20:
1285 #line 447 "grammar.y"
1286         {
1287             begin_typedef();
1288         }
1289 break;
1290 case 23:
1291 #line 459 "grammar.y"
1292         {
1293             int flags = cur_decl_spec_flags;
1294
1295             /* If the typedef is a pointer type, then reset the short type
1296              * flags so it does not get promoted.
1297              */
1298             if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
1299                 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
1300             new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
1301             free_declarator(yystack.l_mark[0].declarator);
1302         }
1303 break;
1304 case 24:
1305 #line 471 "grammar.y"
1306         {
1307             int flags = cur_decl_spec_flags;
1308
1309             if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
1310                 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
1311             new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
1312             free_declarator(yystack.l_mark[0].declarator);
1313         }
1314 break;
1315 case 25:
1316 #line 483 "grammar.y"
1317         {
1318             check_untagged(&yystack.l_mark[-1].decl_spec);
1319             if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
1320                 yyerror("syntax error");
1321                 YYERROR;
1322             }
1323             func_params = &(yystack.l_mark[0].declarator->head->params);
1324             func_params->begin_comment = cur_file->begin_comment;
1325             func_params->end_comment = cur_file->end_comment;
1326         }
1327 break;
1328 case 26:
1329 #line 494 "grammar.y"
1330         {
1331             /* If we're converting to K&R and we've got a nominally K&R
1332              * function which has a parameter which is ANSI (i.e., a prototyped
1333              * function pointer), then we must override the deciphered value of
1334              * 'func_def' so that the parameter will be converted.
1335              */
1336             if (func_style == FUNC_TRADITIONAL
1337              && haveAnsiParam()
1338              && yystack.l_mark[-3].declarator->head->func_def == func_style) {
1339                 yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH;
1340             }
1341
1342             func_params = NULL;
1343
1344             if (cur_file->convert)
1345                 gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
1346             gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
1347 #if OPT_LINTLIBRARY
1348             flush_varargs();
1349 #endif
1350             free_decl_spec(&yystack.l_mark[-4].decl_spec);
1351             free_declarator(yystack.l_mark[-3].declarator);
1352         }
1353 break;
1354 case 28:
1355 #line 519 "grammar.y"
1356         {
1357             if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
1358                 yyerror("syntax error");
1359                 YYERROR;
1360             }
1361             func_params = &(yystack.l_mark[0].declarator->head->params);
1362             func_params->begin_comment = cur_file->begin_comment;
1363             func_params->end_comment = cur_file->end_comment;
1364         }
1365 break;
1366 case 29:
1367 #line 529 "grammar.y"
1368         {
1369             DeclSpec decl_spec;
1370
1371             func_params = NULL;
1372
1373             new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE);
1374             if (cur_file->convert)
1375                 gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
1376             gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
1377 #if OPT_LINTLIBRARY
1378             flush_varargs();
1379 #endif
1380             free_decl_spec(&decl_spec);
1381             free_declarator(yystack.l_mark[-4].declarator);
1382         }
1383 break;
1384 case 36:
1385 #line 560 "grammar.y"
1386         {
1387             join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
1388             free(yystack.l_mark[-1].decl_spec.text);
1389             free(yystack.l_mark[0].decl_spec.text);
1390         }
1391 break;
1392 case 40:
1393 #line 575 "grammar.y"
1394         {
1395             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1396         }
1397 break;
1398 case 41:
1399 #line 579 "grammar.y"
1400         {
1401             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
1402         }
1403 break;
1404 case 42:
1405 #line 583 "grammar.y"
1406         {
1407             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1408         }
1409 break;
1410 case 43:
1411 #line 587 "grammar.y"
1412         {
1413             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
1414         }
1415 break;
1416 case 44:
1417 #line 591 "grammar.y"
1418         {
1419             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
1420         }
1421 break;
1422 case 45:
1423 #line 595 "grammar.y"
1424         {
1425             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
1426         }
1427 break;
1428 case 46:
1429 #line 602 "grammar.y"
1430         {
1431             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
1432         }
1433 break;
1434 case 47:
1435 #line 606 "grammar.y"
1436         {
1437             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1438         }
1439 break;
1440 case 48:
1441 #line 610 "grammar.y"
1442         {
1443             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
1444         }
1445 break;
1446 case 49:
1447 #line 614 "grammar.y"
1448         {
1449             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1450         }
1451 break;
1452 case 50:
1453 #line 618 "grammar.y"
1454         {
1455             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1456         }
1457 break;
1458 case 51:
1459 #line 622 "grammar.y"
1460         {
1461             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
1462         }
1463 break;
1464 case 52:
1465 #line 626 "grammar.y"
1466         {
1467             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1468         }
1469 break;
1470 case 53:
1471 #line 630 "grammar.y"
1472         {
1473             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1474         }
1475 break;
1476 case 54:
1477 #line 634 "grammar.y"
1478         {
1479             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1480         }
1481 break;
1482 case 55:
1483 #line 638 "grammar.y"
1484         {
1485             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
1486         }
1487 break;
1488 case 56:
1489 #line 642 "grammar.y"
1490         {
1491             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1492         }
1493 break;
1494 case 57:
1495 #line 646 "grammar.y"
1496         {
1497             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1498         }
1499 break;
1500 case 58:
1501 #line 650 "grammar.y"
1502         {
1503             Symbol *s;
1504             s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
1505             if (s != NULL)
1506                 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
1507         }
1508 break;
1509 case 61:
1510 #line 662 "grammar.y"
1511         {
1512             new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
1513         }
1514 break;
1515 case 62:
1516 #line 666 "grammar.y"
1517         {
1518             /* This rule allows the <pointer> nonterminal to scan #define
1519              * names as if they were type modifiers.
1520              */
1521             Symbol *s;
1522             s = find_symbol(define_names, yystack.l_mark[0].text.text);
1523             if (s != NULL)
1524                 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
1525         }
1526 break;
1527 case 63:
1528 #line 679 "grammar.y"
1529         {
1530             char *s;
1531             if ((s = implied_typedef()) == 0)
1532                 (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text);
1533             new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
1534         }
1535 break;
1536 case 64:
1537 #line 686 "grammar.y"
1538         {
1539             char *s;
1540             if ((s = implied_typedef()) == 0)
1541                 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
1542             new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
1543         }
1544 break;
1545 case 65:
1546 #line 693 "grammar.y"
1547         {
1548             (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
1549             new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
1550         }
1551 break;
1552 case 66:
1553 #line 701 "grammar.y"
1554         {
1555             imply_typedef(yyval.text.text);
1556         }
1557 break;
1558 case 67:
1559 #line 705 "grammar.y"
1560         {
1561             imply_typedef(yyval.text.text);
1562         }
1563 break;
1564 case 68:
1565 #line 712 "grammar.y"
1566         {
1567             new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
1568         }
1569 break;
1570 case 69:
1571 #line 716 "grammar.y"
1572         {
1573             add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
1574         }
1575 break;
1576 case 70:
1577 #line 723 "grammar.y"
1578         {
1579             if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
1580                 func_style == FUNC_TRADITIONAL && cur_file->convert) {
1581                 gen_func_declarator(yystack.l_mark[0].declarator);
1582                 fputs(cur_text(), cur_file->tmp_file);
1583             }
1584             cur_declarator = yyval.declarator;
1585         }
1586 break;
1587 case 71:
1588 #line 732 "grammar.y"
1589         {
1590             if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
1591                 func_style == FUNC_TRADITIONAL && cur_file->convert) {
1592                 gen_func_declarator(yystack.l_mark[-1].declarator);
1593                 fputs(" =", cur_file->tmp_file);
1594             }
1595         }
1596 break;
1597 case 73:
1598 #line 744 "grammar.y"
1599         {
1600             char *s;
1601             if ((s = implied_typedef()) == 0)
1602                 (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text);
1603             new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
1604         }
1605 break;
1606 case 74:
1607 #line 751 "grammar.y"
1608         {
1609             char *s;
1610             if ((s = implied_typedef()) == 0)
1611                 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
1612             new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
1613         }
1614 break;
1615 case 75:
1616 #line 758 "grammar.y"
1617         {
1618             (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
1619             new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
1620         }
1621 break;
1622 case 76:
1623 #line 766 "grammar.y"
1624         {
1625             imply_typedef("enum");
1626             yyval.text = yystack.l_mark[0].text;
1627         }
1628 break;
1629 case 79:
1630 #line 779 "grammar.y"
1631         {
1632             yyval.declarator = yystack.l_mark[0].declarator;
1633             (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
1634             free(yyval.declarator->text);
1635             yyval.declarator->text = xstrdup(buf);
1636             yyval.declarator->begin = yystack.l_mark[-1].text.begin;
1637             yyval.declarator->pointer = TRUE;
1638         }
1639 break;
1640 case 81:
1641 #line 792 "grammar.y"
1642         {
1643             yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
1644         }
1645 break;
1646 case 82:
1647 #line 796 "grammar.y"
1648         {
1649             yyval.declarator = yystack.l_mark[-1].declarator;
1650             (void)sprintf(buf, "(%s)", yyval.declarator->text);
1651             free(yyval.declarator->text);
1652             yyval.declarator->text = xstrdup(buf);
1653             yyval.declarator->begin = yystack.l_mark[-2].text.begin;
1654         }
1655 break;
1656 case 83:
1657 #line 804 "grammar.y"
1658         {
1659             yyval.declarator = yystack.l_mark[-1].declarator;
1660             (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
1661             free(yyval.declarator->text);
1662             yyval.declarator->text = xstrdup(buf);
1663         }
1664 break;
1665 case 84:
1666 #line 811 "grammar.y"
1667         {
1668             yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
1669             yyval.declarator->params = yystack.l_mark[-1].param_list;
1670             yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
1671             yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
1672             yyval.declarator->func_def = FUNC_ANSI;
1673         }
1674 break;
1675 case 85:
1676 #line 819 "grammar.y"
1677         {
1678             yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
1679             yyval.declarator->params = yystack.l_mark[-1].param_list;
1680             yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
1681             yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
1682             yyval.declarator->func_def = FUNC_TRADITIONAL;
1683         }
1684 break;
1685 case 86:
1686 #line 830 "grammar.y"
1687         {
1688             (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
1689             yyval.text.begin = yystack.l_mark[-1].text.begin;
1690         }
1691 break;
1692 case 87:
1693 #line 835 "grammar.y"
1694         {
1695             (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
1696             yyval.text.begin = yystack.l_mark[-2].text.begin;
1697         }
1698 break;
1699 case 88:
1700 #line 843 "grammar.y"
1701         {
1702             strcpy(yyval.text.text, "");
1703             yyval.text.begin = 0L;
1704         }
1705 break;
1706 case 90:
1707 #line 852 "grammar.y"
1708         {
1709             (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
1710             yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
1711             free(yystack.l_mark[0].decl_spec.text);
1712         }
1713 break;
1714 case 91:
1715 #line 858 "grammar.y"
1716         {
1717             (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
1718             yyval.text.begin = yystack.l_mark[-1].text.begin;
1719             free(yystack.l_mark[0].decl_spec.text);
1720         }
1721 break;
1722 case 93:
1723 #line 868 "grammar.y"
1724         {
1725             add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
1726         }
1727 break;
1728 case 94:
1729 #line 875 "grammar.y"
1730         {
1731             new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
1732         }
1733 break;
1734 case 95:
1735 #line 879 "grammar.y"
1736         {
1737             add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
1738         }
1739 break;
1740 case 96:
1741 #line 886 "grammar.y"
1742         {
1743             check_untagged(&yystack.l_mark[-1].decl_spec);
1744             yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
1745         }
1746 break;
1747 case 97:
1748 #line 891 "grammar.y"
1749         {
1750             check_untagged(&yystack.l_mark[-1].decl_spec);
1751             yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
1752         }
1753 break;
1754 case 98:
1755 #line 896 "grammar.y"
1756         {
1757             check_untagged(&yystack.l_mark[0].decl_spec);
1758             yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
1759         }
1760 break;
1761 case 99:
1762 #line 904 "grammar.y"
1763         {
1764             new_ident_list(&yyval.param_list);
1765         }
1766 break;
1767 case 101:
1768 #line 912 "grammar.y"
1769         {
1770             new_ident_list(&yyval.param_list);
1771             add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
1772         }
1773 break;
1774 case 102:
1775 #line 917 "grammar.y"
1776         {
1777             add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
1778         }
1779 break;
1780 case 103:
1781 #line 924 "grammar.y"
1782         {
1783             yyval.text = yystack.l_mark[0].text;
1784         }
1785 break;
1786 case 104:
1787 #line 928 "grammar.y"
1788         {
1789 #if OPT_LINTLIBRARY
1790             if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
1791                 yyval.text = yystack.l_mark[0].text;
1792             } else
1793 #endif
1794                 (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
1795             yyval.text.begin = yystack.l_mark[-1].text.begin;
1796         }
1797 break;
1798 case 105:
1799 #line 941 "grammar.y"
1800         {
1801             yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
1802         }
1803 break;
1804 case 106:
1805 #line 945 "grammar.y"
1806         {
1807             yyval.declarator = yystack.l_mark[0].declarator;
1808             (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
1809             free(yyval.declarator->text);
1810             yyval.declarator->text = xstrdup(buf);
1811             yyval.declarator->begin = yystack.l_mark[-1].text.begin;
1812         }
1813 break;
1814 case 108:
1815 #line 957 "grammar.y"
1816         {
1817             yyval.declarator = yystack.l_mark[-1].declarator;
1818             (void)sprintf(buf, "(%s)", yyval.declarator->text);
1819             free(yyval.declarator->text);
1820             yyval.declarator->text = xstrdup(buf);
1821             yyval.declarator->begin = yystack.l_mark[-2].text.begin;
1822         }
1823 break;
1824 case 109:
1825 #line 965 "grammar.y"
1826         {
1827             yyval.declarator = yystack.l_mark[-1].declarator;
1828             (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
1829             free(yyval.declarator->text);
1830             yyval.declarator->text = xstrdup(buf);
1831         }
1832 break;
1833 case 110:
1834 #line 972 "grammar.y"
1835         {
1836             yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
1837         }
1838 break;
1839 case 111:
1840 #line 976 "grammar.y"
1841         {
1842             yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
1843             yyval.declarator->params = yystack.l_mark[-1].param_list;
1844             yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
1845             yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
1846             yyval.declarator->func_def = FUNC_ANSI;
1847         }
1848 break;
1849 case 112:
1850 #line 984 "grammar.y"
1851         {
1852             yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
1853             yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
1854             yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
1855             yyval.declarator->func_def = FUNC_ANSI;
1856         }
1857 break;
1858 case 113:
1859 #line 991 "grammar.y"
1860         {
1861             Declarator *d;
1862
1863             d = new_declarator("", "", yystack.l_mark[-2].text.begin);
1864             yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin);
1865             yyval.declarator->params = yystack.l_mark[-1].param_list;
1866             yyval.declarator->func_stack = d;
1867             yyval.declarator->head = yyval.declarator;
1868             yyval.declarator->func_def = FUNC_ANSI;
1869         }
1870 break;
1871 case 114:
1872 #line 1002 "grammar.y"
1873         {
1874             Declarator *d;
1875
1876             d = new_declarator("", "", yystack.l_mark[-1].text.begin);
1877             yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin);
1878             yyval.declarator->func_stack = d;
1879             yyval.declarator->head = yyval.declarator;
1880             yyval.declarator->func_def = FUNC_ANSI;
1881         }
1882 break;
1883 #line 1882 "/dev/stdout"
1884     }
1885     yystack.s_mark -= yym;
1886     yystate = *yystack.s_mark;
1887     yystack.l_mark -= yym;
1888     yym = yylhs[yyn];
1889     if (yystate == 0 && yym == 0)
1890     {
1891 #if YYDEBUG
1892         if (yydebug)
1893             printf("%sdebug: after reduction, shifting from state 0 to\
1894  state %d\n", YYPREFIX, YYFINAL);
1895 #endif
1896         yystate = YYFINAL;
1897         *++yystack.s_mark = YYFINAL;
1898         *++yystack.l_mark = yyval;
1899         if (yychar < 0)
1900         {
1901             if ((yychar = YYLEX) < 0) yychar = 0;
1902 #if YYDEBUG
1903             if (yydebug)
1904             {
1905                 yys = yyname[YYTRANSLATE(yychar)];
1906                 printf("%sdebug: state %d, reading %d (%s)\n",
1907                         YYPREFIX, YYFINAL, yychar, yys);
1908             }
1909 #endif
1910         }
1911         if (yychar == 0) goto yyaccept;
1912         goto yyloop;
1913     }
1914     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1915             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1916         yystate = yytable[yyn];
1917     else
1918         yystate = yydgoto[yym];
1919 #if YYDEBUG
1920     if (yydebug)
1921         printf("%sdebug: after reduction, shifting from state %d \
1922 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1923 #endif
1924     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
1925     {
1926         goto yyoverflow;
1927     }
1928     *++yystack.s_mark = (short) yystate;
1929     *++yystack.l_mark = yyval;
1930     goto yyloop;
1931
1932 yyoverflow:
1933     yyerror("yacc stack overflow");
1934
1935 yyabort:
1936     yyfreestack(&yystack);
1937     return (1);
1938
1939 yyaccept:
1940     yyfreestack(&yystack);
1941     return (0);
1942 }