xref: /netbsd-src/external/gpl3/binutils.old/dist/binutils/sysinfo.c (revision c38e7cc395b1472a774ff828e46123de44c628e9)
1 /* A Bison parser, made by GNU Bison 2.3.  */
2 
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7 
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.
12 
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.
17 
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.  */
22 
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.
32 
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35 
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38 
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.  */
45 
46 /* Identify Bison output.  */
47 #define YYBISON 1
48 
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51 
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54 
55 /* Pure parsers.  */
56 #define YYPURE 0
57 
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60 
61 
62 
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
75    };
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
84 
85 
86 
87 
88 /* Copy the first part of user declarations.  */
89 #line 21 "sysinfo.y"
90 
91 #include <stdio.h>
92 #include <stdlib.h>
93 
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[]= {"","*","**"};
103 
104 static int yyerror (char *s);
105 extern int yylex (void);
106 
107 
108 /* Enabling traces.  */
109 #ifndef YYDEBUG
110 # define YYDEBUG 0
111 #endif
112 
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
120 
121 /* Enabling the token table.  */
122 #ifndef YYTOKEN_TABLE
123 # define YYTOKEN_TABLE 0
124 #endif
125 
126 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
127 typedef union YYSTYPE
128 #line 40 "sysinfo.y"
129 {
130  int i;
131  char *s;
132 }
133 /* Line 193 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
140 
141 
142 
143 /* Copy the second part of user declarations.  */
144 
145 
146 /* Line 216 of yacc.c.  */
147 #line 148 "sysinfo.c"
148 
149 #ifdef short
150 # undef short
151 #endif
152 
153 #ifdef YYTYPE_UINT8
154 typedef YYTYPE_UINT8 yytype_uint8;
155 #else
156 typedef unsigned char yytype_uint8;
157 #endif
158 
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
167 
168 #ifdef YYTYPE_UINT16
169 typedef YYTYPE_UINT16 yytype_uint16;
170 #else
171 typedef unsigned short int yytype_uint16;
172 #endif
173 
174 #ifdef YYTYPE_INT16
175 typedef YYTYPE_INT16 yytype_int16;
176 #else
177 typedef short int yytype_int16;
178 #endif
179 
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
193 
194 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
195 
196 #ifndef YY_
197 # if defined YYENABLE_NLS && 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
207 
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
214 
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
228 {
229   return i;
230 }
231 #endif
232 
233 #if ! defined yyoverflow || YYERROR_VERBOSE
234 
235 /* The parser invokes alloca or malloc; define the necessary symbols.  */
236 
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
260 
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 */
301 
302 
303 #if (! defined yyoverflow \
304      && (! defined __cplusplus \
305 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
306 
307 /* A type that is properly aligned for any stack member.  */
308 union yyalloc
309 {
310   yytype_int16 yyss;
311   YYSTYPE yyvs;
312   };
313 
314 /* The size of the maximum gap between one aligned stack and the next.  */
315 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
316 
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)
322 
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					\
332 	{					\
333 	  YYSIZE_T yyi;				\
334 	  for (yyi = 0; yyi < (Count); yyi++)	\
335 	    (To)[yyi] = (From)[yyi];		\
336 	}					\
337       while (YYID (0))
338 #  endif
339 # endif
340 
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									\
348       {									\
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);				\
354       }									\
355     while (YYID (0))
356 
357 #endif
358 
359 /* YYFINAL -- State number of the termination state.  */
360 #define YYFINAL  3
361 /* YYLAST -- Last index in YYTABLE.  */
362 #define YYLAST   38
363 
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
372 
373 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
374 #define YYUNDEFTOK  2
375 #define YYMAXUTOK   263
376 
377 #define YYTRANSLATE(YYX)						\
378   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
379 
380 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
381 static const yytype_uint8 yytranslate[] =
382 {
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
410 };
411 
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[] =
416 {
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
420 };
421 
422 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
423 static const yytype_int8 yyrhs[] =
424 {
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
434 };
435 
436 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
437 static const yytype_uint16 yyrline[] =
438 {
439        0,    54,    54,    54,    92,    93,    98,    97,   169,   170,
440      171,   172,   176,   175,   223,   222,   250,   249,   357,   358,
441      362,   367,   373,   374,   377,   378,   380,   382
442 };
443 #endif
444 
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[] =
449 {
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
455 };
456 #endif
457 
458 # ifdef YYPRINT
459 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
460    token YYLEX-NUM.  */
461 static const yytype_uint16 yytoknum[] =
462 {
463        0,   256,   257,   258,   259,    40,    41,   260,   261,   262,
464      263
465 };
466 # endif
467 
468 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
469 static const yytype_uint8 yyr1[] =
470 {
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
474 };
475 
476 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
477 static const yytype_uint8 yyr2[] =
478 {
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
482 };
483 
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[] =
488 {
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
495 };
496 
497 /* YYDEFGOTO[NTERM-NUM].  */
498 static const yytype_int8 yydefgoto[] =
499 {
500       -1,     1,     2,     5,     6,    10,    12,    13,    29,    14,
501       28,    15,    44,    32,    19,    36,    42,    47,    48
502 };
503 
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[] =
508 {
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
515 };
516 
517 /* YYPGOTO[NTERM-NUM].  */
518 static const yytype_int8 yypgoto[] =
519 {
520      -14,   -14,   -14,    32,   -14,   -14,   -13,   -14,   -14,   -14,
521      -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14
522 };
523 
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[] =
530 {
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
535 };
536 
537 static const yytype_int8 yycheck[] =
538 {
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
543 };
544 
545 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
546    symbol of state STATE-NUM.  */
547 static const yytype_uint8 yystos[] =
548 {
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
555 };
556 
557 #define yyerrok		(yyerrstatus = 0)
558 #define yyclearin	(yychar = YYEMPTY)
559 #define YYEMPTY		(-2)
560 #define YYEOF		0
561 
562 #define YYACCEPT	goto yyacceptlab
563 #define YYABORT		goto yyabortlab
564 #define YYERROR		goto yyerrorlab
565 
566 
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.  */
570 
571 #define YYFAIL		goto yyerrlab
572 
573 #define YYRECOVERING()  (!!yyerrstatus)
574 
575 #define YYBACKUP(Token, Value)					\
576 do								\
577   if (yychar == YYEMPTY && yylen == 1)				\
578     {								\
579       yychar = (Token);						\
580       yylval = (Value);						\
581       yytoken = YYTRANSLATE (yychar);				\
582       YYPOPSTACK (1);						\
583       goto yybackup;						\
584     }								\
585   else								\
586     {								\
587       yyerror (YY_("syntax error: cannot back up")); \
588       YYERROR;							\
589     }								\
590 while (YYID (0))
591 
592 
593 #define YYTERROR	1
594 #define YYERRCODE	256
595 
596 
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).  */
600 
601 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
602 #ifndef YYLLOC_DEFAULT
603 # define YYLLOC_DEFAULT(Current, Rhs, N)				\
604     do									\
605       if (YYID (N))                                                    \
606 	{								\
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;	\
611 	}								\
612       else								\
613 	{								\
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;				\
618 	}								\
619     while (YYID (0))
620 #endif
621 
622 
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.  */
626 
627 #ifndef YY_LOCATION_PRINT
628 # if defined YYLTYPE_IS_TRIVIAL && 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
637 
638 
639 /* YYLEX -- calling `yylex' with the right arguments.  */
640 
641 #ifdef YYLEX_PARAM
642 # define YYLEX yylex (YYLEX_PARAM)
643 #else
644 # define YYLEX yylex ()
645 #endif
646 
647 /* Enable debugging if requested.  */
648 #if YYDEBUG
649 
650 # ifndef YYFPRINTF
651 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
652 #  define YYFPRINTF fprintf
653 # endif
654 
655 # define YYDPRINTF(Args)			\
656 do {						\
657   if (yydebug)					\
658     YYFPRINTF Args;				\
659 } while (YYID (0))
660 
661 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
662 do {									  \
663   if (yydebug)								  \
664     {									  \
665       YYFPRINTF (stderr, "%s ", Title);					  \
666       yy_symbol_print (stderr,						  \
667 		  Type, Value); \
668       YYFPRINTF (stderr, "\n");						  \
669     }									  \
670 } while (YYID (0))
671 
672 
673 /*--------------------------------.
674 | Print this symbol on YYOUTPUT.  |
675 `--------------------------------*/
676 
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
689 {
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)
699     {
700       default:
701 	break;
702     }
703 }
704 
705 
706 /*--------------------------------.
707 | Print this symbol on YYOUTPUT.  |
708 `--------------------------------*/
709 
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
721 {
722   if (yytype < YYNTOKENS)
723     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
724   else
725     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
726 
727   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
728   YYFPRINTF (yyoutput, ")");
729 }
730 
731 /*------------------------------------------------------------------.
732 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
733 | TOP (included).                                                   |
734 `------------------------------------------------------------------*/
735 
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
746 {
747   YYFPRINTF (stderr, "Stack now");
748   for (; bottom <= top; ++bottom)
749     YYFPRINTF (stderr, " %d", *bottom);
750   YYFPRINTF (stderr, "\n");
751 }
752 
753 # define YY_STACK_PRINT(Bottom, Top)				\
754 do {								\
755   if (yydebug)							\
756     yy_stack_print ((Bottom), (Top));				\
757 } while (YYID (0))
758 
759 
760 /*------------------------------------------------.
761 | Report that the YYRULE is going to be reduced.  |
762 `------------------------------------------------*/
763 
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
774 {
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++)
782     {
783       fprintf (stderr, "   $%d = ", yyi + 1);
784       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
785 		       &(yyvsp[(yyi + 1) - (yynrhs)])
786 		       		       );
787       fprintf (stderr, "\n");
788     }
789 }
790 
791 # define YY_REDUCE_PRINT(Rule)		\
792 do {					\
793   if (yydebug)				\
794     yy_reduce_print (yyvsp, Rule); \
795 } while (YYID (0))
796 
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 */
806 
807 
808 /* YYINITDEPTH -- initial size of the parser's stacks.  */
809 #ifndef	YYINITDEPTH
810 # define YYINITDEPTH 200
811 #endif
812 
813 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
814    if the built-in stack extension method is used).
815 
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.  */
819 
820 #ifndef YYMAXDEPTH
821 # define YYMAXDEPTH 10000
822 #endif
823 
824 
825 
826 #if YYERROR_VERBOSE
827 
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
842 {
843   YYSIZE_T yylen;
844   for (yylen = 0; yystr[yylen]; yylen++)
845     continue;
846   return yylen;
847 }
848 #  endif
849 # endif
850 
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
867 {
868   char *yyd = yydest;
869   const char *yys = yysrc;
870 
871   while ((*yyd++ = *yys++) != '\0')
872     continue;
873 
874   return yyd - 1;
875 }
876 #  endif
877 # endif
878 
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)
889 {
890   if (*yystr == '"')
891     {
892       YYSIZE_T yyn = 0;
893       char const *yyp = yystr;
894 
895       for (;;)
896 	switch (*++yyp)
897 	  {
898 	  case '\'':
899 	  case ',':
900 	    goto do_not_strip_quotes;
901 
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;
911 
912 	  case '"':
913 	    if (yyres)
914 	      yyres[yyn] = '\0';
915 	    return yyn;
916 	  }
917     do_not_strip_quotes: ;
918     }
919 
920   if (! yyres)
921     return yystrlen (yystr);
922 
923   return yystpcpy (yyres, yystr) - yyres;
924 }
925 # endif
926 
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)
936 {
937   int yyn = yypact[yystate];
938 
939   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
940     return 0;
941   else
942     {
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;
951 
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;
971 
972       /* Start YYX at -YYN if negative to avoid negative indexes in
973 	 YYCHECK.  */
974       int yyxbegin = yyn < 0 ? -yyn : 0;
975 
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;
980 
981       yyarg[0] = yytname[yytype];
982       yyfmt = yystpcpy (yyformat, yyunexpected);
983 
984       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
985 	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
986 	  {
987 	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
988 	      {
989 		yycount = 1;
990 		yysize = yysize0;
991 		yyformat[sizeof yyunexpected - 1] = '\0';
992 		break;
993 	      }
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;
1000 	  }
1001 
1002       yyf = YY_(yyformat);
1003       yysize1 = yysize + yystrlen (yyf);
1004       yysize_overflow |= (yysize1 < yysize);
1005       yysize = yysize1;
1006 
1007       if (yysize_overflow)
1008 	return YYSIZE_MAXIMUM;
1009 
1010       if (yyresult)
1011 	{
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')
1018 	    {
1019 	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1020 		{
1021 		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1022 		  yyf += 2;
1023 		}
1024 	      else
1025 		{
1026 		  yyp++;
1027 		  yyf++;
1028 		}
1029 	    }
1030 	}
1031       return yysize;
1032     }
1033 }
1034 #endif /* YYERROR_VERBOSE */
1035 
1036 
1037 /*-----------------------------------------------.
1038 | Release the memory associated to this symbol.  |
1039 `-----------------------------------------------*/
1040 
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
1053 {
1054   YYUSE (yyvaluep);
1055 
1056   if (!yymsg)
1057     yymsg = "Deleting";
1058   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1059 
1060   switch (yytype)
1061     {
1062 
1063       default:
1064 	break;
1065     }
1066 }
1067 
1068 
1069 /* Prevent warnings from -Wmissing-prototypes.  */
1070 
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 */
1084 
1085 
1086 
1087 /* The look-ahead symbol.  */
1088 int yychar;
1089 
1090 /* The semantic value of the look-ahead symbol.  */
1091 YYSTYPE yylval;
1092 
1093 /* Number of syntax errors so far.  */
1094 int yynerrs;
1095 
1096 
1097 
1098 /*----------.
1099 | yyparse.  |
1100 `----------*/
1101 
1102 #ifdef YYPARSE_PARAM
1103 #if (defined __STDC__ || defined __C99__FUNC__ \
1104      || defined __cplusplus || defined _MSC_VER)
1105 int
1106 yyparse (void *YYPARSE_PARAM)
1107 #else
1108 int
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)
1115 int
1116 yyparse (void)
1117 #else
1118 int
1119 yyparse ()
1120 
1121 #endif
1122 #endif
1123 {
1124 
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
1138 
1139   /* Three stacks and their tools:
1140      `yyss': related to states,
1141      `yyvs': related to semantic values,
1142      `yyls': related to locations.
1143 
1144      Refer to the stacks thru separate pointers, to allow yyoverflow
1145      to reallocate them elsewhere.  */
1146 
1147   /* The state stack.  */
1148   yytype_int16 yyssa[YYINITDEPTH];
1149   yytype_int16 *yyss = yyssa;
1150   yytype_int16 *yyssp;
1151 
1152   /* The semantic value stack.  */
1153   YYSTYPE yyvsa[YYINITDEPTH];
1154   YYSTYPE *yyvs = yyvsa;
1155   YYSTYPE *yyvsp;
1156 
1157 
1158 
1159 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1160 
1161   YYSIZE_T yystacksize = YYINITDEPTH;
1162 
1163   /* The variables used to return semantic value and location from the
1164      action routines.  */
1165   YYSTYPE yyval;
1166 
1167 
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;
1171 
1172   YYDPRINTF ((stderr, "Starting parse\n"));
1173 
1174   yystate = 0;
1175   yyerrstatus = 0;
1176   yynerrs = 0;
1177   yychar = YYEMPTY;		/* Cause a token to be read.  */
1178 
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.  */
1183 
1184   yyssp = yyss;
1185   yyvsp = yyvs;
1186 
1187   goto yysetstate;
1188 
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++;
1196 
1197  yysetstate:
1198   *yyssp = yystate;
1199 
1200   if (yyss + yystacksize - 1 <= yyssp)
1201     {
1202       /* Get the current used size of the three stacks, in elements.  */
1203       YYSIZE_T yysize = yyssp - yyss + 1;
1204 
1205 #ifdef yyoverflow
1206       {
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;
1212 
1213 
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),
1221 
1222 		    &yystacksize);
1223 
1224 	yyss = yyss1;
1225 	yyvs = yyvs1;
1226       }
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;
1237 
1238       {
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);
1246 
1247 #  undef YYSTACK_RELOCATE
1248 	if (yyss1 != yyssa)
1249 	  YYSTACK_FREE (yyss1);
1250       }
1251 # endif
1252 #endif /* no yyoverflow */
1253 
1254       yyssp = yyss + yysize - 1;
1255       yyvsp = yyvs + yysize - 1;
1256 
1257 
1258       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1259 		  (unsigned long int) yystacksize));
1260 
1261       if (yyss + yystacksize - 1 <= yyssp)
1262 	YYABORT;
1263     }
1264 
1265   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1266 
1267   goto yybackup;
1268 
1269 /*-----------.
1270 | yybackup.  |
1271 `-----------*/
1272 yybackup:
1273 
1274   /* Do appropriate processing given the current state.  Read a
1275      look-ahead token if we need one and don't already have one.  */
1276 
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;
1281 
1282   /* Not known => get a look-ahead token if don't already have one.  */
1283 
1284   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1285   if (yychar == YYEMPTY)
1286     {
1287       YYDPRINTF ((stderr, "Reading a token: "));
1288       yychar = YYLEX;
1289     }
1290 
1291   if (yychar <= YYEOF)
1292     {
1293       yychar = yytoken = YYEOF;
1294       YYDPRINTF ((stderr, "Now at end of input.\n"));
1295     }
1296   else
1297     {
1298       yytoken = YYTRANSLATE (yychar);
1299       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1300     }
1301 
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)
1309     {
1310       if (yyn == 0 || yyn == YYTABLE_NINF)
1311 	goto yyerrlab;
1312       yyn = -yyn;
1313       goto yyreduce;
1314     }
1315 
1316   if (yyn == YYFINAL)
1317     YYACCEPT;
1318 
1319   /* Count tokens shifted since error; after three, turn off error
1320      status.  */
1321   if (yyerrstatus)
1322     yyerrstatus--;
1323 
1324   /* Shift the look-ahead token.  */
1325   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1326 
1327   /* Discard the shifted token unless it is eof.  */
1328   if (yychar != YYEOF)
1329     yychar = YYEMPTY;
1330 
1331   yystate = yyn;
1332   *++yyvsp = yylval;
1333 
1334   goto yynewstate;
1335 
1336 
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;
1345 
1346 
1347 /*-----------------------------.
1348 | yyreduce -- Do a reduction.  |
1349 `-----------------------------*/
1350 yyreduce:
1351   /* yyn is the number of a rule to reduce with.  */
1352   yylen = yyr2[yyn];
1353 
1354   /* If YYLEN is nonzero, implement the default value of the action:
1355      `$$ = $1'.
1356 
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];
1363 
1364 
1365   YY_REDUCE_PRINT (yyn);
1366   switch (yyn)
1367     {
1368         case 2:
1369 #line 54 "sysinfo.y"
1370     {
1371   switch (writecode)
1372     {
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;
1390     }
1391  }
1392     break;
1393 
1394   case 3:
1395 #line 76 "sysinfo.y"
1396     {
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;
1406   }
1407 }
1408     break;
1409 
1410   case 6:
1411 #line 98 "sysinfo.y"
1412     {
1413 	it = (yyvsp[(2) - (3)].s); code = (yyvsp[(3) - (3)].i);
1414 	switch (writecode)
1415 	  {
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 (struct IT_%s *);\n",
1420 		   (yyvsp[(2) - (3)].s), it);
1421 	    printf("extern void sysroff_swap_%s_out (FILE *, struct IT_%s *);\n",
1422 		   (yyvsp[(2) - (3)].s), it);
1423 	    printf("extern void sysroff_print_%s_out (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 (struct IT_%s * ptr)\n",(yyvsp[(2) - (3)].s),it);
1429 	    printf("{\n");
1430 	    printf("\tunsigned char raw[255];\n");
1431 	    printf("\tint idx = 0;\n");
1432 	    printf("\tint size;\n");
1433 	    printf("\tmemset(raw,0,255);\n");
1434 	    printf("\tmemset(ptr,0,sizeof(*ptr));\n");
1435 	    printf("\tsize = fillup(raw);\n");
1436 	    break;
1437 	  case 'g':
1438 	    printf("void sysroff_swap_%s_out (FILE * ffile, struct IT_%s * ptr)\n",(yyvsp[(2) - (3)].s),it);
1439 	    printf("{\n");
1440 	    printf("\tunsigned char raw[255];\n");
1441 	    printf("\tint idx = 16;\n");
1442 	    printf("\tmemset (raw, 0, 255);\n");
1443 	    printf("\tcode = IT_%s_CODE;\n", it);
1444 	    break;
1445 	  case 'o':
1446 	    printf("void sysroff_swap_%s_out (bfd * abfd, struct IT_%s * ptr)\n",(yyvsp[(2) - (3)].s), it);
1447 	    printf("{\n");
1448 	    printf("\tint idx = 0;\n");
1449 	    break;
1450 	  case 'c':
1451 	    printf("void sysroff_print_%s_out (struct IT_%s *ptr)\n",(yyvsp[(2) - (3)].s),it);
1452 	    printf("{\n");
1453 	    printf("itheader(\"%s\", IT_%s_CODE);\n",(yyvsp[(2) - (3)].s),(yyvsp[(2) - (3)].s));
1454 	    break;
1455 
1456 	  case 't':
1457 	    break;
1458 	  }
1459 
1460       }
1461     break;
1462 
1463   case 7:
1464 #line 149 "sysinfo.y"
1465     {
1466   switch (writecode) {
1467   case 'd':
1468     printf("};\n");
1469     break;
1470   case 'g':
1471     printf("\tchecksum(ffile,raw, idx, IT_%s_CODE);\n", it);
1472 
1473   case 'i':
1474 
1475   case 'o':
1476   case 'c':
1477     printf("}\n");
1478   }
1479 }
1480     break;
1481 
1482   case 12:
1483 #line 176 "sysinfo.y"
1484     {
1485 	  rdepth++;
1486 	  switch (writecode)
1487 	    {
1488 	    case 'c':
1489 	      if (rdepth==1)
1490 	      printf("\tprintf(\"repeat %%d\\n\", %s);\n",(yyvsp[(3) - (3)].s));
1491 	      if (rdepth==2)
1492 	      printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",(yyvsp[(3) - (3)].s));
1493 	    case 'i':
1494 	    case 'g':
1495 	    case 'o':
1496 
1497 	      if (rdepth==1)
1498 		{
1499 	      printf("\t{ int n; for (n = 0; n < %s; n++) {\n",    (yyvsp[(3) - (3)].s));
1500 	    }
1501 	      if (rdepth == 2) {
1502 	      printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n",    (yyvsp[(3) - (3)].s));
1503 	    }
1504 
1505 	      break;
1506 	    }
1507 
1508 	  oldrepeat = repeat;
1509          repeat = (yyvsp[(3) - (3)].s);
1510 	}
1511     break;
1512 
1513   case 13:
1514 #line 206 "sysinfo.y"
1515     {
1516 	  repeat = oldrepeat;
1517 	  oldrepeat =0;
1518 	  rdepth--;
1519 	  switch (writecode)
1520 	    {
1521 	    case 'i':
1522 	    case 'g':
1523 	    case 'o':
1524 	    case 'c':
1525 	  printf("\t}}\n");
1526 	}
1527 	}
1528     break;
1529 
1530   case 14:
1531 #line 223 "sysinfo.y"
1532     {
1533 	  switch (writecode)
1534 	    {
1535 	    case 'i':
1536 	    case 'g':
1537 	    case 'o':
1538 	    case 'c':
1539 	      printf("\tif (%s) {\n", (yyvsp[(3) - (3)].s));
1540 	      break;
1541 	    }
1542 	}
1543     break;
1544 
1545   case 15:
1546 #line 236 "sysinfo.y"
1547     {
1548 	  switch (writecode)
1549 	    {
1550 	    case 'i':
1551 	    case 'g':
1552 	    case 'o':
1553 	    case 'c':
1554 	  printf("\t}\n");
1555 	}
1556 	}
1557     break;
1558 
1559   case 16:
1560 #line 250 "sysinfo.y"
1561     {name = (yyvsp[(7) - (7)].s); }
1562     break;
1563 
1564   case 17:
1565 #line 252 "sysinfo.y"
1566     {
1567 	  char *desc = (yyvsp[(2) - (10)].s);
1568 	  char *type = (yyvsp[(4) - (10)].s);
1569 	  int size = (yyvsp[(5) - (10)].i);
1570 	  char *id = (yyvsp[(7) - (10)].s);
1571 char *p = names[rdepth];
1572 char *ptr = pnames[rdepth];
1573 	  switch (writecode)
1574 	    {
1575 	    case 'g':
1576 	      if (size % 8)
1577 		{
1578 
1579 		  printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n",
1580 			 id,
1581 			 names[rdepth], size);
1582 
1583 		}
1584 	      else {
1585 		printf("\twrite%s(ptr->%s%s,raw,&idx,%d,ffile);\n",
1586 		       type,
1587 		       id,
1588 		       names[rdepth],size/8);
1589 		}
1590 	      break;
1591 	    case 'i':
1592 	      {
1593 
1594 		if (rdepth >= 1)
1595 
1596 		  {
1597 		    printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n",
1598 			   id,
1599 			   id,
1600 			   type,
1601 			   repeat,
1602 			   id);
1603 		  }
1604 
1605 		if (rdepth == 2)
1606 		  {
1607 		    printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n",
1608 			   id,
1609 			   id,
1610 			   type,
1611 			   repeat,
1612 			   id);
1613 		  }
1614 
1615 	      }
1616 
1617 	      if (size % 8)
1618 		{
1619 		  printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n",
1620 			 id,
1621 			 names[rdepth],
1622 			 size);
1623 		}
1624 	      else {
1625 		printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n",
1626 		       id,
1627 		       names[rdepth],
1628 		       type,
1629 		       size/8);
1630 		}
1631 	      break;
1632 	    case 'o':
1633 	      printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type,size/8,size%8,id,names[rdepth]);
1634 	      break;
1635 	    case 'd':
1636 	      if (repeat)
1637 		printf("\t/* repeat %s */\n", repeat);
1638 
1639 		  if (type[0] == 'I') {
1640 		  printf("\tint %s%s; \t/* %s */\n",ptr,id, desc);
1641 		}
1642 		  else if (type[0] =='C') {
1643 		  printf("\tchar %s*%s;\t /* %s */\n",ptr,id, desc);
1644 		}
1645 	      else {
1646 		printf("\tbarray %s%s;\t /* %s */\n",ptr,id, desc);
1647 	      }
1648 		  break;
1649 		case 'c':
1650 	      printf("tabout();\n");
1651 		  printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc, id);
1652 
1653 		  if (type[0] == 'I')
1654 		  printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id,p);
1655 		  else   if (type[0] == 'C')
1656 		  printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id,p);
1657 
1658 		  else   if (type[0] == 'B')
1659 		    {
1660 		  printf("\tpbarray(&ptr->%s%s);\n", id,p);
1661 		}
1662 	      else abort();
1663 		  break;
1664 		}
1665 	}
1666     break;
1667 
1668   case 18:
1669 #line 357 "sysinfo.y"
1670     { (yyval.s) = (yyvsp[(1) - (1)].s); }
1671     break;
1672 
1673   case 19:
1674 #line 358 "sysinfo.y"
1675     { (yyval.s) = "INT";}
1676     break;
1677 
1678   case 20:
1679 #line 363 "sysinfo.y"
1680     { (yyval.s) = (yyvsp[(2) - (3)].s); }
1681     break;
1682 
1683   case 21:
1684 #line 368 "sysinfo.y"
1685     { (yyval.i) = (yyvsp[(1) - (2)].i) * (yyvsp[(2) - (2)].i); }
1686     break;
1687 
1688   case 22:
1689 #line 373 "sysinfo.y"
1690     { (yyval.s) = (yyvsp[(2) - (3)].s); }
1691     break;
1692 
1693   case 23:
1694 #line 374 "sysinfo.y"
1695     { (yyval.s) = "dummy";}
1696     break;
1697 
1698   case 27:
1699 #line 382 "sysinfo.y"
1700     {
1701 	  switch (writecode)
1702 	    {
1703 	    case 'd':
1704 	      printf("#define %s %s\n", (yyvsp[(3) - (5)].s),(yyvsp[(4) - (5)].s));
1705 	      break;
1706 	    case 'c':
1707 		printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],(yyvsp[(4) - (5)].s),(yyvsp[(3) - (5)].s));
1708 	    }
1709 	}
1710     break;
1711 
1712 
1713 /* Line 1267 of yacc.c.  */
1714 #line 1715 "sysinfo.c"
1715       default: break;
1716     }
1717   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1718 
1719   YYPOPSTACK (yylen);
1720   yylen = 0;
1721   YY_STACK_PRINT (yyss, yyssp);
1722 
1723   *++yyvsp = yyval;
1724 
1725 
1726   /* Now `shift' the result of the reduction.  Determine what state
1727      that goes to, based on the state we popped back to and the rule
1728      number reduced by.  */
1729 
1730   yyn = yyr1[yyn];
1731 
1732   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1733   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1734     yystate = yytable[yystate];
1735   else
1736     yystate = yydefgoto[yyn - YYNTOKENS];
1737 
1738   goto yynewstate;
1739 
1740 
1741 /*------------------------------------.
1742 | yyerrlab -- here on detecting error |
1743 `------------------------------------*/
1744 yyerrlab:
1745   /* If not already recovering from an error, report this error.  */
1746   if (!yyerrstatus)
1747     {
1748       ++yynerrs;
1749 #if ! YYERROR_VERBOSE
1750       yyerror (YY_("syntax error"));
1751 #else
1752       {
1753 	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1754 	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1755 	  {
1756 	    YYSIZE_T yyalloc = 2 * yysize;
1757 	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1758 	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
1759 	    if (yymsg != yymsgbuf)
1760 	      YYSTACK_FREE (yymsg);
1761 	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1762 	    if (yymsg)
1763 	      yymsg_alloc = yyalloc;
1764 	    else
1765 	      {
1766 		yymsg = yymsgbuf;
1767 		yymsg_alloc = sizeof yymsgbuf;
1768 	      }
1769 	  }
1770 
1771 	if (0 < yysize && yysize <= yymsg_alloc)
1772 	  {
1773 	    (void) yysyntax_error (yymsg, yystate, yychar);
1774 	    yyerror (yymsg);
1775 	  }
1776 	else
1777 	  {
1778 	    yyerror (YY_("syntax error"));
1779 	    if (yysize != 0)
1780 	      goto yyexhaustedlab;
1781 	  }
1782       }
1783 #endif
1784     }
1785 
1786 
1787 
1788   if (yyerrstatus == 3)
1789     {
1790       /* If just tried and failed to reuse look-ahead token after an
1791 	 error, discard it.  */
1792 
1793       if (yychar <= YYEOF)
1794 	{
1795 	  /* Return failure if at end of input.  */
1796 	  if (yychar == YYEOF)
1797 	    YYABORT;
1798 	}
1799       else
1800 	{
1801 	  yydestruct ("Error: discarding",
1802 		      yytoken, &yylval);
1803 	  yychar = YYEMPTY;
1804 	}
1805     }
1806 
1807   /* Else will try to reuse look-ahead token after shifting the error
1808      token.  */
1809   goto yyerrlab1;
1810 
1811 
1812 /*---------------------------------------------------.
1813 | yyerrorlab -- error raised explicitly by YYERROR.  |
1814 `---------------------------------------------------*/
1815 yyerrorlab:
1816 
1817   /* Pacify compilers like GCC when the user code never invokes
1818      YYERROR and the label yyerrorlab therefore never appears in user
1819      code.  */
1820   if (/*CONSTCOND*/ 0)
1821      goto yyerrorlab;
1822 
1823   /* Do not reclaim the symbols of the rule which action triggered
1824      this YYERROR.  */
1825   YYPOPSTACK (yylen);
1826   yylen = 0;
1827   YY_STACK_PRINT (yyss, yyssp);
1828   yystate = *yyssp;
1829   goto yyerrlab1;
1830 
1831 
1832 /*-------------------------------------------------------------.
1833 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1834 `-------------------------------------------------------------*/
1835 yyerrlab1:
1836   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
1837 
1838   for (;;)
1839     {
1840       yyn = yypact[yystate];
1841       if (yyn != YYPACT_NINF)
1842 	{
1843 	  yyn += YYTERROR;
1844 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1845 	    {
1846 	      yyn = yytable[yyn];
1847 	      if (0 < yyn)
1848 		break;
1849 	    }
1850 	}
1851 
1852       /* Pop the current state because it cannot handle the error token.  */
1853       if (yyssp == yyss)
1854 	YYABORT;
1855 
1856 
1857       yydestruct ("Error: popping",
1858 		  yystos[yystate], yyvsp);
1859       YYPOPSTACK (1);
1860       yystate = *yyssp;
1861       YY_STACK_PRINT (yyss, yyssp);
1862     }
1863 
1864   if (yyn == YYFINAL)
1865     YYACCEPT;
1866 
1867   *++yyvsp = yylval;
1868 
1869 
1870   /* Shift the error token.  */
1871   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1872 
1873   yystate = yyn;
1874   goto yynewstate;
1875 
1876 
1877 /*-------------------------------------.
1878 | yyacceptlab -- YYACCEPT comes here.  |
1879 `-------------------------------------*/
1880 yyacceptlab:
1881   yyresult = 0;
1882   goto yyreturn;
1883 
1884 /*-----------------------------------.
1885 | yyabortlab -- YYABORT comes here.  |
1886 `-----------------------------------*/
1887 yyabortlab:
1888   yyresult = 1;
1889   goto yyreturn;
1890 
1891 #ifndef yyoverflow
1892 /*-------------------------------------------------.
1893 | yyexhaustedlab -- memory exhaustion comes here.  |
1894 `-------------------------------------------------*/
1895 yyexhaustedlab:
1896   yyerror (YY_("memory exhausted"));
1897   yyresult = 2;
1898   /* Fall through.  */
1899 #endif
1900 
1901 yyreturn:
1902   if (yychar != YYEOF && yychar != YYEMPTY)
1903      yydestruct ("Cleanup: discarding lookahead",
1904 		 yytoken, &yylval);
1905   /* Do not reclaim the symbols of the rule which action triggered
1906      this YYABORT or YYACCEPT.  */
1907   YYPOPSTACK (yylen);
1908   YY_STACK_PRINT (yyss, yyssp);
1909   while (yyssp != yyss)
1910     {
1911       yydestruct ("Cleanup: popping",
1912 		  yystos[*yyssp], yyvsp);
1913       YYPOPSTACK (1);
1914     }
1915 #ifndef yyoverflow
1916   if (yyss != yyssa)
1917     YYSTACK_FREE (yyss);
1918 #endif
1919 #if YYERROR_VERBOSE
1920   if (yymsg != yymsgbuf)
1921     YYSTACK_FREE (yymsg);
1922 #endif
1923   /* Make sure YYID is used.  */
1924   return YYID (yyresult);
1925 }
1926 
1927 
1928 #line 397 "sysinfo.y"
1929 
1930 /* four modes
1931 
1932    -d write structure definitions for sysroff in host format
1933    -i write functions to swap into sysroff format in
1934    -o write functions to swap into sysroff format out
1935    -c write code to print info in human form */
1936 
1937 int yydebug;
1938 
1939 int
1940 main (int ac, char **av)
1941 {
1942   yydebug=0;
1943   if (ac > 1)
1944     writecode = av[1][1];
1945 if (writecode == 'd')
1946   {
1947     printf("typedef struct { unsigned char *data; int len; } barray; \n");
1948     printf("typedef  int INT;\n");
1949     printf("typedef  char * CHARS;\n");
1950 
1951   }
1952   yyparse();
1953 return 0;
1954 }
1955 
1956 static int
1957 yyerror (char *s)
1958 {
1959   fprintf(stderr, "%s\n" , s);
1960   return 0;
1961 }
1962 
1963