~ubuntu-branches/ubuntu/feisty/cproto/feisty

« back to all changes in this revision

Viewing changes to y_tab.c

  • Committer: Bazaar Package Importer
  • Author(s): Kenneth J. Pronovici
  • Date: 2004-03-30 19:58:33 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040330195833-loh9sgce2as79j67
Tags: 4.7c-1
* New upstream release.
  - Includes equivalent of patch as used to close #228801 (see below).
  - Supports -X option to filter out unwanted definitions (closes: #235824).
* Now configure using --enable-llib option, so we don't need lint installed.
* Added gcc to Depends: line since -X option requires GCC to work; I assume
  most users will already have gcc installed anyway, if they are developers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef lint
2
 
static char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93 (BSDI)";
3
 
#endif
4
 
#include <stdlib.h>
5
 
#define YYBYACC 1
6
 
#define YYMAJOR 1
7
 
#define YYMINOR 9
8
 
#define YYEMPTY (-1)
9
 
#define YYLEX yylex()
10
 
#define yyclearin (yychar=YYEMPTY)
11
 
#define yyerrok (yyerrflag=0)
12
 
#define YYRECOVERING (yyerrflag!=0)
13
 
#define YYPREFIX "yy"
14
 
#line 65 "grammar.y"
15
 
#include <stdio.h>
16
 
#include <ctype.h>
17
 
#include "cproto.h"
18
 
#include "symbol.h"
19
 
#include "semantic.h"
20
 
 
21
 
#define YYMAXDEPTH 150
22
 
 
23
 
extern  int     yylex ARGS((void));
24
 
 
25
 
/* declaration specifier attributes for the typedef statement currently being
26
 
 * scanned
27
 
 */
28
 
static int cur_decl_spec_flags;
29
 
 
30
 
/* pointer to parameter list for the current function definition */
31
 
static ParameterList *func_params;
32
 
 
33
 
/* A parser semantic action sets this pointer to the current declarator in
34
 
 * a function parameter declaration in order to catch any comments following
35
 
 * the parameter declaration on the same line.  If the lexer scans a comment
36
 
 * and <cur_declarator> is not NULL, then the comment is attached to the
37
 
 * declarator.  To ignore subsequent comments, the lexer sets this to NULL
38
 
 * after scanning a comment or end of line.
39
 
 */
40
 
static Declarator *cur_declarator;
41
 
 
42
 
/* temporary string buffer */
43
 
static char buf[MAX_TEXT_SIZE];
44
 
 
45
 
/* table of typedef names */
46
 
static SymbolTable *typedef_names;
47
 
 
48
 
/* table of define names */
49
 
static SymbolTable *define_names;
50
 
 
51
 
/* table of type qualifiers */
52
 
static SymbolTable *type_qualifiers;
53
 
 
54
 
/* information about the current input file */
55
 
typedef struct {
56
 
    char *base_name;            /* base input file name */
57
 
    char *file_name;            /* current file name */
58
 
    FILE *file;                 /* input file */
59
 
    unsigned line_num;          /* current line number in input file */
60
 
    FILE *tmp_file;             /* temporary file */
61
 
    long begin_comment;         /* tmp file offset after last written ) or ; */
62
 
    long end_comment;           /* tmp file offset after last comment */
63
 
    boolean convert;            /* if TRUE, convert function definitions */
64
 
    boolean changed;            /* TRUE if conversion done in this file */
65
 
} IncludeStack;
66
 
 
67
 
static IncludeStack *cur_file;  /* current input file */
68
 
 
69
 
#include "yyerror.c"
70
 
 
71
 
static int haveAnsiParam ARGS((void));
72
 
 
73
 
 
74
 
/* Flags to enable us to find if a procedure returns a value.
75
 
 */
76
 
static int return_val,  /* nonzero on BRACES iff return-expression found */
77
 
           returned_at; /* marker for token-number to set 'return_val' */
78
 
 
79
 
#if OPT_LINTLIBRARY
80
 
static char *dft_decl_spec ARGS((void));
81
 
 
82
 
static char *
83
 
dft_decl_spec ()
84
 
{
85
 
    return (lintLibrary() && !return_val) ? "void" : "int";
86
 
}
87
 
 
88
 
#else
89
 
#define dft_decl_spec() "int"
90
 
#endif
91
 
 
92
 
static int
93
 
haveAnsiParam ()
94
 
{
95
 
    Parameter *p;
96
 
    if (func_params != 0) {
97
 
        for (p = func_params->first; p != 0; p = p->next) {
98
 
            if (p->declarator->func_def == FUNC_ANSI) {
99
 
                return TRUE;
100
 
            }
101
 
        }
102
 
    }
103
 
    return FALSE;
104
 
}
105
 
#line 106 "y.tab.c"
106
 
#define T_IDENTIFIER 257
107
 
#define T_TYPEDEF_NAME 258
108
 
#define T_DEFINE_NAME 259
109
 
#define T_AUTO 260
110
 
#define T_EXTERN 261
111
 
#define T_REGISTER 262
112
 
#define T_STATIC 263
113
 
#define T_TYPEDEF 264
114
 
#define T_INLINE 265
115
 
#define T_CHAR 266
116
 
#define T_DOUBLE 267
117
 
#define T_FLOAT 268
118
 
#define T_INT 269
119
 
#define T_VOID 270
120
 
#define T_LONG 271
121
 
#define T_SHORT 272
122
 
#define T_SIGNED 273
123
 
#define T_UNSIGNED 274
124
 
#define T_ENUM 275
125
 
#define T_STRUCT 276
126
 
#define T_UNION 277
127
 
#define T_TYPE_QUALIFIER 278
128
 
#define T_BRACKETS 279
129
 
#define T_LBRACE 280
130
 
#define T_MATCHRBRACE 281
131
 
#define T_ELLIPSIS 282
132
 
#define T_INITIALIZER 283
133
 
#define T_STRING_LITERAL 284
134
 
#define T_ASM 285
135
 
#define T_ASMARG 286
136
 
#define T_VA_DCL 287
137
 
#define YYERRCODE 256
138
 
short yylhs[] = {                                        -1,
139
 
    0,    0,   26,   26,   27,   27,   27,   27,   27,   27,
140
 
   27,   31,   30,   30,   28,   28,   34,   28,   32,   33,
141
 
   33,   35,   35,   37,   38,   29,   39,   29,   36,   36,
142
 
   36,   40,   40,    1,    1,    2,    2,    2,    3,    3,
143
 
    3,    3,    3,    4,    4,    4,    4,    4,    4,    4,
144
 
    4,    4,    4,    4,    4,    5,    5,    6,    6,    6,
145
 
   19,   19,    8,    8,    9,   41,    9,    7,    7,    7,
146
 
   25,   23,   23,   10,   10,   11,   11,   11,   11,   11,
147
 
   20,   20,   21,   21,   22,   22,   14,   14,   15,   15,
148
 
   16,   16,   16,   17,   17,   18,   18,   24,   24,   12,
149
 
   12,   12,   13,   13,   13,   13,   13,   13,   13,
150
 
};
151
 
short yylen[] = {                                         2,
152
 
    0,    1,    1,    2,    1,    1,    1,    1,    3,    2,
153
 
    2,    2,    3,    3,    2,    3,    0,    5,    1,    0,
154
 
    1,    1,    3,    0,    0,    7,    0,    5,    0,    1,
155
 
    1,    1,    2,    1,    2,    1,    1,    1,    1,    1,
156
 
    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
157
 
    1,    1,    1,    1,    1,    1,    1,    3,    2,    2,
158
 
    1,    1,    1,    3,    1,    0,    4,    3,    2,    2,
159
 
    1,    1,    1,    2,    1,    1,    3,    2,    4,    4,
160
 
    2,    3,    0,    1,    1,    2,    1,    3,    1,    3,
161
 
    2,    2,    1,    0,    1,    1,    3,    1,    2,    1,
162
 
    2,    1,    3,    2,    1,    4,    3,    3,    2,
163
 
};
164
 
short yydefred[] = {                                      0,
165
 
    0,    0,    0,    0,   98,   53,   57,   39,    0,   41,
166
 
   42,   19,   43,   44,   45,   46,   47,   52,   48,   49,
167
 
   50,   51,   71,   61,   62,   56,    0,    7,    0,    0,
168
 
   34,   36,   37,   38,   54,   55,   27,    0,    0,    0,
169
 
   76,    0,    0,    3,    5,    6,    8,    0,   10,   11,
170
 
    0,   85,    0,    0,   99,    0,    0,   40,   15,   35,
171
 
    0,   63,    0,    0,    0,   78,   72,   73,    0,    0,
172
 
   59,    0,    0,   69,    4,    0,   77,   82,   86,    0,
173
 
   14,   13,    9,   16,    0,   66,    0,   30,   32,    0,
174
 
    0,   96,    0,    0,    0,   89,    0,    0,   12,   58,
175
 
   68,    0,    0,   64,    0,    0,    0,   33,    0,  105,
176
 
   91,   92,    0,    0,   79,    0,   80,    0,   22,    0,
177
 
    0,   67,   25,   28,  109,    0,    0,    0,  104,    0,
178
 
   88,   90,   97,   18,    0,    0,  103,  108,  107,    0,
179
 
   23,   26,  106,
180
 
};
181
 
short yydgoto[] = {                                      29,
182
 
   80,   31,   32,   33,   34,   35,   36,   61,   62,   37,
183
 
   38,  112,  113,   94,   95,   96,   97,   98,   39,   40,
184
 
   53,   54,   70,   41,   42,   43,   44,   45,   46,   47,
185
 
   71,   48,  120,  102,  121,   90,   87,  136,   64,   91,
186
 
  105,
187
 
};
188
 
short yysindex[] = {                                    -38,
189
 
  -36,   17, -248, -241,    0,    0,    0,    0, -264,    0,
190
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
191
 
    0,    0,    0,    0,    0,    0, -261,    0,    0,  395,
192
 
    0,    0,    0,    0,    0,    0,    0,  -37, -245,  -11,
193
 
    0, -245,  -38,    0,    0,    0,    0,  438,    0,    0,
194
 
  -15,    0,   -5, -248,    0,  327,  -27,    0,    0,    0,
195
 
  -16,    0,  -22,  279,  351,    0,    0,    0, -239, -234,
196
 
    0,  -37, -234,    0,    0,  438,    0,    0,    0,  395,
197
 
    0,    0,    0,    0,   17,    0,  279,    0,    0, -232,
198
 
  372,    0,  150,   24,   27,    0,   33,   32,    0,    0,
199
 
    0,   17,  -22,    0, -206, -202, -199,    0,  127,    0,
200
 
    0,    0,  -35,  203,    0,  302,    0, -174,    0,   28,
201
 
   44,    0,    0,    0,    0,   48,   49,  258,    0,  -35,
202
 
    0,    0,    0,    0,   17, -189,    0,    0,    0,   52,
203
 
    0,    0,    0,
204
 
};
205
 
short yyrindex[] = {                                     95,
206
 
    0,    0,  157,    0,    0,    0,    0,    0,  417,    0,
207
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
208
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
209
 
    0,    0,    0,    0,    0,    0,    0,  -10,    0,    0,
210
 
    0,    0,   96,    0,    0,    0,    0,    0,    0,    0,
211
 
    0,    0,  231,  173,    0,    0,    0,    0,    0,    0,
212
 
    0,    0,   50, -183,   57,    0,    0,    0,    0,   81,
213
 
    0,   20,  104,    0,    0,   16,    0,    0,    0,    0,
214
 
    0,    0,    0,    0,    0,    0, -183,    0,    0,    0,
215
 
 -180,    0,  -26,    0,   60,    0,    0,   61,    0,    0,
216
 
    0,   45,    1,    0,    0,    0,    0,    0,    0,    0,
217
 
    0,    0,    9,   25,    0,    0,    0,    0,    0,    0,
218
 
   46,    0,    0,    0,    0,    0,    0,    0,    0,   29,
219
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
220
 
    0,    0,    0,
221
 
};
222
 
short yygindex[] = {                                      0,
223
 
   19,   -8,    0,    0,   -2,    0,    0,    0,   18,    6,
224
 
  -34,   -3,   -7,  -95,    0,   -6,    0,    0,    0,  -46,
225
 
    0,    0,   69,    0,    0,    0,   70,  -47,    0,    0,
226
 
  -32,    0,    0,    0,    0,   30,    0,    0,    0,    0,
227
 
    0,
228
 
};
229
 
#define YYTABLESIZE 716
230
 
short yytable[] = {                                       4,
231
 
   52,    2,   65,    3,  128,   72,   78,   51,   81,   74,
232
 
    7,   67,   68,  127,   93,   55,   89,   93,   30,   56,
233
 
   28,   60,   50,   82,   57,   77,    4,   85,    2,   26,
234
 
   75,   83,  140,   75,   69,   63,    3,  100,   86,   89,
235
 
  101,   99,   84,  108,   65,   69,  114,  107,   75,  102,
236
 
   75,   79,  102,   17,    4,   17,    2,   17,    3,   65,
237
 
   74,   30,  114,   74,  115,  100,   76,   60,  100,  101,
238
 
  116,   60,  101,  117,   17,  118,  122,  123,   74,   72,
239
 
   74,  124,  133,   93,   60,  103,  134,  135,  137,  138,
240
 
  103,  142,  143,   65,    1,    2,   29,   94,  111,   31,
241
 
   87,   95,  104,   20,   21,  126,  130,  119,   65,  132,
242
 
   73,    0,   75,    0,   51,    0,  106,    0,   60,    0,
243
 
   60,   60,   60,    0,   60,    0,    0,   93,    0,    0,
244
 
    0,    0,    0,    0,   93,    0,    0,    0,    0,   60,
245
 
  141,   70,    0,   70,   70,   70,   93,   70,    0,    0,
246
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
247
 
    0,    0,   70,    0,    4,    0,  109,  125,    3,    0,
248
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
249
 
    0,    0,    0,    0,    0,    0,    0,    4,    0,  109,
250
 
    0,    3,    0,    0,   83,    0,   83,   83,   83,    0,
251
 
   83,    0,    0,    0,    0,    0,    0,    0,    0,    0,
252
 
   84,    0,   84,   84,   84,    0,   84,    1,    5,    6,
253
 
    7,    8,    9,   10,   11,   12,   13,   14,   15,   16,
254
 
   17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
255
 
    4,   66,  109,  129,   49,    5,   27,   75,   75,   75,
256
 
   75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
257
 
   75,   75,   75,   75,   75,   75,   75,   75,   81,   75,
258
 
   81,   81,   17,    5,   81,    0,   75,   74,   74,   74,
259
 
   74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
260
 
   74,   74,   74,   74,   74,   74,   74,   74,  139,   74,
261
 
    0,    0,    0,    0,    0,    0,   74,   24,   24,   24,
262
 
   24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
263
 
   24,   24,   24,   24,   24,   24,   24,   24,    0,   24,
264
 
    0,    0,    0,    0,    0,    0,   24,   60,   60,   60,
265
 
   60,   60,   60,   60,    0,   60,   60,   60,   60,   60,
266
 
   60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
267
 
   70,   70,   70,   70,   70,   70,   70,    0,   70,   70,
268
 
   70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
269
 
   70,   70,   70,    5,    6,    7,    8,   58,   10,   11,
270
 
    0,   13,   14,   15,   16,   17,   18,   19,   20,   21,
271
 
   22,   23,   24,   25,   26,  110,    5,    6,    7,    8,
272
 
   58,   10,   11,   83,   13,   14,   15,   16,   17,   18,
273
 
   19,   20,   21,   22,   23,   24,   25,   26,  110,   84,
274
 
    0,    0,    4,    0,    2,   83,    3,    0,    0,    0,
275
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
276
 
    0,   84,    0,   59,   40,    0,   40,    0,   40,    5,
277
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
278
 
    0,    0,    0,    0,    0,   40,    0,    0,    0,    0,
279
 
    0,  110,    0,    0,    0,    0,    0,   81,    0,    0,
280
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
281
 
    0,    0,    0,    0,    0,    0,    0,    0,    0,   81,
282
 
    0,    0,    0,    0,    0,    6,    7,    8,   58,   10,
283
 
   11,    0,   13,   14,   15,   16,   17,   18,   19,   20,
284
 
   21,   22,   23,   24,   25,   26,    6,    7,    8,   58,
285
 
   10,   11,   12,   13,   14,   15,   16,   17,   18,   19,
286
 
   20,   21,   22,   23,   24,   25,   26,    0,    0,    6,
287
 
    7,    8,   58,   10,   11,   88,   13,   14,   15,   16,
288
 
   17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
289
 
    0,    0,    0,  131,    6,    7,    8,   58,   10,   11,
290
 
   12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
291
 
   22,   23,   24,   25,   26,    0,   69,   92,    6,    7,
292
 
    8,   58,   10,   11,    0,   13,   14,   15,   16,   17,
293
 
   18,   19,   20,   21,   22,   23,   24,   25,   26,    6,
294
 
    7,    8,   58,   10,   11,   12,   13,   14,   15,   16,
295
 
   17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
296
 
    0,    5,    6,    7,    8,   58,   10,   11,    0,   13,
297
 
   14,   15,   16,   17,   18,   19,   20,   21,   22,   23,
298
 
   24,   25,   26,   40,   40,   40,   40,   40,   40,   40,
299
 
    0,   40,   40,   40,   40,   40,   40,   40,   40,   40,
300
 
   40,   40,   40,   40,   40,    6,    7,    8,   58,   10,
301
 
   11,    0,   13,   14,   15,   16,   17,   18,   19,   20,
302
 
   21,   22,   23,   24,   25,   26,
303
 
};
304
 
short yycheck[] = {                                      38,
305
 
    3,   40,   40,   42,   40,   40,   53,    2,   56,   42,
306
 
  259,  257,  258,  109,   41,  257,   64,   44,    0,  284,
307
 
   59,   30,   59,   56,  286,   41,   38,   44,   40,  278,
308
 
   41,   59,  128,   44,  280,   30,   42,   70,   61,   87,
309
 
   73,  281,   59,   91,   44,  280,   93,  280,   59,   41,
310
 
   61,   54,   44,   38,   38,   40,   40,   42,   42,   59,
311
 
   41,   43,  109,   44,   41,   41,   48,   76,   44,   41,
312
 
   44,   80,   44,   41,   59,   44,  283,  280,   59,  114,
313
 
   61,  281,  257,   65,   93,   80,   59,   44,   41,   41,
314
 
   85,  281,   41,   44,    0,    0,  280,   41,   93,  280,
315
 
   41,   41,   85,   59,   59,  109,  114,  102,   59,  116,
316
 
   42,   -1,   43,   -1,  109,   -1,   87,   -1,   38,   -1,
317
 
   40,   41,   42,   -1,   44,   -1,   -1,  109,   -1,   -1,
318
 
   -1,   -1,   -1,   -1,  116,   -1,   -1,   -1,   -1,   59,
319
 
  135,   38,   -1,   40,   41,   42,  128,   44,   -1,   -1,
320
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
321
 
   -1,   -1,   59,   -1,   38,   -1,   40,   41,   42,   -1,
322
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
323
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   38,   -1,   40,
324
 
   -1,   42,   -1,   -1,   38,   -1,   40,   41,   42,   -1,
325
 
   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
326
 
   38,   -1,   40,   41,   42,   -1,   44,  256,  257,  258,
327
 
  259,  260,  261,  262,  263,  264,  265,  266,  267,  268,
328
 
  269,  270,  271,  272,  273,  274,  275,  276,  277,  278,
329
 
   38,  279,   40,  279,  281,  257,  285,  258,  259,  260,
330
 
  261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
331
 
  271,  272,  273,  274,  275,  276,  277,  278,   38,  280,
332
 
   40,   41,  257,  257,   44,   -1,  287,  258,  259,  260,
333
 
  261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
334
 
  271,  272,  273,  274,  275,  276,  277,  278,   41,  280,
335
 
   -1,   -1,   -1,   -1,   -1,   -1,  287,  258,  259,  260,
336
 
  261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
337
 
  271,  272,  273,  274,  275,  276,  277,  278,   -1,  280,
338
 
   -1,   -1,   -1,   -1,   -1,   -1,  287,  257,  258,  259,
339
 
  260,  261,  262,  263,   -1,  265,  266,  267,  268,  269,
340
 
  270,  271,  272,  273,  274,  275,  276,  277,  278,  279,
341
 
  257,  258,  259,  260,  261,  262,  263,   -1,  265,  266,
342
 
  267,  268,  269,  270,  271,  272,  273,  274,  275,  276,
343
 
  277,  278,  279,  257,  258,  259,  260,  261,  262,  263,
344
 
   -1,  265,  266,  267,  268,  269,  270,  271,  272,  273,
345
 
  274,  275,  276,  277,  278,  279,  257,  258,  259,  260,
346
 
  261,  262,  263,  257,  265,  266,  267,  268,  269,  270,
347
 
  271,  272,  273,  274,  275,  276,  277,  278,  279,  257,
348
 
   -1,   -1,   38,   -1,   40,  279,   42,   -1,   -1,   -1,
349
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
350
 
   -1,  279,   -1,   59,   38,   -1,   40,   -1,   42,  257,
351
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
352
 
   -1,   -1,   -1,   -1,   -1,   59,   -1,   -1,   -1,   -1,
353
 
   -1,  279,   -1,   -1,   -1,   -1,   -1,  257,   -1,   -1,
354
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
355
 
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  279,
356
 
   -1,   -1,   -1,   -1,   -1,  258,  259,  260,  261,  262,
357
 
  263,   -1,  265,  266,  267,  268,  269,  270,  271,  272,
358
 
  273,  274,  275,  276,  277,  278,  258,  259,  260,  261,
359
 
  262,  263,  264,  265,  266,  267,  268,  269,  270,  271,
360
 
  272,  273,  274,  275,  276,  277,  278,   -1,   -1,  258,
361
 
  259,  260,  261,  262,  263,  287,  265,  266,  267,  268,
362
 
  269,  270,  271,  272,  273,  274,  275,  276,  277,  278,
363
 
   -1,   -1,   -1,  282,  258,  259,  260,  261,  262,  263,
364
 
  264,  265,  266,  267,  268,  269,  270,  271,  272,  273,
365
 
  274,  275,  276,  277,  278,   -1,  280,  257,  258,  259,
366
 
  260,  261,  262,  263,   -1,  265,  266,  267,  268,  269,
367
 
  270,  271,  272,  273,  274,  275,  276,  277,  278,  258,
368
 
  259,  260,  261,  262,  263,  264,  265,  266,  267,  268,
369
 
  269,  270,  271,  272,  273,  274,  275,  276,  277,  278,
370
 
   -1,  257,  258,  259,  260,  261,  262,  263,   -1,  265,
371
 
  266,  267,  268,  269,  270,  271,  272,  273,  274,  275,
372
 
  276,  277,  278,  257,  258,  259,  260,  261,  262,  263,
373
 
   -1,  265,  266,  267,  268,  269,  270,  271,  272,  273,
374
 
  274,  275,  276,  277,  278,  258,  259,  260,  261,  262,
375
 
  263,   -1,  265,  266,  267,  268,  269,  270,  271,  272,
376
 
  273,  274,  275,  276,  277,  278,
377
 
};
378
 
#define YYFINAL 29
379
 
#ifndef YYDEBUG
380
 
#define YYDEBUG 0
381
 
#endif
382
 
#define YYMAXTOKEN 287
383
 
#if YYDEBUG
384
 
char *yyname[] = {
385
 
"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,
386
 
0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
387
 
"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
388
 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
389
 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
390
 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
391
 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
392
 
"T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
393
 
"T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_CHAR","T_DOUBLE","T_FLOAT",
394
 
"T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED","T_UNSIGNED","T_ENUM","T_STRUCT",
395
 
"T_UNION","T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE",
396
 
"T_ELLIPSIS","T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL",
397
 
};
398
 
char *yyrule[] = {
399
 
"$accept : program",
400
 
"program :",
401
 
"program : translation_unit",
402
 
"translation_unit : external_declaration",
403
 
"translation_unit : translation_unit external_declaration",
404
 
"external_declaration : declaration",
405
 
"external_declaration : function_definition",
406
 
"external_declaration : ';'",
407
 
"external_declaration : linkage_specification",
408
 
"external_declaration : T_ASM T_ASMARG ';'",
409
 
"external_declaration : error T_MATCHRBRACE",
410
 
"external_declaration : error ';'",
411
 
"braces : T_LBRACE T_MATCHRBRACE",
412
 
"linkage_specification : T_EXTERN T_STRING_LITERAL braces",
413
 
"linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
414
 
"declaration : decl_specifiers ';'",
415
 
"declaration : decl_specifiers init_declarator_list ';'",
416
 
"$$1 :",
417
 
"declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
418
 
"any_typedef : T_TYPEDEF",
419
 
"opt_declarator_list :",
420
 
"opt_declarator_list : declarator_list",
421
 
"declarator_list : declarator",
422
 
"declarator_list : declarator_list ',' declarator",
423
 
"$$2 :",
424
 
"$$3 :",
425
 
"function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
426
 
"$$4 :",
427
 
"function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
428
 
"opt_declaration_list :",
429
 
"opt_declaration_list : T_VA_DCL",
430
 
"opt_declaration_list : declaration_list",
431
 
"declaration_list : declaration",
432
 
"declaration_list : declaration_list declaration",
433
 
"decl_specifiers : decl_specifier",
434
 
"decl_specifiers : decl_specifiers decl_specifier",
435
 
"decl_specifier : storage_class",
436
 
"decl_specifier : type_specifier",
437
 
"decl_specifier : type_qualifier",
438
 
"storage_class : T_AUTO",
439
 
"storage_class : T_EXTERN",
440
 
"storage_class : T_REGISTER",
441
 
"storage_class : T_STATIC",
442
 
"storage_class : T_INLINE",
443
 
"type_specifier : T_CHAR",
444
 
"type_specifier : T_DOUBLE",
445
 
"type_specifier : T_FLOAT",
446
 
"type_specifier : T_INT",
447
 
"type_specifier : T_LONG",
448
 
"type_specifier : T_SHORT",
449
 
"type_specifier : T_SIGNED",
450
 
"type_specifier : T_UNSIGNED",
451
 
"type_specifier : T_VOID",
452
 
"type_specifier : T_TYPEDEF_NAME",
453
 
"type_specifier : struct_or_union_specifier",
454
 
"type_specifier : enum_specifier",
455
 
"type_qualifier : T_TYPE_QUALIFIER",
456
 
"type_qualifier : T_DEFINE_NAME",
457
 
"struct_or_union_specifier : struct_or_union any_id braces",
458
 
"struct_or_union_specifier : struct_or_union braces",
459
 
"struct_or_union_specifier : struct_or_union any_id",
460
 
"struct_or_union : T_STRUCT",
461
 
"struct_or_union : T_UNION",
462
 
"init_declarator_list : init_declarator",
463
 
"init_declarator_list : init_declarator_list ',' init_declarator",
464
 
"init_declarator : declarator",
465
 
"$$5 :",
466
 
"init_declarator : declarator '=' $$5 T_INITIALIZER",
467
 
"enum_specifier : enumeration any_id braces",
468
 
"enum_specifier : enumeration braces",
469
 
"enum_specifier : enumeration any_id",
470
 
"enumeration : T_ENUM",
471
 
"any_id : T_IDENTIFIER",
472
 
"any_id : T_TYPEDEF_NAME",
473
 
"declarator : pointer direct_declarator",
474
 
"declarator : direct_declarator",
475
 
"direct_declarator : identifier_or_ref",
476
 
"direct_declarator : '(' declarator ')'",
477
 
"direct_declarator : direct_declarator T_BRACKETS",
478
 
"direct_declarator : direct_declarator '(' parameter_type_list ')'",
479
 
"direct_declarator : direct_declarator '(' opt_identifier_list ')'",
480
 
"pointer : '*' opt_type_qualifiers",
481
 
"pointer : '*' opt_type_qualifiers pointer",
482
 
"opt_type_qualifiers :",
483
 
"opt_type_qualifiers : type_qualifier_list",
484
 
"type_qualifier_list : type_qualifier",
485
 
"type_qualifier_list : type_qualifier_list type_qualifier",
486
 
"parameter_type_list : parameter_list",
487
 
"parameter_type_list : parameter_list ',' T_ELLIPSIS",
488
 
"parameter_list : parameter_declaration",
489
 
"parameter_list : parameter_list ',' parameter_declaration",
490
 
"parameter_declaration : decl_specifiers declarator",
491
 
"parameter_declaration : decl_specifiers abs_declarator",
492
 
"parameter_declaration : decl_specifiers",
493
 
"opt_identifier_list :",
494
 
"opt_identifier_list : identifier_list",
495
 
"identifier_list : T_IDENTIFIER",
496
 
"identifier_list : identifier_list ',' T_IDENTIFIER",
497
 
"identifier_or_ref : T_IDENTIFIER",
498
 
"identifier_or_ref : '&' T_IDENTIFIER",
499
 
"abs_declarator : pointer",
500
 
"abs_declarator : pointer direct_abs_declarator",
501
 
"abs_declarator : direct_abs_declarator",
502
 
"direct_abs_declarator : '(' abs_declarator ')'",
503
 
"direct_abs_declarator : direct_abs_declarator T_BRACKETS",
504
 
"direct_abs_declarator : T_BRACKETS",
505
 
"direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
506
 
"direct_abs_declarator : direct_abs_declarator '(' ')'",
507
 
"direct_abs_declarator : '(' parameter_type_list ')'",
508
 
"direct_abs_declarator : '(' ')'",
509
 
};
510
 
#endif
511
 
#ifdef YYSTACKSIZE
512
 
#undef YYMAXDEPTH
513
 
#define YYMAXDEPTH YYSTACKSIZE
514
 
#else
515
 
#ifdef YYMAXDEPTH
516
 
#define YYSTACKSIZE YYMAXDEPTH
517
 
#else
518
 
#define YYSTACKSIZE 10000
519
 
#define YYMAXDEPTH 10000
520
 
#endif
521
 
#endif
522
 
#define YYINITSTACKSIZE 200
523
 
int yydebug;
524
 
int yynerrs;
525
 
struct yystack {
526
 
    short *ssp;
527
 
    YYSTYPE *vsp;
528
 
    short *ss;
529
 
    YYSTYPE *vs;
530
 
    int stacksize;
531
 
    short *sslim;
532
 
};
533
 
int yychar; /* some people use this, so we copy it in & out */
534
 
int yyerrflag; /* must be global for yyerrok & YYRECOVERING */
535
 
YYSTYPE yylval;
536
 
#line 792 "grammar.y"
537
 
 
538
 
#if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(vms)
539
 
# ifdef USE_flex
540
 
#  include "lexyy.c"
541
 
# else
542
 
#  include "lex_yy.c"
543
 
# endif
544
 
#else
545
 
# include "lex.yy.c"
546
 
#endif
547
 
 
548
 
static void
549
 
yaccError (msg)
550
 
char *msg;
551
 
{
552
 
    func_params = NULL;
553
 
    put_error();                /* tell what line we're on, and what file */
554
 
    fprintf(stderr, "%s at token '%s'\n", msg, yytext);
555
 
}
556
 
 
557
 
/* Initialize the table of type qualifier keywords recognized by the lexical
558
 
 * analyzer.
559
 
 */
560
 
void
561
 
init_parser ()
562
 
{
563
 
    static char *keywords[] = {
564
 
        "const", "volatile", "interrupt",
565
 
#ifdef vms
566
 
        "noshare", "readonly",
567
 
#endif
568
 
#if defined(MSDOS) || defined(OS2)
569
 
        "cdecl", "far", "huge", "near", "pascal",
570
 
        "_cdecl", "_export", "_far", "_fastcall", "_fortran", "_huge",
571
 
        "_interrupt", "_loadds", "_near", "_pascal", "_saveregs", "_segment",
572
 
        "_cs", "_ds", "_es", "_ss", "_seg",
573
 
        "__cdecl", "__export", "__far", "__fastcall", "__fortran", "__huge",
574
 
        "__inline", "__interrupt", "__loadds", "__near", "__pascal",
575
 
        "__saveregs", "__segment", "__stdcall", "__syscall",
576
 
#ifdef OS2
577
 
        "__far16",
578
 
#endif
579
 
#else
580
 
        "__const__",    "__const",
581
 
        "__volatile__", "__volatile",
582
 
        "__inline__",   "__inline",
583
 
#endif
584
 
    };
585
 
    int i;
586
 
 
587
 
    /* Initialize type qualifier table. */
588
 
    type_qualifiers = new_symbol_table();
589
 
    for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
590
 
        new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
591
 
    }
592
 
}
593
 
 
594
 
