1235723Sbapt#ifndef lint 2235723Sbaptstatic const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; 3235723Sbapt#endif 4235723Sbapt 5235723Sbapt#define YYBYACC 1 6235723Sbapt#define YYMAJOR 1 7235723Sbapt#define YYMINOR 9 8262960Sjmmv#define YYPATCH 20140101 9235723Sbapt 10235723Sbapt#define YYEMPTY (-1) 11235723Sbapt#define yyclearin (yychar = YYEMPTY) 12235723Sbapt#define yyerrok (yyerrflag = 0) 13235723Sbapt#define YYRECOVERING() (yyerrflag != 0) 14235723Sbapt 15235723Sbapt#define YYPREFIX "yy" 16235723Sbapt 17235723Sbapt#define YYPURE 0 18235723Sbapt 19235723Sbapt#line 9 "grammar.y" 20235723Sbapt#ifdef YYBISON 21235723Sbapt#include <stdlib.h> 22235723Sbapt#define YYSTYPE_IS_DECLARED 23235723Sbapt#define yyerror yaccError 24235723Sbapt#endif 25235723Sbapt 26235723Sbapt#if defined(YYBISON) || !defined(YYBYACC) 27235723Sbaptstatic void yyerror(const char *s); 28235723Sbapt#endif 29235723Sbapt#line 81 "grammar.y" 30235723Sbapt#include <stdio.h> 31235723Sbapt#include <ctype.h> 32235723Sbapt#include <string.h> 33235723Sbapt 34235723Sbapt#define OPT_LINTLIBRARY 1 35235723Sbapt 36235723Sbapt#ifndef TRUE 37235723Sbapt#define TRUE (1) 38235723Sbapt#endif 39235723Sbapt 40235723Sbapt#ifndef FALSE 41235723Sbapt#define FALSE (0) 42235723Sbapt#endif 43235723Sbapt 44235723Sbapt/* #include "cproto.h" */ 45235723Sbapt#define MAX_TEXT_SIZE 1024 46235723Sbapt 47235723Sbapt/* Prototype styles */ 48235723Sbapt#if OPT_LINTLIBRARY 49235723Sbapt#define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */ 50235723Sbapt#define PROTO_LINTLIBRARY -1 /* form lint-library source */ 51235723Sbapt#endif 52235723Sbapt#define PROTO_NONE 0 /* do not output any prototypes */ 53235723Sbapt#define PROTO_TRADITIONAL 1 /* comment out parameters */ 54235723Sbapt#define PROTO_ABSTRACT 2 /* comment out parameter names */ 55235723Sbapt#define PROTO_ANSI 3 /* ANSI C prototype */ 56235723Sbapt 57235723Sbapttypedef int PrototypeStyle; 58235723Sbapt 59235723Sbapttypedef char boolean; 60235723Sbapt 61235723Sbaptextern boolean types_out; 62235723Sbaptextern PrototypeStyle proto_style; 63235723Sbapt 64235723Sbapt#define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB) 65235723Sbapt#define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY) 66235723Sbapt#define lintLibrary() (knrLintLibrary() || ansiLintLibrary()) 67235723Sbapt 68235723Sbapt#if OPT_LINTLIBRARY 69235723Sbapt#define FUNC_UNKNOWN -1 /* unspecified */ 70235723Sbapt#else 71235723Sbapt#define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */ 72235723Sbapt#endif 73235723Sbapt#define FUNC_NONE 0 /* not a function definition */ 74235723Sbapt#define FUNC_TRADITIONAL 1 /* traditional style */ 75235723Sbapt#define FUNC_ANSI 2 /* ANSI style */ 76235723Sbapt#define FUNC_BOTH 3 /* both styles */ 77235723Sbapt 78235723Sbapttypedef int FuncDefStyle; 79235723Sbapt 80235723Sbapt/* Source file text */ 81235723Sbapttypedef struct text { 82235723Sbapt char text[MAX_TEXT_SIZE]; /* source text */ 83235723Sbapt long begin; /* offset in temporary file */ 84235723Sbapt} Text; 85235723Sbapt 86235723Sbapt/* Declaration specifier flags */ 87235723Sbapt#define DS_NONE 0 /* default */ 88235723Sbapt#define DS_EXTERN 1 /* contains "extern" specifier */ 89235723Sbapt#define DS_STATIC 2 /* contains "static" specifier */ 90235723Sbapt#define DS_CHAR 4 /* contains "char" type specifier */ 91235723Sbapt#define DS_SHORT 8 /* contains "short" type specifier */ 92235723Sbapt#define DS_FLOAT 16 /* contains "float" type specifier */ 93235723Sbapt#define DS_INLINE 32 /* contains "inline" specifier */ 94235723Sbapt#define DS_JUNK 64 /* we're not interested in this declaration */ 95235723Sbapt 96235723Sbapt/* This structure stores information about a declaration specifier. */ 97235723Sbapttypedef struct decl_spec { 98235723Sbapt unsigned short flags; /* flags defined above */ 99235723Sbapt char *text; /* source text */ 100235723Sbapt long begin; /* offset in temporary file */ 101235723Sbapt} DeclSpec; 102235723Sbapt 103235723Sbapt/* This is a list of function parameters. */ 104235723Sbapttypedef struct _ParameterList { 105235723Sbapt struct parameter *first; /* pointer to first parameter in list */ 106235723Sbapt struct parameter *last; /* pointer to last parameter in list */ 107235723Sbapt long begin_comment; /* begin offset of comment */ 108235723Sbapt long end_comment; /* end offset of comment */ 109235723Sbapt char *comment; /* comment at start of parameter list */ 110235723Sbapt} ParameterList; 111235723Sbapt 112235723Sbapt/* This structure stores information about a declarator. */ 113235723Sbapttypedef struct _Declarator { 114235723Sbapt char *name; /* name of variable or function */ 115235723Sbapt char *text; /* source text */ 116235723Sbapt long begin; /* offset in temporary file */ 117235723Sbapt long begin_comment; /* begin offset of comment */ 118235723Sbapt long end_comment; /* end offset of comment */ 119235723Sbapt FuncDefStyle func_def; /* style of function definition */ 120235723Sbapt ParameterList params; /* function parameters */ 121235723Sbapt boolean pointer; /* TRUE if it declares a pointer */ 122235723Sbapt struct _Declarator *head; /* head function declarator */ 123235723Sbapt struct _Declarator *func_stack; /* stack of function declarators */ 124235723Sbapt struct _Declarator *next; /* next declarator in list */ 125235723Sbapt} Declarator; 126235723Sbapt 127235723Sbapt/* This structure stores information about a function parameter. */ 128235723Sbapttypedef struct parameter { 129235723Sbapt struct parameter *next; /* next parameter in list */ 130235723Sbapt DeclSpec decl_spec; 131235723Sbapt Declarator *declarator; 132235723Sbapt char *comment; /* comment following the parameter */ 133235723Sbapt} Parameter; 134235723Sbapt 135235723Sbapt/* This is a list of declarators. */ 136235723Sbapttypedef struct declarator_list { 137235723Sbapt Declarator *first; /* pointer to first declarator in list */ 138235723Sbapt Declarator *last; /* pointer to last declarator in list */ 139235723Sbapt} DeclaratorList; 140235723Sbapt 141235723Sbapt/* #include "symbol.h" */ 142235723Sbapttypedef struct symbol { 143235723Sbapt struct symbol *next; /* next symbol in list */ 144235723Sbapt char *name; /* name of symbol */ 145235723Sbapt char *value; /* value of symbol (for defines) */ 146235723Sbapt short flags; /* symbol attributes */ 147235723Sbapt} Symbol; 148235723Sbapt 149235723Sbapt/* parser stack entry type */ 150235723Sbapttypedef union { 151235723Sbapt Text text; 152235723Sbapt DeclSpec decl_spec; 153235723Sbapt Parameter *parameter; 154235723Sbapt ParameterList param_list; 155235723Sbapt Declarator *declarator; 156235723Sbapt DeclaratorList decl_list; 157235723Sbapt} YYSTYPE; 158235723Sbapt 159235723Sbapt/* The hash table length should be a prime number. */ 160235723Sbapt#define SYM_MAX_HASH 251 161235723Sbapt 162235723Sbapttypedef struct symbol_table { 163235723Sbapt Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */ 164235723Sbapt} SymbolTable; 165235723Sbapt 166235723Sbaptextern SymbolTable *new_symbol_table /* Create symbol table */ 167235723Sbapt (void); 168235723Sbaptextern void free_symbol_table /* Destroy symbol table */ 169235723Sbapt (SymbolTable *s); 170235723Sbaptextern Symbol *find_symbol /* Lookup symbol name */ 171235723Sbapt (SymbolTable *s, const char *n); 172235723Sbaptextern Symbol *new_symbol /* Define new symbol */ 173235723Sbapt (SymbolTable *s, const char *n, const char *v, int f); 174235723Sbapt 175235723Sbapt/* #include "semantic.h" */ 176235723Sbaptextern void new_decl_spec (DeclSpec *, const char *, long, int); 177235723Sbaptextern void free_decl_spec (DeclSpec *); 178235723Sbaptextern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *); 179235723Sbaptextern void check_untagged (DeclSpec *); 180235723Sbaptextern Declarator *new_declarator (const char *, const char *, long); 181235723Sbaptextern void free_declarator (Declarator *); 182235723Sbaptextern void new_decl_list (DeclaratorList *, Declarator *); 183235723Sbaptextern void free_decl_list (DeclaratorList *); 184235723Sbaptextern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *); 185235723Sbaptextern Parameter *new_parameter (DeclSpec *, Declarator *); 186235723Sbaptextern void free_parameter (Parameter *); 187235723Sbaptextern void new_param_list (ParameterList *, Parameter *); 188235723Sbaptextern void free_param_list (ParameterList *); 189235723Sbaptextern void add_param_list (ParameterList *, ParameterList *, Parameter *); 190235723Sbaptextern void new_ident_list (ParameterList *); 191235723Sbaptextern void add_ident_list (ParameterList *, ParameterList *, const char *); 192235723Sbaptextern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *); 193235723Sbaptextern void gen_declarations (DeclSpec *, DeclaratorList *); 194235723Sbaptextern void gen_prototype (DeclSpec *, Declarator *); 195235723Sbaptextern void gen_func_declarator (Declarator *); 196235723Sbaptextern void gen_func_definition (DeclSpec *, Declarator *); 197235723Sbapt 198235723Sbaptextern void init_parser (void); 199235723Sbaptextern void process_file (FILE *infile, char *name); 200235723Sbaptextern char *cur_text (void); 201235723Sbaptextern char *cur_file_name (void); 202235723Sbaptextern char *implied_typedef (void); 203235723Sbaptextern void include_file (char *name, int convert); 204235723Sbaptextern char *supply_parm (int count); 205235723Sbaptextern char *xstrdup (const char *); 206235723Sbaptextern int already_declared (char *name); 207235723Sbaptextern int is_actual_func (Declarator *d); 208235723Sbaptextern int lint_ellipsis (Parameter *p); 209235723Sbaptextern int want_typedef (void); 210235723Sbaptextern void begin_tracking (void); 211235723Sbaptextern void begin_typedef (void); 212235723Sbaptextern void copy_typedef (char *s); 213235723Sbaptextern void ellipsis_varargs (Declarator *d); 214235723Sbaptextern void end_typedef (void); 215235723Sbaptextern void flush_varargs (void); 216235723Sbaptextern void fmt_library (int code); 217235723Sbaptextern void imply_typedef (const char *s); 218235723Sbaptextern void indent (FILE *outf); 219235723Sbaptextern void put_blankline (FILE *outf); 220235723Sbaptextern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator); 221235723Sbaptextern void put_char (FILE *outf, int c); 222235723Sbaptextern void put_error (void); 223235723Sbaptextern void put_newline (FILE *outf); 224235723Sbaptextern void put_padded (FILE *outf, const char *s); 225235723Sbaptextern void put_string (FILE *outf, const char *s); 226235723Sbaptextern void track_in (void); 227235723Sbapt 228235723Sbaptextern boolean file_comments; 229235723Sbaptextern FuncDefStyle func_style; 230235723Sbaptextern char base_file[]; 231235723Sbapt 232235723Sbaptextern int yylex (void); 233235723Sbapt 234235723Sbapt/* declaration specifier attributes for the typedef statement currently being 235235723Sbapt * scanned 236235723Sbapt */ 237235723Sbaptstatic int cur_decl_spec_flags; 238235723Sbapt 239235723Sbapt/* pointer to parameter list for the current function definition */ 240235723Sbaptstatic ParameterList *func_params; 241235723Sbapt 242235723Sbapt/* A parser semantic action sets this pointer to the current declarator in 243235723Sbapt * a function parameter declaration in order to catch any comments following 244235723Sbapt * the parameter declaration on the same line. If the lexer scans a comment 245235723Sbapt * and <cur_declarator> is not NULL, then the comment is attached to the 246235723Sbapt * declarator. To ignore subsequent comments, the lexer sets this to NULL 247235723Sbapt * after scanning a comment or end of line. 248235723Sbapt */ 249235723Sbaptstatic Declarator *cur_declarator; 250235723Sbapt 251235723Sbapt/* temporary string buffer */ 252235723Sbaptstatic char buf[MAX_TEXT_SIZE]; 253235723Sbapt 254235723Sbapt/* table of typedef names */ 255235723Sbaptstatic SymbolTable *typedef_names; 256235723Sbapt 257235723Sbapt/* table of define names */ 258235723Sbaptstatic SymbolTable *define_names; 259235723Sbapt 260235723Sbapt/* table of type qualifiers */ 261235723Sbaptstatic SymbolTable *type_qualifiers; 262235723Sbapt 263235723Sbapt/* information about the current input file */ 264235723Sbapttypedef struct { 265235723Sbapt char *base_name; /* base input file name */ 266235723Sbapt char *file_name; /* current file name */ 267235723Sbapt FILE *file; /* input file */ 268235723Sbapt unsigned line_num; /* current line number in input file */ 269235723Sbapt FILE *tmp_file; /* temporary file */ 270235723Sbapt long begin_comment; /* tmp file offset after last written ) or ; */ 271235723Sbapt long end_comment; /* tmp file offset after last comment */ 272235723Sbapt boolean convert; /* if TRUE, convert function definitions */ 273235723Sbapt boolean changed; /* TRUE if conversion done in this file */ 274235723Sbapt} IncludeStack; 275235723Sbapt 276235723Sbaptstatic IncludeStack *cur_file; /* current input file */ 277235723Sbapt 278235723Sbapt/* #include "yyerror.c" */ 279235723Sbapt 280235723Sbaptstatic int haveAnsiParam (void); 281235723Sbapt 282235723Sbapt 283235723Sbapt/* Flags to enable us to find if a procedure returns a value. 284235723Sbapt */ 285235723Sbaptstatic int return_val; /* nonzero on BRACES iff return-expression found */ 286235723Sbapt 287235723Sbaptstatic const char * 288235723Sbaptdft_decl_spec (void) 289235723Sbapt{ 290235723Sbapt return (lintLibrary() && !return_val) ? "void" : "int"; 291235723Sbapt} 292235723Sbapt 293235723Sbaptstatic int 294235723SbapthaveAnsiParam (void) 295235723Sbapt{ 296235723Sbapt Parameter *p; 297235723Sbapt if (func_params != 0) { 298235723Sbapt for (p = func_params->first; p != 0; p = p->next) { 299235723Sbapt if (p->declarator->func_def == FUNC_ANSI) { 300235723Sbapt return TRUE; 301235723Sbapt } 302235723Sbapt } 303235723Sbapt } 304235723Sbapt return FALSE; 305235723Sbapt} 306262960Sjmmv#line 306 "/dev/stdout" 307235723Sbapt 308235723Sbapt/* compatibility with bison */ 309235723Sbapt#ifdef YYPARSE_PARAM 310235723Sbapt/* compatibility with FreeBSD */ 311235723Sbapt# ifdef YYPARSE_PARAM_TYPE 312235723Sbapt# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 313235723Sbapt# else 314235723Sbapt# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 315235723Sbapt# endif 316235723Sbapt#else 317235723Sbapt# define YYPARSE_DECL() yyparse(void) 318235723Sbapt#endif 319235723Sbapt 320235723Sbapt/* Parameters sent to lex. */ 321235723Sbapt#ifdef YYLEX_PARAM 322235723Sbapt# define YYLEX_DECL() yylex(void *YYLEX_PARAM) 323235723Sbapt# define YYLEX yylex(YYLEX_PARAM) 324235723Sbapt#else 325235723Sbapt# define YYLEX_DECL() yylex(void) 326235723Sbapt# define YYLEX yylex() 327235723Sbapt#endif 328235723Sbapt 329235723Sbapt/* Parameters sent to yyerror. */ 330235723Sbapt#ifndef YYERROR_DECL 331235723Sbapt#define YYERROR_DECL() yyerror(const char *s) 332235723Sbapt#endif 333235723Sbapt#ifndef YYERROR_CALL 334235723Sbapt#define YYERROR_CALL(msg) yyerror(msg) 335235723Sbapt#endif 336235723Sbapt 337235723Sbaptextern int YYPARSE_DECL(); 338235723Sbapt 339235723Sbapt#define T_IDENTIFIER 257 340235723Sbapt#define T_TYPEDEF_NAME 258 341235723Sbapt#define T_DEFINE_NAME 259 342235723Sbapt#define T_AUTO 260 343235723Sbapt#define T_EXTERN 261 344235723Sbapt#define T_REGISTER 262 345235723Sbapt#define T_STATIC 263 346235723Sbapt#define T_TYPEDEF 264 347235723Sbapt#define T_INLINE 265 348235723Sbapt#define T_EXTENSION 266 349235723Sbapt#define T_CHAR 267 350235723Sbapt#define T_DOUBLE 268 351235723Sbapt#define T_FLOAT 269 352235723Sbapt#define T_INT 270 353235723Sbapt#define T_VOID 271 354235723Sbapt#define T_LONG 272 355235723Sbapt#define T_SHORT 273 356235723Sbapt#define T_SIGNED 274 357235723Sbapt#define T_UNSIGNED 275 358235723Sbapt#define T_ENUM 276 359235723Sbapt#define T_STRUCT 277 360235723Sbapt#define T_UNION 278 361235723Sbapt#define T_Bool 279 362235723Sbapt#define T_Complex 280 363235723Sbapt#define T_Imaginary 281 364235723Sbapt#define T_TYPE_QUALIFIER 282 365235723Sbapt#define T_BRACKETS 283 366235723Sbapt#define T_LBRACE 284 367235723Sbapt#define T_MATCHRBRACE 285 368235723Sbapt#define T_ELLIPSIS 286 369235723Sbapt#define T_INITIALIZER 287 370235723Sbapt#define T_STRING_LITERAL 288 371235723Sbapt#define T_ASM 289 372235723Sbapt#define T_ASMARG 290 373235723Sbapt#define T_VA_DCL 291 374235723Sbapt#define YYERRCODE 256 375235723Sbaptstatic const short yylhs[] = { -1, 376235723Sbapt 0, 0, 26, 26, 27, 27, 27, 27, 27, 27, 377235723Sbapt 27, 31, 30, 30, 28, 28, 34, 28, 32, 32, 378235723Sbapt 33, 33, 35, 35, 37, 38, 29, 39, 29, 36, 379235723Sbapt 36, 36, 40, 40, 1, 1, 2, 2, 2, 3, 380235723Sbapt 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 381235723Sbapt 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 382235723Sbapt 5, 5, 6, 6, 6, 19, 19, 8, 8, 9, 383235723Sbapt 41, 9, 7, 7, 7, 25, 23, 23, 10, 10, 384235723Sbapt 11, 11, 11, 11, 11, 20, 20, 21, 21, 22, 385235723Sbapt 22, 14, 14, 15, 15, 16, 16, 16, 17, 17, 386235723Sbapt 18, 18, 24, 24, 12, 12, 12, 13, 13, 13, 387235723Sbapt 13, 13, 13, 13, 388235723Sbapt}; 389235723Sbaptstatic const short yylen[] = { 2, 390235723Sbapt 0, 1, 1, 2, 1, 1, 1, 1, 3, 2, 391235723Sbapt 2, 2, 3, 3, 2, 3, 0, 5, 2, 1, 392235723Sbapt 0, 1, 1, 3, 0, 0, 7, 0, 5, 0, 393235723Sbapt 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 394235723Sbapt 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 395235723Sbapt 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 396235723Sbapt 1, 1, 3, 2, 2, 1, 1, 1, 3, 1, 397235723Sbapt 0, 4, 3, 2, 2, 1, 1, 1, 2, 1, 398235723Sbapt 1, 3, 2, 4, 4, 2, 3, 0, 1, 1, 399235723Sbapt 2, 1, 3, 1, 3, 2, 2, 1, 0, 1, 400235723Sbapt 1, 3, 1, 2, 1, 2, 1, 3, 2, 1, 401235723Sbapt 4, 3, 3, 2, 402235723Sbapt}; 403235723Sbaptstatic const short yydefred[] = { 0, 404235723Sbapt 0, 0, 0, 0, 77, 0, 62, 40, 0, 42, 405235723Sbapt 43, 20, 44, 0, 46, 47, 48, 49, 54, 50, 406235723Sbapt 51, 52, 53, 76, 66, 67, 55, 56, 57, 61, 407235723Sbapt 0, 7, 0, 0, 35, 37, 38, 39, 59, 60, 408235723Sbapt 28, 0, 0, 0, 103, 81, 0, 0, 3, 5, 409235723Sbapt 6, 8, 0, 10, 11, 78, 0, 90, 0, 0, 410235723Sbapt 104, 0, 19, 0, 41, 45, 15, 36, 0, 68, 411235723Sbapt 0, 0, 0, 83, 0, 0, 64, 0, 0, 74, 412235723Sbapt 4, 58, 0, 82, 87, 91, 0, 14, 13, 9, 413235723Sbapt 16, 0, 71, 0, 31, 33, 0, 0, 0, 0, 414235723Sbapt 0, 94, 0, 0, 101, 12, 63, 73, 0, 0, 415235723Sbapt 69, 0, 0, 0, 34, 0, 110, 96, 97, 0, 416235723Sbapt 0, 84, 0, 85, 0, 23, 0, 0, 72, 26, 417235723Sbapt 29, 114, 0, 0, 0, 109, 0, 93, 95, 102, 418235723Sbapt 18, 0, 0, 108, 113, 112, 0, 24, 27, 111, 419235723Sbapt}; 420235723Sbaptstatic const short yydgoto[] = { 33, 421235723Sbapt 87, 35, 36, 37, 38, 39, 40, 69, 70, 41, 422235723Sbapt 42, 119, 120, 100, 101, 102, 103, 104, 43, 44, 423235723Sbapt 59, 60, 45, 46, 47, 48, 49, 50, 51, 52, 424235723Sbapt 77, 53, 127, 109, 128, 97, 94, 143, 72, 98, 425235723Sbapt 112, 426235723Sbapt}; 427235723Sbaptstatic const short yysindex[] = { -2, 428235723Sbapt -3, 27, -239, -177, 0, 0, 0, 0, -274, 0, 429235723Sbapt 0, 0, 0, -246, 0, 0, 0, 0, 0, 0, 430235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 431235723Sbapt -266, 0, 0, 455, 0, 0, 0, 0, 0, 0, 432235723Sbapt 0, -35, -245, 128, 0, 0, -245, -2, 0, 0, 433235723Sbapt 0, 0, 642, 0, 0, 0, -15, 0, -12, -239, 434235723Sbapt 0, 590, 0, -27, 0, 0, 0, 0, -10, 0, 435235723Sbapt -11, 534, -72, 0, -237, -232, 0, -35, -232, 0, 436235723Sbapt 0, 0, 642, 0, 0, 0, 455, 0, 0, 0, 437235723Sbapt 0, 27, 0, 534, 0, 0, -222, 617, 209, 34, 438235723Sbapt 39, 0, 44, 42, 0, 0, 0, 0, 27, -11, 439235723Sbapt 0, -200, -196, -195, 0, 174, 0, 0, 0, -33, 440235723Sbapt 243, 0, 561, 0, -177, 0, 33, 49, 0, 0, 441235723Sbapt 0, 0, 53, 55, 417, 0, -33, 0, 0, 0, 442235723Sbapt 0, 27, -188, 0, 0, 0, 57, 0, 0, 0, 443235723Sbapt}; 444235723Sbaptstatic const short yyrindex[] = { 99, 445235723Sbapt 0, 0, 275, 0, 0, -38, 0, 0, 481, 0, 446235723Sbapt 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 447235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 448235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 449235723Sbapt 0, 30, 0, 0, 0, 0, 0, 101, 0, 0, 450235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 343, 309, 451235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 452235723Sbapt 98, -182, 62, 0, 0, 133, 0, 64, 379, 0, 453235723Sbapt 0, 0, -5, 0, 0, 0, 0, 0, 0, 0, 454235723Sbapt 0, 0, 0, -182, 0, 0, 0, -180, -19, 0, 455235723Sbapt 65, 0, 0, 68, 0, 0, 0, 0, 51, 9, 456235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, -13, 457235723Sbapt 19, 0, 0, 0, 0, 0, 0, 52, 0, 0, 458235723Sbapt 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 459235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 460235723Sbapt}; 461235723Sbaptstatic const short yygindex[] = { 0, 462235723Sbapt 11, -17, 0, 0, 13, 0, 0, 0, 20, 8, 463235723Sbapt -43, -1, -8, -89, 0, -9, 0, 0, 0, -44, 464235723Sbapt 0, 0, 4, 0, 0, 0, 70, -53, 0, 0, 465235723Sbapt -18, 0, 0, 0, 0, 22, 0, 0, 0, 0, 466235723Sbapt 0, 467235723Sbapt}; 468235723Sbapt#define YYTABLESIZE 924 469235723Sbaptstatic const short yytable[] = { 58, 470235723Sbapt 78, 58, 58, 58, 73, 58, 135, 61, 88, 57, 471235723Sbapt 34, 5, 56, 62, 85, 58, 68, 63, 96, 7, 472235723Sbapt 58, 98, 78, 64, 98, 84, 134, 107, 80, 3, 473235723Sbapt 107, 90, 17, 92, 17, 4, 17, 2, 75, 3, 474235723Sbapt 96, 71, 30, 89, 115, 147, 76, 106, 91, 93, 475235723Sbapt 79, 75, 70, 17, 121, 55, 32, 107, 34, 105, 476235723Sbapt 108, 114, 105, 83, 4, 68, 2, 70, 3, 68, 477235723Sbapt 80, 121, 86, 80, 122, 106, 105, 78, 106, 5, 478235723Sbapt 56, 68, 123, 99, 124, 125, 129, 130, 80, 131, 479235723Sbapt 80, 141, 142, 144, 110, 145, 149, 150, 1, 110, 480235723Sbapt 2, 30, 99, 32, 79, 92, 118, 79, 100, 21, 481235723Sbapt 22, 111, 137, 139, 133, 113, 126, 81, 0, 0, 482235723Sbapt 0, 0, 79, 57, 79, 0, 99, 0, 140, 0, 483235723Sbapt 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, 484235723Sbapt 0, 70, 0, 0, 0, 99, 0, 0, 0, 148, 485235723Sbapt 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 486235723Sbapt 0, 0, 0, 0, 0, 4, 0, 2, 0, 0, 487235723Sbapt 65, 0, 65, 65, 65, 0, 65, 0, 0, 0, 488235723Sbapt 0, 0, 0, 0, 5, 6, 7, 8, 65, 10, 489235723Sbapt 11, 65, 13, 66, 15, 16, 17, 18, 19, 20, 490235723Sbapt 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 491235723Sbapt 0, 4, 0, 116, 132, 3, 0, 0, 58, 58, 492235723Sbapt 58, 58, 58, 58, 58, 78, 58, 58, 58, 58, 493235723Sbapt 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 494235723Sbapt 58, 58, 58, 58, 58, 78, 4, 74, 116, 136, 495235723Sbapt 3, 17, 78, 1, 5, 6, 7, 8, 9, 10, 496235723Sbapt 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 497235723Sbapt 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 498235723Sbapt 4, 54, 116, 5, 56, 0, 31, 80, 80, 80, 499235723Sbapt 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 500235723Sbapt 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 501235723Sbapt 80, 80, 88, 80, 88, 88, 88, 0, 88, 0, 502235723Sbapt 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 503235723Sbapt 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 504235723Sbapt 79, 79, 79, 79, 79, 79, 89, 79, 89, 89, 505235723Sbapt 89, 0, 89, 0, 79, 25, 25, 25, 25, 25, 506235723Sbapt 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 507235723Sbapt 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 508235723Sbapt 86, 25, 86, 86, 5, 56, 86, 0, 25, 65, 509235723Sbapt 65, 65, 65, 65, 65, 65, 0, 65, 65, 65, 510235723Sbapt 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 511235723Sbapt 65, 65, 65, 65, 65, 65, 75, 0, 75, 75, 512235723Sbapt 75, 0, 75, 0, 0, 0, 0, 0, 0, 0, 513235723Sbapt 5, 6, 7, 8, 65, 10, 11, 75, 13, 66, 514235723Sbapt 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 515235723Sbapt 25, 26, 27, 28, 29, 30, 117, 146, 0, 0, 516235723Sbapt 0, 0, 0, 0, 0, 5, 6, 7, 8, 65, 517235723Sbapt 10, 11, 0, 13, 66, 15, 16, 17, 18, 19, 518235723Sbapt 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 519235723Sbapt 30, 117, 4, 0, 2, 0, 3, 0, 0, 5, 520235723Sbapt 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 521235723Sbapt 0, 0, 0, 67, 0, 0, 0, 0, 41, 0, 522235723Sbapt 41, 0, 41, 0, 0, 117, 0, 0, 0, 0, 523235723Sbapt 0, 88, 88, 0, 0, 0, 0, 0, 0, 41, 524235723Sbapt 0, 0, 0, 0, 0, 0, 45, 0, 45, 0, 525235723Sbapt 45, 0, 0, 0, 0, 0, 0, 88, 0, 0, 526235723Sbapt 0, 0, 0, 0, 0, 89, 89, 45, 0, 0, 527235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 528235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 529235723Sbapt 0, 89, 0, 0, 0, 0, 0, 0, 0, 86, 530235723Sbapt 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 531235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 532235723Sbapt 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 533235723Sbapt 0, 0, 0, 0, 0, 75, 75, 75, 75, 75, 534235723Sbapt 75, 75, 0, 75, 75, 75, 75, 75, 75, 75, 535235723Sbapt 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 536235723Sbapt 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 537235723Sbapt 0, 0, 0, 0, 82, 7, 8, 65, 10, 11, 538235723Sbapt 0, 13, 66, 15, 16, 17, 18, 19, 20, 21, 539235723Sbapt 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 540235723Sbapt 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 541235723Sbapt 0, 5, 6, 7, 8, 65, 10, 11, 0, 13, 542235723Sbapt 66, 15, 16, 17, 18, 19, 20, 21, 22, 23, 543235723Sbapt 24, 25, 26, 27, 28, 29, 30, 41, 41, 41, 544235723Sbapt 41, 41, 41, 41, 0, 41, 41, 41, 41, 41, 545235723Sbapt 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 546235723Sbapt 41, 41, 41, 0, 0, 45, 45, 45, 45, 45, 547235723Sbapt 45, 45, 0, 45, 45, 45, 45, 45, 45, 45, 548235723Sbapt 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 549235723Sbapt 45, 82, 7, 8, 65, 10, 11, 12, 13, 14, 550235723Sbapt 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 551235723Sbapt 25, 26, 27, 28, 29, 30, 0, 0, 82, 7, 552235723Sbapt 8, 65, 10, 11, 95, 13, 66, 15, 16, 17, 553235723Sbapt 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 554235723Sbapt 28, 29, 30, 0, 0, 0, 138, 82, 7, 8, 555235723Sbapt 65, 10, 11, 12, 13, 14, 15, 16, 17, 18, 556235723Sbapt 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 557235723Sbapt 29, 30, 0, 75, 82, 7, 8, 65, 10, 11, 558235723Sbapt 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 559235723Sbapt 22, 23, 24, 25, 26, 27, 28, 29, 30, 82, 560235723Sbapt 7, 8, 65, 10, 11, 0, 13, 66, 15, 16, 561235723Sbapt 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 562235723Sbapt 27, 28, 29, 30, 563235723Sbapt}; 564235723Sbaptstatic const short yycheck[] = { 38, 565235723Sbapt 44, 40, 41, 42, 40, 44, 40, 4, 62, 2, 566235723Sbapt 0, 257, 258, 288, 59, 3, 34, 264, 72, 259, 567235723Sbapt 59, 41, 61, 290, 44, 41, 116, 41, 47, 42, 568235723Sbapt 44, 59, 38, 44, 40, 38, 42, 40, 284, 42, 569235723Sbapt 94, 34, 282, 62, 98, 135, 43, 285, 59, 61, 570235723Sbapt 47, 284, 44, 59, 99, 59, 59, 76, 48, 41, 571235723Sbapt 79, 284, 44, 53, 38, 83, 40, 59, 42, 87, 572235723Sbapt 41, 116, 60, 44, 41, 41, 73, 121, 44, 257, 573235723Sbapt 258, 99, 44, 73, 41, 44, 287, 284, 59, 285, 574235723Sbapt 61, 59, 44, 41, 87, 41, 285, 41, 0, 92, 575235723Sbapt 0, 284, 41, 284, 41, 41, 99, 44, 41, 59, 576235723Sbapt 59, 92, 121, 123, 116, 94, 109, 48, -1, -1, 577235723Sbapt -1, -1, 59, 116, 61, -1, 116, -1, 125, -1, 578235723Sbapt -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, 579235723Sbapt -1, 44, -1, -1, -1, 135, -1, -1, -1, 142, 580235723Sbapt -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, 581235723Sbapt -1, -1, -1, -1, -1, 38, -1, 40, -1, -1, 582235723Sbapt 38, -1, 40, 41, 42, -1, 44, -1, -1, -1, 583235723Sbapt -1, -1, -1, -1, 257, 258, 259, 260, 261, 262, 584235723Sbapt 263, 59, 265, 266, 267, 268, 269, 270, 271, 272, 585235723Sbapt 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 586235723Sbapt -1, 38, -1, 40, 41, 42, -1, -1, 257, 258, 587235723Sbapt 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 588235723Sbapt 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 589235723Sbapt 279, 280, 281, 282, 283, 284, 38, 283, 40, 283, 590235723Sbapt 42, 257, 291, 256, 257, 258, 259, 260, 261, 262, 591235723Sbapt 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 592235723Sbapt 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 593235723Sbapt 38, 285, 40, 257, 258, -1, 289, 258, 259, 260, 594235723Sbapt 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 595235723Sbapt 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 596235723Sbapt 281, 282, 38, 284, 40, 41, 42, -1, 44, -1, 597235723Sbapt 291, 258, 259, 260, 261, 262, 263, 264, 265, 266, 598235723Sbapt 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 599235723Sbapt 277, 278, 279, 280, 281, 282, 38, 284, 40, 41, 600235723Sbapt 42, -1, 44, -1, 291, 258, 259, 260, 261, 262, 601235723Sbapt 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 602235723Sbapt 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 603235723Sbapt 38, 284, 40, 41, 257, 258, 44, -1, 291, 257, 604235723Sbapt 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, 605235723Sbapt 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 606235723Sbapt 278, 279, 280, 281, 282, 283, 38, -1, 40, 41, 607235723Sbapt 42, -1, 44, -1, -1, -1, -1, -1, -1, -1, 608235723Sbapt 257, 258, 259, 260, 261, 262, 263, 59, 265, 266, 609235723Sbapt 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 610235723Sbapt 277, 278, 279, 280, 281, 282, 283, 41, -1, -1, 611235723Sbapt -1, -1, -1, -1, -1, 257, 258, 259, 260, 261, 612235723Sbapt 262, 263, -1, 265, 266, 267, 268, 269, 270, 271, 613235723Sbapt 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 614235723Sbapt 282, 283, 38, -1, 40, -1, 42, -1, -1, 257, 615235723Sbapt 258, -1, -1, -1, -1, -1, -1, -1, -1, -1, 616235723Sbapt -1, -1, -1, 59, -1, -1, -1, -1, 38, -1, 617235723Sbapt 40, -1, 42, -1, -1, 283, -1, -1, -1, -1, 618235723Sbapt -1, 257, 258, -1, -1, -1, -1, -1, -1, 59, 619235723Sbapt -1, -1, -1, -1, -1, -1, 38, -1, 40, -1, 620235723Sbapt 42, -1, -1, -1, -1, -1, -1, 283, -1, -1, 621235723Sbapt -1, -1, -1, -1, -1, 257, 258, 59, -1, -1, 622235723Sbapt -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 623235723Sbapt -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 624235723Sbapt -1, 283, -1, -1, -1, -1, -1, -1, -1, 257, 625235723Sbapt 258, -1, -1, -1, -1, -1, -1, -1, -1, -1, 626235723Sbapt -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 627235723Sbapt -1, -1, -1, -1, -1, 283, -1, -1, -1, -1, 628235723Sbapt -1, -1, -1, -1, -1, 257, 258, 259, 260, 261, 629235723Sbapt 262, 263, -1, 265, 266, 267, 268, 269, 270, 271, 630235723Sbapt 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 631235723Sbapt 282, 283, -1, -1, -1, -1, -1, -1, -1, -1, 632235723Sbapt -1, -1, -1, -1, 258, 259, 260, 261, 262, 263, 633235723Sbapt -1, 265, 266, 267, 268, 269, 270, 271, 272, 273, 634235723Sbapt 274, 275, 276, 277, 278, 279, 280, 281, 282, -1, 635235723Sbapt -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 636235723Sbapt -1, 257, 258, 259, 260, 261, 262, 263, -1, 265, 637235723Sbapt 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 638235723Sbapt 276, 277, 278, 279, 280, 281, 282, 257, 258, 259, 639235723Sbapt 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, 640235723Sbapt 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 641235723Sbapt 280, 281, 282, -1, -1, 257, 258, 259, 260, 261, 642235723Sbapt 262, 263, -1, 265, 266, 267, 268, 269, 270, 271, 643235723Sbapt 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 644235723Sbapt 282, 258, 259, 260, 261, 262, 263, 264, 265, 266, 645235723Sbapt 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 646235723Sbapt 277, 278, 279, 280, 281, 282, -1, -1, 258, 259, 647235723Sbapt 260, 261, 262, 263, 291, 265, 266, 267, 268, 269, 648235723Sbapt 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 649235723Sbapt 280, 281, 282, -1, -1, -1, 286, 258, 259, 260, 650235723Sbapt 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 651235723Sbapt 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 652235723Sbapt 281, 282, -1, 284, 258, 259, 260, 261, 262, 263, 653235723Sbapt 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 654235723Sbapt 274, 275, 276, 277, 278, 279, 280, 281, 282, 258, 655235723Sbapt 259, 260, 261, 262, 263, -1, 265, 266, 267, 268, 656235723Sbapt 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 657235723Sbapt 279, 280, 281, 282, 658235723Sbapt}; 659235723Sbapt#define YYFINAL 33 660235723Sbapt#ifndef YYDEBUG 661235723Sbapt#define YYDEBUG 0 662235723Sbapt#endif 663235723Sbapt#define YYMAXTOKEN 291 664262960Sjmmv#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? (YYMAXTOKEN + 1) : (a)) 665235723Sbapt#if YYDEBUG 666235723Sbaptstatic const char *yyname[] = { 667235723Sbapt 668235723Sbapt"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, 669235723Sbapt0,0,0,0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0, 670235723Sbapt"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 671235723Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 672235723Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 673235723Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 674235723Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 675235723Sbapt"T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN", 676235723Sbapt"T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR", 677235723Sbapt"T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED", 678235723Sbapt"T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary", 679235723Sbapt"T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS", 680235723Sbapt"T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL", 681262960Sjmmv"illegal-symbol", 682235723Sbapt}; 683235723Sbaptstatic const char *yyrule[] = { 684235723Sbapt"$accept : program", 685235723Sbapt"program :", 686235723Sbapt"program : translation_unit", 687235723Sbapt"translation_unit : external_declaration", 688235723Sbapt"translation_unit : translation_unit external_declaration", 689235723Sbapt"external_declaration : declaration", 690235723Sbapt"external_declaration : function_definition", 691235723Sbapt"external_declaration : ';'", 692235723Sbapt"external_declaration : linkage_specification", 693235723Sbapt"external_declaration : T_ASM T_ASMARG ';'", 694235723Sbapt"external_declaration : error T_MATCHRBRACE", 695235723Sbapt"external_declaration : error ';'", 696235723Sbapt"braces : T_LBRACE T_MATCHRBRACE", 697235723Sbapt"linkage_specification : T_EXTERN T_STRING_LITERAL braces", 698235723Sbapt"linkage_specification : T_EXTERN T_STRING_LITERAL declaration", 699235723Sbapt"declaration : decl_specifiers ';'", 700235723Sbapt"declaration : decl_specifiers init_declarator_list ';'", 701235723Sbapt"$$1 :", 702235723Sbapt"declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'", 703235723Sbapt"any_typedef : T_EXTENSION T_TYPEDEF", 704235723Sbapt"any_typedef : T_TYPEDEF", 705235723Sbapt"opt_declarator_list :", 706235723Sbapt"opt_declarator_list : declarator_list", 707235723Sbapt"declarator_list : declarator", 708235723Sbapt"declarator_list : declarator_list ',' declarator", 709235723Sbapt"$$2 :", 710235723Sbapt"$$3 :", 711235723Sbapt"function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE", 712235723Sbapt"$$4 :", 713235723Sbapt"function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE", 714235723Sbapt"opt_declaration_list :", 715235723Sbapt"opt_declaration_list : T_VA_DCL", 716235723Sbapt"opt_declaration_list : declaration_list", 717235723Sbapt"declaration_list : declaration", 718235723Sbapt"declaration_list : declaration_list declaration", 719235723Sbapt"decl_specifiers : decl_specifier", 720235723Sbapt"decl_specifiers : decl_specifiers decl_specifier", 721235723Sbapt"decl_specifier : storage_class", 722235723Sbapt"decl_specifier : type_specifier", 723235723Sbapt"decl_specifier : type_qualifier", 724235723Sbapt"storage_class : T_AUTO", 725235723Sbapt"storage_class : T_EXTERN", 726235723Sbapt"storage_class : T_REGISTER", 727235723Sbapt"storage_class : T_STATIC", 728235723Sbapt"storage_class : T_INLINE", 729235723Sbapt"storage_class : T_EXTENSION", 730235723Sbapt"type_specifier : T_CHAR", 731235723Sbapt"type_specifier : T_DOUBLE", 732235723Sbapt"type_specifier : T_FLOAT", 733235723Sbapt"type_specifier : T_INT", 734235723Sbapt"type_specifier : T_LONG", 735235723Sbapt"type_specifier : T_SHORT", 736235723Sbapt"type_specifier : T_SIGNED", 737235723Sbapt"type_specifier : T_UNSIGNED", 738235723Sbapt"type_specifier : T_VOID", 739235723Sbapt"type_specifier : T_Bool", 740235723Sbapt"type_specifier : T_Complex", 741235723Sbapt"type_specifier : T_Imaginary", 742235723Sbapt"type_specifier : T_TYPEDEF_NAME", 743235723Sbapt"type_specifier : struct_or_union_specifier", 744235723Sbapt"type_specifier : enum_specifier", 745235723Sbapt"type_qualifier : T_TYPE_QUALIFIER", 746235723Sbapt"type_qualifier : T_DEFINE_NAME", 747235723Sbapt"struct_or_union_specifier : struct_or_union any_id braces", 748235723Sbapt"struct_or_union_specifier : struct_or_union braces", 749235723Sbapt"struct_or_union_specifier : struct_or_union any_id", 750235723Sbapt"struct_or_union : T_STRUCT", 751235723Sbapt"struct_or_union : T_UNION", 752235723Sbapt"init_declarator_list : init_declarator", 753235723Sbapt"init_declarator_list : init_declarator_list ',' init_declarator", 754235723Sbapt"init_declarator : declarator", 755235723Sbapt"$$5 :", 756235723Sbapt"init_declarator : declarator '=' $$5 T_INITIALIZER", 757235723Sbapt"enum_specifier : enumeration any_id braces", 758235723Sbapt"enum_specifier : enumeration braces", 759235723Sbapt"enum_specifier : enumeration any_id", 760235723Sbapt"enumeration : T_ENUM", 761235723Sbapt"any_id : T_IDENTIFIER", 762235723Sbapt"any_id : T_TYPEDEF_NAME", 763235723Sbapt"declarator : pointer direct_declarator", 764235723Sbapt"declarator : direct_declarator", 765235723Sbapt"direct_declarator : identifier_or_ref", 766235723Sbapt"direct_declarator : '(' declarator ')'", 767235723Sbapt"direct_declarator : direct_declarator T_BRACKETS", 768235723Sbapt"direct_declarator : direct_declarator '(' parameter_type_list ')'", 769235723Sbapt"direct_declarator : direct_declarator '(' opt_identifier_list ')'", 770235723Sbapt"pointer : '*' opt_type_qualifiers", 771235723Sbapt"pointer : '*' opt_type_qualifiers pointer", 772235723Sbapt"opt_type_qualifiers :", 773235723Sbapt"opt_type_qualifiers : type_qualifier_list", 774235723Sbapt"type_qualifier_list : type_qualifier", 775235723Sbapt"type_qualifier_list : type_qualifier_list type_qualifier", 776235723Sbapt"parameter_type_list : parameter_list", 777235723Sbapt"parameter_type_list : parameter_list ',' T_ELLIPSIS", 778235723Sbapt"parameter_list : parameter_declaration", 779235723Sbapt"parameter_list : parameter_list ',' parameter_declaration", 780235723Sbapt"parameter_declaration : decl_specifiers declarator", 781235723Sbapt"parameter_declaration : decl_specifiers abs_declarator", 782235723Sbapt"parameter_declaration : decl_specifiers", 783235723Sbapt"opt_identifier_list :", 784235723Sbapt"opt_identifier_list : identifier_list", 785235723Sbapt"identifier_list : any_id", 786235723Sbapt"identifier_list : identifier_list ',' any_id", 787235723Sbapt"identifier_or_ref : any_id", 788235723Sbapt"identifier_or_ref : '&' any_id", 789235723Sbapt"abs_declarator : pointer", 790235723Sbapt"abs_declarator : pointer direct_abs_declarator", 791235723Sbapt"abs_declarator : direct_abs_declarator", 792235723Sbapt"direct_abs_declarator : '(' abs_declarator ')'", 793235723Sbapt"direct_abs_declarator : direct_abs_declarator T_BRACKETS", 794235723Sbapt"direct_abs_declarator : T_BRACKETS", 795235723Sbapt"direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'", 796235723Sbapt"direct_abs_declarator : direct_abs_declarator '(' ')'", 797235723Sbapt"direct_abs_declarator : '(' parameter_type_list ')'", 798235723Sbapt"direct_abs_declarator : '(' ')'", 799235723Sbapt 800235723Sbapt}; 801235723Sbapt#endif 802235723Sbapt 803235723Sbaptint yydebug; 804235723Sbaptint yynerrs; 805235723Sbapt 806235723Sbaptint yyerrflag; 807235723Sbaptint yychar; 808235723SbaptYYSTYPE yyval; 809235723SbaptYYSTYPE yylval; 810235723Sbapt 811235723Sbapt/* define the initial stack-sizes */ 812235723Sbapt#ifdef YYSTACKSIZE 813235723Sbapt#undef YYMAXDEPTH 814235723Sbapt#define YYMAXDEPTH YYSTACKSIZE 815235723Sbapt#else 816235723Sbapt#ifdef YYMAXDEPTH 817235723Sbapt#define YYSTACKSIZE YYMAXDEPTH 818235723Sbapt#else 819262960Sjmmv#define YYSTACKSIZE 10000 820262960Sjmmv#define YYMAXDEPTH 10000 821235723Sbapt#endif 822235723Sbapt#endif 823235723Sbapt 824262960Sjmmv#define YYINITSTACKSIZE 200 825235723Sbapt 826235723Sbapttypedef struct { 827235723Sbapt unsigned stacksize; 828235723Sbapt short *s_base; 829235723Sbapt short *s_mark; 830235723Sbapt short *s_last; 831235723Sbapt YYSTYPE *l_base; 832235723Sbapt YYSTYPE *l_mark; 833235723Sbapt} YYSTACKDATA; 834235723Sbapt/* variables for the parser stack */ 835235723Sbaptstatic YYSTACKDATA yystack; 836235723Sbapt#line 1014 "grammar.y" 837235723Sbapt 838235723Sbapt/* lex.yy.c */ 839235723Sbapt#define BEGIN yy_start = 1 + 2 * 840235723Sbapt 841235723Sbapt#define CPP1 1 842235723Sbapt#define INIT1 2 843235723Sbapt#define INIT2 3 844235723Sbapt#define CURLY 4 845235723Sbapt#define LEXYACC 5 846235723Sbapt#define ASM 6 847235723Sbapt#define CPP_INLINE 7 848235723Sbapt 849235723Sbaptextern char *yytext; 850235723Sbaptextern FILE *yyin, *yyout; 851235723Sbapt 852235723Sbaptstatic int curly; /* number of curly brace nesting levels */ 853249582Sgaborstatic int ly_count; /* number of occurrences of %% */ 854235723Sbaptstatic int inc_depth; /* include nesting level */ 855235723Sbaptstatic SymbolTable *included_files; /* files already included */ 856235723Sbaptstatic int yy_start = 0; /* start state number */ 857235723Sbapt 858235723Sbapt#define grammar_error(s) yaccError(s) 859235723Sbapt 860235723Sbaptstatic void 861235723SbaptyaccError (const char *msg) 862235723Sbapt{ 863235723Sbapt func_params = NULL; 864235723Sbapt put_error(); /* tell what line we're on, and what file */ 865235723Sbapt fprintf(stderr, "%s at token '%s'\n", msg, yytext); 866235723Sbapt} 867235723Sbapt 868235723Sbapt/* Initialize the table of type qualifier keywords recognized by the lexical 869235723Sbapt * analyzer. 870235723Sbapt */ 871235723Sbaptvoid 872235723Sbaptinit_parser (void) 873235723Sbapt{ 874235723Sbapt static const char *keywords[] = { 875235723Sbapt "const", 876235723Sbapt "restrict", 877235723Sbapt "volatile", 878235723Sbapt "interrupt", 879235723Sbapt#ifdef vms 880235723Sbapt "noshare", 881235723Sbapt "readonly", 882235723Sbapt#endif 883235723Sbapt#if defined(MSDOS) || defined(OS2) 884235723Sbapt "__cdecl", 885235723Sbapt "__export", 886235723Sbapt "__far", 887235723Sbapt "__fastcall", 888235723Sbapt "__fortran", 889235723Sbapt "__huge", 890235723Sbapt "__inline", 891235723Sbapt "__interrupt", 892235723Sbapt "__loadds", 893235723Sbapt "__near", 894235723Sbapt "__pascal", 895235723Sbapt "__saveregs", 896235723Sbapt "__segment", 897235723Sbapt "__stdcall", 898235723Sbapt "__syscall", 899235723Sbapt "_cdecl", 900235723Sbapt "_cs", 901235723Sbapt "_ds", 902235723Sbapt "_es", 903235723Sbapt "_export", 904235723Sbapt "_far", 905235723Sbapt "_fastcall", 906235723Sbapt "_fortran", 907235723Sbapt "_huge", 908235723Sbapt "_interrupt", 909235723Sbapt "_loadds", 910235723Sbapt "_near", 911235723Sbapt "_pascal", 912235723Sbapt "_saveregs", 913235723Sbapt "_seg", 914235723Sbapt "_segment", 915235723Sbapt "_ss", 916235723Sbapt "cdecl", 917235723Sbapt "far", 918235723Sbapt "huge", 919235723Sbapt "near", 920235723Sbapt "pascal", 921235723Sbapt#ifdef OS2 922235723Sbapt "__far16", 923235723Sbapt#endif 924235723Sbapt#endif 925235723Sbapt#ifdef __GNUC__ 926235723Sbapt /* gcc aliases */ 927235723Sbapt "__builtin_va_arg", 928235723Sbapt "__builtin_va_list", 929235723Sbapt "__const", 930235723Sbapt "__const__", 931235723Sbapt "__inline", 932235723Sbapt "__inline__", 933235723Sbapt "__restrict", 934235723Sbapt "__restrict__", 935235723Sbapt "__volatile", 936235723Sbapt "__volatile__", 937235723Sbapt#endif 938235723Sbapt }; 939235723Sbapt unsigned i; 940235723Sbapt 941235723Sbapt /* Initialize type qualifier table. */ 942235723Sbapt type_qualifiers = new_symbol_table(); 943235723Sbapt for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) { 944235723Sbapt new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE); 945235723Sbapt } 946235723Sbapt} 947235723Sbapt 948235723Sbapt/* Process the C source file. Write function prototypes to the standard 949235723Sbapt * output. Convert function definitions and write the converted source 950235723Sbapt * code to a temporary file. 951235723Sbapt */ 952235723Sbaptvoid 953235723Sbaptprocess_file (FILE *infile, char *name) 954235723Sbapt{ 955235723Sbapt char *s; 956235723Sbapt 957235723Sbapt if (strlen(name) > 2) { 958235723Sbapt s = name + strlen(name) - 2; 959235723Sbapt if (*s == '.') { 960235723Sbapt ++s; 961235723Sbapt if (*s == 'l' || *s == 'y') 962235723Sbapt BEGIN LEXYACC; 963235723Sbapt#if defined(MSDOS) || defined(OS2) 964235723Sbapt if (*s == 'L' || *s == 'Y') 965235723Sbapt BEGIN LEXYACC; 966235723Sbapt#endif 967235723Sbapt } 968235723Sbapt } 969235723Sbapt 970235723Sbapt included_files = new_symbol_table(); 971235723Sbapt typedef_names = new_symbol_table(); 972235723Sbapt define_names = new_symbol_table(); 973235723Sbapt inc_depth = -1; 974235723Sbapt curly = 0; 975235723Sbapt ly_count = 0; 976235723Sbapt func_params = NULL; 977235723Sbapt yyin = infile; 978235723Sbapt include_file(strcpy(base_file, name), func_style != FUNC_NONE); 979235723Sbapt if (file_comments) { 980235723Sbapt#if OPT_LINTLIBRARY 981235723Sbapt if (lintLibrary()) { 982235723Sbapt put_blankline(stdout); 983235723Sbapt begin_tracking(); 984235723Sbapt } 985235723Sbapt#endif 986235723Sbapt put_string(stdout, "/* "); 987235723Sbapt put_string(stdout, cur_file_name()); 988235723Sbapt put_string(stdout, " */\n"); 989235723Sbapt } 990235723Sbapt yyparse(); 991235723Sbapt free_symbol_table(define_names); 992235723Sbapt free_symbol_table(typedef_names); 993235723Sbapt free_symbol_table(included_files); 994235723Sbapt} 995235723Sbapt 996235723Sbapt#ifdef NO_LEAKS 997235723Sbaptvoid 998235723Sbaptfree_parser(void) 999235723Sbapt{ 1000235723Sbapt free_symbol_table (type_qualifiers); 1001235723Sbapt#ifdef FLEX_SCANNER 1002235723Sbapt if (yy_current_buffer != 0) 1003235723Sbapt yy_delete_buffer(yy_current_buffer); 1004235723Sbapt#endif 1005235723Sbapt} 1006235723Sbapt#endif 1007262960Sjmmv#line 1006 "/dev/stdout" 1008235723Sbapt 1009235723Sbapt#if YYDEBUG 1010235723Sbapt#include <stdio.h> /* needed for printf */ 1011235723Sbapt#endif 1012235723Sbapt 1013235723Sbapt#include <stdlib.h> /* needed for malloc, etc */ 1014235723Sbapt#include <string.h> /* needed for memset */ 1015235723Sbapt 1016235723Sbapt/* allocate initial stack or double stack size, up to YYMAXDEPTH */ 1017235723Sbaptstatic int yygrowstack(YYSTACKDATA *data) 1018235723Sbapt{ 1019235723Sbapt int i; 1020235723Sbapt unsigned newsize; 1021235723Sbapt short *newss; 1022235723Sbapt YYSTYPE *newvs; 1023235723Sbapt 1024235723Sbapt if ((newsize = data->stacksize) == 0) 1025235723Sbapt newsize = YYINITSTACKSIZE; 1026235723Sbapt else if (newsize >= YYMAXDEPTH) 1027235723Sbapt return -1; 1028235723Sbapt else if ((newsize *= 2) > YYMAXDEPTH) 1029235723Sbapt newsize = YYMAXDEPTH; 1030235723Sbapt 1031262960Sjmmv i = (int) (data->s_mark - data->s_base); 1032235723Sbapt newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); 1033235723Sbapt if (newss == 0) 1034235723Sbapt return -1; 1035235723Sbapt 1036235723Sbapt data->s_base = newss; 1037235723Sbapt data->s_mark = newss + i; 1038235723Sbapt 1039235723Sbapt newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 1040235723Sbapt if (newvs == 0) 1041235723Sbapt return -1; 1042235723Sbapt 1043235723Sbapt data->l_base = newvs; 1044235723Sbapt data->l_mark = newvs + i; 1045235723Sbapt 1046235723Sbapt data->stacksize = newsize; 1047235723Sbapt data->s_last = data->s_base + newsize - 1; 1048235723Sbapt return 0; 1049235723Sbapt} 1050235723Sbapt 1051235723Sbapt#if YYPURE || defined(YY_NO_LEAKS) 1052235723Sbaptstatic void yyfreestack(YYSTACKDATA *data) 1053235723Sbapt{ 1054235723Sbapt free(data->s_base); 1055235723Sbapt free(data->l_base); 1056235723Sbapt memset(data, 0, sizeof(*data)); 1057235723Sbapt} 1058235723Sbapt#else 1059235723Sbapt#define yyfreestack(data) /* nothing */ 1060235723Sbapt#endif 1061235723Sbapt 1062235723Sbapt#define YYABORT goto yyabort 1063235723Sbapt#define YYREJECT goto yyabort 1064235723Sbapt#define YYACCEPT goto yyaccept 1065235723Sbapt#define YYERROR goto yyerrlab 1066235723Sbapt 1067235723Sbaptint 1068235723SbaptYYPARSE_DECL() 1069235723Sbapt{ 1070235723Sbapt int yym, yyn, yystate; 1071235723Sbapt#if YYDEBUG 1072235723Sbapt const char *yys; 1073235723Sbapt 1074235723Sbapt if ((yys = getenv("YYDEBUG")) != 0) 1075235723Sbapt { 1076235723Sbapt yyn = *yys; 1077235723Sbapt if (yyn >= '0' && yyn <= '9') 1078235723Sbapt yydebug = yyn - '0'; 1079235723Sbapt } 1080235723Sbapt#endif 1081235723Sbapt 1082235723Sbapt yynerrs = 0; 1083235723Sbapt yyerrflag = 0; 1084235723Sbapt yychar = YYEMPTY; 1085235723Sbapt yystate = 0; 1086235723Sbapt 1087235723Sbapt#if YYPURE 1088235723Sbapt memset(&yystack, 0, sizeof(yystack)); 1089235723Sbapt#endif 1090235723Sbapt 1091235723Sbapt if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow; 1092235723Sbapt yystack.s_mark = yystack.s_base; 1093235723Sbapt yystack.l_mark = yystack.l_base; 1094235723Sbapt yystate = 0; 1095235723Sbapt *yystack.s_mark = 0; 1096235723Sbapt 1097235723Sbaptyyloop: 1098235723Sbapt if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 1099235723Sbapt if (yychar < 0) 1100235723Sbapt { 1101235723Sbapt if ((yychar = YYLEX) < 0) yychar = 0; 1102235723Sbapt#if YYDEBUG 1103235723Sbapt if (yydebug) 1104235723Sbapt { 1105262960Sjmmv yys = yyname[YYTRANSLATE(yychar)]; 1106235723Sbapt printf("%sdebug: state %d, reading %d (%s)\n", 1107235723Sbapt YYPREFIX, yystate, yychar, yys); 1108235723Sbapt } 1109235723Sbapt#endif 1110235723Sbapt } 1111235723Sbapt if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && 1112235723Sbapt yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 1113235723Sbapt { 1114235723Sbapt#if YYDEBUG 1115235723Sbapt if (yydebug) 1116235723Sbapt printf("%sdebug: state %d, shifting to state %d\n", 1117235723Sbapt YYPREFIX, yystate, yytable[yyn]); 1118235723Sbapt#endif 1119235723Sbapt if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) 1120235723Sbapt { 1121235723Sbapt goto yyoverflow; 1122235723Sbapt } 1123235723Sbapt yystate = yytable[yyn]; 1124235723Sbapt *++yystack.s_mark = yytable[yyn]; 1125235723Sbapt *++yystack.l_mark = yylval; 1126235723Sbapt yychar = YYEMPTY; 1127235723Sbapt if (yyerrflag > 0) --yyerrflag; 1128235723Sbapt goto yyloop; 1129235723Sbapt } 1130235723Sbapt if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && 1131235723Sbapt yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 1132235723Sbapt { 1133235723Sbapt yyn = yytable[yyn]; 1134235723Sbapt goto yyreduce; 1135235723Sbapt } 1136235723Sbapt if (yyerrflag) goto yyinrecovery; 1137235723Sbapt 1138235723Sbapt yyerror("syntax error"); 1139235723Sbapt 1140235723Sbapt goto yyerrlab; 1141235723Sbapt 1142235723Sbaptyyerrlab: 1143235723Sbapt ++yynerrs; 1144235723Sbapt 1145235723Sbaptyyinrecovery: 1146235723Sbapt if (yyerrflag < 3) 1147235723Sbapt { 1148235723Sbapt yyerrflag = 3; 1149235723Sbapt for (;;) 1150235723Sbapt { 1151235723Sbapt if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && 1152235723Sbapt yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) 1153235723Sbapt { 1154235723Sbapt#if YYDEBUG 1155235723Sbapt if (yydebug) 1156235723Sbapt printf("%sdebug: state %d, error recovery shifting\ 1157235723Sbapt to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 1158235723Sbapt#endif 1159235723Sbapt if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) 1160235723Sbapt { 1161235723Sbapt goto yyoverflow; 1162235723Sbapt } 1163235723Sbapt yystate = yytable[yyn]; 1164235723Sbapt *++yystack.s_mark = yytable[yyn]; 1165235723Sbapt *++yystack.l_mark = yylval; 1166235723Sbapt goto yyloop; 1167235723Sbapt } 1168235723Sbapt else 1169235723Sbapt { 1170235723Sbapt#if YYDEBUG 1171235723Sbapt if (yydebug) 1172235723Sbapt printf("%sdebug: error recovery discarding state %d\n", 1173235723Sbapt YYPREFIX, *yystack.s_mark); 1174235723Sbapt#endif 1175235723Sbapt if (yystack.s_mark <= yystack.s_base) goto yyabort; 1176235723Sbapt --yystack.s_mark; 1177235723Sbapt --yystack.l_mark; 1178235723Sbapt } 1179235723Sbapt } 1180235723Sbapt } 1181235723Sbapt else 1182235723Sbapt { 1183235723Sbapt if (yychar == 0) goto yyabort; 1184235723Sbapt#if YYDEBUG 1185235723Sbapt if (yydebug) 1186235723Sbapt { 1187262960Sjmmv yys = yyname[YYTRANSLATE(yychar)]; 1188235723Sbapt printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 1189235723Sbapt YYPREFIX, yystate, yychar, yys); 1190235723Sbapt } 1191235723Sbapt#endif 1192235723Sbapt yychar = YYEMPTY; 1193235723Sbapt goto yyloop; 1194235723Sbapt } 1195235723Sbapt 1196235723Sbaptyyreduce: 1197235723Sbapt#if YYDEBUG 1198235723Sbapt if (yydebug) 1199235723Sbapt printf("%sdebug: state %d, reducing by rule %d (%s)\n", 1200235723Sbapt YYPREFIX, yystate, yyn, yyrule[yyn]); 1201235723Sbapt#endif 1202235723Sbapt yym = yylen[yyn]; 1203235723Sbapt if (yym) 1204235723Sbapt yyval = yystack.l_mark[1-yym]; 1205235723Sbapt else 1206235723Sbapt memset(&yyval, 0, sizeof yyval); 1207235723Sbapt switch (yyn) 1208235723Sbapt { 1209235723Sbaptcase 10: 1210235723Sbapt#line 377 "grammar.y" 1211235723Sbapt { 1212235723Sbapt yyerrok; 1213235723Sbapt } 1214235723Sbaptbreak; 1215235723Sbaptcase 11: 1216235723Sbapt#line 381 "grammar.y" 1217235723Sbapt { 1218235723Sbapt yyerrok; 1219235723Sbapt } 1220235723Sbaptbreak; 1221235723Sbaptcase 13: 1222235723Sbapt#line 392 "grammar.y" 1223235723Sbapt { 1224235723Sbapt /* Provide an empty action here so bison will not complain about 1225235723Sbapt * incompatible types in the default action it normally would 1226235723Sbapt * have generated. 1227235723Sbapt */ 1228235723Sbapt } 1229235723Sbaptbreak; 1230235723Sbaptcase 14: 1231235723Sbapt#line 399 "grammar.y" 1232235723Sbapt { 1233235723Sbapt /* empty */ 1234235723Sbapt } 1235235723Sbaptbreak; 1236235723Sbaptcase 15: 1237235723Sbapt#line 406 "grammar.y" 1238235723Sbapt { 1239235723Sbapt#if OPT_LINTLIBRARY 1240235723Sbapt if (types_out && want_typedef()) { 1241235723Sbapt gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0); 1242235723Sbapt flush_varargs(); 1243235723Sbapt } 1244235723Sbapt#endif 1245235723Sbapt free_decl_spec(&yystack.l_mark[-1].decl_spec); 1246235723Sbapt end_typedef(); 1247235723Sbapt } 1248235723Sbaptbreak; 1249235723Sbaptcase 16: 1250235723Sbapt#line 417 "grammar.y" 1251235723Sbapt { 1252235723Sbapt if (func_params != NULL) { 1253235723Sbapt set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list); 1254235723Sbapt } else { 1255235723Sbapt gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list); 1256235723Sbapt#if OPT_LINTLIBRARY 1257235723Sbapt flush_varargs(); 1258235723Sbapt#endif 1259235723Sbapt free_decl_list(&yystack.l_mark[-1].decl_list); 1260235723Sbapt } 1261235723Sbapt free_decl_spec(&yystack.l_mark[-2].decl_spec); 1262235723Sbapt end_typedef(); 1263235723Sbapt } 1264235723Sbaptbreak; 1265235723Sbaptcase 17: 1266235723Sbapt#line 431 "grammar.y" 1267235723Sbapt { 1268235723Sbapt cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags; 1269235723Sbapt free_decl_spec(&yystack.l_mark[0].decl_spec); 1270235723Sbapt } 1271235723Sbaptbreak; 1272235723Sbaptcase 18: 1273235723Sbapt#line 436 "grammar.y" 1274235723Sbapt { 1275235723Sbapt end_typedef(); 1276235723Sbapt } 1277235723Sbaptbreak; 1278235723Sbaptcase 19: 1279235723Sbapt#line 443 "grammar.y" 1280235723Sbapt { 1281235723Sbapt begin_typedef(); 1282235723Sbapt } 1283235723Sbaptbreak; 1284235723Sbaptcase 20: 1285235723Sbapt#line 447 "grammar.y" 1286235723Sbapt { 1287235723Sbapt begin_typedef(); 1288235723Sbapt } 1289235723Sbaptbreak; 1290235723Sbaptcase 23: 1291235723Sbapt#line 459 "grammar.y" 1292235723Sbapt { 1293235723Sbapt int flags = cur_decl_spec_flags; 1294235723Sbapt 1295235723Sbapt /* If the typedef is a pointer type, then reset the short type 1296235723Sbapt * flags so it does not get promoted. 1297235723Sbapt */ 1298235723Sbapt if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0) 1299235723Sbapt flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); 1300235723Sbapt new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags); 1301235723Sbapt free_declarator(yystack.l_mark[0].declarator); 1302235723Sbapt } 1303235723Sbaptbreak; 1304235723Sbaptcase 24: 1305235723Sbapt#line 471 "grammar.y" 1306235723Sbapt { 1307235723Sbapt int flags = cur_decl_spec_flags; 1308235723Sbapt 1309235723Sbapt if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0) 1310235723Sbapt flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT); 1311235723Sbapt new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags); 1312235723Sbapt free_declarator(yystack.l_mark[0].declarator); 1313235723Sbapt } 1314235723Sbaptbreak; 1315235723Sbaptcase 25: 1316235723Sbapt#line 483 "grammar.y" 1317235723Sbapt { 1318235723Sbapt check_untagged(&yystack.l_mark[-1].decl_spec); 1319235723Sbapt if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) { 1320235723Sbapt yyerror("syntax error"); 1321235723Sbapt YYERROR; 1322235723Sbapt } 1323235723Sbapt func_params = &(yystack.l_mark[0].declarator->head->params); 1324235723Sbapt func_params->begin_comment = cur_file->begin_comment; 1325235723Sbapt func_params->end_comment = cur_file->end_comment; 1326235723Sbapt } 1327235723Sbaptbreak; 1328235723Sbaptcase 26: 1329235723Sbapt#line 494 "grammar.y" 1330235723Sbapt { 1331235723Sbapt /* If we're converting to K&R and we've got a nominally K&R 1332235723Sbapt * function which has a parameter which is ANSI (i.e., a prototyped 1333235723Sbapt * function pointer), then we must override the deciphered value of 1334235723Sbapt * 'func_def' so that the parameter will be converted. 1335235723Sbapt */ 1336235723Sbapt if (func_style == FUNC_TRADITIONAL 1337235723Sbapt && haveAnsiParam() 1338235723Sbapt && yystack.l_mark[-3].declarator->head->func_def == func_style) { 1339235723Sbapt yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH; 1340235723Sbapt } 1341235723Sbapt 1342235723Sbapt func_params = NULL; 1343235723Sbapt 1344235723Sbapt if (cur_file->convert) 1345235723Sbapt gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator); 1346235723Sbapt gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator); 1347235723Sbapt#if OPT_LINTLIBRARY 1348235723Sbapt flush_varargs(); 1349235723Sbapt#endif 1350235723Sbapt free_decl_spec(&yystack.l_mark[-4].decl_spec); 1351235723Sbapt free_declarator(yystack.l_mark[-3].declarator); 1352235723Sbapt } 1353235723Sbaptbreak; 1354235723Sbaptcase 28: 1355235723Sbapt#line 519 "grammar.y" 1356235723Sbapt { 1357235723Sbapt if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) { 1358235723Sbapt yyerror("syntax error"); 1359235723Sbapt YYERROR; 1360235723Sbapt } 1361235723Sbapt func_params = &(yystack.l_mark[0].declarator->head->params); 1362235723Sbapt func_params->begin_comment = cur_file->begin_comment; 1363235723Sbapt func_params->end_comment = cur_file->end_comment; 1364235723Sbapt } 1365235723Sbaptbreak; 1366235723Sbaptcase 29: 1367235723Sbapt#line 529 "grammar.y" 1368235723Sbapt { 1369235723Sbapt DeclSpec decl_spec; 1370235723Sbapt 1371235723Sbapt func_params = NULL; 1372235723Sbapt 1373235723Sbapt new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE); 1374235723Sbapt if (cur_file->convert) 1375235723Sbapt gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator); 1376235723Sbapt gen_prototype(&decl_spec, yystack.l_mark[-4].declarator); 1377235723Sbapt#if OPT_LINTLIBRARY 1378235723Sbapt flush_varargs(); 1379235723Sbapt#endif 1380235723Sbapt free_decl_spec(&decl_spec); 1381235723Sbapt free_declarator(yystack.l_mark[-4].declarator); 1382235723Sbapt } 1383235723Sbaptbreak; 1384235723Sbaptcase 36: 1385235723Sbapt#line 560 "grammar.y" 1386235723Sbapt { 1387235723Sbapt join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec); 1388235723Sbapt free(yystack.l_mark[-1].decl_spec.text); 1389235723Sbapt free(yystack.l_mark[0].decl_spec.text); 1390235723Sbapt } 1391235723Sbaptbreak; 1392235723Sbaptcase 40: 1393235723Sbapt#line 575 "grammar.y" 1394235723Sbapt { 1395235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1396235723Sbapt } 1397235723Sbaptbreak; 1398235723Sbaptcase 41: 1399235723Sbapt#line 579 "grammar.y" 1400235723Sbapt { 1401235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN); 1402235723Sbapt } 1403235723Sbaptbreak; 1404235723Sbaptcase 42: 1405235723Sbapt#line 583 "grammar.y" 1406235723Sbapt { 1407235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1408235723Sbapt } 1409235723Sbaptbreak; 1410235723Sbaptcase 43: 1411235723Sbapt#line 587 "grammar.y" 1412235723Sbapt { 1413235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC); 1414235723Sbapt } 1415235723Sbaptbreak; 1416235723Sbaptcase 44: 1417235723Sbapt#line 591 "grammar.y" 1418235723Sbapt { 1419235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE); 1420235723Sbapt } 1421235723Sbaptbreak; 1422235723Sbaptcase 45: 1423235723Sbapt#line 595 "grammar.y" 1424235723Sbapt { 1425235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK); 1426235723Sbapt } 1427235723Sbaptbreak; 1428235723Sbaptcase 46: 1429235723Sbapt#line 602 "grammar.y" 1430235723Sbapt { 1431235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR); 1432235723Sbapt } 1433235723Sbaptbreak; 1434235723Sbaptcase 47: 1435235723Sbapt#line 606 "grammar.y" 1436235723Sbapt { 1437235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1438235723Sbapt } 1439235723Sbaptbreak; 1440235723Sbaptcase 48: 1441235723Sbapt#line 610 "grammar.y" 1442235723Sbapt { 1443235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT); 1444235723Sbapt } 1445235723Sbaptbreak; 1446235723Sbaptcase 49: 1447235723Sbapt#line 614 "grammar.y" 1448235723Sbapt { 1449235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1450235723Sbapt } 1451235723Sbaptbreak; 1452235723Sbaptcase 50: 1453235723Sbapt#line 618 "grammar.y" 1454235723Sbapt { 1455235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1456235723Sbapt } 1457235723Sbaptbreak; 1458235723Sbaptcase 51: 1459235723Sbapt#line 622 "grammar.y" 1460235723Sbapt { 1461235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT); 1462235723Sbapt } 1463235723Sbaptbreak; 1464235723Sbaptcase 52: 1465235723Sbapt#line 626 "grammar.y" 1466235723Sbapt { 1467235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1468235723Sbapt } 1469235723Sbaptbreak; 1470235723Sbaptcase 53: 1471235723Sbapt#line 630 "grammar.y" 1472235723Sbapt { 1473235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1474235723Sbapt } 1475235723Sbaptbreak; 1476235723Sbaptcase 54: 1477235723Sbapt#line 634 "grammar.y" 1478235723Sbapt { 1479235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1480235723Sbapt } 1481235723Sbaptbreak; 1482235723Sbaptcase 55: 1483235723Sbapt#line 638 "grammar.y" 1484235723Sbapt { 1485235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR); 1486235723Sbapt } 1487235723Sbaptbreak; 1488235723Sbaptcase 56: 1489235723Sbapt#line 642 "grammar.y" 1490235723Sbapt { 1491235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1492235723Sbapt } 1493235723Sbaptbreak; 1494235723Sbaptcase 57: 1495235723Sbapt#line 646 "grammar.y" 1496235723Sbapt { 1497235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1498235723Sbapt } 1499235723Sbaptbreak; 1500235723Sbaptcase 58: 1501235723Sbapt#line 650 "grammar.y" 1502235723Sbapt { 1503235723Sbapt Symbol *s; 1504235723Sbapt s = find_symbol(typedef_names, yystack.l_mark[0].text.text); 1505235723Sbapt if (s != NULL) 1506235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags); 1507235723Sbapt } 1508235723Sbaptbreak; 1509235723Sbaptcase 61: 1510235723Sbapt#line 662 "grammar.y" 1511235723Sbapt { 1512235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE); 1513235723Sbapt } 1514235723Sbaptbreak; 1515235723Sbaptcase 62: 1516235723Sbapt#line 666 "grammar.y" 1517235723Sbapt { 1518235723Sbapt /* This rule allows the <pointer> nonterminal to scan #define 1519235723Sbapt * names as if they were type modifiers. 1520235723Sbapt */ 1521235723Sbapt Symbol *s; 1522235723Sbapt s = find_symbol(define_names, yystack.l_mark[0].text.text); 1523235723Sbapt if (s != NULL) 1524235723Sbapt new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags); 1525235723Sbapt } 1526235723Sbaptbreak; 1527235723Sbaptcase 63: 1528235723Sbapt#line 679 "grammar.y" 1529235723Sbapt { 1530235723Sbapt char *s; 1531235723Sbapt if ((s = implied_typedef()) == 0) 1532235723Sbapt (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text); 1533235723Sbapt new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE); 1534235723Sbapt } 1535235723Sbaptbreak; 1536235723Sbaptcase 64: 1537235723Sbapt#line 686 "grammar.y" 1538235723Sbapt { 1539235723Sbapt char *s; 1540235723Sbapt if ((s = implied_typedef()) == 0) 1541235723Sbapt (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text); 1542235723Sbapt new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE); 1543235723Sbapt } 1544235723Sbaptbreak; 1545235723Sbaptcase 65: 1546235723Sbapt#line 693 "grammar.y" 1547235723Sbapt { 1548235723Sbapt (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text); 1549235723Sbapt new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE); 1550235723Sbapt } 1551235723Sbaptbreak; 1552235723Sbaptcase 66: 1553235723Sbapt#line 701 "grammar.y" 1554235723Sbapt { 1555235723Sbapt imply_typedef(yyval.text.text); 1556235723Sbapt } 1557235723Sbaptbreak; 1558235723Sbaptcase 67: 1559235723Sbapt#line 705 "grammar.y" 1560235723Sbapt { 1561235723Sbapt imply_typedef(yyval.text.text); 1562235723Sbapt } 1563235723Sbaptbreak; 1564235723Sbaptcase 68: 1565235723Sbapt#line 712 "grammar.y" 1566235723Sbapt { 1567235723Sbapt new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator); 1568235723Sbapt } 1569235723Sbaptbreak; 1570235723Sbaptcase 69: 1571235723Sbapt#line 716 "grammar.y" 1572235723Sbapt { 1573235723Sbapt add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator); 1574235723Sbapt } 1575235723Sbaptbreak; 1576235723Sbaptcase 70: 1577235723Sbapt#line 723 "grammar.y" 1578235723Sbapt { 1579235723Sbapt if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL && 1580235723Sbapt func_style == FUNC_TRADITIONAL && cur_file->convert) { 1581235723Sbapt gen_func_declarator(yystack.l_mark[0].declarator); 1582235723Sbapt fputs(cur_text(), cur_file->tmp_file); 1583235723Sbapt } 1584235723Sbapt cur_declarator = yyval.declarator; 1585235723Sbapt } 1586235723Sbaptbreak; 1587235723Sbaptcase 71: 1588235723Sbapt#line 732 "grammar.y" 1589235723Sbapt { 1590235723Sbapt if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL && 1591235723Sbapt func_style == FUNC_TRADITIONAL && cur_file->convert) { 1592235723Sbapt gen_func_declarator(yystack.l_mark[-1].declarator); 1593235723Sbapt fputs(" =", cur_file->tmp_file); 1594235723Sbapt } 1595235723Sbapt } 1596235723Sbaptbreak; 1597235723Sbaptcase 73: 1598235723Sbapt#line 744 "grammar.y" 1599235723Sbapt { 1600235723Sbapt char *s; 1601235723Sbapt if ((s = implied_typedef()) == 0) 1602235723Sbapt (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text); 1603235723Sbapt new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE); 1604235723Sbapt } 1605235723Sbaptbreak; 1606235723Sbaptcase 74: 1607235723Sbapt#line 751 "grammar.y" 1608235723Sbapt { 1609235723Sbapt char *s; 1610235723Sbapt if ((s = implied_typedef()) == 0) 1611235723Sbapt (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text); 1612235723Sbapt new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE); 1613235723Sbapt } 1614235723Sbaptbreak; 1615235723Sbaptcase 75: 1616235723Sbapt#line 758 "grammar.y" 1617235723Sbapt { 1618235723Sbapt (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text); 1619235723Sbapt new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE); 1620235723Sbapt } 1621235723Sbaptbreak; 1622235723Sbaptcase 76: 1623235723Sbapt#line 766 "grammar.y" 1624235723Sbapt { 1625235723Sbapt imply_typedef("enum"); 1626235723Sbapt yyval.text = yystack.l_mark[0].text; 1627235723Sbapt } 1628235723Sbaptbreak; 1629235723Sbaptcase 79: 1630235723Sbapt#line 779 "grammar.y" 1631235723Sbapt { 1632235723Sbapt yyval.declarator = yystack.l_mark[0].declarator; 1633235723Sbapt (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text); 1634235723Sbapt free(yyval.declarator->text); 1635235723Sbapt yyval.declarator->text = xstrdup(buf); 1636235723Sbapt yyval.declarator->begin = yystack.l_mark[-1].text.begin; 1637235723Sbapt yyval.declarator->pointer = TRUE; 1638235723Sbapt } 1639235723Sbaptbreak; 1640235723Sbaptcase 81: 1641235723Sbapt#line 792 "grammar.y" 1642235723Sbapt { 1643235723Sbapt yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin); 1644235723Sbapt } 1645235723Sbaptbreak; 1646235723Sbaptcase 82: 1647235723Sbapt#line 796 "grammar.y" 1648235723Sbapt { 1649235723Sbapt yyval.declarator = yystack.l_mark[-1].declarator; 1650235723Sbapt (void)sprintf(buf, "(%s)", yyval.declarator->text); 1651235723Sbapt free(yyval.declarator->text); 1652235723Sbapt yyval.declarator->text = xstrdup(buf); 1653235723Sbapt yyval.declarator->begin = yystack.l_mark[-2].text.begin; 1654235723Sbapt } 1655235723Sbaptbreak; 1656235723Sbaptcase 83: 1657235723Sbapt#line 804 "grammar.y" 1658235723Sbapt { 1659235723Sbapt yyval.declarator = yystack.l_mark[-1].declarator; 1660235723Sbapt (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text); 1661235723Sbapt free(yyval.declarator->text); 1662235723Sbapt yyval.declarator->text = xstrdup(buf); 1663235723Sbapt } 1664235723Sbaptbreak; 1665235723Sbaptcase 84: 1666235723Sbapt#line 811 "grammar.y" 1667235723Sbapt { 1668235723Sbapt yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin); 1669235723Sbapt yyval.declarator->params = yystack.l_mark[-1].param_list; 1670235723Sbapt yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 1671235723Sbapt yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 1672235723Sbapt yyval.declarator->func_def = FUNC_ANSI; 1673235723Sbapt } 1674235723Sbaptbreak; 1675235723Sbaptcase 85: 1676235723Sbapt#line 819 "grammar.y" 1677235723Sbapt { 1678235723Sbapt yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin); 1679235723Sbapt yyval.declarator->params = yystack.l_mark[-1].param_list; 1680235723Sbapt yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 1681235723Sbapt yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 1682235723Sbapt yyval.declarator->func_def = FUNC_TRADITIONAL; 1683235723Sbapt } 1684235723Sbaptbreak; 1685235723Sbaptcase 86: 1686235723Sbapt#line 830 "grammar.y" 1687235723Sbapt { 1688235723Sbapt (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text); 1689235723Sbapt yyval.text.begin = yystack.l_mark[-1].text.begin; 1690235723Sbapt } 1691235723Sbaptbreak; 1692235723Sbaptcase 87: 1693235723Sbapt#line 835 "grammar.y" 1694235723Sbapt { 1695235723Sbapt (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text); 1696235723Sbapt yyval.text.begin = yystack.l_mark[-2].text.begin; 1697235723Sbapt } 1698235723Sbaptbreak; 1699235723Sbaptcase 88: 1700235723Sbapt#line 843 "grammar.y" 1701235723Sbapt { 1702235723Sbapt strcpy(yyval.text.text, ""); 1703235723Sbapt yyval.text.begin = 0L; 1704235723Sbapt } 1705235723Sbaptbreak; 1706235723Sbaptcase 90: 1707235723Sbapt#line 852 "grammar.y" 1708235723Sbapt { 1709235723Sbapt (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text); 1710235723Sbapt yyval.text.begin = yystack.l_mark[0].decl_spec.begin; 1711235723Sbapt free(yystack.l_mark[0].decl_spec.text); 1712235723Sbapt } 1713235723Sbaptbreak; 1714235723Sbaptcase 91: 1715235723Sbapt#line 858 "grammar.y" 1716235723Sbapt { 1717235723Sbapt (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text); 1718235723Sbapt yyval.text.begin = yystack.l_mark[-1].text.begin; 1719235723Sbapt free(yystack.l_mark[0].decl_spec.text); 1720235723Sbapt } 1721235723Sbaptbreak; 1722235723Sbaptcase 93: 1723235723Sbapt#line 868 "grammar.y" 1724235723Sbapt { 1725235723Sbapt add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "..."); 1726235723Sbapt } 1727235723Sbaptbreak; 1728235723Sbaptcase 94: 1729235723Sbapt#line 875 "grammar.y" 1730235723Sbapt { 1731235723Sbapt new_param_list(&yyval.param_list, yystack.l_mark[0].parameter); 1732235723Sbapt } 1733235723Sbaptbreak; 1734235723Sbaptcase 95: 1735235723Sbapt#line 879 "grammar.y" 1736235723Sbapt { 1737235723Sbapt add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter); 1738235723Sbapt } 1739235723Sbaptbreak; 1740235723Sbaptcase 96: 1741235723Sbapt#line 886 "grammar.y" 1742235723Sbapt { 1743235723Sbapt check_untagged(&yystack.l_mark[-1].decl_spec); 1744235723Sbapt yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator); 1745235723Sbapt } 1746235723Sbaptbreak; 1747235723Sbaptcase 97: 1748235723Sbapt#line 891 "grammar.y" 1749235723Sbapt { 1750235723Sbapt check_untagged(&yystack.l_mark[-1].decl_spec); 1751235723Sbapt yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator); 1752235723Sbapt } 1753235723Sbaptbreak; 1754235723Sbaptcase 98: 1755235723Sbapt#line 896 "grammar.y" 1756235723Sbapt { 1757235723Sbapt check_untagged(&yystack.l_mark[0].decl_spec); 1758235723Sbapt yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0); 1759235723Sbapt } 1760235723Sbaptbreak; 1761235723Sbaptcase 99: 1762235723Sbapt#line 904 "grammar.y" 1763235723Sbapt { 1764235723Sbapt new_ident_list(&yyval.param_list); 1765235723Sbapt } 1766235723Sbaptbreak; 1767235723Sbaptcase 101: 1768235723Sbapt#line 912 "grammar.y" 1769235723Sbapt { 1770235723Sbapt new_ident_list(&yyval.param_list); 1771235723Sbapt add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text); 1772235723Sbapt } 1773235723Sbaptbreak; 1774235723Sbaptcase 102: 1775235723Sbapt#line 917 "grammar.y" 1776235723Sbapt { 1777235723Sbapt add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text); 1778235723Sbapt } 1779235723Sbaptbreak; 1780235723Sbaptcase 103: 1781235723Sbapt#line 924 "grammar.y" 1782235723Sbapt { 1783235723Sbapt yyval.text = yystack.l_mark[0].text; 1784235723Sbapt } 1785235723Sbaptbreak; 1786235723Sbaptcase 104: 1787235723Sbapt#line 928 "grammar.y" 1788235723Sbapt { 1789235723Sbapt#if OPT_LINTLIBRARY 1790235723Sbapt if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */ 1791235723Sbapt yyval.text = yystack.l_mark[0].text; 1792235723Sbapt } else 1793235723Sbapt#endif 1794235723Sbapt (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text); 1795235723Sbapt yyval.text.begin = yystack.l_mark[-1].text.begin; 1796235723Sbapt } 1797235723Sbaptbreak; 1798235723Sbaptcase 105: 1799235723Sbapt#line 941 "grammar.y" 1800235723Sbapt { 1801235723Sbapt yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin); 1802235723Sbapt } 1803235723Sbaptbreak; 1804235723Sbaptcase 106: 1805235723Sbapt#line 945 "grammar.y" 1806235723Sbapt { 1807235723Sbapt yyval.declarator = yystack.l_mark[0].declarator; 1808235723Sbapt (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text); 1809235723Sbapt free(yyval.declarator->text); 1810235723Sbapt yyval.declarator->text = xstrdup(buf); 1811235723Sbapt yyval.declarator->begin = yystack.l_mark[-1].text.begin; 1812235723Sbapt } 1813235723Sbaptbreak; 1814235723Sbaptcase 108: 1815235723Sbapt#line 957 "grammar.y" 1816235723Sbapt { 1817235723Sbapt yyval.declarator = yystack.l_mark[-1].declarator; 1818235723Sbapt (void)sprintf(buf, "(%s)", yyval.declarator->text); 1819235723Sbapt free(yyval.declarator->text); 1820235723Sbapt yyval.declarator->text = xstrdup(buf); 1821235723Sbapt yyval.declarator->begin = yystack.l_mark[-2].text.begin; 1822235723Sbapt } 1823235723Sbaptbreak; 1824235723Sbaptcase 109: 1825235723Sbapt#line 965 "grammar.y" 1826235723Sbapt { 1827235723Sbapt yyval.declarator = yystack.l_mark[-1].declarator; 1828235723Sbapt (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text); 1829235723Sbapt free(yyval.declarator->text); 1830235723Sbapt yyval.declarator->text = xstrdup(buf); 1831235723Sbapt } 1832235723Sbaptbreak; 1833235723Sbaptcase 110: 1834235723Sbapt#line 972 "grammar.y" 1835235723Sbapt { 1836235723Sbapt yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin); 1837235723Sbapt } 1838235723Sbaptbreak; 1839235723Sbaptcase 111: 1840235723Sbapt#line 976 "grammar.y" 1841235723Sbapt { 1842235723Sbapt yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin); 1843235723Sbapt yyval.declarator->params = yystack.l_mark[-1].param_list; 1844235723Sbapt yyval.declarator->func_stack = yystack.l_mark[-3].declarator; 1845235723Sbapt yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head; 1846235723Sbapt yyval.declarator->func_def = FUNC_ANSI; 1847235723Sbapt } 1848235723Sbaptbreak; 1849235723Sbaptcase 112: 1850235723Sbapt#line 984 "grammar.y" 1851235723Sbapt { 1852235723Sbapt yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin); 1853235723Sbapt yyval.declarator->func_stack = yystack.l_mark[-2].declarator; 1854235723Sbapt yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head; 1855235723Sbapt yyval.declarator->func_def = FUNC_ANSI; 1856235723Sbapt } 1857235723Sbaptbreak; 1858235723Sbaptcase 113: 1859235723Sbapt#line 991 "grammar.y" 1860235723Sbapt { 1861235723Sbapt Declarator *d; 1862235723Sbapt 1863235723Sbapt d = new_declarator("", "", yystack.l_mark[-2].text.begin); 1864235723Sbapt yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin); 1865235723Sbapt yyval.declarator->params = yystack.l_mark[-1].param_list; 1866235723Sbapt yyval.declarator->func_stack = d; 1867235723Sbapt yyval.declarator->head = yyval.declarator; 1868235723Sbapt yyval.declarator->func_def = FUNC_ANSI; 1869235723Sbapt } 1870235723Sbaptbreak; 1871235723Sbaptcase 114: 1872235723Sbapt#line 1002 "grammar.y" 1873235723Sbapt { 1874235723Sbapt Declarator *d; 1875235723Sbapt 1876235723Sbapt d = new_declarator("", "", yystack.l_mark[-1].text.begin); 1877235723Sbapt yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin); 1878235723Sbapt yyval.declarator->func_stack = d; 1879235723Sbapt yyval.declarator->head = yyval.declarator; 1880235723Sbapt yyval.declarator->func_def = FUNC_ANSI; 1881235723Sbapt } 1882235723Sbaptbreak; 1883262960Sjmmv#line 1882 "/dev/stdout" 1884235723Sbapt } 1885235723Sbapt yystack.s_mark -= yym; 1886235723Sbapt yystate = *yystack.s_mark; 1887235723Sbapt yystack.l_mark -= yym; 1888235723Sbapt yym = yylhs[yyn]; 1889235723Sbapt if (yystate == 0 && yym == 0) 1890235723Sbapt { 1891235723Sbapt#if YYDEBUG 1892235723Sbapt if (yydebug) 1893235723Sbapt printf("%sdebug: after reduction, shifting from state 0 to\ 1894235723Sbapt state %d\n", YYPREFIX, YYFINAL); 1895235723Sbapt#endif 1896235723Sbapt yystate = YYFINAL; 1897235723Sbapt *++yystack.s_mark = YYFINAL; 1898235723Sbapt *++yystack.l_mark = yyval; 1899235723Sbapt if (yychar < 0) 1900235723Sbapt { 1901235723Sbapt if ((yychar = YYLEX) < 0) yychar = 0; 1902235723Sbapt#if YYDEBUG 1903235723Sbapt if (yydebug) 1904235723Sbapt { 1905262960Sjmmv yys = yyname[YYTRANSLATE(yychar)]; 1906235723Sbapt printf("%sdebug: state %d, reading %d (%s)\n", 1907235723Sbapt YYPREFIX, YYFINAL, yychar, yys); 1908235723Sbapt } 1909235723Sbapt#endif 1910235723Sbapt } 1911235723Sbapt if (yychar == 0) goto yyaccept; 1912235723Sbapt goto yyloop; 1913235723Sbapt } 1914235723Sbapt if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && 1915235723Sbapt yyn <= YYTABLESIZE && yycheck[yyn] == yystate) 1916235723Sbapt yystate = yytable[yyn]; 1917235723Sbapt else 1918235723Sbapt yystate = yydgoto[yym]; 1919235723Sbapt#if YYDEBUG 1920235723Sbapt if (yydebug) 1921235723Sbapt printf("%sdebug: after reduction, shifting from state %d \ 1922235723Sbaptto state %d\n", YYPREFIX, *yystack.s_mark, yystate); 1923235723Sbapt#endif 1924235723Sbapt if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) 1925235723Sbapt { 1926235723Sbapt goto yyoverflow; 1927235723Sbapt } 1928235723Sbapt *++yystack.s_mark = (short) yystate; 1929235723Sbapt *++yystack.l_mark = yyval; 1930235723Sbapt goto yyloop; 1931235723Sbapt 1932235723Sbaptyyoverflow: 1933235723Sbapt yyerror("yacc stack overflow"); 1934235723Sbapt 1935235723Sbaptyyabort: 1936235723Sbapt yyfreestack(&yystack); 1937235723Sbapt return (1); 1938235723Sbapt 1939235723Sbaptyyaccept: 1940235723Sbapt yyfreestack(&yystack); 1941235723Sbapt return (0); 1942235723Sbapt} 1943