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