/* Process the C source file.  Write function prototypes to the standard
595
 
 * output.  Convert function definitions and write the converted source
596
 
 * code to a temporary file.
597
 
 */
598
 
void
599
 
process_file (infile, name)
600
 
FILE *infile;
601
 
char *name;
602
 
{
603
 
    char *s;
604
 
 
605
 
    if (strlen(name) > 2) {
606
 
        s = name + strlen(name) - 2;
607
 
        if (*s == '.') {
608
 
            ++s;
609
 
            if (*s == 'l' || *s == 'y')
610
 
                BEGIN LEXYACC;
611
 
#if defined(MSDOS) || defined(OS2)
612
 
            if (*s == 'L' || *s == 'Y')
613
 
                BEGIN LEXYACC;
614
 
#endif
615
 
        }
616
 
    }
617
 
 
618
 
    included_files = new_symbol_table();
619
 
    typedef_names = new_symbol_table();
620
 
    define_names = new_symbol_table();
621
 
    inc_depth = -1;
622
 
    curly = 0;
623
 
    ly_count = 0;
624
 
    func_params = NULL;
625
 
    yyin = infile;
626
 
    include_file(strcpy(base_file, name), func_style != FUNC_NONE);
627
 
    if (file_comments) {
628
 
#if OPT_LINTLIBRARY
629
 
        if (lintLibrary()) {
630
 
            put_blankline(stdout);
631
 
            begin_tracking();
632
 
        }
633
 
#endif
634
 
        put_string(stdout, "/* ");
635
 
        put_string(stdout, cur_file_name());
636
 
        put_string(stdout, " */\n");
637
 
    }
638
 
    yyparse();
639
 
    free_symbol_table(define_names);
640
 
    free_symbol_table(typedef_names);
641
 
    free_symbol_table(included_files);
642
 
}
643
 
 
644
 
