Commit generated files for binutils 2.17.90.
[binutils.git] / binutils / sysinfo.c
blobf1c7a4bf12b5a2256d9159b1a83c818408f77946
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 COND = 258,
70 REPEAT = 259,
71 TYPE = 260,
72 NAME = 261,
73 NUMBER = 262,
74 UNIT = 263
76 #endif
77 /* Tokens. */
78 #define COND 258
79 #define REPEAT 259
80 #define TYPE 260
81 #define NAME 261
82 #define NUMBER 262
83 #define UNIT 263
88 /* Copy the first part of user declarations. */
89 #line 21 "sysinfo.y"
91 #include <stdio.h>
92 #include <stdlib.h>
94 static char writecode;
95 static char *it;
96 static int code;
97 static char * repeat;
98 static char *oldrepeat;
99 static char *name;
100 static int rdepth;
101 static char *names[] = {" ","[n]","[n][m]"};
102 static char *pnames[]= {"","*","**"};
104 static int yyerror (char *s);
105 extern int yylex (void);
108 /* Enabling traces. */
109 #ifndef YYDEBUG
110 # define YYDEBUG 0
111 #endif
113 /* Enabling verbose error messages. */
114 #ifdef YYERROR_VERBOSE
115 # undef YYERROR_VERBOSE
116 # define YYERROR_VERBOSE 1
117 #else
118 # define YYERROR_VERBOSE 0
119 #endif
121 /* Enabling the token table. */
122 #ifndef YYTOKEN_TABLE
123 # define YYTOKEN_TABLE 0
124 #endif
126 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
127 typedef union YYSTYPE
128 #line 40 "sysinfo.y"
130 int i;
131 char *s;
133 /* Line 187 of yacc.c. */
134 #line 135 "sysinfo.c"
135 YYSTYPE;
136 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
137 # define YYSTYPE_IS_DECLARED 1
138 # define YYSTYPE_IS_TRIVIAL 1
139 #endif
143 /* Copy the second part of user declarations. */
146 /* Line 216 of yacc.c. */
147 #line 148 "sysinfo.c"
149 #ifdef short
150 # undef short
151 #endif
153 #ifdef YYTYPE_UINT8
154 typedef YYTYPE_UINT8 yytype_uint8;
155 #else
156 typedef unsigned char yytype_uint8;
157 #endif
159 #ifdef YYTYPE_INT8
160 typedef YYTYPE_INT8 yytype_int8;
161 #elif (defined __STDC__ || defined __C99__FUNC__ \
162 || defined __cplusplus || defined _MSC_VER)
163 typedef signed char yytype_int8;
164 #else
165 typedef short int yytype_int8;
166 #endif
168 #ifdef YYTYPE_UINT16
169 typedef YYTYPE_UINT16 yytype_uint16;
170 #else
171 typedef unsigned short int yytype_uint16;
172 #endif
174 #ifdef YYTYPE_INT16
175 typedef YYTYPE_INT16 yytype_int16;
176 #else
177 typedef short int yytype_int16;
178 #endif
180 #ifndef YYSIZE_T
181 # ifdef __SIZE_TYPE__
182 # define YYSIZE_T __SIZE_TYPE__
183 # elif defined size_t
184 # define YYSIZE_T size_t
185 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
186 || defined __cplusplus || defined _MSC_VER)
187 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
188 # define YYSIZE_T size_t
189 # else
190 # define YYSIZE_T unsigned int
191 # endif
192 #endif
194 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
196 #ifndef YY_
197 # if YYENABLE_NLS
198 # if ENABLE_NLS
199 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
200 # define YY_(msgid) dgettext ("bison-runtime", msgid)
201 # endif
202 # endif
203 # ifndef YY_
204 # define YY_(msgid) msgid
205 # endif
206 #endif
208 /* Suppress unused-variable warnings by "using" E. */
209 #if ! defined lint || defined __GNUC__
210 # define YYUSE(e) ((void) (e))
211 #else
212 # define YYUSE(e) /* empty */
213 #endif
215 /* Identity function, used to suppress warnings about constant conditions. */
216 #ifndef lint
217 # define YYID(n) (n)
218 #else
219 #if (defined __STDC__ || defined __C99__FUNC__ \
220 || defined __cplusplus || defined _MSC_VER)
221 static int
222 YYID (int i)
223 #else
224 static int
225 YYID (i)
226 int i;
227 #endif
229 return i;
231 #endif
233 #if ! defined yyoverflow || YYERROR_VERBOSE
235 /* The parser invokes alloca or malloc; define the necessary symbols. */
237 # ifdef YYSTACK_USE_ALLOCA
238 # if YYSTACK_USE_ALLOCA
239 # ifdef __GNUC__
240 # define YYSTACK_ALLOC __builtin_alloca
241 # elif defined __BUILTIN_VA_ARG_INCR
242 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
243 # elif defined _AIX
244 # define YYSTACK_ALLOC __alloca
245 # elif defined _MSC_VER
246 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
247 # define alloca _alloca
248 # else
249 # define YYSTACK_ALLOC alloca
250 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
251 || defined __cplusplus || defined _MSC_VER)
252 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
253 # ifndef _STDLIB_H
254 # define _STDLIB_H 1
255 # endif
256 # endif
257 # endif
258 # endif
259 # endif
261 # ifdef YYSTACK_ALLOC
262 /* Pacify GCC's `empty if-body' warning. */
263 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
264 # ifndef YYSTACK_ALLOC_MAXIMUM
265 /* The OS might guarantee only one guard page at the bottom of the stack,
266 and a page size can be as small as 4096 bytes. So we cannot safely
267 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
268 to allow for a few compiler-allocated temporary stack slots. */
269 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
270 # endif
271 # else
272 # define YYSTACK_ALLOC YYMALLOC
273 # define YYSTACK_FREE YYFREE
274 # ifndef YYSTACK_ALLOC_MAXIMUM
275 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
276 # endif
277 # if (defined __cplusplus && ! defined _STDLIB_H \
278 && ! ((defined YYMALLOC || defined malloc) \
279 && (defined YYFREE || defined free)))
280 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
281 # ifndef _STDLIB_H
282 # define _STDLIB_H 1
283 # endif
284 # endif
285 # ifndef YYMALLOC
286 # define YYMALLOC malloc
287 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
288 || defined __cplusplus || defined _MSC_VER)
289 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
290 # endif
291 # endif
292 # ifndef YYFREE
293 # define YYFREE free
294 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
295 || defined __cplusplus || defined _MSC_VER)
296 void free (void *); /* INFRINGES ON USER NAME SPACE */
297 # endif
298 # endif
299 # endif
300 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
303 #if (! defined yyoverflow \
304 && (! defined __cplusplus \
305 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
307 /* A type that is properly aligned for any stack member. */
308 union yyalloc
310 yytype_int16 yyss;
311 YYSTYPE yyvs;
314 /* The size of the maximum gap between one aligned stack and the next. */
315 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
317 /* The size of an array large to enough to hold all stacks, each with
318 N elements. */
319 # define YYSTACK_BYTES(N) \
320 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
321 + YYSTACK_GAP_MAXIMUM)
323 /* Copy COUNT objects from FROM to TO. The source and destination do
324 not overlap. */
325 # ifndef YYCOPY
326 # if defined __GNUC__ && 1 < __GNUC__
327 # define YYCOPY(To, From, Count) \
328 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
329 # else
330 # define YYCOPY(To, From, Count) \
331 do \
333 YYSIZE_T yyi; \
334 for (yyi = 0; yyi < (Count); yyi++) \
335 (To)[yyi] = (From)[yyi]; \
337 while (YYID (0))
338 # endif
339 # endif
341 /* Relocate STACK from its old location to the new one. The
342 local variables YYSIZE and YYSTACKSIZE give the old and new number of
343 elements in the stack, and YYPTR gives the new location of the
344 stack. Advance YYPTR to a properly aligned location for the next
345 stack. */
346 # define YYSTACK_RELOCATE(Stack) \
347 do \
349 YYSIZE_T yynewbytes; \
350 YYCOPY (&yyptr->Stack, Stack, yysize); \
351 Stack = &yyptr->Stack; \
352 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
353 yyptr += yynewbytes / sizeof (*yyptr); \
355 while (YYID (0))
357 #endif
359 /* YYFINAL -- State number of the termination state. */
360 #define YYFINAL 3
361 /* YYLAST -- Last index in YYTABLE. */
362 #define YYLAST 38
364 /* YYNTOKENS -- Number of terminals. */
365 #define YYNTOKENS 11
366 /* YYNNTS -- Number of nonterminals. */
367 #define YYNNTS 19
368 /* YYNRULES -- Number of rules. */
369 #define YYNRULES 27
370 /* YYNRULES -- Number of states. */
371 #define YYNSTATES 55
373 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
374 #define YYUNDEFTOK 2
375 #define YYMAXUTOK 263
377 #define YYTRANSLATE(YYX) \
378 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
380 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
381 static const yytype_uint8 yytranslate[] =
383 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 5, 6, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
409 7, 8, 9, 10
412 #if YYDEBUG
413 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
414 YYRHS. */
415 static const yytype_uint8 yyprhs[] =
417 0, 0, 3, 4, 7, 10, 11, 12, 19, 22,
418 25, 28, 29, 30, 37, 38, 45, 46, 57, 59,
419 60, 64, 67, 71, 72, 73, 77, 78
422 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
423 static const yytype_int8 yyrhs[] =
425 12, 0, -1, -1, 13, 14, -1, 15, 14, -1,
426 -1, -1, 5, 8, 9, 16, 17, 6, -1, 22,
427 17, -1, 20, 17, -1, 18, 17, -1, -1, -1,
428 5, 4, 8, 19, 17, 6, -1, -1, 5, 3,
429 8, 21, 17, 6, -1, -1, 5, 25, 5, 24,
430 26, 6, 27, 23, 28, 6, -1, 7, -1, -1,
431 5, 8, 6, -1, 9, 10, -1, 5, 8, 6,
432 -1, -1, -1, 5, 29, 6, -1, -1, 29, 5,
433 8, 8, 6, -1
436 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
437 static const yytype_uint16 yyrline[] =
439 0, 54, 54, 54, 92, 93, 98, 97, 175, 176,
440 177, 178, 182, 181, 229, 228, 256, 255, 363, 364,
441 368, 373, 379, 380, 383, 384, 386, 388
443 #endif
445 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
446 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
447 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
448 static const char *const yytname[] =
450 "$end", "error", "$undefined", "COND", "REPEAT", "'('", "')'", "TYPE",
451 "NAME", "NUMBER", "UNIT", "$accept", "top", "@1", "it_list", "it", "@2",
452 "it_field_list", "repeat_it_field", "@3", "cond_it_field", "@4",
453 "it_field", "@5", "attr_type", "attr_desc", "attr_size", "attr_id",
454 "enums", "enum_list", 0
456 #endif
458 # ifdef YYPRINT
459 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
460 token YYLEX-NUM. */
461 static const yytype_uint16 yytoknum[] =
463 0, 256, 257, 258, 259, 40, 41, 260, 261, 262,
466 # endif
468 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
469 static const yytype_uint8 yyr1[] =
471 0, 11, 13, 12, 14, 14, 16, 15, 17, 17,
472 17, 17, 19, 18, 21, 20, 23, 22, 24, 24,
473 25, 26, 27, 27, 28, 28, 29, 29
476 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
477 static const yytype_uint8 yyr2[] =
479 0, 2, 0, 2, 2, 0, 0, 6, 2, 2,
480 2, 0, 0, 6, 0, 6, 0, 10, 1, 0,
481 3, 2, 3, 0, 0, 3, 0, 5
484 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
485 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
486 means the default is an error. */
487 static const yytype_uint8 yydefact[] =
489 2, 0, 5, 1, 0, 3, 5, 0, 4, 6,
490 11, 0, 0, 11, 11, 11, 0, 0, 0, 0,
491 7, 10, 9, 8, 14, 12, 0, 19, 11, 11,
492 20, 18, 0, 0, 0, 0, 0, 15, 13, 21,
493 23, 0, 16, 0, 24, 22, 26, 0, 0, 17,
494 0, 25, 0, 0, 27
497 /* YYDEFGOTO[NTERM-NUM]. */
498 static const yytype_int8 yydefgoto[] =
500 -1, 1, 2, 5, 6, 10, 12, 13, 29, 14,
501 28, 15, 44, 32, 19, 36, 42, 47, 48
504 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
505 STATE-NUM. */
506 #define YYPACT_NINF -14
507 static const yytype_int8 yypact[] =
509 -14, 8, 4, -14, 2, -14, 4, 3, -14, -14,
510 6, 0, 7, 6, 6, 6, 9, 10, 11, 15,
511 -14, -14, -14, -14, -14, -14, 16, 14, 6, 6,
512 -14, -14, 5, 17, 18, 19, 20, -14, -14, -14,
513 22, 23, -14, 24, 27, -14, -14, 28, 1, -14,
514 25, -14, 29, 30, -14
517 /* YYPGOTO[NTERM-NUM]. */
518 static const yytype_int8 yypgoto[] =
520 -14, -14, -14, 32, -14, -14, -13, -14, -14, -14,
521 -14, -14, -14, -14, -14, -14, -14, -14, -14
524 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
525 positive, shift that token. If negative, reduce the rule which
526 number is the opposite. If zero, do what YYDEFACT says.
527 If YYTABLE_NINF, syntax error. */
528 #define YYTABLE_NINF -1
529 static const yytype_uint8 yytable[] =
531 21, 22, 23, 16, 17, 18, 50, 51, 3, 4,
532 7, 11, 9, 20, 35, 33, 34, 24, 25, 26,
533 27, 31, 30, 37, 38, 0, 40, 41, 0, 39,
534 45, 43, 46, 52, 49, 0, 54, 53, 8
537 static const yytype_int8 yycheck[] =
539 13, 14, 15, 3, 4, 5, 5, 6, 0, 5,
540 8, 5, 9, 6, 9, 28, 29, 8, 8, 8,
541 5, 7, 6, 6, 6, -1, 6, 5, -1, 10,
542 6, 8, 5, 8, 6, -1, 6, 8, 6
545 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
546 symbol of state STATE-NUM. */
547 static const yytype_uint8 yystos[] =
549 0, 12, 13, 0, 5, 14, 15, 8, 14, 9,
550 16, 5, 17, 18, 20, 22, 3, 4, 5, 25,
551 6, 17, 17, 17, 8, 8, 8, 5, 21, 19,
552 6, 7, 24, 17, 17, 9, 26, 6, 6, 10,
553 6, 5, 27, 8, 23, 6, 5, 28, 29, 6,
554 5, 6, 8, 8, 6
557 #define yyerrok (yyerrstatus = 0)
558 #define yyclearin (yychar = YYEMPTY)
559 #define YYEMPTY (-2)
560 #define YYEOF 0
562 #define YYACCEPT goto yyacceptlab
563 #define YYABORT goto yyabortlab
564 #define YYERROR goto yyerrorlab
567 /* Like YYERROR except do call yyerror. This remains here temporarily
568 to ease the transition to the new meaning of YYERROR, for GCC.
569 Once GCC version 2 has supplanted version 1, this can go. */
571 #define YYFAIL goto yyerrlab
573 #define YYRECOVERING() (!!yyerrstatus)
575 #define YYBACKUP(Token, Value) \
576 do \
577 if (yychar == YYEMPTY && yylen == 1) \
579 yychar = (Token); \
580 yylval = (Value); \
581 yytoken = YYTRANSLATE (yychar); \
582 YYPOPSTACK (1); \
583 goto yybackup; \
585 else \
587 yyerror (YY_("syntax error: cannot back up")); \
588 YYERROR; \
590 while (YYID (0))
593 #define YYTERROR 1
594 #define YYERRCODE 256
597 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
598 If N is 0, then set CURRENT to the empty location which ends
599 the previous symbol: RHS[0] (always defined). */
601 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
602 #ifndef YYLLOC_DEFAULT
603 # define YYLLOC_DEFAULT(Current, Rhs, N) \
604 do \
605 if (YYID (N)) \
607 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
608 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
609 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
610 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
612 else \
614 (Current).first_line = (Current).last_line = \
615 YYRHSLOC (Rhs, 0).last_line; \
616 (Current).first_column = (Current).last_column = \
617 YYRHSLOC (Rhs, 0).last_column; \
619 while (YYID (0))
620 #endif
623 /* YY_LOCATION_PRINT -- Print the location on the stream.
624 This macro was not mandated originally: define only if we know
625 we won't break user code: when these are the locations we know. */
627 #ifndef YY_LOCATION_PRINT
628 # if YYLTYPE_IS_TRIVIAL
629 # define YY_LOCATION_PRINT(File, Loc) \
630 fprintf (File, "%d.%d-%d.%d", \
631 (Loc).first_line, (Loc).first_column, \
632 (Loc).last_line, (Loc).last_column)
633 # else
634 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
635 # endif
636 #endif
639 /* YYLEX -- calling `yylex' with the right arguments. */
641 #ifdef YYLEX_PARAM
642 # define YYLEX yylex (YYLEX_PARAM)
643 #else
644 # define YYLEX yylex ()
645 #endif
647 /* Enable debugging if requested. */
648 #if YYDEBUG
650 # ifndef YYFPRINTF
651 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
652 # define YYFPRINTF fprintf
653 # endif
655 # define YYDPRINTF(Args) \
656 do { \
657 if (yydebug) \
658 YYFPRINTF Args; \
659 } while (YYID (0))
661 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
662 do { \
663 if (yydebug) \
665 YYFPRINTF (stderr, "%s ", Title); \
666 yy_symbol_print (stderr, \
667 Type, Value); \
668 YYFPRINTF (stderr, "\n"); \
670 } while (YYID (0))
673 /*--------------------------------.
674 | Print this symbol on YYOUTPUT. |
675 `--------------------------------*/
677 /*ARGSUSED*/
678 #if (defined __STDC__ || defined __C99__FUNC__ \
679 || defined __cplusplus || defined _MSC_VER)
680 static void
681 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
682 #else
683 static void
684 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
685 FILE *yyoutput;
686 int yytype;
687 YYSTYPE const * const yyvaluep;
688 #endif
690 if (!yyvaluep)
691 return;
692 # ifdef YYPRINT
693 if (yytype < YYNTOKENS)
694 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
695 # else
696 YYUSE (yyoutput);
697 # endif
698 switch (yytype)
700 default:
701 break;
706 /*--------------------------------.
707 | Print this symbol on YYOUTPUT. |
708 `--------------------------------*/
710 #if (defined __STDC__ || defined __C99__FUNC__ \
711 || defined __cplusplus || defined _MSC_VER)
712 static void
713 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
714 #else
715 static void
716 yy_symbol_print (yyoutput, yytype, yyvaluep)
717 FILE *yyoutput;
718 int yytype;
719 YYSTYPE const * const yyvaluep;
720 #endif
722 if (yytype < YYNTOKENS)
723 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
724 else
725 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
727 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
728 YYFPRINTF (yyoutput, ")");
731 /*------------------------------------------------------------------.
732 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
733 | TOP (included). |
734 `------------------------------------------------------------------*/
736 #if (defined __STDC__ || defined __C99__FUNC__ \
737 || defined __cplusplus || defined _MSC_VER)
738 static void
739 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
740 #else
741 static void
742 yy_stack_print (bottom, top)
743 yytype_int16 *bottom;
744 yytype_int16 *top;
745 #endif
747 YYFPRINTF (stderr, "Stack now");
748 for (; bottom <= top; ++bottom)
749 YYFPRINTF (stderr, " %d", *bottom);
750 YYFPRINTF (stderr, "\n");
753 # define YY_STACK_PRINT(Bottom, Top) \
754 do { \
755 if (yydebug) \
756 yy_stack_print ((Bottom), (Top)); \
757 } while (YYID (0))
760 /*------------------------------------------------.
761 | Report that the YYRULE is going to be reduced. |
762 `------------------------------------------------*/
764 #if (defined __STDC__ || defined __C99__FUNC__ \
765 || defined __cplusplus || defined _MSC_VER)
766 static void
767 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
768 #else
769 static void
770 yy_reduce_print (yyvsp, yyrule)
771 YYSTYPE *yyvsp;
772 int yyrule;
773 #endif
775 int yynrhs = yyr2[yyrule];
776 int yyi;
777 unsigned long int yylno = yyrline[yyrule];
778 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
779 yyrule - 1, yylno);
780 /* The symbols being reduced. */
781 for (yyi = 0; yyi < yynrhs; yyi++)
783 fprintf (stderr, " $%d = ", yyi + 1);
784 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
785 &(yyvsp[(yyi + 1) - (yynrhs)])
787 fprintf (stderr, "\n");
791 # define YY_REDUCE_PRINT(Rule) \
792 do { \
793 if (yydebug) \
794 yy_reduce_print (yyvsp, Rule); \
795 } while (YYID (0))
797 /* Nonzero means print parse trace. It is left uninitialized so that
798 multiple parsers can coexist. */
799 int yydebug;
800 #else /* !YYDEBUG */
801 # define YYDPRINTF(Args)
802 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
803 # define YY_STACK_PRINT(Bottom, Top)
804 # define YY_REDUCE_PRINT(Rule)
805 #endif /* !YYDEBUG */
808 /* YYINITDEPTH -- initial size of the parser's stacks. */
809 #ifndef YYINITDEPTH
810 # define YYINITDEPTH 200
811 #endif
813 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
814 if the built-in stack extension method is used).
816 Do not make this value too large; the results are undefined if
817 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
818 evaluated with infinite-precision integer arithmetic. */
820 #ifndef YYMAXDEPTH
821 # define YYMAXDEPTH 10000
822 #endif
826 #if YYERROR_VERBOSE
828 # ifndef yystrlen
829 # if defined __GLIBC__ && defined _STRING_H
830 # define yystrlen strlen
831 # else
832 /* Return the length of YYSTR. */
833 #if (defined __STDC__ || defined __C99__FUNC__ \
834 || defined __cplusplus || defined _MSC_VER)
835 static YYSIZE_T
836 yystrlen (const char *yystr)
837 #else
838 static YYSIZE_T
839 yystrlen (yystr)
840 const char *yystr;
841 #endif
843 YYSIZE_T yylen;
844 for (yylen = 0; yystr[yylen]; yylen++)
845 continue;
846 return yylen;
848 # endif
849 # endif
851 # ifndef yystpcpy
852 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
853 # define yystpcpy stpcpy
854 # else
855 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
856 YYDEST. */
857 #if (defined __STDC__ || defined __C99__FUNC__ \
858 || defined __cplusplus || defined _MSC_VER)
859 static char *
860 yystpcpy (char *yydest, const char *yysrc)
861 #else
862 static char *
863 yystpcpy (yydest, yysrc)
864 char *yydest;
865 const char *yysrc;
866 #endif
868 char *yyd = yydest;
869 const char *yys = yysrc;
871 while ((*yyd++ = *yys++) != '\0')
872 continue;
874 return yyd - 1;
876 # endif
877 # endif
879 # ifndef yytnamerr
880 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
881 quotes and backslashes, so that it's suitable for yyerror. The
882 heuristic is that double-quoting is unnecessary unless the string
883 contains an apostrophe, a comma, or backslash (other than
884 backslash-backslash). YYSTR is taken from yytname. If YYRES is
885 null, do not copy; instead, return the length of what the result
886 would have been. */
887 static YYSIZE_T
888 yytnamerr (char *yyres, const char *yystr)
890 if (*yystr == '"')
892 YYSIZE_T yyn = 0;
893 char const *yyp = yystr;
895 for (;;)
896 switch (*++yyp)
898 case '\'':
899 case ',':
900 goto do_not_strip_quotes;
902 case '\\':
903 if (*++yyp != '\\')
904 goto do_not_strip_quotes;
905 /* Fall through. */
906 default:
907 if (yyres)
908 yyres[yyn] = *yyp;
909 yyn++;
910 break;
912 case '"':
913 if (yyres)
914 yyres[yyn] = '\0';
915 return yyn;
917 do_not_strip_quotes: ;
920 if (! yyres)
921 return yystrlen (yystr);
923 return yystpcpy (yyres, yystr) - yyres;
925 # endif
927 /* Copy into YYRESULT an error message about the unexpected token
928 YYCHAR while in state YYSTATE. Return the number of bytes copied,
929 including the terminating null byte. If YYRESULT is null, do not
930 copy anything; just return the number of bytes that would be
931 copied. As a special case, return 0 if an ordinary "syntax error"
932 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
933 size calculation. */
934 static YYSIZE_T
935 yysyntax_error (char *yyresult, int yystate, int yychar)
937 int yyn = yypact[yystate];
939 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
940 return 0;
941 else
943 int yytype = YYTRANSLATE (yychar);
944 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
945 YYSIZE_T yysize = yysize0;
946 YYSIZE_T yysize1;
947 int yysize_overflow = 0;
948 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
949 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
950 int yyx;
952 # if 0
953 /* This is so xgettext sees the translatable formats that are
954 constructed on the fly. */
955 YY_("syntax error, unexpected %s");
956 YY_("syntax error, unexpected %s, expecting %s");
957 YY_("syntax error, unexpected %s, expecting %s or %s");
958 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
959 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
960 # endif
961 char *yyfmt;
962 char const *yyf;
963 static char const yyunexpected[] = "syntax error, unexpected %s";
964 static char const yyexpecting[] = ", expecting %s";
965 static char const yyor[] = " or %s";
966 char yyformat[sizeof yyunexpected
967 + sizeof yyexpecting - 1
968 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
969 * (sizeof yyor - 1))];
970 char const *yyprefix = yyexpecting;
972 /* Start YYX at -YYN if negative to avoid negative indexes in
973 YYCHECK. */
974 int yyxbegin = yyn < 0 ? -yyn : 0;
976 /* Stay within bounds of both yycheck and yytname. */
977 int yychecklim = YYLAST - yyn + 1;
978 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
979 int yycount = 1;
981 yyarg[0] = yytname[yytype];
982 yyfmt = yystpcpy (yyformat, yyunexpected);
984 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
985 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
987 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
989 yycount = 1;
990 yysize = yysize0;
991 yyformat[sizeof yyunexpected - 1] = '\0';
992 break;
994 yyarg[yycount++] = yytname[yyx];
995 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
996 yysize_overflow |= (yysize1 < yysize);
997 yysize = yysize1;
998 yyfmt = yystpcpy (yyfmt, yyprefix);
999 yyprefix = yyor;
1002 yyf = YY_(yyformat);
1003 yysize1 = yysize + yystrlen (yyf);
1004 yysize_overflow |= (yysize1 < yysize);
1005 yysize = yysize1;
1007 if (yysize_overflow)
1008 return YYSIZE_MAXIMUM;
1010 if (yyresult)
1012 /* Avoid sprintf, as that infringes on the user's name space.
1013 Don't have undefined behavior even if the translation
1014 produced a string with the wrong number of "%s"s. */
1015 char *yyp = yyresult;
1016 int yyi = 0;
1017 while ((*yyp = *yyf) != '\0')
1019 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1021 yyp += yytnamerr (yyp, yyarg[yyi++]);
1022 yyf += 2;
1024 else
1026 yyp++;
1027 yyf++;
1031 return yysize;
1034 #endif /* YYERROR_VERBOSE */
1037 /*-----------------------------------------------.
1038 | Release the memory associated to this symbol. |
1039 `-----------------------------------------------*/
1041 /*ARGSUSED*/
1042 #if (defined __STDC__ || defined __C99__FUNC__ \
1043 || defined __cplusplus || defined _MSC_VER)
1044 static void
1045 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1046 #else
1047 static void
1048 yydestruct (yymsg, yytype, yyvaluep)
1049 const char *yymsg;
1050 int yytype;
1051 YYSTYPE *yyvaluep;
1052 #endif
1054 YYUSE (yyvaluep);
1056 if (!yymsg)
1057 yymsg = "Deleting";
1058 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1060 switch (yytype)
1063 default:
1064 break;
1069 /* Prevent warnings from -Wmissing-prototypes. */
1071 #ifdef YYPARSE_PARAM
1072 #if defined __STDC__ || defined __cplusplus
1073 int yyparse (void *YYPARSE_PARAM);
1074 #else
1075 int yyparse ();
1076 #endif
1077 #else /* ! YYPARSE_PARAM */
1078 #if defined __STDC__ || defined __cplusplus
1079 int yyparse (void);
1080 #else
1081 int yyparse ();
1082 #endif
1083 #endif /* ! YYPARSE_PARAM */
1087 /* The look-ahead symbol. */
1088 int yychar;
1090 /* The semantic value of the look-ahead symbol. */
1091 YYSTYPE yylval;
1093 /* Number of syntax errors so far. */
1094 int yynerrs;
1098 /*----------.
1099 | yyparse. |
1100 `----------*/
1102 #ifdef YYPARSE_PARAM
1103 #if (defined __STDC__ || defined __C99__FUNC__ \
1104 || defined __cplusplus || defined _MSC_VER)
1106 yyparse (void *YYPARSE_PARAM)
1107 #else
1109 yyparse (YYPARSE_PARAM)
1110 void *YYPARSE_PARAM;
1111 #endif
1112 #else /* ! YYPARSE_PARAM */
1113 #if (defined __STDC__ || defined __C99__FUNC__ \
1114 || defined __cplusplus || defined _MSC_VER)
1116 yyparse (void)
1117 #else
1119 yyparse ()
1121 #endif
1122 #endif
1125 int yystate;
1126 int yyn;
1127 int yyresult;
1128 /* Number of tokens to shift before error messages enabled. */
1129 int yyerrstatus;
1130 /* Look-ahead token as an internal (translated) token number. */
1131 int yytoken = 0;
1132 #if YYERROR_VERBOSE
1133 /* Buffer for error messages, and its allocated size. */
1134 char yymsgbuf[128];
1135 char *yymsg = yymsgbuf;
1136 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1137 #endif
1139 /* Three stacks and their tools:
1140 `yyss': related to states,
1141 `yyvs': related to semantic values,
1142 `yyls': related to locations.
1144 Refer to the stacks thru separate pointers, to allow yyoverflow
1145 to reallocate them elsewhere. */
1147 /* The state stack. */
1148 yytype_int16 yyssa[YYINITDEPTH];
1149 yytype_int16 *yyss = yyssa;
1150 yytype_int16 *yyssp;
1152 /* The semantic value stack. */
1153 YYSTYPE yyvsa[YYINITDEPTH];
1154 YYSTYPE *yyvs = yyvsa;
1155 YYSTYPE *yyvsp;
1159 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1161 YYSIZE_T yystacksize = YYINITDEPTH;
1163 /* The variables used to return semantic value and location from the
1164 action routines. */
1165 YYSTYPE yyval;
1168 /* The number of symbols on the RHS of the reduced rule.
1169 Keep to zero when no symbol should be popped. */
1170 int yylen = 0;
1172 YYDPRINTF ((stderr, "Starting parse\n"));
1174 yystate = 0;
1175 yyerrstatus = 0;
1176 yynerrs = 0;
1177 yychar = YYEMPTY; /* Cause a token to be read. */
1179 /* Initialize stack pointers.
1180 Waste one element of value and location stack
1181 so that they stay on the same level as the state stack.
1182 The wasted elements are never initialized. */
1184 yyssp = yyss;
1185 yyvsp = yyvs;
1187 goto yysetstate;
1189 /*------------------------------------------------------------.
1190 | yynewstate -- Push a new state, which is found in yystate. |
1191 `------------------------------------------------------------*/
1192 yynewstate:
1193 /* In all cases, when you get here, the value and location stacks
1194 have just been pushed. So pushing a state here evens the stacks. */
1195 yyssp++;
1197 yysetstate:
1198 *yyssp = yystate;
1200 if (yyss + yystacksize - 1 <= yyssp)
1202 /* Get the current used size of the three stacks, in elements. */
1203 YYSIZE_T yysize = yyssp - yyss + 1;
1205 #ifdef yyoverflow
1207 /* Give user a chance to reallocate the stack. Use copies of
1208 these so that the &'s don't force the real ones into
1209 memory. */
1210 YYSTYPE *yyvs1 = yyvs;
1211 yytype_int16 *yyss1 = yyss;
1214 /* Each stack pointer address is followed by the size of the
1215 data in use in that stack, in bytes. This used to be a
1216 conditional around just the two extra args, but that might
1217 be undefined if yyoverflow is a macro. */
1218 yyoverflow (YY_("memory exhausted"),
1219 &yyss1, yysize * sizeof (*yyssp),
1220 &yyvs1, yysize * sizeof (*yyvsp),
1222 &yystacksize);
1224 yyss = yyss1;
1225 yyvs = yyvs1;
1227 #else /* no yyoverflow */
1228 # ifndef YYSTACK_RELOCATE
1229 goto yyexhaustedlab;
1230 # else
1231 /* Extend the stack our own way. */
1232 if (YYMAXDEPTH <= yystacksize)
1233 goto yyexhaustedlab;
1234 yystacksize *= 2;
1235 if (YYMAXDEPTH < yystacksize)
1236 yystacksize = YYMAXDEPTH;
1239 yytype_int16 *yyss1 = yyss;
1240 union yyalloc *yyptr =
1241 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1242 if (! yyptr)
1243 goto yyexhaustedlab;
1244 YYSTACK_RELOCATE (yyss);
1245 YYSTACK_RELOCATE (yyvs);
1247 # undef YYSTACK_RELOCATE
1248 if (yyss1 != yyssa)
1249 YYSTACK_FREE (yyss1);
1251 # endif
1252 #endif /* no yyoverflow */
1254 yyssp = yyss + yysize - 1;
1255 yyvsp = yyvs + yysize - 1;
1258 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1259 (unsigned long int) yystacksize));
1261 if (yyss + yystacksize - 1 <= yyssp)
1262 YYABORT;
1265 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1267 goto yybackup;
1269 /*-----------.
1270 | yybackup. |
1271 `-----------*/
1272 yybackup:
1274 /* Do appropriate processing given the current state. Read a
1275 look-ahead token if we need one and don't already have one. */
1277 /* First try to decide what to do without reference to look-ahead token. */
1278 yyn = yypact[yystate];
1279 if (yyn == YYPACT_NINF)
1280 goto yydefault;
1282 /* Not known => get a look-ahead token if don't already have one. */
1284 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1285 if (yychar == YYEMPTY)
1287 YYDPRINTF ((stderr, "Reading a token: "));
1288 yychar = YYLEX;
1291 if (yychar <= YYEOF)
1293 yychar = yytoken = YYEOF;
1294 YYDPRINTF ((stderr, "Now at end of input.\n"));
1296 else
1298 yytoken = YYTRANSLATE (yychar);
1299 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1302 /* If the proper action on seeing token YYTOKEN is to reduce or to
1303 detect an error, take that action. */
1304 yyn += yytoken;
1305 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1306 goto yydefault;
1307 yyn = yytable[yyn];
1308 if (yyn <= 0)
1310 if (yyn == 0 || yyn == YYTABLE_NINF)
1311 goto yyerrlab;
1312 yyn = -yyn;
1313 goto yyreduce;
1316 if (yyn == YYFINAL)
1317 YYACCEPT;
1319 /* Count tokens shifted since error; after three, turn off error
1320 status. */
1321 if (yyerrstatus)
1322 yyerrstatus--;
1324 /* Shift the look-ahead token. */
1325 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1327 /* Discard the shifted token unless it is eof. */
1328 if (yychar != YYEOF)
1329 yychar = YYEMPTY;
1331 yystate = yyn;
1332 *++yyvsp = yylval;
1334 goto yynewstate;
1337 /*-----------------------------------------------------------.
1338 | yydefault -- do the default action for the current state. |
1339 `-----------------------------------------------------------*/
1340 yydefault:
1341 yyn = yydefact[yystate];
1342 if (yyn == 0)
1343 goto yyerrlab;
1344 goto yyreduce;
1347 /*-----------------------------.
1348 | yyreduce -- Do a reduction. |
1349 `-----------------------------*/
1350 yyreduce:
1351 /* yyn is the number of a rule to reduce with. */
1352 yylen = yyr2[yyn];
1354 /* If YYLEN is nonzero, implement the default value of the action:
1355 `$$ = $1'.
1357 Otherwise, the following line sets YYVAL to garbage.
1358 This behavior is undocumented and Bison
1359 users should not rely upon it. Assigning to YYVAL
1360 unconditionally makes the parser a bit smaller, and it avoids a
1361 GCC warning that YYVAL may be used uninitialized. */
1362 yyval = yyvsp[1-yylen];
1365 YY_REDUCE_PRINT (yyn);
1366 switch (yyn)
1368 case 2:
1369 #line 54 "sysinfo.y"
1371 switch (writecode)
1373 case 'i':
1374 printf("#ifdef SYSROFF_SWAP_IN\n");
1375 break;
1376 case 'p':
1377 printf("#ifdef SYSROFF_p\n");
1378 break;
1379 case 'd':
1380 break;
1381 case 'g':
1382 printf("#ifdef SYSROFF_SWAP_OUT\n");
1383 break;
1384 case 'c':
1385 printf("#ifdef SYSROFF_PRINT\n");
1386 printf("#include <stdio.h>\n");
1387 printf("#include <stdlib.h>\n");
1388 printf("#include <ansidecl.h>\n");
1389 break;
1392 break;
1394 case 3:
1395 #line 76 "sysinfo.y"
1397 switch (writecode) {
1398 case 'i':
1399 case 'p':
1400 case 'g':
1401 case 'c':
1402 printf("#endif\n");
1403 break;
1404 case 'd':
1405 break;
1408 break;
1410 case 6:
1411 #line 98 "sysinfo.y"
1413 it = (yyvsp[(2) - (3)].s); code = (yyvsp[(3) - (3)].i);
1414 switch (writecode)
1416 case 'd':
1417 printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code);
1418 printf("struct IT_%s;\n", it);
1419 printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n",
1420 (yyvsp[(2) - (3)].s), it);
1421 printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n",
1422 (yyvsp[(2) - (3)].s), it);
1423 printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n",
1424 (yyvsp[(2) - (3)].s), it);
1425 printf("struct IT_%s { \n", it);
1426 break;
1427 case 'i':
1428 printf("void sysroff_swap_%s_in(ptr)\n",(yyvsp[(2) - (3)].s));
1429 printf("struct IT_%s *ptr;\n", it);
1430 printf("{\n");
1431 printf("unsigned char raw[255];\n");
1432 printf("\tint idx = 0 ;\n");
1433 printf("\tint size;\n");
1434 printf("memset(raw,0,255);\n");
1435 printf("memset(ptr,0,sizeof(*ptr));\n");
1436 printf("size = fillup(raw);\n");
1437 break;
1438 case 'g':
1439 printf("void sysroff_swap_%s_out(file,ptr)\n",(yyvsp[(2) - (3)].s));
1440 printf("FILE * file;\n");
1441 printf("struct IT_%s *ptr;\n", it);
1442 printf("{\n");
1443 printf("\tunsigned char raw[255];\n");
1444 printf("\tint idx = 16 ;\n");
1445 printf("\tmemset (raw, 0, 255);\n");
1446 printf("\tcode = IT_%s_CODE;\n", it);
1447 break;
1448 case 'o':
1449 printf("void sysroff_swap_%s_out(abfd,ptr)\n",(yyvsp[(2) - (3)].s));
1450 printf("bfd * abfd;\n");
1451 printf("struct IT_%s *ptr;\n",it);
1452 printf("{\n");
1453 printf("int idx = 0 ;\n");
1454 break;
1455 case 'c':
1456 printf("void sysroff_print_%s_out(ptr)\n",(yyvsp[(2) - (3)].s));
1457 printf("struct IT_%s *ptr;\n", it);
1458 printf("{\n");
1459 printf("itheader(\"%s\", IT_%s_CODE);\n",(yyvsp[(2) - (3)].s),(yyvsp[(2) - (3)].s));
1460 break;
1462 case 't':
1463 break;
1467 break;
1469 case 7:
1470 #line 155 "sysinfo.y"
1472 switch (writecode) {
1473 case 'd':
1474 printf("};\n");
1475 break;
1476 case 'g':
1477 printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it);
1479 case 'i':
1481 case 'o':
1482 case 'c':
1483 printf("}\n");
1486 break;
1488 case 12:
1489 #line 182 "sysinfo.y"
1491 rdepth++;
1492 switch (writecode)
1494 case 'c':
1495 if (rdepth==1)
1496 printf("\tprintf(\"repeat %%d\\n\", %s);\n",(yyvsp[(3) - (3)].s));
1497 if (rdepth==2)
1498 printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",(yyvsp[(3) - (3)].s));
1499 case 'i':
1500 case 'g':
1501 case 'o':
1503 if (rdepth==1)
1505 printf("\t{ int n; for (n = 0; n < %s; n++) {\n", (yyvsp[(3) - (3)].s));
1507 if (rdepth == 2) {
1508 printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n", (yyvsp[(3) - (3)].s));
1511 break;
1514 oldrepeat = repeat;
1515 repeat = (yyvsp[(3) - (3)].s);
1517 break;
1519 case 13:
1520 #line 212 "sysinfo.y"
1522 repeat = oldrepeat;
1523 oldrepeat =0;
1524 rdepth--;
1525 switch (writecode)
1527 case 'i':
1528 case 'g':
1529 case 'o':
1530 case 'c':
1531 printf("\t}}\n");
1534 break;
1536 case 14:
1537 #line 229 "sysinfo.y"
1539 switch (writecode)
1541 case 'i':
1542 case 'g':
1543 case 'o':
1544 case 'c':
1545 printf("\tif (%s) {\n", (yyvsp[(3) - (3)].s));
1546 break;
1549 break;
1551 case 15:
1552 #line 242 "sysinfo.y"
1554 switch (writecode)
1556 case 'i':
1557 case 'g':
1558 case 'o':
1559 case 'c':
1560 printf("\t}\n");
1563 break;
1565 case 16:
1566 #line 256 "sysinfo.y"
1567 {name = (yyvsp[(7) - (7)].s); }
1568 break;
1570 case 17:
1571 #line 258 "sysinfo.y"
1573 char *desc = (yyvsp[(2) - (10)].s);
1574 char *type = (yyvsp[(4) - (10)].s);
1575 int size = (yyvsp[(5) - (10)].i);
1576 char *id = (yyvsp[(7) - (10)].s);
1577 char *p = names[rdepth];
1578 char *ptr = pnames[rdepth];
1579 switch (writecode)
1581 case 'g':
1582 if (size % 8)
1585 printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n",
1587 names[rdepth], size);
1590 else {
1591 printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n",
1592 type,
1594 names[rdepth],size/8);
1596 break;
1597 case 'i':
1600 if (rdepth >= 1)
1603 printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n",
1604 id,
1606 type,
1607 repeat,
1608 id);
1611 if (rdepth == 2)
1613 printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n",
1614 id,
1616 type,
1617 repeat,
1618 id);
1623 if (size % 8)
1625 printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n",
1627 names[rdepth],
1628 size);
1630 else {
1631 printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n",
1633 names[rdepth],
1634 type,
1635 size/8);
1637 break;
1638 case 'o':
1639 printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type,size/8,size%8,id,names[rdepth]);
1640 break;
1641 case 'd':
1642 if (repeat)
1643 printf("\t/* repeat %s */\n", repeat);
1645 if (type[0] == 'I') {
1646 printf("\tint %s%s; \t/* %s */\n",ptr,id, desc);
1648 else if (type[0] =='C') {
1649 printf("\tchar %s*%s;\t /* %s */\n",ptr,id, desc);
1651 else {
1652 printf("\tbarray %s%s;\t /* %s */\n",ptr,id, desc);
1654 break;
1655 case 'c':
1656 printf("tabout();\n");
1657 printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc, id);
1659 if (type[0] == 'I')
1660 printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id,p);
1661 else if (type[0] == 'C')
1662 printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id,p);
1664 else if (type[0] == 'B')
1666 printf("\tpbarray(&ptr->%s%s);\n", id,p);
1668 else abort();
1669 break;
1672 break;
1674 case 18:
1675 #line 363 "sysinfo.y"
1676 { (yyval.s) = (yyvsp[(1) - (1)].s); }
1677 break;
1679 case 19:
1680 #line 364 "sysinfo.y"
1681 { (yyval.s) = "INT";}
1682 break;
1684 case 20:
1685 #line 369 "sysinfo.y"
1686 { (yyval.s) = (yyvsp[(2) - (3)].s); }
1687 break;
1689 case 21:
1690 #line 374 "sysinfo.y"
1691 { (yyval.i) = (yyvsp[(1) - (2)].i) * (yyvsp[(2) - (2)].i); }
1692 break;
1694 case 22:
1695 #line 379 "sysinfo.y"
1696 { (yyval.s) = (yyvsp[(2) - (3)].s); }
1697 break;
1699 case 23:
1700 #line 380 "sysinfo.y"
1701 { (yyval.s) = "dummy";}
1702 break;
1704 case 27:
1705 #line 388 "sysinfo.y"
1707 switch (writecode)
1709 case 'd':
1710 printf("#define %s %s\n", (yyvsp[(3) - (5)].s),(yyvsp[(4) - (5)].s));
1711 break;
1712 case 'c':
1713 printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],(yyvsp[(4) - (5)].s),(yyvsp[(3) - (5)].s));
1716 break;
1719 /* Line 1267 of yacc.c. */
1720 #line 1721 "sysinfo.c"
1721 default: break;
1723 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1725 YYPOPSTACK (yylen);
1726 yylen = 0;
1727 YY_STACK_PRINT (yyss, yyssp);
1729 *++yyvsp = yyval;
1732 /* Now `shift' the result of the reduction. Determine what state
1733 that goes to, based on the state we popped back to and the rule
1734 number reduced by. */
1736 yyn = yyr1[yyn];
1738 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1739 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1740 yystate = yytable[yystate];
1741 else
1742 yystate = yydefgoto[yyn - YYNTOKENS];
1744 goto yynewstate;
1747 /*------------------------------------.
1748 | yyerrlab -- here on detecting error |
1749 `------------------------------------*/
1750 yyerrlab:
1751 /* If not already recovering from an error, report this error. */
1752 if (!yyerrstatus)
1754 ++yynerrs;
1755 #if ! YYERROR_VERBOSE
1756 yyerror (YY_("syntax error"));
1757 #else
1759 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1760 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1762 YYSIZE_T yyalloc = 2 * yysize;
1763 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1764 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1765 if (yymsg != yymsgbuf)
1766 YYSTACK_FREE (yymsg);
1767 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1768 if (yymsg)
1769 yymsg_alloc = yyalloc;
1770 else
1772 yymsg = yymsgbuf;
1773 yymsg_alloc = sizeof yymsgbuf;
1777 if (0 < yysize && yysize <= yymsg_alloc)
1779 (void) yysyntax_error (yymsg, yystate, yychar);
1780 yyerror (yymsg);
1782 else
1784 yyerror (YY_("syntax error"));
1785 if (yysize != 0)
1786 goto yyexhaustedlab;
1789 #endif
1794 if (yyerrstatus == 3)
1796 /* If just tried and failed to reuse look-ahead token after an
1797 error, discard it. */
1799 if (yychar <= YYEOF)
1801 /* Return failure if at end of input. */
1802 if (yychar == YYEOF)
1803 YYABORT;
1805 else
1807 yydestruct ("Error: discarding",
1808 yytoken, &yylval);
1809 yychar = YYEMPTY;
1813 /* Else will try to reuse look-ahead token after shifting the error
1814 token. */
1815 goto yyerrlab1;
1818 /*---------------------------------------------------.
1819 | yyerrorlab -- error raised explicitly by YYERROR. |
1820 `---------------------------------------------------*/
1821 yyerrorlab:
1823 /* Pacify compilers like GCC when the user code never invokes
1824 YYERROR and the label yyerrorlab therefore never appears in user
1825 code. */
1826 if (/*CONSTCOND*/ 0)
1827 goto yyerrorlab;
1829 /* Do not reclaim the symbols of the rule which action triggered
1830 this YYERROR. */
1831 YYPOPSTACK (yylen);
1832 yylen = 0;
1833 YY_STACK_PRINT (yyss, yyssp);
1834 yystate = *yyssp;
1835 goto yyerrlab1;
1838 /*-------------------------------------------------------------.
1839 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1840 `-------------------------------------------------------------*/
1841 yyerrlab1:
1842 yyerrstatus = 3; /* Each real token shifted decrements this. */
1844 for (;;)
1846 yyn = yypact[yystate];
1847 if (yyn != YYPACT_NINF)
1849 yyn += YYTERROR;
1850 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1852 yyn = yytable[yyn];
1853 if (0 < yyn)
1854 break;
1858 /* Pop the current state because it cannot handle the error token. */
1859 if (yyssp == yyss)
1860 YYABORT;
1863 yydestruct ("Error: popping",
1864 yystos[yystate], yyvsp);
1865 YYPOPSTACK (1);
1866 yystate = *yyssp;
1867 YY_STACK_PRINT (yyss, yyssp);
1870 if (yyn == YYFINAL)
1871 YYACCEPT;
1873 *++yyvsp = yylval;
1876 /* Shift the error token. */
1877 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1879 yystate = yyn;
1880 goto yynewstate;
1883 /*-------------------------------------.
1884 | yyacceptlab -- YYACCEPT comes here. |
1885 `-------------------------------------*/
1886 yyacceptlab:
1887 yyresult = 0;
1888 goto yyreturn;
1890 /*-----------------------------------.
1891 | yyabortlab -- YYABORT comes here. |
1892 `-----------------------------------*/
1893 yyabortlab:
1894 yyresult = 1;
1895 goto yyreturn;
1897 #ifndef yyoverflow
1898 /*-------------------------------------------------.
1899 | yyexhaustedlab -- memory exhaustion comes here. |
1900 `-------------------------------------------------*/
1901 yyexhaustedlab:
1902 yyerror (YY_("memory exhausted"));
1903 yyresult = 2;
1904 /* Fall through. */
1905 #endif
1907 yyreturn:
1908 if (yychar != YYEOF && yychar != YYEMPTY)
1909 yydestruct ("Cleanup: discarding lookahead",
1910 yytoken, &yylval);
1911 /* Do not reclaim the symbols of the rule which action triggered
1912 this YYABORT or YYACCEPT. */
1913 YYPOPSTACK (yylen);
1914 YY_STACK_PRINT (yyss, yyssp);
1915 while (yyssp != yyss)
1917 yydestruct ("Cleanup: popping",
1918 yystos[*yyssp], yyvsp);
1919 YYPOPSTACK (1);
1921 #ifndef yyoverflow
1922 if (yyss != yyssa)
1923 YYSTACK_FREE (yyss);
1924 #endif
1925 #if YYERROR_VERBOSE
1926 if (yymsg != yymsgbuf)
1927 YYSTACK_FREE (yymsg);
1928 #endif
1929 /* Make sure YYID is used. */
1930 return YYID (yyresult);
1934 #line 403 "sysinfo.y"
1936 /* four modes
1938 -d write structure definitions for sysroff in host format
1939 -i write functions to swap into sysroff format in
1940 -o write functions to swap into sysroff format out
1941 -c write code to print info in human form */
1943 int yydebug;
1945 int
1946 main (int ac, char **av)
1948 yydebug=0;
1949 if (ac > 1)
1950 writecode = av[1][1];
1951 if (writecode == 'd')
1953 printf("typedef struct { unsigned char *data; int len; } barray; \n");
1954 printf("typedef int INT;\n");
1955 printf("typedef char * CHARS;\n");
1958 yyparse();
1959 return 0;
1962 static int
1963 yyerror (char *s)
1965 fprintf(stderr, "%s\n" , s);
1966 return 0;