1 1.8 christos /* A Bison parser, made by GNU Bison 3.8.2. */ 2 1.1 christos 3 1.6 christos /* Bison implementation for Yacc-like parsers in C 4 1.1 christos 5 1.8 christos Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, 6 1.8 christos Inc. 7 1.1 christos 8 1.6 christos This program is free software: you can redistribute it and/or modify 9 1.1 christos it under the terms of the GNU General Public License as published by 10 1.6 christos the Free Software Foundation, either version 3 of the License, or 11 1.6 christos (at your option) any later version. 12 1.1 christos 13 1.1 christos This program is distributed in the hope that it will be useful, 14 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 15 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 1.1 christos GNU General Public License for more details. 17 1.1 christos 18 1.1 christos You should have received a copy of the GNU General Public License 19 1.8 christos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 20 1.1 christos 21 1.1 christos /* As a special exception, you may create a larger work that contains 22 1.1 christos part or all of the Bison parser skeleton and distribute that work 23 1.1 christos under terms of your choice, so long as that work isn't itself a 24 1.1 christos parser generator using the skeleton or a modified version thereof 25 1.1 christos as a parser skeleton. Alternatively, if you modify or redistribute 26 1.1 christos the parser skeleton itself, you may (at your option) remove this 27 1.1 christos special exception, which will cause the skeleton and the resulting 28 1.1 christos Bison output files to be licensed under the GNU General Public 29 1.1 christos License without this special exception. 30 1.1 christos 31 1.1 christos This special exception was added by the Free Software Foundation in 32 1.1 christos version 2.2 of Bison. */ 33 1.1 christos 34 1.1 christos /* C LALR(1) parser skeleton written by Richard Stallman, by 35 1.1 christos simplifying the original so-called "semantic" parser. */ 36 1.1 christos 37 1.8 christos /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, 38 1.8 christos especially those whose name start with YY_ or yy_. They are 39 1.8 christos private implementation details that can be changed or removed. */ 40 1.8 christos 41 1.1 christos /* All symbols defined below should begin with yy or YY, to avoid 42 1.1 christos infringing on user name space. This should be done even for local 43 1.1 christos variables, as they might otherwise be expanded by user macros. 44 1.1 christos There are some unavoidable exceptions within include files to 45 1.1 christos define necessary library symbols; they are noted "INFRINGES ON 46 1.1 christos USER NAME SPACE" below. */ 47 1.1 christos 48 1.8 christos /* Identify Bison output, and Bison version. */ 49 1.8 christos #define YYBISON 30802 50 1.1 christos 51 1.8 christos /* Bison version string. */ 52 1.8 christos #define YYBISON_VERSION "3.8.2" 53 1.1 christos 54 1.1 christos /* Skeleton name. */ 55 1.1 christos #define YYSKELETON_NAME "yacc.c" 56 1.1 christos 57 1.1 christos /* Pure parsers. */ 58 1.1 christos #define YYPURE 0 59 1.1 christos 60 1.6 christos /* Push parsers. */ 61 1.6 christos #define YYPUSH 0 62 1.1 christos 63 1.6 christos /* Pull parsers. */ 64 1.6 christos #define YYPULL 1 65 1.1 christos 66 1.1 christos 67 1.1 christos 68 1.1 christos 69 1.8 christos /* First part of user prologue. */ 70 1.8 christos #line 21 "sysinfo.y" 71 1.1 christos 72 1.1 christos #include <stdio.h> 73 1.1 christos #include <stdlib.h> 74 1.6 christos #include <string.h> 75 1.1 christos 76 1.1 christos static char writecode; 77 1.1 christos static char *it; 78 1.1 christos static int code; 79 1.1 christos static char * repeat; 80 1.1 christos static char *oldrepeat; 81 1.1 christos static char *name; 82 1.1 christos static int rdepth; 83 1.1 christos static char *names[] = {" ","[n]","[n][m]"}; 84 1.1 christos static char *pnames[]= {"","*","**"}; 85 1.1 christos 86 1.8 christos static void yyerror (const char *s); 87 1.1 christos extern int yylex (void); 88 1.1 christos 89 1.8 christos #line 90 "sysinfo.c" 90 1.1 christos 91 1.8 christos # ifndef YY_CAST 92 1.8 christos # ifdef __cplusplus 93 1.8 christos # define YY_CAST(Type, Val) static_cast<Type> (Val) 94 1.8 christos # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) 95 1.8 christos # else 96 1.8 christos # define YY_CAST(Type, Val) ((Type) (Val)) 97 1.8 christos # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) 98 1.8 christos # endif 99 1.8 christos # endif 100 1.6 christos # ifndef YY_NULLPTR 101 1.8 christos # if defined __cplusplus 102 1.8 christos # if 201103L <= __cplusplus 103 1.8 christos # define YY_NULLPTR nullptr 104 1.8 christos # else 105 1.8 christos # define YY_NULLPTR 0 106 1.8 christos # endif 107 1.6 christos # else 108 1.8 christos # define YY_NULLPTR ((void*)0) 109 1.6 christos # endif 110 1.6 christos # endif 111 1.1 christos 112 1.8 christos /* Use api.header.include to #include this header 113 1.8 christos instead of duplicating it here. */ 114 1.6 christos #ifndef YY_YY_SYSINFO_H_INCLUDED 115 1.6 christos # define YY_YY_SYSINFO_H_INCLUDED 116 1.6 christos /* Debug traces. */ 117 1.6 christos #ifndef YYDEBUG 118 1.6 christos # define YYDEBUG 0 119 1.6 christos #endif 120 1.6 christos #if YYDEBUG 121 1.6 christos extern int yydebug; 122 1.3 christos #endif 123 1.3 christos 124 1.8 christos /* Token kinds. */ 125 1.6 christos #ifndef YYTOKENTYPE 126 1.6 christos # define YYTOKENTYPE 127 1.6 christos enum yytokentype 128 1.6 christos { 129 1.8 christos YYEMPTY = -2, 130 1.8 christos YYEOF = 0, /* "end of file" */ 131 1.8 christos YYerror = 256, /* error */ 132 1.8 christos YYUNDEF = 257, /* "invalid token" */ 133 1.8 christos COND = 258, /* COND */ 134 1.8 christos REPEAT = 259, /* REPEAT */ 135 1.8 christos TYPE = 260, /* TYPE */ 136 1.8 christos NAME = 261, /* NAME */ 137 1.8 christos NUMBER = 262, /* NUMBER */ 138 1.8 christos UNIT = 263 /* UNIT */ 139 1.6 christos }; 140 1.8 christos typedef enum yytokentype yytoken_kind_t; 141 1.6 christos #endif 142 1.8 christos /* Token kinds. */ 143 1.8 christos #define YYEMPTY -2 144 1.8 christos #define YYEOF 0 145 1.8 christos #define YYerror 256 146 1.8 christos #define YYUNDEF 257 147 1.6 christos #define COND 258 148 1.6 christos #define REPEAT 259 149 1.6 christos #define TYPE 260 150 1.6 christos #define NAME 261 151 1.6 christos #define NUMBER 262 152 1.6 christos #define UNIT 263 153 1.6 christos 154 1.6 christos /* Value type. */ 155 1.1 christos #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 156 1.6 christos union YYSTYPE 157 1.1 christos { 158 1.8 christos #line 41 "sysinfo.y" 159 1.6 christos 160 1.1 christos int i; 161 1.1 christos char *s; 162 1.6 christos 163 1.8 christos #line 164 "sysinfo.c" 164 1.8 christos 165 1.6 christos }; 166 1.6 christos typedef union YYSTYPE YYSTYPE; 167 1.6 christos # define YYSTYPE_IS_TRIVIAL 1 168 1.5 christos # define YYSTYPE_IS_DECLARED 1 169 1.1 christos #endif 170 1.1 christos 171 1.1 christos 172 1.6 christos extern YYSTYPE yylval; 173 1.6 christos 174 1.8 christos 175 1.6 christos int yyparse (void); 176 1.6 christos 177 1.8 christos 178 1.6 christos #endif /* !YY_YY_SYSINFO_H_INCLUDED */ 179 1.8 christos /* Symbol kind. */ 180 1.8 christos enum yysymbol_kind_t 181 1.8 christos { 182 1.8 christos YYSYMBOL_YYEMPTY = -2, 183 1.8 christos YYSYMBOL_YYEOF = 0, /* "end of file" */ 184 1.8 christos YYSYMBOL_YYerror = 1, /* error */ 185 1.8 christos YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ 186 1.8 christos YYSYMBOL_COND = 3, /* COND */ 187 1.8 christos YYSYMBOL_REPEAT = 4, /* REPEAT */ 188 1.8 christos YYSYMBOL_5_ = 5, /* '(' */ 189 1.8 christos YYSYMBOL_6_ = 6, /* ')' */ 190 1.8 christos YYSYMBOL_TYPE = 7, /* TYPE */ 191 1.8 christos YYSYMBOL_NAME = 8, /* NAME */ 192 1.8 christos YYSYMBOL_NUMBER = 9, /* NUMBER */ 193 1.8 christos YYSYMBOL_UNIT = 10, /* UNIT */ 194 1.8 christos YYSYMBOL_YYACCEPT = 11, /* $accept */ 195 1.8 christos YYSYMBOL_top = 12, /* top */ 196 1.8 christos YYSYMBOL_13_1 = 13, /* $@1 */ 197 1.8 christos YYSYMBOL_it_list = 14, /* it_list */ 198 1.8 christos YYSYMBOL_it = 15, /* it */ 199 1.8 christos YYSYMBOL_16_2 = 16, /* $@2 */ 200 1.8 christos YYSYMBOL_it_field_list = 17, /* it_field_list */ 201 1.8 christos YYSYMBOL_repeat_it_field = 18, /* repeat_it_field */ 202 1.8 christos YYSYMBOL_19_3 = 19, /* $@3 */ 203 1.8 christos YYSYMBOL_cond_it_field = 20, /* cond_it_field */ 204 1.8 christos YYSYMBOL_21_4 = 21, /* $@4 */ 205 1.8 christos YYSYMBOL_it_field = 22, /* it_field */ 206 1.8 christos YYSYMBOL_23_5 = 23, /* $@5 */ 207 1.8 christos YYSYMBOL_attr_type = 24, /* attr_type */ 208 1.8 christos YYSYMBOL_attr_desc = 25, /* attr_desc */ 209 1.8 christos YYSYMBOL_attr_size = 26, /* attr_size */ 210 1.8 christos YYSYMBOL_attr_id = 27, /* attr_id */ 211 1.8 christos YYSYMBOL_enums = 28, /* enums */ 212 1.8 christos YYSYMBOL_enum_list = 29 /* enum_list */ 213 1.8 christos }; 214 1.8 christos typedef enum yysymbol_kind_t yysymbol_kind_t; 215 1.8 christos 216 1.3 christos 217 1.3 christos 218 1.1 christos 219 1.1 christos #ifdef short 220 1.1 christos # undef short 221 1.1 christos #endif 222 1.1 christos 223 1.8 christos /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure 224 1.8 christos <limits.h> and (if available) <stdint.h> are included 225 1.8 christos so that the code can choose integer types of a good width. */ 226 1.8 christos 227 1.8 christos #ifndef __PTRDIFF_MAX__ 228 1.8 christos # include <limits.h> /* INFRINGES ON USER NAME SPACE */ 229 1.8 christos # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 230 1.8 christos # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ 231 1.8 christos # define YY_STDINT_H 232 1.8 christos # endif 233 1.8 christos #endif 234 1.8 christos 235 1.8 christos /* Narrow types that promote to a signed type and that can represent a 236 1.8 christos signed or unsigned integer of at least N bits. In tables they can 237 1.8 christos save space and decrease cache pressure. Promoting to a signed type 238 1.8 christos helps avoid bugs in integer arithmetic. */ 239 1.8 christos 240 1.8 christos #ifdef __INT_LEAST8_MAX__ 241 1.8 christos typedef __INT_LEAST8_TYPE__ yytype_int8; 242 1.8 christos #elif defined YY_STDINT_H 243 1.8 christos typedef int_least8_t yytype_int8; 244 1.1 christos #else 245 1.8 christos typedef signed char yytype_int8; 246 1.1 christos #endif 247 1.1 christos 248 1.8 christos #ifdef __INT_LEAST16_MAX__ 249 1.8 christos typedef __INT_LEAST16_TYPE__ yytype_int16; 250 1.8 christos #elif defined YY_STDINT_H 251 1.8 christos typedef int_least16_t yytype_int16; 252 1.6 christos #else 253 1.8 christos typedef short yytype_int16; 254 1.1 christos #endif 255 1.1 christos 256 1.8 christos /* Work around bug in HP-UX 11.23, which defines these macros 257 1.8 christos incorrectly for preprocessor constants. This workaround can likely 258 1.8 christos be removed in 2023, as HPE has promised support for HP-UX 11.23 259 1.8 christos (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of 260 1.8 christos <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ 261 1.8 christos #ifdef __hpux 262 1.8 christos # undef UINT_LEAST8_MAX 263 1.8 christos # undef UINT_LEAST16_MAX 264 1.8 christos # define UINT_LEAST8_MAX 255 265 1.8 christos # define UINT_LEAST16_MAX 65535 266 1.8 christos #endif 267 1.8 christos 268 1.8 christos #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ 269 1.8 christos typedef __UINT_LEAST8_TYPE__ yytype_uint8; 270 1.8 christos #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ 271 1.8 christos && UINT_LEAST8_MAX <= INT_MAX) 272 1.8 christos typedef uint_least8_t yytype_uint8; 273 1.8 christos #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX 274 1.8 christos typedef unsigned char yytype_uint8; 275 1.1 christos #else 276 1.8 christos typedef short yytype_uint8; 277 1.1 christos #endif 278 1.1 christos 279 1.8 christos #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ 280 1.8 christos typedef __UINT_LEAST16_TYPE__ yytype_uint16; 281 1.8 christos #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ 282 1.8 christos && UINT_LEAST16_MAX <= INT_MAX) 283 1.8 christos typedef uint_least16_t yytype_uint16; 284 1.8 christos #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX 285 1.8 christos typedef unsigned short yytype_uint16; 286 1.1 christos #else 287 1.8 christos typedef int yytype_uint16; 288 1.8 christos #endif 289 1.8 christos 290 1.8 christos #ifndef YYPTRDIFF_T 291 1.8 christos # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ 292 1.8 christos # define YYPTRDIFF_T __PTRDIFF_TYPE__ 293 1.8 christos # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ 294 1.8 christos # elif defined PTRDIFF_MAX 295 1.8 christos # ifndef ptrdiff_t 296 1.8 christos # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 297 1.8 christos # endif 298 1.8 christos # define YYPTRDIFF_T ptrdiff_t 299 1.8 christos # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX 300 1.8 christos # else 301 1.8 christos # define YYPTRDIFF_T long 302 1.8 christos # define YYPTRDIFF_MAXIMUM LONG_MAX 303 1.8 christos # endif 304 1.1 christos #endif 305 1.1 christos 306 1.1 christos #ifndef YYSIZE_T 307 1.1 christos # ifdef __SIZE_TYPE__ 308 1.1 christos # define YYSIZE_T __SIZE_TYPE__ 309 1.1 christos # elif defined size_t 310 1.1 christos # define YYSIZE_T size_t 311 1.8 christos # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 312 1.1 christos # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 313 1.1 christos # define YYSIZE_T size_t 314 1.1 christos # else 315 1.8 christos # define YYSIZE_T unsigned 316 1.1 christos # endif 317 1.1 christos #endif 318 1.1 christos 319 1.8 christos #define YYSIZE_MAXIMUM \ 320 1.8 christos YY_CAST (YYPTRDIFF_T, \ 321 1.8 christos (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ 322 1.8 christos ? YYPTRDIFF_MAXIMUM \ 323 1.8 christos : YY_CAST (YYSIZE_T, -1))) 324 1.8 christos 325 1.8 christos #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) 326 1.8 christos 327 1.8 christos 328 1.8 christos /* Stored state numbers (used for stacks). */ 329 1.8 christos typedef yytype_int8 yy_state_t; 330 1.8 christos 331 1.8 christos /* State numbers in computations. */ 332 1.8 christos typedef int yy_state_fast_t; 333 1.1 christos 334 1.1 christos #ifndef YY_ 335 1.1 christos # if defined YYENABLE_NLS && YYENABLE_NLS 336 1.1 christos # if ENABLE_NLS 337 1.1 christos # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 338 1.6 christos # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 339 1.1 christos # endif 340 1.1 christos # endif 341 1.1 christos # ifndef YY_ 342 1.6 christos # define YY_(Msgid) Msgid 343 1.6 christos # endif 344 1.6 christos #endif 345 1.6 christos 346 1.8 christos 347 1.8 christos #ifndef YY_ATTRIBUTE_PURE 348 1.8 christos # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) 349 1.8 christos # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) 350 1.6 christos # else 351 1.8 christos # define YY_ATTRIBUTE_PURE 352 1.6 christos # endif 353 1.6 christos #endif 354 1.6 christos 355 1.6 christos #ifndef YY_ATTRIBUTE_UNUSED 356 1.8 christos # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 357 1.8 christos # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 358 1.6 christos # else 359 1.8 christos # define YY_ATTRIBUTE_UNUSED 360 1.1 christos # endif 361 1.1 christos #endif 362 1.1 christos 363 1.1 christos /* Suppress unused-variable warnings by "using" E. */ 364 1.1 christos #if ! defined lint || defined __GNUC__ 365 1.8 christos # define YY_USE(E) ((void) (E)) 366 1.1 christos #else 367 1.8 christos # define YY_USE(E) /* empty */ 368 1.1 christos #endif 369 1.1 christos 370 1.6 christos /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 371 1.8 christos #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ 372 1.8 christos # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 373 1.8 christos # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 374 1.8 christos _Pragma ("GCC diagnostic push") \ 375 1.8 christos _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") 376 1.8 christos # else 377 1.8 christos # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 378 1.8 christos _Pragma ("GCC diagnostic push") \ 379 1.8 christos _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ 380 1.6 christos _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 381 1.8 christos # endif 382 1.8 christos # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 383 1.6 christos _Pragma ("GCC diagnostic pop") 384 1.1 christos #else 385 1.6 christos # define YY_INITIAL_VALUE(Value) Value 386 1.6 christos #endif 387 1.6 christos #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 388 1.6 christos # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 389 1.6 christos # define YY_IGNORE_MAYBE_UNINITIALIZED_END 390 1.3 christos #endif 391 1.6 christos #ifndef YY_INITIAL_VALUE 392 1.6 christos # define YY_INITIAL_VALUE(Value) /* Nothing. */ 393 1.1 christos #endif 394 1.1 christos 395 1.8 christos #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ 396 1.8 christos # define YY_IGNORE_USELESS_CAST_BEGIN \ 397 1.8 christos _Pragma ("GCC diagnostic push") \ 398 1.8 christos _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") 399 1.8 christos # define YY_IGNORE_USELESS_CAST_END \ 400 1.8 christos _Pragma ("GCC diagnostic pop") 401 1.8 christos #endif 402 1.8 christos #ifndef YY_IGNORE_USELESS_CAST_BEGIN 403 1.8 christos # define YY_IGNORE_USELESS_CAST_BEGIN 404 1.8 christos # define YY_IGNORE_USELESS_CAST_END 405 1.8 christos #endif 406 1.8 christos 407 1.6 christos 408 1.8 christos #define YY_ASSERT(E) ((void) (0 && (E))) 409 1.8 christos 410 1.8 christos #if !defined yyoverflow 411 1.1 christos 412 1.1 christos /* The parser invokes alloca or malloc; define the necessary symbols. */ 413 1.1 christos 414 1.1 christos # ifdef YYSTACK_USE_ALLOCA 415 1.1 christos # if YYSTACK_USE_ALLOCA 416 1.1 christos # ifdef __GNUC__ 417 1.1 christos # define YYSTACK_ALLOC __builtin_alloca 418 1.1 christos # elif defined __BUILTIN_VA_ARG_INCR 419 1.1 christos # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 420 1.1 christos # elif defined _AIX 421 1.1 christos # define YYSTACK_ALLOC __alloca 422 1.1 christos # elif defined _MSC_VER 423 1.1 christos # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 424 1.1 christos # define alloca _alloca 425 1.1 christos # else 426 1.1 christos # define YYSTACK_ALLOC alloca 427 1.6 christos # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 428 1.1 christos # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 429 1.6 christos /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 430 1.6 christos # ifndef EXIT_SUCCESS 431 1.6 christos # define EXIT_SUCCESS 0 432 1.1 christos # endif 433 1.1 christos # endif 434 1.1 christos # endif 435 1.1 christos # endif 436 1.1 christos # endif 437 1.1 christos 438 1.1 christos # ifdef YYSTACK_ALLOC 439 1.6 christos /* Pacify GCC's 'empty if-body' warning. */ 440 1.6 christos # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 441 1.1 christos # ifndef YYSTACK_ALLOC_MAXIMUM 442 1.1 christos /* The OS might guarantee only one guard page at the bottom of the stack, 443 1.1 christos and a page size can be as small as 4096 bytes. So we cannot safely 444 1.1 christos invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 445 1.1 christos to allow for a few compiler-allocated temporary stack slots. */ 446 1.1 christos # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 447 1.1 christos # endif 448 1.1 christos # else 449 1.1 christos # define YYSTACK_ALLOC YYMALLOC 450 1.1 christos # define YYSTACK_FREE YYFREE 451 1.1 christos # ifndef YYSTACK_ALLOC_MAXIMUM 452 1.1 christos # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 453 1.1 christos # endif 454 1.6 christos # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 455 1.1 christos && ! ((defined YYMALLOC || defined malloc) \ 456 1.6 christos && (defined YYFREE || defined free))) 457 1.1 christos # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 458 1.6 christos # ifndef EXIT_SUCCESS 459 1.6 christos # define EXIT_SUCCESS 0 460 1.1 christos # endif 461 1.1 christos # endif 462 1.1 christos # ifndef YYMALLOC 463 1.1 christos # define YYMALLOC malloc 464 1.6 christos # if ! defined malloc && ! defined EXIT_SUCCESS 465 1.1 christos void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 466 1.1 christos # endif 467 1.1 christos # endif 468 1.1 christos # ifndef YYFREE 469 1.1 christos # define YYFREE free 470 1.6 christos # if ! defined free && ! defined EXIT_SUCCESS 471 1.1 christos void free (void *); /* INFRINGES ON USER NAME SPACE */ 472 1.1 christos # endif 473 1.1 christos # endif 474 1.1 christos # endif 475 1.8 christos #endif /* !defined yyoverflow */ 476 1.1 christos 477 1.1 christos #if (! defined yyoverflow \ 478 1.1 christos && (! defined __cplusplus \ 479 1.6 christos || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 480 1.1 christos 481 1.1 christos /* A type that is properly aligned for any stack member. */ 482 1.1 christos union yyalloc 483 1.1 christos { 484 1.8 christos yy_state_t yyss_alloc; 485 1.6 christos YYSTYPE yyvs_alloc; 486 1.6 christos }; 487 1.1 christos 488 1.1 christos /* The size of the maximum gap between one aligned stack and the next. */ 489 1.8 christos # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) 490 1.1 christos 491 1.1 christos /* The size of an array large to enough to hold all stacks, each with 492 1.1 christos N elements. */ 493 1.1 christos # define YYSTACK_BYTES(N) \ 494 1.8 christos ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ 495 1.1 christos + YYSTACK_GAP_MAXIMUM) 496 1.1 christos 497 1.6 christos # define YYCOPY_NEEDED 1 498 1.1 christos 499 1.1 christos /* Relocate STACK from its old location to the new one. The 500 1.1 christos local variables YYSIZE and YYSTACKSIZE give the old and new number of 501 1.1 christos elements in the stack, and YYPTR gives the new location of the 502 1.1 christos stack. Advance YYPTR to a properly aligned location for the next 503 1.1 christos stack. */ 504 1.6 christos # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 505 1.6 christos do \ 506 1.6 christos { \ 507 1.8 christos YYPTRDIFF_T yynewbytes; \ 508 1.6 christos YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 509 1.6 christos Stack = &yyptr->Stack_alloc; \ 510 1.8 christos yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ 511 1.8 christos yyptr += yynewbytes / YYSIZEOF (*yyptr); \ 512 1.6 christos } \ 513 1.6 christos while (0) 514 1.1 christos 515 1.1 christos #endif 516 1.1 christos 517 1.6 christos #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 518 1.6 christos /* Copy COUNT objects from SRC to DST. The source and destination do 519 1.6 christos not overlap. */ 520 1.6 christos # ifndef YYCOPY 521 1.6 christos # if defined __GNUC__ && 1 < __GNUC__ 522 1.6 christos # define YYCOPY(Dst, Src, Count) \ 523 1.8 christos __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) 524 1.6 christos # else 525 1.6 christos # define YYCOPY(Dst, Src, Count) \ 526 1.6 christos do \ 527 1.6 christos { \ 528 1.8 christos YYPTRDIFF_T yyi; \ 529 1.6 christos for (yyi = 0; yyi < (Count); yyi++) \ 530 1.6 christos (Dst)[yyi] = (Src)[yyi]; \ 531 1.6 christos } \ 532 1.6 christos while (0) 533 1.6 christos # endif 534 1.6 christos # endif 535 1.6 christos #endif /* !YYCOPY_NEEDED */ 536 1.6 christos 537 1.1 christos /* YYFINAL -- State number of the termination state. */ 538 1.1 christos #define YYFINAL 3 539 1.1 christos /* YYLAST -- Last index in YYTABLE. */ 540 1.1 christos #define YYLAST 38 541 1.1 christos 542 1.1 christos /* YYNTOKENS -- Number of terminals. */ 543 1.1 christos #define YYNTOKENS 11 544 1.1 christos /* YYNNTS -- Number of nonterminals. */ 545 1.1 christos #define YYNNTS 19 546 1.1 christos /* YYNRULES -- Number of rules. */ 547 1.1 christos #define YYNRULES 27 548 1.6 christos /* YYNSTATES -- Number of states. */ 549 1.1 christos #define YYNSTATES 55 550 1.1 christos 551 1.8 christos /* YYMAXUTOK -- Last valid token kind. */ 552 1.1 christos #define YYMAXUTOK 263 553 1.1 christos 554 1.8 christos 555 1.8 christos /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 556 1.8 christos as returned by yylex, with out-of-bounds checking. */ 557 1.8 christos #define YYTRANSLATE(YYX) \ 558 1.8 christos (0 <= (YYX) && (YYX) <= YYMAXUTOK \ 559 1.8 christos ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ 560 1.8 christos : YYSYMBOL_YYUNDEF) 561 1.1 christos 562 1.6 christos /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 563 1.8 christos as returned by yylex. */ 564 1.8 christos static const yytype_int8 yytranslate[] = 565 1.1 christos { 566 1.1 christos 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 567 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 568 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 569 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 570 1.1 christos 5, 6, 2, 2, 2, 2, 2, 2, 2, 2, 571 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 572 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 573 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 574 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 575 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 576 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 577 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 578 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 579 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 580 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 581 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 582 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 583 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 584 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 585 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 586 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 587 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 588 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 589 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 590 1.1 christos 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 591 1.1 christos 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 592 1.1 christos 7, 8, 9, 10 593 1.1 christos }; 594 1.1 christos 595 1.1 christos #if YYDEBUG 596 1.8 christos /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 597 1.8 christos static const yytype_int16 yyrline[] = 598 1.1 christos { 599 1.6 christos 0, 55, 55, 55, 93, 94, 99, 98, 171, 172, 600 1.6 christos 173, 174, 178, 177, 228, 227, 257, 256, 367, 368, 601 1.6 christos 372, 377, 383, 384, 387, 388, 390, 392 602 1.1 christos }; 603 1.1 christos #endif 604 1.1 christos 605 1.8 christos /** Accessing symbol of state STATE. */ 606 1.8 christos #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) 607 1.8 christos 608 1.8 christos #if YYDEBUG || 0 609 1.8 christos /* The user-facing name of the symbol whose (internal) number is 610 1.8 christos YYSYMBOL. No bounds checking. */ 611 1.8 christos static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; 612 1.8 christos 613 1.1 christos /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 614 1.1 christos First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 615 1.1 christos static const char *const yytname[] = 616 1.1 christos { 617 1.8 christos "\"end of file\"", "error", "\"invalid token\"", "COND", "REPEAT", 618 1.8 christos "'('", "')'", "TYPE", "NAME", "NUMBER", "UNIT", "$accept", "top", "$@1", 619 1.8 christos "it_list", "it", "$@2", "it_field_list", "repeat_it_field", "$@3", 620 1.8 christos "cond_it_field", "$@4", "it_field", "$@5", "attr_type", "attr_desc", 621 1.8 christos "attr_size", "attr_id", "enums", "enum_list", YY_NULLPTR 622 1.1 christos }; 623 1.1 christos 624 1.8 christos static const char * 625 1.8 christos yysymbol_name (yysymbol_kind_t yysymbol) 626 1.1 christos { 627 1.8 christos return yytname[yysymbol]; 628 1.8 christos } 629 1.8 christos #endif 630 1.1 christos 631 1.8 christos #define YYPACT_NINF (-14) 632 1.6 christos 633 1.8 christos #define yypact_value_is_default(Yyn) \ 634 1.8 christos ((Yyn) == YYPACT_NINF) 635 1.6 christos 636 1.8 christos #define YYTABLE_NINF (-1) 637 1.6 christos 638 1.8 christos #define yytable_value_is_error(Yyn) \ 639 1.6 christos 0 640 1.3 christos 641 1.8 christos /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 642 1.8 christos STATE-NUM. */ 643 1.6 christos static const yytype_int8 yypact[] = 644 1.5 christos { 645 1.6 christos -14, 8, 4, -14, 2, -14, 4, 3, -14, -14, 646 1.6 christos 6, 0, 7, 6, 6, 6, 9, 10, 11, 15, 647 1.6 christos -14, -14, -14, -14, -14, -14, 16, 14, 6, 6, 648 1.6 christos -14, -14, 5, 17, 18, 19, 20, -14, -14, -14, 649 1.6 christos 22, 23, -14, 24, 27, -14, -14, 28, 1, -14, 650 1.6 christos 25, -14, 29, 30, -14 651 1.5 christos }; 652 1.3 christos 653 1.8 christos /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 654 1.8 christos Performed when YYTABLE does not specify something else to do. Zero 655 1.8 christos means the default is an error. */ 656 1.8 christos static const yytype_int8 yydefact[] = 657 1.5 christos { 658 1.5 christos 2, 0, 5, 1, 0, 3, 5, 0, 4, 6, 659 1.5 christos 11, 0, 0, 11, 11, 11, 0, 0, 0, 0, 660 1.5 christos 7, 10, 9, 8, 14, 12, 0, 19, 11, 11, 661 1.5 christos 20, 18, 0, 0, 0, 0, 0, 15, 13, 21, 662 1.5 christos 23, 0, 16, 0, 24, 22, 26, 0, 0, 17, 663 1.5 christos 0, 25, 0, 0, 27 664 1.5 christos }; 665 1.3 christos 666 1.8 christos /* YYPGOTO[NTERM-NUM]. */ 667 1.6 christos static const yytype_int8 yypgoto[] = 668 1.6 christos { 669 1.6 christos -14, -14, -14, 32, -14, -14, -13, -14, -14, -14, 670 1.6 christos -14, -14, -14, -14, -14, -14, -14, -14, -14 671 1.6 christos }; 672 1.6 christos 673 1.8 christos /* YYDEFGOTO[NTERM-NUM]. */ 674 1.5 christos static const yytype_int8 yydefgoto[] = 675 1.5 christos { 676 1.8 christos 0, 1, 2, 5, 6, 10, 12, 13, 29, 14, 677 1.5 christos 28, 15, 44, 32, 19, 36, 42, 47, 48 678 1.5 christos }; 679 1.1 christos 680 1.8 christos /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 681 1.8 christos positive, shift that token. If negative, reduce the rule whose 682 1.8 christos number is the opposite. If YYTABLE_NINF, syntax error. */ 683 1.8 christos static const yytype_int8 yytable[] = 684 1.1 christos { 685 1.1 christos 21, 22, 23, 16, 17, 18, 50, 51, 3, 4, 686 1.1 christos 7, 11, 9, 20, 35, 33, 34, 24, 25, 26, 687 1.1 christos 27, 31, 30, 37, 38, 0, 40, 41, 0, 39, 688 1.1 christos 45, 43, 46, 52, 49, 0, 54, 53, 8 689 1.1 christos }; 690 1.1 christos 691 1.1 christos static const yytype_int8 yycheck[] = 692 1.1 christos { 693 1.1 christos 13, 14, 15, 3, 4, 5, 5, 6, 0, 5, 694 1.1 christos 8, 5, 9, 6, 9, 28, 29, 8, 8, 8, 695 1.1 christos 5, 7, 6, 6, 6, -1, 6, 5, -1, 10, 696 1.1 christos 6, 8, 5, 8, 6, -1, 6, 8, 6 697 1.1 christos }; 698 1.1 christos 699 1.8 christos /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of 700 1.8 christos state STATE-NUM. */ 701 1.8 christos static const yytype_int8 yystos[] = 702 1.1 christos { 703 1.1 christos 0, 12, 13, 0, 5, 14, 15, 8, 14, 9, 704 1.1 christos 16, 5, 17, 18, 20, 22, 3, 4, 5, 25, 705 1.1 christos 6, 17, 17, 17, 8, 8, 8, 5, 21, 19, 706 1.1 christos 6, 7, 24, 17, 17, 9, 26, 6, 6, 10, 707 1.1 christos 6, 5, 27, 8, 23, 6, 5, 28, 29, 6, 708 1.1 christos 5, 6, 8, 8, 6 709 1.1 christos }; 710 1.1 christos 711 1.8 christos /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ 712 1.8 christos static const yytype_int8 yyr1[] = 713 1.6 christos { 714 1.6 christos 0, 11, 13, 12, 14, 14, 16, 15, 17, 17, 715 1.6 christos 17, 17, 19, 18, 21, 20, 23, 22, 24, 24, 716 1.6 christos 25, 26, 27, 27, 28, 28, 29, 29 717 1.6 christos }; 718 1.1 christos 719 1.8 christos /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ 720 1.8 christos static const yytype_int8 yyr2[] = 721 1.6 christos { 722 1.6 christos 0, 2, 0, 2, 2, 0, 0, 6, 2, 2, 723 1.6 christos 2, 0, 0, 6, 0, 6, 0, 10, 1, 0, 724 1.6 christos 3, 2, 3, 0, 0, 3, 0, 5 725 1.6 christos }; 726 1.1 christos 727 1.1 christos 728 1.8 christos enum { YYENOMEM = -2 }; 729 1.8 christos 730 1.6 christos #define yyerrok (yyerrstatus = 0) 731 1.6 christos #define yyclearin (yychar = YYEMPTY) 732 1.6 christos 733 1.6 christos #define YYACCEPT goto yyacceptlab 734 1.6 christos #define YYABORT goto yyabortlab 735 1.6 christos #define YYERROR goto yyerrorlab 736 1.8 christos #define YYNOMEM goto yyexhaustedlab 737 1.1 christos 738 1.1 christos 739 1.1 christos #define YYRECOVERING() (!!yyerrstatus) 740 1.1 christos 741 1.8 christos #define YYBACKUP(Token, Value) \ 742 1.8 christos do \ 743 1.8 christos if (yychar == YYEMPTY) \ 744 1.8 christos { \ 745 1.8 christos yychar = (Token); \ 746 1.8 christos yylval = (Value); \ 747 1.8 christos YYPOPSTACK (yylen); \ 748 1.8 christos yystate = *yyssp; \ 749 1.8 christos goto yybackup; \ 750 1.8 christos } \ 751 1.8 christos else \ 752 1.8 christos { \ 753 1.8 christos yyerror (YY_("syntax error: cannot back up")); \ 754 1.8 christos YYERROR; \ 755 1.8 christos } \ 756 1.8 christos while (0) 757 1.8 christos 758 1.8 christos /* Backward compatibility with an undocumented macro. 759 1.8 christos Use YYerror or YYUNDEF. */ 760 1.8 christos #define YYERRCODE YYUNDEF 761 1.5 christos 762 1.5 christos 763 1.1 christos /* Enable debugging if requested. */ 764 1.1 christos #if YYDEBUG 765 1.1 christos 766 1.1 christos # ifndef YYFPRINTF 767 1.1 christos # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 768 1.1 christos # define YYFPRINTF fprintf 769 1.1 christos # endif 770 1.1 christos 771 1.6 christos # define YYDPRINTF(Args) \ 772 1.6 christos do { \ 773 1.6 christos if (yydebug) \ 774 1.6 christos YYFPRINTF Args; \ 775 1.6 christos } while (0) 776 1.6 christos 777 1.6 christos 778 1.1 christos 779 1.8 christos 780 1.8 christos # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ 781 1.6 christos do { \ 782 1.6 christos if (yydebug) \ 783 1.6 christos { \ 784 1.6 christos YYFPRINTF (stderr, "%s ", Title); \ 785 1.6 christos yy_symbol_print (stderr, \ 786 1.8 christos Kind, Value); \ 787 1.6 christos YYFPRINTF (stderr, "\n"); \ 788 1.6 christos } \ 789 1.6 christos } while (0) 790 1.3 christos 791 1.3 christos 792 1.8 christos /*-----------------------------------. 793 1.8 christos | Print this symbol's value on YYO. | 794 1.8 christos `-----------------------------------*/ 795 1.6 christos 796 1.1 christos static void 797 1.8 christos yy_symbol_value_print (FILE *yyo, 798 1.8 christos yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) 799 1.1 christos { 800 1.8 christos FILE *yyoutput = yyo; 801 1.8 christos YY_USE (yyoutput); 802 1.1 christos if (!yyvaluep) 803 1.1 christos return; 804 1.8 christos YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 805 1.8 christos YY_USE (yykind); 806 1.8 christos YY_IGNORE_MAYBE_UNINITIALIZED_END 807 1.1 christos } 808 1.1 christos 809 1.1 christos 810 1.8 christos /*---------------------------. 811 1.8 christos | Print this symbol on YYO. | 812 1.8 christos `---------------------------*/ 813 1.1 christos 814 1.1 christos static void 815 1.8 christos yy_symbol_print (FILE *yyo, 816 1.8 christos yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) 817 1.1 christos { 818 1.8 christos YYFPRINTF (yyo, "%s %s (", 819 1.8 christos yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); 820 1.1 christos 821 1.8 christos yy_symbol_value_print (yyo, yykind, yyvaluep); 822 1.8 christos YYFPRINTF (yyo, ")"); 823 1.1 christos } 824 1.1 christos 825 1.1 christos /*------------------------------------------------------------------. 826 1.1 christos | yy_stack_print -- Print the state stack from its BOTTOM up to its | 827 1.1 christos | TOP (included). | 828 1.1 christos `------------------------------------------------------------------*/ 829 1.1 christos 830 1.1 christos static void 831 1.8 christos yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) 832 1.1 christos { 833 1.1 christos YYFPRINTF (stderr, "Stack now"); 834 1.6 christos for (; yybottom <= yytop; yybottom++) 835 1.6 christos { 836 1.6 christos int yybot = *yybottom; 837 1.6 christos YYFPRINTF (stderr, " %d", yybot); 838 1.6 christos } 839 1.1 christos YYFPRINTF (stderr, "\n"); 840 1.1 christos } 841 1.1 christos 842 1.6 christos # define YY_STACK_PRINT(Bottom, Top) \ 843 1.6 christos do { \ 844 1.6 christos if (yydebug) \ 845 1.6 christos yy_stack_print ((Bottom), (Top)); \ 846 1.6 christos } while (0) 847 1.1 christos 848 1.1 christos 849 1.1 christos /*------------------------------------------------. 850 1.1 christos | Report that the YYRULE is going to be reduced. | 851 1.1 christos `------------------------------------------------*/ 852 1.1 christos 853 1.1 christos static void 854 1.8 christos yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, 855 1.8 christos int yyrule) 856 1.1 christos { 857 1.8 christos int yylno = yyrline[yyrule]; 858 1.1 christos int yynrhs = yyr2[yyrule]; 859 1.1 christos int yyi; 860 1.8 christos YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", 861 1.6 christos yyrule - 1, yylno); 862 1.1 christos /* The symbols being reduced. */ 863 1.1 christos for (yyi = 0; yyi < yynrhs; yyi++) 864 1.1 christos { 865 1.6 christos YYFPRINTF (stderr, " $%d = ", yyi + 1); 866 1.6 christos yy_symbol_print (stderr, 867 1.8 christos YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), 868 1.8 christos &yyvsp[(yyi + 1) - (yynrhs)]); 869 1.6 christos YYFPRINTF (stderr, "\n"); 870 1.1 christos } 871 1.1 christos } 872 1.1 christos 873 1.6 christos # define YY_REDUCE_PRINT(Rule) \ 874 1.6 christos do { \ 875 1.6 christos if (yydebug) \ 876 1.6 christos yy_reduce_print (yyssp, yyvsp, Rule); \ 877 1.6 christos } while (0) 878 1.1 christos 879 1.1 christos /* Nonzero means print parse trace. It is left uninitialized so that 880 1.1 christos multiple parsers can coexist. */ 881 1.1 christos int yydebug; 882 1.1 christos #else /* !YYDEBUG */ 883 1.8 christos # define YYDPRINTF(Args) ((void) 0) 884 1.8 christos # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) 885 1.1 christos # define YY_STACK_PRINT(Bottom, Top) 886 1.1 christos # define YY_REDUCE_PRINT(Rule) 887 1.1 christos #endif /* !YYDEBUG */ 888 1.1 christos 889 1.1 christos 890 1.1 christos /* YYINITDEPTH -- initial size of the parser's stacks. */ 891 1.6 christos #ifndef YYINITDEPTH 892 1.1 christos # define YYINITDEPTH 200 893 1.1 christos #endif 894 1.1 christos 895 1.1 christos /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 896 1.1 christos if the built-in stack extension method is used). 897 1.1 christos 898 1.1 christos Do not make this value too large; the results are undefined if 899 1.1 christos YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 900 1.1 christos evaluated with infinite-precision integer arithmetic. */ 901 1.1 christos 902 1.1 christos #ifndef YYMAXDEPTH 903 1.1 christos # define YYMAXDEPTH 10000 904 1.1 christos #endif 905 1.1 christos 906 1.1 christos 907 1.1 christos 908 1.1 christos 909 1.1 christos 910 1.1 christos 911 1.1 christos /*-----------------------------------------------. 912 1.1 christos | Release the memory associated to this symbol. | 913 1.1 christos `-----------------------------------------------*/ 914 1.1 christos 915 1.1 christos static void 916 1.8 christos yydestruct (const char *yymsg, 917 1.8 christos yysymbol_kind_t yykind, YYSTYPE *yyvaluep) 918 1.1 christos { 919 1.8 christos YY_USE (yyvaluep); 920 1.1 christos if (!yymsg) 921 1.1 christos yymsg = "Deleting"; 922 1.8 christos YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); 923 1.1 christos 924 1.6 christos YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 925 1.8 christos YY_USE (yykind); 926 1.6 christos YY_IGNORE_MAYBE_UNINITIALIZED_END 927 1.1 christos } 928 1.1 christos 929 1.5 christos 930 1.8 christos /* Lookahead token kind. */ 931 1.1 christos int yychar; 932 1.1 christos 933 1.6 christos /* The semantic value of the lookahead symbol. */ 934 1.1 christos YYSTYPE yylval; 935 1.1 christos /* Number of syntax errors so far. */ 936 1.1 christos int yynerrs; 937 1.1 christos 938 1.1 christos 939 1.8 christos 940 1.8 christos 941 1.1 christos /*----------. 942 1.1 christos | yyparse. | 943 1.1 christos `----------*/ 944 1.1 christos 945 1.1 christos int 946 1.1 christos yyparse (void) 947 1.6 christos { 948 1.8 christos yy_state_fast_t yystate = 0; 949 1.6 christos /* Number of tokens to shift before error messages enabled. */ 950 1.8 christos int yyerrstatus = 0; 951 1.6 christos 952 1.8 christos /* Refer to the stacks through separate pointers, to allow yyoverflow 953 1.8 christos to reallocate them elsewhere. */ 954 1.6 christos 955 1.8 christos /* Their size. */ 956 1.8 christos YYPTRDIFF_T yystacksize = YYINITDEPTH; 957 1.6 christos 958 1.8 christos /* The state stack: array, bottom, top. */ 959 1.8 christos yy_state_t yyssa[YYINITDEPTH]; 960 1.8 christos yy_state_t *yyss = yyssa; 961 1.8 christos yy_state_t *yyssp = yyss; 962 1.6 christos 963 1.8 christos /* The semantic value stack: array, bottom, top. */ 964 1.6 christos YYSTYPE yyvsa[YYINITDEPTH]; 965 1.8 christos YYSTYPE *yyvs = yyvsa; 966 1.8 christos YYSTYPE *yyvsp = yyvs; 967 1.5 christos 968 1.1 christos int yyn; 969 1.8 christos /* The return value of yyparse. */ 970 1.1 christos int yyresult; 971 1.8 christos /* Lookahead symbol kind. */ 972 1.8 christos yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; 973 1.6 christos /* The variables used to return semantic value and location from the 974 1.6 christos action routines. */ 975 1.6 christos YYSTYPE yyval; 976 1.6 christos 977 1.8 christos 978 1.1 christos 979 1.1 christos #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 980 1.1 christos 981 1.1 christos /* The number of symbols on the RHS of the reduced rule. 982 1.1 christos Keep to zero when no symbol should be popped. */ 983 1.1 christos int yylen = 0; 984 1.1 christos 985 1.1 christos YYDPRINTF ((stderr, "Starting parse\n")); 986 1.1 christos 987 1.6 christos yychar = YYEMPTY; /* Cause a token to be read. */ 988 1.8 christos 989 1.1 christos goto yysetstate; 990 1.1 christos 991 1.8 christos 992 1.1 christos /*------------------------------------------------------------. 993 1.8 christos | yynewstate -- push a new state, which is found in yystate. | 994 1.1 christos `------------------------------------------------------------*/ 995 1.8 christos yynewstate: 996 1.1 christos /* In all cases, when you get here, the value and location stacks 997 1.1 christos have just been pushed. So pushing a state here evens the stacks. */ 998 1.1 christos yyssp++; 999 1.1 christos 1000 1.8 christos 1001 1.8 christos /*--------------------------------------------------------------------. 1002 1.8 christos | yysetstate -- set current state (the top of the stack) to yystate. | 1003 1.8 christos `--------------------------------------------------------------------*/ 1004 1.8 christos yysetstate: 1005 1.8 christos YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1006 1.8 christos YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 1007 1.8 christos YY_IGNORE_USELESS_CAST_BEGIN 1008 1.8 christos *yyssp = YY_CAST (yy_state_t, yystate); 1009 1.8 christos YY_IGNORE_USELESS_CAST_END 1010 1.8 christos YY_STACK_PRINT (yyss, yyssp); 1011 1.1 christos 1012 1.1 christos if (yyss + yystacksize - 1 <= yyssp) 1013 1.8 christos #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1014 1.8 christos YYNOMEM; 1015 1.8 christos #else 1016 1.1 christos { 1017 1.1 christos /* Get the current used size of the three stacks, in elements. */ 1018 1.8 christos YYPTRDIFF_T yysize = yyssp - yyss + 1; 1019 1.1 christos 1020 1.8 christos # if defined yyoverflow 1021 1.1 christos { 1022 1.6 christos /* Give user a chance to reallocate the stack. Use copies of 1023 1.6 christos these so that the &'s don't force the real ones into 1024 1.6 christos memory. */ 1025 1.8 christos yy_state_t *yyss1 = yyss; 1026 1.6 christos YYSTYPE *yyvs1 = yyvs; 1027 1.6 christos 1028 1.6 christos /* Each stack pointer address is followed by the size of the 1029 1.6 christos data in use in that stack, in bytes. This used to be a 1030 1.6 christos conditional around just the two extra args, but that might 1031 1.6 christos be undefined if yyoverflow is a macro. */ 1032 1.6 christos yyoverflow (YY_("memory exhausted"), 1033 1.8 christos &yyss1, yysize * YYSIZEOF (*yyssp), 1034 1.8 christos &yyvs1, yysize * YYSIZEOF (*yyvsp), 1035 1.6 christos &yystacksize); 1036 1.6 christos yyss = yyss1; 1037 1.6 christos yyvs = yyvs1; 1038 1.1 christos } 1039 1.8 christos # else /* defined YYSTACK_RELOCATE */ 1040 1.1 christos /* Extend the stack our own way. */ 1041 1.1 christos if (YYMAXDEPTH <= yystacksize) 1042 1.8 christos YYNOMEM; 1043 1.1 christos yystacksize *= 2; 1044 1.1 christos if (YYMAXDEPTH < yystacksize) 1045 1.6 christos yystacksize = YYMAXDEPTH; 1046 1.1 christos 1047 1.1 christos { 1048 1.8 christos yy_state_t *yyss1 = yyss; 1049 1.6 christos union yyalloc *yyptr = 1050 1.8 christos YY_CAST (union yyalloc *, 1051 1.8 christos YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); 1052 1.6 christos if (! yyptr) 1053 1.8 christos YYNOMEM; 1054 1.6 christos YYSTACK_RELOCATE (yyss_alloc, yyss); 1055 1.6 christos YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1056 1.1 christos # undef YYSTACK_RELOCATE 1057 1.6 christos if (yyss1 != yyssa) 1058 1.6 christos YYSTACK_FREE (yyss1); 1059 1.1 christos } 1060 1.1 christos # endif 1061 1.1 christos 1062 1.1 christos yyssp = yyss + yysize - 1; 1063 1.1 christos yyvsp = yyvs + yysize - 1; 1064 1.1 christos 1065 1.8 christos YY_IGNORE_USELESS_CAST_BEGIN 1066 1.8 christos YYDPRINTF ((stderr, "Stack size increased to %ld\n", 1067 1.8 christos YY_CAST (long, yystacksize))); 1068 1.8 christos YY_IGNORE_USELESS_CAST_END 1069 1.1 christos 1070 1.1 christos if (yyss + yystacksize - 1 <= yyssp) 1071 1.6 christos YYABORT; 1072 1.1 christos } 1073 1.8 christos #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1074 1.1 christos 1075 1.1 christos 1076 1.6 christos if (yystate == YYFINAL) 1077 1.6 christos YYACCEPT; 1078 1.6 christos 1079 1.1 christos goto yybackup; 1080 1.1 christos 1081 1.8 christos 1082 1.1 christos /*-----------. 1083 1.1 christos | yybackup. | 1084 1.1 christos `-----------*/ 1085 1.1 christos yybackup: 1086 1.1 christos /* Do appropriate processing given the current state. Read a 1087 1.6 christos lookahead token if we need one and don't already have one. */ 1088 1.1 christos 1089 1.6 christos /* First try to decide what to do without reference to lookahead token. */ 1090 1.1 christos yyn = yypact[yystate]; 1091 1.6 christos if (yypact_value_is_default (yyn)) 1092 1.1 christos goto yydefault; 1093 1.1 christos 1094 1.6 christos /* Not known => get a lookahead token if don't already have one. */ 1095 1.1 christos 1096 1.8 christos /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ 1097 1.1 christos if (yychar == YYEMPTY) 1098 1.1 christos { 1099 1.8 christos YYDPRINTF ((stderr, "Reading a token\n")); 1100 1.6 christos yychar = yylex (); 1101 1.1 christos } 1102 1.1 christos 1103 1.1 christos if (yychar <= YYEOF) 1104 1.1 christos { 1105 1.8 christos yychar = YYEOF; 1106 1.8 christos yytoken = YYSYMBOL_YYEOF; 1107 1.1 christos YYDPRINTF ((stderr, "Now at end of input.\n")); 1108 1.1 christos } 1109 1.8 christos else if (yychar == YYerror) 1110 1.8 christos { 1111 1.8 christos /* The scanner already issued an error message, process directly 1112 1.8 christos to error recovery. But do not keep the error token as 1113 1.8 christos lookahead, it is too special and may lead us to an endless 1114 1.8 christos loop in error recovery. */ 1115 1.8 christos yychar = YYUNDEF; 1116 1.8 christos yytoken = YYSYMBOL_YYerror; 1117 1.8 christos goto yyerrlab1; 1118 1.8 christos } 1119 1.1 christos else 1120 1.1 christos { 1121 1.1 christos yytoken = YYTRANSLATE (yychar); 1122 1.1 christos YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1123 1.1 christos } 1124 1.1 christos 1125 1.1 christos /* If the proper action on seeing token YYTOKEN is to reduce or to 1126 1.1 christos detect an error, take that action. */ 1127 1.1 christos yyn += yytoken; 1128 1.1 christos if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1129 1.1 christos goto yydefault; 1130 1.1 christos yyn = yytable[yyn]; 1131 1.1 christos if (yyn <= 0) 1132 1.1 christos { 1133 1.6 christos if (yytable_value_is_error (yyn)) 1134 1.6 christos goto yyerrlab; 1135 1.1 christos yyn = -yyn; 1136 1.1 christos goto yyreduce; 1137 1.1 christos } 1138 1.1 christos 1139 1.1 christos /* Count tokens shifted since error; after three, turn off error 1140 1.1 christos status. */ 1141 1.1 christos if (yyerrstatus) 1142 1.1 christos yyerrstatus--; 1143 1.1 christos 1144 1.6 christos /* Shift the lookahead token. */ 1145 1.1 christos YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1146 1.1 christos yystate = yyn; 1147 1.6 christos YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1148 1.1 christos *++yyvsp = yylval; 1149 1.6 christos YY_IGNORE_MAYBE_UNINITIALIZED_END 1150 1.1 christos 1151 1.8 christos /* Discard the shifted token. */ 1152 1.8 christos yychar = YYEMPTY; 1153 1.1 christos goto yynewstate; 1154 1.1 christos 1155 1.1 christos 1156 1.1 christos /*-----------------------------------------------------------. 1157 1.1 christos | yydefault -- do the default action for the current state. | 1158 1.1 christos `-----------------------------------------------------------*/ 1159 1.1 christos yydefault: 1160 1.1 christos yyn = yydefact[yystate]; 1161 1.1 christos if (yyn == 0) 1162 1.1 christos goto yyerrlab; 1163 1.1 christos goto yyreduce; 1164 1.1 christos 1165 1.1 christos 1166 1.1 christos /*-----------------------------. 1167 1.8 christos | yyreduce -- do a reduction. | 1168 1.1 christos `-----------------------------*/ 1169 1.1 christos yyreduce: 1170 1.1 christos /* yyn is the number of a rule to reduce with. */ 1171 1.1 christos yylen = yyr2[yyn]; 1172 1.1 christos 1173 1.1 christos /* If YYLEN is nonzero, implement the default value of the action: 1174 1.6 christos '$$ = $1'. 1175 1.1 christos 1176 1.1 christos Otherwise, the following line sets YYVAL to garbage. 1177 1.1 christos This behavior is undocumented and Bison 1178 1.1 christos users should not rely upon it. Assigning to YYVAL 1179 1.1 christos unconditionally makes the parser a bit smaller, and it avoids a 1180 1.1 christos GCC warning that YYVAL may be used uninitialized. */ 1181 1.1 christos yyval = yyvsp[1-yylen]; 1182 1.1 christos 1183 1.1 christos 1184 1.1 christos YY_REDUCE_PRINT (yyn); 1185 1.1 christos switch (yyn) 1186 1.1 christos { 1187 1.8 christos case 2: /* $@1: %empty */ 1188 1.8 christos #line 55 "sysinfo.y" 1189 1.8 christos { 1190 1.1 christos switch (writecode) 1191 1.1 christos { 1192 1.1 christos case 'i': 1193 1.1 christos printf("#ifdef SYSROFF_SWAP_IN\n"); 1194 1.3 christos break; 1195 1.1 christos case 'p': 1196 1.1 christos printf("#ifdef SYSROFF_p\n"); 1197 1.3 christos break; 1198 1.1 christos case 'd': 1199 1.1 christos break; 1200 1.1 christos case 'g': 1201 1.1 christos printf("#ifdef SYSROFF_SWAP_OUT\n"); 1202 1.1 christos break; 1203 1.1 christos case 'c': 1204 1.1 christos printf("#ifdef SYSROFF_PRINT\n"); 1205 1.1 christos printf("#include <stdio.h>\n"); 1206 1.1 christos printf("#include <stdlib.h>\n"); 1207 1.1 christos printf("#include <ansidecl.h>\n"); 1208 1.1 christos break; 1209 1.1 christos } 1210 1.1 christos } 1211 1.8 christos #line 1212 "sysinfo.c" 1212 1.1 christos break; 1213 1.1 christos 1214 1.8 christos case 3: /* top: $@1 it_list */ 1215 1.8 christos #line 77 "sysinfo.y" 1216 1.8 christos { 1217 1.1 christos switch (writecode) { 1218 1.1 christos case 'i': 1219 1.1 christos case 'p': 1220 1.1 christos case 'g': 1221 1.1 christos case 'c': 1222 1.1 christos printf("#endif\n"); 1223 1.3 christos break; 1224 1.1 christos case 'd': 1225 1.1 christos break; 1226 1.1 christos } 1227 1.1 christos } 1228 1.8 christos #line 1229 "sysinfo.c" 1229 1.1 christos break; 1230 1.1 christos 1231 1.8 christos case 6: /* $@2: %empty */ 1232 1.8 christos #line 99 "sysinfo.y" 1233 1.8 christos { 1234 1.6 christos it = (yyvsp[-1].s); code = (yyvsp[0].i); 1235 1.3 christos switch (writecode) 1236 1.1 christos { 1237 1.1 christos case 'd': 1238 1.1 christos printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code); 1239 1.1 christos printf("struct IT_%s;\n", it); 1240 1.1 christos printf("extern void sysroff_swap_%s_in (struct IT_%s *);\n", 1241 1.6 christos (yyvsp[-1].s), it); 1242 1.1 christos printf("extern void sysroff_swap_%s_out (FILE *, struct IT_%s *);\n", 1243 1.6 christos (yyvsp[-1].s), it); 1244 1.1 christos printf("extern void sysroff_print_%s_out (struct IT_%s *);\n", 1245 1.6 christos (yyvsp[-1].s), it); 1246 1.1 christos printf("struct IT_%s { \n", it); 1247 1.1 christos break; 1248 1.1 christos case 'i': 1249 1.6 christos printf("void sysroff_swap_%s_in (struct IT_%s * ptr)\n",(yyvsp[-1].s),it); 1250 1.1 christos printf("{\n"); 1251 1.1 christos printf("\tunsigned char raw[255];\n"); 1252 1.1 christos printf("\tint idx = 0;\n"); 1253 1.1 christos printf("\tint size;\n"); 1254 1.3 christos printf("\tmemset(raw,0,255);\n"); 1255 1.1 christos printf("\tmemset(ptr,0,sizeof(*ptr));\n"); 1256 1.1 christos printf("\tsize = fillup(raw);\n"); 1257 1.1 christos break; 1258 1.1 christos case 'g': 1259 1.6 christos printf("void sysroff_swap_%s_out (FILE * ffile, struct IT_%s * ptr)\n",(yyvsp[-1].s),it); 1260 1.1 christos printf("{\n"); 1261 1.1 christos printf("\tunsigned char raw[255];\n"); 1262 1.1 christos printf("\tint idx = 16;\n"); 1263 1.1 christos printf("\tmemset (raw, 0, 255);\n"); 1264 1.1 christos printf("\tcode = IT_%s_CODE;\n", it); 1265 1.1 christos break; 1266 1.1 christos case 'o': 1267 1.6 christos printf("void sysroff_swap_%s_out (bfd * abfd, struct IT_%s * ptr)\n",(yyvsp[-1].s), it); 1268 1.1 christos printf("{\n"); 1269 1.1 christos printf("\tint idx = 0;\n"); 1270 1.1 christos break; 1271 1.1 christos case 'c': 1272 1.6 christos printf("void sysroff_print_%s_out (struct IT_%s *ptr)\n",(yyvsp[-1].s),it); 1273 1.1 christos printf("{\n"); 1274 1.6 christos printf("itheader(\"%s\", IT_%s_CODE);\n",(yyvsp[-1].s),(yyvsp[-1].s)); 1275 1.1 christos break; 1276 1.1 christos 1277 1.1 christos case 't': 1278 1.1 christos break; 1279 1.1 christos } 1280 1.1 christos 1281 1.1 christos } 1282 1.8 christos #line 1283 "sysinfo.c" 1283 1.1 christos break; 1284 1.1 christos 1285 1.8 christos case 7: /* it: '(' NAME NUMBER $@2 it_field_list ')' */ 1286 1.8 christos #line 150 "sysinfo.y" 1287 1.8 christos { 1288 1.1 christos switch (writecode) { 1289 1.3 christos case 'd': 1290 1.1 christos printf("};\n"); 1291 1.1 christos break; 1292 1.1 christos case 'g': 1293 1.1 christos printf("\tchecksum(ffile,raw, idx, IT_%s_CODE);\n", it); 1294 1.6 christos /* Fall through. */ 1295 1.1 christos case 'i': 1296 1.1 christos case 'o': 1297 1.1 christos case 'c': 1298 1.1 christos printf("}\n"); 1299 1.1 christos } 1300 1.6 christos 1301 1.6 christos free (it); 1302 1.1 christos } 1303 1.8 christos #line 1304 "sysinfo.c" 1304 1.1 christos break; 1305 1.1 christos 1306 1.8 christos case 12: /* $@3: %empty */ 1307 1.8 christos #line 178 "sysinfo.y" 1308 1.8 christos { 1309 1.1 christos rdepth++; 1310 1.3 christos switch (writecode) 1311 1.1 christos { 1312 1.1 christos case 'c': 1313 1.1 christos if (rdepth==1) 1314 1.6 christos printf("\tprintf(\"repeat %%d\\n\", %s);\n",(yyvsp[0].s)); 1315 1.1 christos if (rdepth==2) 1316 1.6 christos printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",(yyvsp[0].s)); 1317 1.6 christos /* Fall through. */ 1318 1.1 christos case 'i': 1319 1.1 christos case 'g': 1320 1.1 christos case 'o': 1321 1.1 christos 1322 1.3 christos if (rdepth==1) 1323 1.1 christos { 1324 1.6 christos printf("\t{ int n; for (n = 0; n < %s; n++) {\n", (yyvsp[0].s)); 1325 1.1 christos } 1326 1.1 christos if (rdepth == 2) { 1327 1.6 christos printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n", (yyvsp[0].s)); 1328 1.3 christos } 1329 1.1 christos 1330 1.1 christos break; 1331 1.1 christos } 1332 1.1 christos 1333 1.1 christos oldrepeat = repeat; 1334 1.6 christos repeat = (yyvsp[0].s); 1335 1.1 christos } 1336 1.8 christos #line 1337 "sysinfo.c" 1337 1.1 christos break; 1338 1.1 christos 1339 1.8 christos case 13: /* repeat_it_field: '(' REPEAT NAME $@3 it_field_list ')' */ 1340 1.8 christos #line 209 "sysinfo.y" 1341 1.8 christos { 1342 1.6 christos free (repeat); 1343 1.6 christos 1344 1.1 christos repeat = oldrepeat; 1345 1.1 christos oldrepeat =0; 1346 1.1 christos rdepth--; 1347 1.1 christos switch (writecode) 1348 1.1 christos { 1349 1.1 christos case 'i': 1350 1.1 christos case 'g': 1351 1.1 christos case 'o': 1352 1.1 christos case 'c': 1353 1.1 christos printf("\t}}\n"); 1354 1.1 christos } 1355 1.1 christos } 1356 1.8 christos #line 1357 "sysinfo.c" 1357 1.1 christos break; 1358 1.1 christos 1359 1.8 christos case 14: /* $@4: %empty */ 1360 1.8 christos #line 228 "sysinfo.y" 1361 1.8 christos { 1362 1.3 christos switch (writecode) 1363 1.1 christos { 1364 1.1 christos case 'i': 1365 1.1 christos case 'g': 1366 1.1 christos case 'o': 1367 1.1 christos case 'c': 1368 1.6 christos printf("\tif (%s) {\n", (yyvsp[0].s)); 1369 1.1 christos break; 1370 1.1 christos } 1371 1.6 christos 1372 1.6 christos free ((yyvsp[0].s)); 1373 1.1 christos } 1374 1.8 christos #line 1375 "sysinfo.c" 1375 1.1 christos break; 1376 1.1 christos 1377 1.8 christos case 15: /* cond_it_field: '(' COND NAME $@4 it_field_list ')' */ 1378 1.8 christos #line 243 "sysinfo.y" 1379 1.8 christos { 1380 1.1 christos switch (writecode) 1381 1.1 christos { 1382 1.1 christos case 'i': 1383 1.1 christos case 'g': 1384 1.1 christos case 'o': 1385 1.1 christos case 'c': 1386 1.1 christos printf("\t}\n"); 1387 1.1 christos } 1388 1.1 christos } 1389 1.8 christos #line 1390 "sysinfo.c" 1390 1.1 christos break; 1391 1.1 christos 1392 1.8 christos case 16: /* $@5: %empty */ 1393 1.8 christos #line 257 "sysinfo.y" 1394 1.8 christos {name = (yyvsp[0].s); } 1395 1.8 christos #line 1396 "sysinfo.c" 1396 1.1 christos break; 1397 1.1 christos 1398 1.8 christos case 17: /* it_field: '(' attr_desc '(' attr_type attr_size ')' attr_id $@5 enums ')' */ 1399 1.8 christos #line 259 "sysinfo.y" 1400 1.8 christos { 1401 1.6 christos char *desc = (yyvsp[-8].s); 1402 1.6 christos char *type = (yyvsp[-6].s); 1403 1.6 christos int size = (yyvsp[-5].i); 1404 1.6 christos char *id = (yyvsp[-3].s); 1405 1.1 christos char *p = names[rdepth]; 1406 1.1 christos char *ptr = pnames[rdepth]; 1407 1.3 christos switch (writecode) 1408 1.1 christos { 1409 1.1 christos case 'g': 1410 1.3 christos if (size % 8) 1411 1.1 christos { 1412 1.3 christos 1413 1.1 christos printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n", 1414 1.1 christos id, 1415 1.1 christos names[rdepth], size); 1416 1.1 christos 1417 1.1 christos } 1418 1.1 christos else { 1419 1.1 christos printf("\twrite%s(ptr->%s%s,raw,&idx,%d,ffile);\n", 1420 1.1 christos type, 1421 1.1 christos id, 1422 1.1 christos names[rdepth],size/8); 1423 1.1 christos } 1424 1.3 christos break; 1425 1.1 christos case 'i': 1426 1.1 christos { 1427 1.1 christos 1428 1.1 christos if (rdepth >= 1) 1429 1.1 christos 1430 1.1 christos { 1431 1.3 christos printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n", 1432 1.3 christos id, 1433 1.1 christos id, 1434 1.1 christos type, 1435 1.1 christos repeat, 1436 1.1 christos id); 1437 1.1 christos } 1438 1.1 christos 1439 1.1 christos if (rdepth == 2) 1440 1.1 christos { 1441 1.3 christos printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n", 1442 1.3 christos id, 1443 1.1 christos id, 1444 1.1 christos type, 1445 1.1 christos repeat, 1446 1.1 christos id); 1447 1.1 christos } 1448 1.1 christos 1449 1.1 christos } 1450 1.1 christos 1451 1.3 christos if (size % 8) 1452 1.1 christos { 1453 1.1 christos printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n", 1454 1.1 christos id, 1455 1.3 christos names[rdepth], 1456 1.1 christos size); 1457 1.1 christos } 1458 1.1 christos else { 1459 1.1 christos printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n", 1460 1.1 christos id, 1461 1.1 christos names[rdepth], 1462 1.1 christos type, 1463 1.1 christos size/8); 1464 1.1 christos } 1465 1.1 christos break; 1466 1.1 christos case 'o': 1467 1.1 christos printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type,size/8,size%8,id,names[rdepth]); 1468 1.1 christos break; 1469 1.1 christos case 'd': 1470 1.3 christos if (repeat) 1471 1.1 christos printf("\t/* repeat %s */\n", repeat); 1472 1.1 christos 1473 1.1 christos if (type[0] == 'I') { 1474 1.1 christos printf("\tint %s%s; \t/* %s */\n",ptr,id, desc); 1475 1.1 christos } 1476 1.1 christos else if (type[0] =='C') { 1477 1.1 christos printf("\tchar %s*%s;\t /* %s */\n",ptr,id, desc); 1478 1.1 christos } 1479 1.1 christos else { 1480 1.1 christos printf("\tbarray %s%s;\t /* %s */\n",ptr,id, desc); 1481 1.1 christos } 1482 1.1 christos break; 1483 1.1 christos case 'c': 1484 1.1 christos printf("tabout();\n"); 1485 1.1 christos printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc, id); 1486 1.1 christos 1487 1.1 christos if (type[0] == 'I') 1488 1.1 christos printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id,p); 1489 1.1 christos else if (type[0] == 'C') 1490 1.1 christos printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id,p); 1491 1.1 christos 1492 1.3 christos else if (type[0] == 'B') 1493 1.1 christos { 1494 1.1 christos printf("\tpbarray(&ptr->%s%s);\n", id,p); 1495 1.1 christos } 1496 1.1 christos else abort(); 1497 1.1 christos break; 1498 1.1 christos } 1499 1.6 christos 1500 1.6 christos free (desc); 1501 1.6 christos free (id); 1502 1.1 christos } 1503 1.8 christos #line 1504 "sysinfo.c" 1504 1.1 christos break; 1505 1.1 christos 1506 1.8 christos case 18: /* attr_type: TYPE */ 1507 1.8 christos #line 367 "sysinfo.y" 1508 1.8 christos { (yyval.s) = (yyvsp[0].s); } 1509 1.8 christos #line 1510 "sysinfo.c" 1510 1.1 christos break; 1511 1.1 christos 1512 1.8 christos case 19: /* attr_type: %empty */ 1513 1.8 christos #line 368 "sysinfo.y" 1514 1.8 christos { (yyval.s) = "INT";} 1515 1.8 christos #line 1516 "sysinfo.c" 1516 1.1 christos break; 1517 1.1 christos 1518 1.8 christos case 20: /* attr_desc: '(' NAME ')' */ 1519 1.8 christos #line 373 "sysinfo.y" 1520 1.8 christos { (yyval.s) = (yyvsp[-1].s); } 1521 1.8 christos #line 1522 "sysinfo.c" 1522 1.1 christos break; 1523 1.1 christos 1524 1.8 christos case 21: /* attr_size: NUMBER UNIT */ 1525 1.8 christos #line 378 "sysinfo.y" 1526 1.8 christos { (yyval.i) = (yyvsp[-1].i) * (yyvsp[0].i); } 1527 1.8 christos #line 1528 "sysinfo.c" 1528 1.1 christos break; 1529 1.1 christos 1530 1.8 christos case 22: /* attr_id: '(' NAME ')' */ 1531 1.8 christos #line 383 "sysinfo.y" 1532 1.8 christos { (yyval.s) = (yyvsp[-1].s); } 1533 1.8 christos #line 1534 "sysinfo.c" 1534 1.1 christos break; 1535 1.1 christos 1536 1.8 christos case 23: /* attr_id: %empty */ 1537 1.8 christos #line 384 "sysinfo.y" 1538 1.8 christos { (yyval.s) = strdup ("dummy");} 1539 1.8 christos #line 1540 "sysinfo.c" 1540 1.1 christos break; 1541 1.1 christos 1542 1.8 christos case 27: /* enum_list: enum_list '(' NAME NAME ')' */ 1543 1.8 christos #line 392 "sysinfo.y" 1544 1.8 christos { 1545 1.3 christos switch (writecode) 1546 1.1 christos { 1547 1.1 christos case 'd': 1548 1.6 christos printf("#define %s %s\n", (yyvsp[-2].s),(yyvsp[-1].s)); 1549 1.1 christos break; 1550 1.1 christos case 'c': 1551 1.6 christos printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],(yyvsp[-1].s),(yyvsp[-2].s)); 1552 1.1 christos } 1553 1.6 christos 1554 1.6 christos free ((yyvsp[-2].s)); 1555 1.6 christos free ((yyvsp[-1].s)); 1556 1.1 christos } 1557 1.8 christos #line 1558 "sysinfo.c" 1558 1.1 christos break; 1559 1.1 christos 1560 1.1 christos 1561 1.8 christos #line 1562 "sysinfo.c" 1562 1.8 christos 1563 1.1 christos default: break; 1564 1.1 christos } 1565 1.6 christos /* User semantic actions sometimes alter yychar, and that requires 1566 1.6 christos that yytoken be updated with the new translation. We take the 1567 1.6 christos approach of translating immediately before every use of yytoken. 1568 1.6 christos One alternative is translating here after every semantic action, 1569 1.6 christos but that translation would be missed if the semantic action invokes 1570 1.6 christos YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1571 1.6 christos if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1572 1.6 christos incorrect destructor might then be invoked immediately. In the 1573 1.6 christos case of YYERROR or YYBACKUP, subsequent parser actions might lead 1574 1.6 christos to an incorrect destructor call or verbose syntax error message 1575 1.6 christos before the lookahead is translated. */ 1576 1.8 christos YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); 1577 1.1 christos 1578 1.1 christos YYPOPSTACK (yylen); 1579 1.1 christos yylen = 0; 1580 1.1 christos 1581 1.1 christos *++yyvsp = yyval; 1582 1.1 christos 1583 1.6 christos /* Now 'shift' the result of the reduction. Determine what state 1584 1.1 christos that goes to, based on the state we popped back to and the rule 1585 1.1 christos number reduced by. */ 1586 1.8 christos { 1587 1.8 christos const int yylhs = yyr1[yyn] - YYNTOKENS; 1588 1.8 christos const int yyi = yypgoto[yylhs] + *yyssp; 1589 1.8 christos yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 1590 1.8 christos ? yytable[yyi] 1591 1.8 christos : yydefgoto[yylhs]); 1592 1.8 christos } 1593 1.1 christos 1594 1.1 christos goto yynewstate; 1595 1.1 christos 1596 1.1 christos 1597 1.6 christos /*--------------------------------------. 1598 1.6 christos | yyerrlab -- here on detecting error. | 1599 1.6 christos `--------------------------------------*/ 1600 1.1 christos yyerrlab: 1601 1.6 christos /* Make sure we have latest lookahead translation. See comments at 1602 1.6 christos user semantic actions for why this is necessary. */ 1603 1.8 christos yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); 1604 1.1 christos /* If not already recovering from an error, report this error. */ 1605 1.1 christos if (!yyerrstatus) 1606 1.1 christos { 1607 1.1 christos ++yynerrs; 1608 1.1 christos yyerror (YY_("syntax error")); 1609 1.1 christos } 1610 1.1 christos 1611 1.1 christos if (yyerrstatus == 3) 1612 1.1 christos { 1613 1.6 christos /* If just tried and failed to reuse lookahead token after an 1614 1.6 christos error, discard it. */ 1615 1.1 christos 1616 1.1 christos if (yychar <= YYEOF) 1617 1.6 christos { 1618 1.6 christos /* Return failure if at end of input. */ 1619 1.6 christos if (yychar == YYEOF) 1620 1.6 christos YYABORT; 1621 1.6 christos } 1622 1.1 christos else 1623 1.6 christos { 1624 1.6 christos yydestruct ("Error: discarding", 1625 1.6 christos yytoken, &yylval); 1626 1.6 christos yychar = YYEMPTY; 1627 1.6 christos } 1628 1.1 christos } 1629 1.1 christos 1630 1.6 christos /* Else will try to reuse lookahead token after shifting the error 1631 1.1 christos token. */ 1632 1.1 christos goto yyerrlab1; 1633 1.1 christos 1634 1.1 christos 1635 1.1 christos /*---------------------------------------------------. 1636 1.1 christos | yyerrorlab -- error raised explicitly by YYERROR. | 1637 1.1 christos `---------------------------------------------------*/ 1638 1.1 christos yyerrorlab: 1639 1.8 christos /* Pacify compilers when the user code never invokes YYERROR and the 1640 1.8 christos label yyerrorlab therefore never appears in user code. */ 1641 1.8 christos if (0) 1642 1.8 christos YYERROR; 1643 1.8 christos ++yynerrs; 1644 1.1 christos 1645 1.6 christos /* Do not reclaim the symbols of the rule whose action triggered 1646 1.1 christos this YYERROR. */ 1647 1.1 christos YYPOPSTACK (yylen); 1648 1.1 christos yylen = 0; 1649 1.1 christos YY_STACK_PRINT (yyss, yyssp); 1650 1.1 christos yystate = *yyssp; 1651 1.1 christos goto yyerrlab1; 1652 1.1 christos 1653 1.1 christos 1654 1.1 christos /*-------------------------------------------------------------. 1655 1.1 christos | yyerrlab1 -- common code for both syntax error and YYERROR. | 1656 1.1 christos `-------------------------------------------------------------*/ 1657 1.1 christos yyerrlab1: 1658 1.6 christos yyerrstatus = 3; /* Each real token shifted decrements this. */ 1659 1.1 christos 1660 1.8 christos /* Pop stack until we find a state that shifts the error token. */ 1661 1.1 christos for (;;) 1662 1.1 christos { 1663 1.1 christos yyn = yypact[yystate]; 1664 1.6 christos if (!yypact_value_is_default (yyn)) 1665 1.6 christos { 1666 1.8 christos yyn += YYSYMBOL_YYerror; 1667 1.8 christos if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) 1668 1.6 christos { 1669 1.6 christos yyn = yytable[yyn]; 1670 1.6 christos if (0 < yyn) 1671 1.6 christos break; 1672 1.6 christos } 1673 1.6 christos } 1674 1.1 christos 1675 1.1 christos /* Pop the current state because it cannot handle the error token. */ 1676 1.1 christos if (yyssp == yyss) 1677 1.6 christos YYABORT; 1678 1.1 christos 1679 1.1 christos 1680 1.1 christos yydestruct ("Error: popping", 1681 1.8 christos YY_ACCESSING_SYMBOL (yystate), yyvsp); 1682 1.1 christos YYPOPSTACK (1); 1683 1.1 christos yystate = *yyssp; 1684 1.1 christos YY_STACK_PRINT (yyss, yyssp); 1685 1.1 christos } 1686 1.1 christos 1687 1.6 christos YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1688 1.1 christos *++yyvsp = yylval; 1689 1.6 christos YY_IGNORE_MAYBE_UNINITIALIZED_END 1690 1.1 christos 1691 1.1 christos 1692 1.1 christos /* Shift the error token. */ 1693 1.8 christos YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); 1694 1.1 christos 1695 1.1 christos yystate = yyn; 1696 1.1 christos goto yynewstate; 1697 1.1 christos 1698 1.1 christos 1699 1.1 christos /*-------------------------------------. 1700 1.1 christos | yyacceptlab -- YYACCEPT comes here. | 1701 1.1 christos `-------------------------------------*/ 1702 1.1 christos yyacceptlab: 1703 1.1 christos yyresult = 0; 1704 1.8 christos goto yyreturnlab; 1705 1.8 christos 1706 1.1 christos 1707 1.1 christos /*-----------------------------------. 1708 1.1 christos | yyabortlab -- YYABORT comes here. | 1709 1.1 christos `-----------------------------------*/ 1710 1.1 christos yyabortlab: 1711 1.1 christos yyresult = 1; 1712 1.8 christos goto yyreturnlab; 1713 1.8 christos 1714 1.1 christos 1715 1.8 christos /*-----------------------------------------------------------. 1716 1.8 christos | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | 1717 1.8 christos `-----------------------------------------------------------*/ 1718 1.1 christos yyexhaustedlab: 1719 1.1 christos yyerror (YY_("memory exhausted")); 1720 1.1 christos yyresult = 2; 1721 1.8 christos goto yyreturnlab; 1722 1.8 christos 1723 1.1 christos 1724 1.8 christos /*----------------------------------------------------------. 1725 1.8 christos | yyreturnlab -- parsing is finished, clean up and return. | 1726 1.8 christos `----------------------------------------------------------*/ 1727 1.8 christos yyreturnlab: 1728 1.6 christos if (yychar != YYEMPTY) 1729 1.6 christos { 1730 1.6 christos /* Make sure we have latest lookahead translation. See comments at 1731 1.6 christos user semantic actions for why this is necessary. */ 1732 1.6 christos yytoken = YYTRANSLATE (yychar); 1733 1.6 christos yydestruct ("Cleanup: discarding lookahead", 1734 1.6 christos yytoken, &yylval); 1735 1.6 christos } 1736 1.6 christos /* Do not reclaim the symbols of the rule whose action triggered 1737 1.1 christos this YYABORT or YYACCEPT. */ 1738 1.1 christos YYPOPSTACK (yylen); 1739 1.1 christos YY_STACK_PRINT (yyss, yyssp); 1740 1.1 christos while (yyssp != yyss) 1741 1.1 christos { 1742 1.1 christos yydestruct ("Cleanup: popping", 1743 1.8 christos YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); 1744 1.1 christos YYPOPSTACK (1); 1745 1.1 christos } 1746 1.1 christos #ifndef yyoverflow 1747 1.1 christos if (yyss != yyssa) 1748 1.1 christos YYSTACK_FREE (yyss); 1749 1.1 christos #endif 1750 1.8 christos 1751 1.6 christos return yyresult; 1752 1.1 christos } 1753 1.8 christos 1754 1.8 christos #line 410 "sysinfo.y" 1755 1.1 christos 1756 1.1 christos /* four modes 1757 1.1 christos 1758 1.1 christos -d write structure definitions for sysroff in host format 1759 1.1 christos -i write functions to swap into sysroff format in 1760 1.1 christos -o write functions to swap into sysroff format out 1761 1.1 christos -c write code to print info in human form */ 1762 1.1 christos 1763 1.1 christos int yydebug; 1764 1.1 christos 1765 1.3 christos int 1766 1.1 christos main (int ac, char **av) 1767 1.1 christos { 1768 1.1 christos yydebug=0; 1769 1.1 christos if (ac > 1) 1770 1.1 christos writecode = av[1][1]; 1771 1.1 christos if (writecode == 'd') 1772 1.1 christos { 1773 1.1 christos printf("typedef struct { unsigned char *data; int len; } barray; \n"); 1774 1.1 christos printf("typedef int INT;\n"); 1775 1.1 christos printf("typedef char * CHARS;\n"); 1776 1.1 christos 1777 1.1 christos } 1778 1.1 christos yyparse(); 1779 1.1 christos return 0; 1780 1.1 christos } 1781 1.1 christos 1782 1.8 christos static void 1783 1.8 christos yyerror (const char *s) 1784 1.1 christos { 1785 1.1 christos fprintf(stderr, "%s\n" , s); 1786 1.1 christos } 1787