#ifdef NO_LEAKS
645
 
void
646
 
free_parser()
647
 
{
648
 
    free_symbol_table (type_qualifiers);
649
 
#ifdef FLEX_SCANNER
650
 
    if (yy_current_buffer != 0)
651
 
        yy_delete_buffer(yy_current_buffer);
652
 
#endif
653
 
}
654
 
#endif
655
 
#line 656 "y.tab.c"
656
 
/* allocate initial stack */
657
 
#if defined(__STDC__) || defined(__cplusplus)
658
 
static int yyinitstack(struct yystack *sp)
659
 
#else
660
 
static int yyinitstack(sp)
661
 
    struct yystack *sp;
662
 
#endif
663
 
{
664
 
    int newsize;
665
 
    short *newss;
666
 
    YYSTYPE *newvs;
667
 
 
668
 
    newsize = YYINITSTACKSIZE;
669
 
    newss = (short *)malloc(newsize * sizeof *newss);
670
 
    newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs);
671
 
    sp->ss = sp->ssp = newss;
672
 
    sp->vs = sp->vsp = newvs;
673
 
    if (newss == NULL || newvs == NULL) return -1;
674
 
    sp->stacksize = newsize;
675
 
    sp->sslim = newss + newsize - 1;
676
 
    return 0;
