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