677
 
}
678
 
 
679
 
/* double stack size, up to YYMAXDEPTH */
680
 
#if defined(__STDC__) || defined(__cplusplus)
681
 
static int yygrowstack(struct yystack *sp)
682
 
#else
683
 
static int yygrowstack(sp)
684
 
    struct yystack *sp;
685
 
#endif
686
 
{
687
 
    int newsize, i;
688
 
    short *newss;
689
 
    YYSTYPE *newvs;
690
 
 
691
 
    if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1;
692
 
    if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH;
693
 
    i = sp->ssp - sp->ss;
694
 
    if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL)
695
 
        return -1;
696
 
    sp->ss = newss;
697
 
    sp->ssp = newss + i;
698
 
    if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL)
699
 
        return -1;
700
 
    sp->vs = newvs;
701
 
    sp->vsp = newvs + i;
702
 
    sp->stacksize = newsize;
703
 
    sp->sslim = newss + newsize - 1;
704
 
    return 0;
705
 
}
706
 
 
707
 
#define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); }
708
 
 
709
 
#define YYABORT goto yyabort
710
 
#define YYREJECT goto yyabort
711
 
#define YYACCEPT goto yyaccept
712
 
#define YYERROR goto yyerrlab
713
 
int
714
 
yyparse()
715
 
{
716
 
    register int yym, yyn, yystate, yych;
717
 
    register YYSTYPE *yyvsp;
718
 
    YYSTYPE yyval;
719
 
    struct yystack yystk;
720
 
#if YYDEBUG
721
 
    register char *yys;
722
 
    extern char *getenv();
723
 
 
724
 
    if (yys = getenv("YYDEBUG"))
725
 
    {
726
 
        yyn = *yys;
727
 
        if (yyn >= '0' && yyn <= '9')
728
 
            yydebug = yyn - '0';
729
 
    }
730
 
#endif
731
 
 
732
 
    yynerrs = 0;
733
 
    yyerrflag = 0;
734
 
    yychar = yych = YYEMPTY;
735
 
 
736
 
    if (yyinitstack(&yystk)) goto yyoverflow;
737
 
    *yystk.ssp = yystate = 0;
738
 
 
739
 
yyloop:
740
 
    if (yyn = yydefred[yystate]) goto yyreduce;
741
 
    if (yych < 0)
742
 
    {
743
 
        if ((yych = YYLEX) < 0) yych = 0;
744
 
        yychar = yych;
745
 
#if YYDEBUG
746
 
        if (yydebug)
747
 
        {
748
 
            yys = 0;
749
 
            if (yych <= YYMAXTOKEN) yys = yyname[yych];
750
 
            if (!yys) yys = "illegal-symbol";
751
 
            printf("%sdebug: state %d, reading %d (%s)\n",
752
 
                    YYPREFIX, yystate, yych, yys);
753
 
        }
754
 
#endif
755
 
    }
756
 
    if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 &&
757
 
            yyn <= YYTABLESIZE && yycheck[yyn] == yych)
758
 
    {
759
 
#if YYDEBUG
760
 
        if (yydebug)
761
 
            printf("%sdebug: state %d, shifting to state %d\n",
762
 
                    YYPREFIX, yystate, yytable[yyn]);
763
 
#endif
764
 
        if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
765
 
            goto yyoverflow;
766
 
        *++yystk.ssp = yystate = yytable[yyn];
767
 
        *++yystk.vsp = yylval;
768
 
        yychar = yych = YYEMPTY;
769
 
        if (yyerrflag > 0)  --yyerrflag;
770
 
        goto yyloop;
771
 
    }
772
 
    if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 &&
773
 
            yyn <= YYTABLESIZE && yycheck[yyn] == yych)
774
 
    {
775
 
        yyn = yytable[yyn];
776
 
        goto yyreduce;
777
 
    }
778
 
    if (yyerrflag) goto yyinrecovery;
779
 
#ifdef lint
780
 
    goto yynewerror;
781
 
#endif
782
 
yynewerror:
783
 
    yyerror("syntax error");
784
 
#ifdef lint
785
 
    goto yyerrlab;
786
 
#endif
787
 
yyerrlab:
788
 
    ++yynerrs;
789
 
yyinrecovery:
790
 
    if (yyerrflag < 3)
791
 
    {
792
 
        yyerrflag = 3;
793
 
        for (;;)
794
 
        {
795
 
            if ((yyn = yysindex[*yystk.ssp]) &&
796
 
                    (yyn += YYERRCODE) >= 0 &&
797
 
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
798
 
            {
799
 
#if YYDEBUG
800
 
                if (yydebug)
801
 
                    printf("%sdebug: state %d, error recovery shifting\
802
 
 to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]);
803
 
#endif
804
 
                if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
805
 
                    goto yyoverflow;
806
 
                *++yystk.ssp = yystate = yytable[yyn];
807
 
                *++yystk.vsp = yylval;
808
 
                goto yyloop;
809
 
            }
810
 
            else
811
 
            {
812
 
#if YYDEBUG
813
 
                if (yydebug)
814
 
                    printf("%sdebug: error recovery discarding state %d\n",
815
 
                            YYPREFIX, *yystk.ssp);
816
 
#endif
817
 
                if (yystk.ssp <= yystk.ss) goto yyabort;
818
 
                --yystk.ssp;
819
 
                --yystk.vsp;
820
 
            }
821
 
        }
822
 
    }
823
 
    else
824
 
    {
825
 
        if (yych == 0) goto yyabort;
826
 
#if YYDEBUG
827
 
        if (yydebug)
828
 
        {
829
 
            yys = 0;
830
 
            if (yych <= YYMAXTOKEN) yys = yyname[yych];
831
 
            if (!yys) yys = "illegal-symbol";
832
 
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
833
 
                    YYPREFIX, yystate, yych, yys);
834
 
        }
835
 
#endif
836
 
        yychar = yych = YYEMPTY;
837
 
        goto yyloop;
838
 
    }
839
 
yyreduce:
840
 
#if YYDEBUG
841
 
    if (yydebug)
842
 
        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
843
 
                YYPREFIX, yystate, yyn, yyrule[yyn]);
844
 
#endif
845
 
    yym = yylen[yyn];
846
 
    yyvsp = yystk.vsp; /* for speed in code under switch() */
847
 
    yyval = yyvsp[1-yym];
848
 
    switch (yyn)
849
 
    {
850
 
case 10:
851
 
#line 175 "grammar.y"
852
 
{
853
 
            yyerrok;
854
 
        }
855
 
break;
856
 
case 11:
857
 
#line 179 "grammar.y"
858
 
{
859
 
            yyerrok;
860
 
        }
861
 
break;
862
 
case 13:
863
 
#line 190 "grammar.y"
864
 
{
865
 
            /* Provide an empty action here so bison will not complain about
866
 
             * incompatible types in the default action it normally would
867
 
             * have generated.
868
 
             */
869
 
        }
870
 
break;
871
 
case 14:
872
 
#line 197 "grammar.y"
873
 
{
874
 
            /* empty */
875
 
        }
876
 
break;
877
 
case 15:
878
 
#line 204 "grammar.y"
879
 
{
880
 
#if OPT_LINTLIBRARY
881
 
            if (types_out && want_typedef()) {
882
 
                gen_declarations(&yyvsp[-1].decl_spec, (DeclaratorList *)0);
883
 
                flush_varargs();
884
 
            }
885
 
#endif
886
 
            free_decl_spec(&yyvsp[-1].decl_spec);
887
 
            end_typedef();
888
 
        }
889
 
break;
890
 
case 16:
891
 
#line 215 "grammar.y"
892
 
{
893
 
            if (func_params != NULL) {
894
 
                set_param_types(func_params, &yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);
895
 
            } else {
896
 
                gen_declarations(&yyvsp[-2].decl_spec, &yyvsp[-1].decl_list);
897
 
#if OPT_LINTLIBRARY
898
 
                flush_varargs();
899
 
#endif
900
 
                free_decl_list(&yyvsp[-1].decl_list);
901
 
            }
902
 
            free_decl_spec(&yyvsp[-2].decl_spec);
903
 
            end_typedef();
904
 
        }
905
 
break;
906
 
case 17:
907
 
#line 229 "grammar.y"
908
 
{
909
 
            cur_decl_spec_flags = yyvsp[0].decl_spec.flags;
910
 
            free_decl_spec(&yyvsp[0].decl_spec);
911
 
        }
912
 
break;
913
 
case 18:
914
 
#line 234 "grammar.y"
915
 
{
916
 
            end_typedef();
917
 
        }
918
 
break;
919
 
case 19:
920
 
#line 241 "grammar.y"
921
 
{
922
 
            begin_typedef();
923
 
        }
924
 
break;
925
 
case 22:
926
 
#line 253 "grammar.y"
927
 
{
928
 
            int flags = cur_decl_spec_flags;
929
 
 
930
 
            /* If the typedef is a pointer type, then reset the short type
931
 
             * flags so it does not get promoted.
932
 
             */
933
 
            if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0)
934
 
                flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
935
 
            new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags);
936
 
            free_declarator(yyvsp[0].declarator);
937
 
        }
938
 
break;
939
 
case 23:
940
 
#line 265 "grammar.y"
941
 
{
942
 
            int flags = cur_decl_spec_flags;
943
 
 
944
 
            if (strcmp(yyvsp[0].declarator->text, yyvsp[0].declarator->name) != 0)
945
 
                flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
946
 
            new_symbol(typedef_names, yyvsp[0].declarator->name, NULL, flags);
947
 
            free_declarator(yyvsp[0].declarator);
948
 
        }
949
 
break;
950
 
case 24:
951
 
#line 277 "grammar.y"
952
 
{
953
 
            check_untagged(&yyvsp[-1].decl_spec);
954
 
            if (yyvsp[0].declarator->func_def == FUNC_NONE) {
955
 
                yyerror("syntax error");
956
 
                YYERROR;
957
 
            }
958
 
            func_params = &(yyvsp[0].declarator->head->params);
959
 
            func_params->begin_comment = cur_file->begin_comment;
960
 
            func_params->end_comment = cur_file->end_comment;
961
 
        }
962
 
break;
963
 
case 25:
964
 
#line 288 "grammar.y"
965
 
{
966
 
            /* If we're converting to K&R and we've got a nominally K&R
967
 
             * function which has a parameter which is ANSI (i.e., a prototyped
968
 
             * function pointer), then we must override the deciphered value of
969
 
             * 'func_def' so that the parameter will be converted.
970
 
             */
971
 
            if (func_style == FUNC_TRADITIONAL
972
 
             && haveAnsiParam()
973
 
             && yyvsp[-3].declarator->head->func_def == func_style) {
974
 
                yyvsp[-3].declarator->head->func_def = FUNC_BOTH;
975
 
            }
976
 
 
977
 
            func_params = NULL;
978
 
 
979
 
            if (cur_file->convert)
980
 
                gen_func_definition(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);
981
 
            gen_prototype(&yyvsp[-4].decl_spec, yyvsp[-3].declarator);
982
 
#if OPT_LINTLIBRARY
983
 
            flush_varargs();
984
 
#endif
985
 
            free_decl_spec(&yyvsp[-4].decl_spec);
986
 
            free_declarator(yyvsp[-3].declarator);
987
 
        }
988
 
break;
989
 
case 27:
990
 
#line 313 "grammar.y"
991
 
{
992
 
            if (yyvsp[0].declarator->func_def == FUNC_NONE) {
993
 
                yyerror("syntax error");
994
 
                YYERROR;
995
 
            }
996
 
            func_params = &(yyvsp[0].declarator->head->params);
997
 
            func_params->begin_comment = cur_file->begin_comment;
998
 
            func_params->end_comment = cur_file->end_comment;
999
 
        }
1000
 
break;
1001
 
case 28:
1002
 
#line 323 "grammar.y"
1003
 
{
1004
 
            DeclSpec decl_spec;
1005
 
 
1006
 
            func_params = NULL;
1007
 
 
1008
 
            new_decl_spec(&decl_spec, dft_decl_spec(), yyvsp[-4].declarator->begin, DS_NONE);
1009
 
            if (cur_file->convert)
1010
 
                gen_func_definition(&decl_spec, yyvsp[-4].declarator);
1011
 
            gen_prototype(&decl_spec, yyvsp[-4].declarator);
1012
 
#if OPT_LINTLIBRARY
1013
 
            flush_varargs();
1014
 
#endif
1015
 
            free_decl_spec(&decl_spec);
1016
 
            free_declarator(yyvsp[-4].declarator);
1017
 
        }
1018
 
break;
1019
 
case 35:
1020
 
#line 354 "grammar.y"
1021
 
{
1022
 
            join_decl_specs(&yyval.decl_spec, &yyvsp[-1].decl_spec, &yyvsp[0].decl_spec);
1023
 
            free(yyvsp[-1].decl_spec.text);
1024
 
            free(yyvsp[0].decl_spec.text);
1025
 
        }
1026
 
break;
1027
 
case 39:
1028
 
#line 369 "grammar.y"
1029
 
{
1030
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1031
 
        }
1032
 
break;
1033
 
case 40:
1034
 
#line 373 "grammar.y"
1035
 
{
1036
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_EXTERN);
1037
 
        }
1038
 
break;
1039
 
case 41:
1040
 
#line 377 "grammar.y"
1041
 
{
1042
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1043
 
        }
1044
 
break;
1045
 
case 42:
1046
 
#line 381 "grammar.y"
1047
 
{
1048
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_STATIC);
1049
 
        }
1050
 
break;
1051
 
case 43:
1052
 
#line 385 "grammar.y"
1053
 
{
1054
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_JUNK);
1055
 
        }
1056
 
break;
1057
 
case 44:
1058
 
#line 392 "grammar.y"
1059
 
{
1060
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_CHAR);
1061
 
        }
1062
 
break;
1063
 
case 45:
1064
 
#line 396 "grammar.y"
1065
 
{
1066
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1067
 
        }
1068
 
break;
1069
 
case 46:
1070
 
#line 400 "grammar.y"
1071
 
{
1072
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_FLOAT);
1073
 
        }
1074
 
break;
1075
 
case 47:
1076
 
#line 404 "grammar.y"
1077
 
{
1078
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1079
 
        }
1080
 
break;
1081
 
case 48:
1082
 
#line 408 "grammar.y"
1083
 
{
1084
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1085
 
        }
1086
 
break;
1087
 
case 49:
1088
 
#line 412 "grammar.y"
1089
 
{
1090
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_SHORT);
1091
 
        }
1092
 
break;
1093
 
case 50:
1094
 
#line 416 "grammar.y"
1095
 
{
1096
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1097
 
        }
1098
 
break;
1099
 
case 51:
1100
 
#line 420 "grammar.y"
1101
 
{
1102
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1103
 
        }
1104
 
break;
1105
 
case 52:
1106
 
#line 424 "grammar.y"
1107
 
{
1108
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1109
 
        }
1110
 
break;
1111
 
case 53:
1112
 
#line 428 "grammar.y"
1113
 
{
1114
 
            Symbol *s;
1115
 
            s = find_symbol(typedef_names, yyvsp[0].text.text);
1116
 
            if (s != NULL)
1117
 
                new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags);
1118
 
        }
1119
 
break;
1120
 
case 56:
1121
 
#line 440 "grammar.y"
1122
 
{
1123
 
            new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, DS_NONE);
1124
 
        }
1125
 
break;
1126
 
case 57:
1127
 
#line 444 "grammar.y"
1128
 
{
1129
 
            /* This rule allows the <pointer> nonterminal to scan #define
1130
 
             * names as if they were type modifiers.
1131
 
             */
1132
 
            Symbol *s;
1133
 
            s = find_symbol(define_names, yyvsp[0].text.text);
1134
 
            if (s != NULL)
1135
 
                new_decl_spec(&yyval.decl_spec, yyvsp[0].text.text, yyvsp[0].text.begin, s->flags);
1136
 
        }
1137
 
break;
1138
 
case 58:
1139
 
#line 457 "grammar.y"
1140
 
{
1141
 
            char *s;
1142
 
            if ((s = implied_typedef()) == 0)
1143
 
                (void)sprintf(s = buf, "%s %s", yyvsp[-2].text.text, yyvsp[-1].text.text);
1144
 
            new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE);
1145
 
        }
1146
 
break;
1147
 
case 59:
1148
 
#line 464 "grammar.y"
1149
 
{
1150
 
            char *s;
1151
 
            if ((s = implied_typedef()) == 0)
1152
 
                (void)sprintf(s = buf, "%s {}", yyvsp[-1].text.text);
1153
 
            new_decl_spec(&yyval.decl_spec, s, yyvsp[-1].text.begin, DS_NONE);
1154
 
        }
1155
 
break;
1156
 
case 60:
1157
 
#line 471 "grammar.y"
1158
 
{
1159
 
            (void)sprintf(buf, "%s %s", yyvsp[-1].text.text, yyvsp[0].text.text);
1160
 
            new_decl_spec(&yyval.decl_spec, buf, yyvsp[-1].text.begin, DS_NONE);
1161
 
        }
1162
 
break;
1163
 
case 61:
1164
 
#line 479 "grammar.y"
1165
 
{
1166
 
            imply_typedef(yyval.text.text);
1167
 
        }
1168
 
break;
1169
 
case 62:
1170
 
#line 483 "grammar.y"
1171
 
{
1172
 
            imply_typedef(yyval.text.text);
1173
 
        }
1174
 
break;
1175
 
case 63:
1176
 
#line 490 "grammar.y"
1177
 
{
1178
 
            new_decl_list(&yyval.decl_list, yyvsp[0].declarator);
1179
 
        }
1180
 
break;
1181
 
case 64:
1182
 
#line 494 "grammar.y"
1183
 
{
1184
 
            add_decl_list(&yyval.decl_list, &yyvsp[-2].decl_list, yyvsp[0].declarator);
1185
 
        }
1186
 
break;
1187
 
case 65:
1188
 
#line 501 "grammar.y"
1189
 
{
1190
 
            if (yyvsp[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
1191
 
                func_style == FUNC_TRADITIONAL && cur_file->convert) {
1192
 
                gen_func_declarator(yyvsp[0].declarator);
1193
 
                fputs(cur_text(), cur_file->tmp_file);
1194
 
            }
1195
 
            cur_declarator = yyval.declarator;
1196
 
        }
1197
 
break;
1198
 
case 66:
1199
 
#line 510 "grammar.y"
1200
 
{
1201
 
            if (yyvsp[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
1202
 
                func_style == FUNC_TRADITIONAL && cur_file->convert) {
1203
 
                gen_func_declarator(yyvsp[-1].declarator);
1204
 
                fputs(" =", cur_file->tmp_file);
1205
 
            }
1206
 
        }
1207
 
break;
1208
 
case 68:
1209
 
#line 522 "grammar.y"
1210
 
{
1211
 
            char *s;
1212
 
            if ((s = implied_typedef()) == 0)
1213
 
                (void)sprintf(s = buf, "enum %s", yyvsp[-1].text.text);
1214
 
            new_decl_spec(&yyval.decl_spec, s, yyvsp[-2].text.begin, DS_NONE);
1215
 
        }
1216
 
break;
1217
 
case 69:
1218
 
#line 529 "grammar.y"
1219
 
{
1220
 
            char *s;
1221
 
            if ((s = implied_typedef()) == 0)
1222
 
                (void)sprintf(s = buf, "%s {}", yyvsp[-1].text.text);
1223
 
            new_decl_spec(&yyval.decl_spec, s, yyvsp[-1].text.begin, DS_NONE);
1224
 
        }
1225
 
break;
1226
 
case 70:
1227
 
#line 536 "grammar.y"
1228
 
{
1229
 
            (void)sprintf(buf, "enum %s", yyvsp[0].text.text);
1230
 
            new_decl_spec(&yyval.decl_spec, buf, yyvsp[-1].text.begin, DS_NONE);
1231
 
        }
1232
 
break;
1233
 
case 71:
1234
 
#line 544 "grammar.y"
1235
 
{
1236
 
            imply_typedef("enum");
1237
 
            yyval.text = yyvsp[0].text;
1238
 
        }
1239
 
break;
1240
 
case 74:
1241
 
#line 557 "grammar.y"
1242
 
{
1243
 
            yyval.declarator = yyvsp[0].declarator;
1244
 
            (void)sprintf(buf, "%s%s", yyvsp[-1].text.text, yyval.declarator->text);
1245
 
            free(yyval.declarator->text);
1246
 
            yyval.declarator->text = xstrdup(buf);
1247
 
            yyval.declarator->begin = yyvsp[-1].text.begin;
1248
 
            yyval.declarator->pointer = TRUE;
1249
 
        }
1250
 
break;
1251
 
case 76:
1252
 
#line 570 "grammar.y"
1253
 
{
1254
 
            yyval.declarator = new_declarator(yyvsp[0].text.text, yyvsp[0].text.text, yyvsp[0].text.begin);
1255
 
        }
1256
 
break;
1257
 
case 77:
1258
 
#line 574 "grammar.y"
1259
 
{
1260
 
            yyval.declarator = yyvsp[-1].declarator;
1261
 
            (void)sprintf(buf, "(%s)", yyval.declarator->text);
1262
 
            free(yyval.declarator->text);
1263
 
            yyval.declarator->text = xstrdup(buf);
1264
 
            yyval.declarator->begin = yyvsp[-2].text.begin;
1265
 
        }
1266
 
break;
1267
 
case 78:
1268
 
#line 582 "grammar.y"
1269
 
{
1270
 
            yyval.declarator = yyvsp[-1].declarator;
1271
 
            (void)sprintf(buf, "%s%s", yyval.declarator->text, yyvsp[0].text.text);
1272
 
            free(yyval.declarator->text);
1273
 
            yyval.declarator->text = xstrdup(buf);
1274
 
        }
1275
 
break;
1276
 
case 79:
1277
 
#line 589 "grammar.y"
1278
 
{
1279
 
            yyval.declarator = new_declarator("%s()", yyvsp[-3].declarator->name, yyvsp[-3].declarator->begin);
1280
 
            yyval.declarator->params = yyvsp[-1].param_list;
1281
 
            yyval.declarator->func_stack = yyvsp[-3].declarator;
1282
 
            yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1283
 
            yyval.declarator->func_def = FUNC_ANSI;
1284
 
        }
1285
 
break;
1286
 
case 80:
1287
 
#line 597 "grammar.y"
1288
 
{
1289
 
            yyval.declarator = new_declarator("%s()", yyvsp[-3].declarator->name, yyvsp[-3].declarator->begin);
1290
 
            yyval.declarator->params = yyvsp[-1].param_list;
1291
 
            yyval.declarator->func_stack = yyvsp[-3].declarator;
1292
 
            yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1293
 
            yyval.declarator->func_def = FUNC_TRADITIONAL;
1294
 
        }
1295
 
break;
1296
 
case 81:
1297
 
#line 608 "grammar.y"
1298
 
{
1299
 
            (void)sprintf(yyval.text.text, "*%s", yyvsp[0].text.text);
1300
 
            yyval.text.begin = yyvsp[-1].text.begin;
1301
 
        }
1302
 
break;
1303
 
case 82:
1304
 
#line 613 "grammar.y"
1305
 
{
1306
 
            (void)sprintf(yyval.text.text, "*%s%s", yyvsp[-1].text.text, yyvsp[0].text.text);
1307
 
            yyval.text.begin = yyvsp[-2].text.begin;
1308
 
        }
1309
 
break;
1310
 
case 83:
1311
 
#line 621 "grammar.y"
1312
 
{
1313
 
            strcpy(yyval.text.text, "");
1314
 
            yyval.text.begin = 0L;
1315
 
        }
1316
 
break;
1317
 
case 85:
1318
 
#line 630 "grammar.y"
1319
 
{
1320
 
            (void)sprintf(yyval.text.text, "%s ", yyvsp[0].decl_spec.text);
1321
 
            yyval.text.begin = yyvsp[0].decl_spec.begin;
1322
 
            free(yyvsp[0].decl_spec.text);
1323
 
        }
1324
 
break;
1325
 
case 86:
1326
 
#line 636 "grammar.y"
1327
 
{
1328
 
            (void)sprintf(yyval.text.text, "%s%s ", yyvsp[-1].text.text, yyvsp[0].decl_spec.text);
1329
 
            yyval.text.begin = yyvsp[-1].text.begin;
1330
 
            free(yyvsp[0].decl_spec.text);
1331
 
        }
1332
 
break;
1333
 
case 88:
1334
 
#line 646 "grammar.y"
1335
 
{
1336
 
            add_ident_list(&yyval.param_list, &yyvsp[-2].param_list, "...");
1337
 
        }
1338
 
break;
1339
 
case 89:
1340
 
#line 653 "grammar.y"
1341
 
{
1342
 
            new_param_list(&yyval.param_list, yyvsp[0].parameter);
1343
 
        }
1344
 
break;
1345
 
case 90:
1346
 
#line 657 "grammar.y"
1347
 
{
1348
 
            add_param_list(&yyval.param_list, &yyvsp[-2].param_list, yyvsp[0].parameter);
1349
 
        }
1350
 
break;
1351
 
case 91:
1352
 
#line 664 "grammar.y"
1353
 
{
1354
 
            check_untagged(&yyvsp[-1].decl_spec);
1355
 
            yyval.parameter = new_parameter(&yyvsp[-1].decl_spec, yyvsp[0].declarator);
1356
 
        }
1357
 
break;
1358
 
case 92:
1359
 
#line 669 "grammar.y"
1360
 
{
1361
 
            check_untagged(&yyvsp[-1].decl_spec);
1362
 
            yyval.parameter = new_parameter(&yyvsp[-1].decl_spec, yyvsp[0].declarator);
1363
 
        }
1364
 
break;
1365
 
case 93:
1366
 
#line 674 "grammar.y"
1367
 
{
1368
 
            check_untagged(&yyvsp[0].decl_spec);
1369
 
            yyval.parameter = new_parameter(&yyvsp[0].decl_spec, (Declarator *)0);
1370
 
        }
1371
 
break;
1372
 
case 94:
1373
 
#line 682 "grammar.y"
1374
 
{
1375
 
            new_ident_list(&yyval.param_list);
1376
 
        }
1377
 
break;
1378
 
case 96:
1379
 
#line 690 "grammar.y"
1380
 
{
1381
 
            new_ident_list(&yyval.param_list);
1382
 
            add_ident_list(&yyval.param_list, &yyval.param_list, yyvsp[0].text.text);
1383
 
        }
1384
 
break;
1385
 
case 97:
1386
 
#line 695 "grammar.y"
1387
 
{
1388
 
            add_ident_list(&yyval.param_list, &yyvsp[-2].param_list, yyvsp[0].text.text);
1389
 
        }
1390
 
break;
1391
 
case 98:
1392
 
#line 702 "grammar.y"
1393
 
{
1394
 
            yyval.text = yyvsp[0].text;
1395
 
        }
1396
 
break;
1397
 
case 99:
1398
 
#line 706 "grammar.y"
1399
 
{
1400
 
#if OPT_LINTLIBRARY
1401
 
            if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
1402
 
                yyval.text = yyvsp[0].text;
1403
 
            } else
1404
 
#endif
1405
 
                (void)sprintf(yyval.text.text, "&%s", yyvsp[0].text.text);
1406
 
            yyval.text.begin = yyvsp[-1].text.begin;
1407
 
        }
1408
 
break;
1409
 
case 100:
1410
 
#line 719 "grammar.y"
1411
 
{
1412
 
            yyval.declarator = new_declarator(yyvsp[0].text.text, "", yyvsp[0].text.begin);
1413
 
        }
1414
 
break;
1415
 
case 101:
1416
 
#line 723 "grammar.y"
1417
 
{
1418
 
            yyval.declarator = yyvsp[0].declarator;
1419
 
            (void)sprintf(buf, "%s%s", yyvsp[-1].text.text, yyval.declarator->text);
1420
 
            free(yyval.declarator->text);
1421
 
            yyval.declarator->text = xstrdup(buf);
1422
 
            yyval.declarator->begin = yyvsp[-1].text.begin;
1423
 
        }
1424
 
break;
1425
 
case 103:
1426
 
#line 735 "grammar.y"
1427
 
{
1428
 
            yyval.declarator = yyvsp[-1].declarator;
1429
 
            (void)sprintf(buf, "(%s)", yyval.declarator->text);
1430
 
            free(yyval.declarator->text);
1431
 
            yyval.declarator->text = xstrdup(buf);
1432
 
            yyval.declarator->begin = yyvsp[-2].text.begin;
1433
 
        }
1434
 
break;
1435
 
case 104:
1436
 
#line 743 "grammar.y"
1437
 
{
1438
 
            yyval.declarator = yyvsp[-1].declarator;
1439
 
            (void)sprintf(buf, "%s%s", yyval.declarator->text, yyvsp[0].text.text);
1440
 
            free(yyval.declarator->text);
1441
 
            yyval.declarator->text = xstrdup(buf);
1442
 
        }
1443
 
break;
1444
 
case 105:
1445
 
#line 750 "grammar.y"
1446
 
{
1447
 
            yyval.declarator = new_declarator(yyvsp[0].text.text, "", yyvsp[0].text.begin);
1448
 
        }
1449
 
break;
1450
 
case 106:
1451
 
#line 754 "grammar.y"
1452
 
{
1453
 
            yyval.declarator = new_declarator("%s()", "", yyvsp[-3].declarator->begin);
1454
 
            yyval.declarator->params = yyvsp[-1].param_list;
1455
 
            yyval.declarator->func_stack = yyvsp[-3].declarator;
1456
 
            yyval.declarator->head = (yyvsp[-3].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-3].declarator->head;
1457
 
            yyval.declarator->func_def = FUNC_ANSI;
1458
 
        }
1459
 
break;
1460
 
case 107:
1461
 
#line 762 "grammar.y"
1462
 
{
1463
 
            yyval.declarator = new_declarator("%s()", "", yyvsp[-2].declarator->begin);
1464
 
            yyval.declarator->func_stack = yyvsp[-2].declarator;
1465
 
            yyval.declarator->head = (yyvsp[-2].declarator->func_stack == NULL) ? yyval.declarator : yyvsp[-2].declarator->head;
1466
 
            yyval.declarator->func_def = FUNC_ANSI;
1467
 
        }
1468
 
break;
1469
 
case 108:
1470
 
#line 769 "grammar.y"
1471
 
{
1472
 
            Declarator *d;
1473
 
            
1474
 
            d = new_declarator("", "", yyvsp[-2].text.begin);
1475
 
            yyval.declarator = new_declarator("%s()", "", yyvsp[-2].text.begin);
1476
 
            yyval.declarator->params = yyvsp[-1].param_list;
1477
 
            yyval.declarator->func_stack = d;
1478
 
            yyval.declarator->head = yyval.declarator;
1479
 
            yyval.declarator->func_def = FUNC_ANSI;
1480
 
        }
1481
 
break;
1482
 
case 109:
1483
 
#line 780 "grammar.y"
1484
 
{
1485
 
            Declarator *d;
1486
 
            
1487
 
            d = new_declarator("", "", yyvsp[-1].text.begin);
1488
 
            yyval.declarator = new_declarator("%s()", "", yyvsp[-1].text.begin);
1489
 
            yyval.declarator->func_stack = d;
1490
 
            yyval.declarator->head = yyval.declarator;
1491
 
            yyval.declarator->func_def = FUNC_ANSI;
1492
 
        }
1493
 
break;
1494
 
#line 1495 "y.tab.c"
1495
 
    }
1496
 
    yystk.ssp -= yym;
1497
 
    yystate = *yystk.ssp;
1498
 
    yystk.vsp -= yym;
1499
 
    yym = yylhs[yyn];
1500
 
    yych = yychar;
1501
 
    if (yystate == 0 && yym == 0)
1502
 
    {
1503
 
#if YYDEBUG
1504
 
        if (yydebug)
1505
 
            printf("%sdebug: after reduction, shifting from state 0 to\
1506
 
 state %d\n", YYPREFIX, YYFINAL);
1507
 
#endif
1508
 
        yystate = YYFINAL;
1509
 
        *++yystk.ssp = YYFINAL;
1510
 
        *++yystk.vsp = yyval;
1511
 
        if (yych < 0)
1512
 
        {
1513
 
            if ((yych = YYLEX) < 0) yych = 0;
1514
 
            yychar = yych;
1515
 
#if YYDEBUG
1516
 
            if (yydebug)
1517
 
            {
1518
 
                yys = 0;
1519
 
                if (yych <= YYMAXTOKEN) yys = yyname[yych];
1520
 
                if (!yys) yys = "illegal-symbol";
1521
 
                printf("%sdebug: state %d, reading %d (%s)\n",
1522
 
                        YYPREFIX, YYFINAL, yych, yys);
1523
 
            }
1524
 
#endif
1525
 
        }
1526
 
        if (yych == 0) goto yyaccept;
1527
 
        goto yyloop;
1528
 
    }
1529
 
    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1530
 
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1531
 
        yystate = yytable[yyn];
1532
 
    else
1533
 
        yystate = yydgoto[yym];
1534
 
#if YYDEBUG
1535
 
    if (yydebug)
1536
 
        printf("%sdebug: after reduction, shifting from state %d \
1537
 
to state %d\n", YYPREFIX, *yystk.ssp, yystate);
1538
 
#endif
1539
 
    if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk))
1540
 
        goto yyoverflow;
1541
 
    *++yystk.ssp = yystate;
1542
 
    *++yystk.vsp = yyval;
1543
 
    goto yyloop;
1544
 
yyoverflow:
1545
 
    yyerror("yacc stack overflow");
1546
 
yyabort:
1547
 
    YYFREESTACK(&yystk);
1548
 
    return (1);
1549
 
yyaccept:
1550
 
    YYFREESTACK(&yystk);
1551
 
    return (0);
1552
 
}