OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [binutils/] [sysinfo.c] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* A Bison parser, made by GNU Bison 1.875c.  */
2
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2, or (at your option)
9
   any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
/* As a special exception, when this file is copied by Bison into a
22
   Bison output file, you may use that output file without restriction.
23
   This special exception was added by the Free Software Foundation
24
   in version 1.24 of Bison.  */
25
 
26
/* Written by Richard Stallman by simplifying the original so called
27
   ``semantic'' parser.  */
28
 
29
/* All symbols defined below should begin with yy or YY, to avoid
30
   infringing on user name space.  This should be done even for local
31
   variables, as they might otherwise be expanded by user macros.
32
   There are some unavoidable exceptions within include files to
33
   define necessary library symbols; they are noted "INFRINGES ON
34
   USER NAME SPACE" below.  */
35
 
36
/* Identify Bison output.  */
37
#define YYBISON 1
38
 
39
/* Skeleton name.  */
40
#define YYSKELETON_NAME "yacc.c"
41
 
42
/* Pure parsers.  */
43
#define YYPURE 0
44
 
45
/* Using locations.  */
46
#define YYLSP_NEEDED 0
47
 
48
 
49
 
50
/* Tokens.  */
51
#ifndef YYTOKENTYPE
52
# define YYTOKENTYPE
53
   /* Put the tokens into the symbol table, so that GDB and other debuggers
54
      know about them.  */
55
   enum yytokentype {
56
     COND = 258,
57
     REPEAT = 259,
58
     TYPE = 260,
59
     NAME = 261,
60
     NUMBER = 262,
61
     UNIT = 263
62
   };
63
#endif
64
#define COND 258
65
#define REPEAT 259
66
#define TYPE 260
67
#define NAME 261
68
#define NUMBER 262
69
#define UNIT 263
70
 
71
 
72
 
73
 
74
/* Copy the first part of user declarations.  */
75
#line 21 "sysinfo.y"
76
 
77
#include <stdio.h>
78
#include <stdlib.h>
79
 
80
static char writecode;
81
static char *it;
82
static int code;
83
static char * repeat;
84
static char *oldrepeat;
85
static char *name;
86
static int rdepth;
87
static char *names[] = {" ","[n]","[n][m]"};
88
static char *pnames[]= {"","*","**"};
89
 
90
static int yyerror (char *s);
91
extern int yylex (void);
92
 
93
 
94
/* Enabling traces.  */
95
#ifndef YYDEBUG
96
# define YYDEBUG 0
97
#endif
98
 
99
/* Enabling verbose error messages.  */
100
#ifdef YYERROR_VERBOSE
101
# undef YYERROR_VERBOSE
102
# define YYERROR_VERBOSE 1
103
#else
104
# define YYERROR_VERBOSE 0
105
#endif
106
 
107
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
108
#line 40 "sysinfo.y"
109
typedef union YYSTYPE {
110
 int i;
111
 char *s;
112
} YYSTYPE;
113
/* Line 191 of yacc.c.  */
114
#line 115 "sysinfo.c"
115
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
116
# define YYSTYPE_IS_DECLARED 1
117
# define YYSTYPE_IS_TRIVIAL 1
118
#endif
119
 
120
 
121
 
122
/* Copy the second part of user declarations.  */
123
 
124
 
125
/* Line 214 of yacc.c.  */
126
#line 127 "sysinfo.c"
127
 
128
#if ! defined (yyoverflow) || YYERROR_VERBOSE
129
 
130
# ifndef YYFREE
131
#  define YYFREE free
132
# endif
133
# ifndef YYMALLOC
134
#  define YYMALLOC malloc
135
# endif
136
 
137
/* The parser invokes alloca or malloc; define the necessary symbols.  */
138
 
139
# ifdef YYSTACK_USE_ALLOCA
140
#  if YYSTACK_USE_ALLOCA
141
#   define YYSTACK_ALLOC alloca
142
#  endif
143
# else
144
#  if defined (alloca) || defined (_ALLOCA_H)
145
#   define YYSTACK_ALLOC alloca
146
#  else
147
#   ifdef __GNUC__
148
#    define YYSTACK_ALLOC __builtin_alloca
149
#   endif
150
#  endif
151
# endif
152
 
153
# ifdef YYSTACK_ALLOC
154
   /* Pacify GCC's `empty if-body' warning. */
155
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
156
# else
157
#  if defined (__STDC__) || defined (__cplusplus)
158
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
159
#   define YYSIZE_T size_t
160
#  endif
161
#  define YYSTACK_ALLOC YYMALLOC
162
#  define YYSTACK_FREE YYFREE
163
# endif
164
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
165
 
166
 
167
#if (! defined (yyoverflow) \
168
     && (! defined (__cplusplus) \
169
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
170
 
171
/* A type that is properly aligned for any stack member.  */
172
union yyalloc
173
{
174
  short yyss;
175
  YYSTYPE yyvs;
176
  };
177
 
178
/* The size of the maximum gap between one aligned stack and the next.  */
179
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
180
 
181
/* The size of an array large to enough to hold all stacks, each with
182
   N elements.  */
183
# define YYSTACK_BYTES(N) \
184
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
185
      + YYSTACK_GAP_MAXIMUM)
186
 
187
/* Copy COUNT objects from FROM to TO.  The source and destination do
188
   not overlap.  */
189
# ifndef YYCOPY
190
#  if defined (__GNUC__) && 1 < __GNUC__
191
#   define YYCOPY(To, From, Count) \
192
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
193
#  else
194
#   define YYCOPY(To, From, Count)              \
195
      do                                        \
196
        {                                       \
197
          register YYSIZE_T yyi;                \
198
          for (yyi = 0; yyi < (Count); yyi++)    \
199
            (To)[yyi] = (From)[yyi];            \
200
        }                                       \
201
      while (0)
202
#  endif
203
# endif
204
 
205
/* Relocate STACK from its old location to the new one.  The
206
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
207
   elements in the stack, and YYPTR gives the new location of the
208
   stack.  Advance YYPTR to a properly aligned location for the next
209
   stack.  */
210
# define YYSTACK_RELOCATE(Stack)                                        \
211
    do                                                                  \
212
      {                                                                 \
213
        YYSIZE_T yynewbytes;                                            \
214
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
215
        Stack = &yyptr->Stack;                                          \
216
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
217
        yyptr += yynewbytes / sizeof (*yyptr);                          \
218
      }                                                                 \
219
    while (0)
220
 
221
#endif
222
 
223
#if defined (__STDC__) || defined (__cplusplus)
224
   typedef signed char yysigned_char;
225
#else
226
   typedef short yysigned_char;
227
#endif
228
 
229
/* YYFINAL -- State number of the termination state. */
230
#define YYFINAL  3
231
/* YYLAST -- Last index in YYTABLE.  */
232
#define YYLAST   38
233
 
234
/* YYNTOKENS -- Number of terminals. */
235
#define YYNTOKENS  11
236
/* YYNNTS -- Number of nonterminals. */
237
#define YYNNTS  19
238
/* YYNRULES -- Number of rules. */
239
#define YYNRULES  27
240
/* YYNRULES -- Number of states. */
241
#define YYNSTATES  55
242
 
243
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
244
#define YYUNDEFTOK  2
245
#define YYMAXUTOK   263
246
 
247
#define YYTRANSLATE(YYX)                                                \
248
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
249
 
250
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
251
static const unsigned char yytranslate[] =
252
{
253
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
254
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
255
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
256
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
257
       5,     6,     2,     2,     2,     2,     2,     2,     2,     2,
258
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
259
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
260
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
261
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
262
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
263
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
264
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
265
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
266
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
267
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
268
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
269
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
270
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
271
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
272
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
273
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
274
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
275
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
276
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
277
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
278
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
279
       7,     8,     9,    10
280
};
281
 
282
#if YYDEBUG
283
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
284
   YYRHS.  */
285
static const unsigned char yyprhs[] =
286
{
287
       0,     0,     3,     4,     7,    10,    11,    12,    19,    22,
288
      25,    28,    29,    30,    37,    38,    45,    46,    57,    59,
289
      60,    64,    67,    71,    72,    73,    77,    78
290
};
291
 
292
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
293
static const yysigned_char yyrhs[] =
294
{
295
      12,     0,    -1,    -1,    13,    14,    -1,    15,    14,    -1,
296
      -1,    -1,     5,     8,     9,    16,    17,     6,    -1,    22,
297
      17,    -1,    20,    17,    -1,    18,    17,    -1,    -1,    -1,
298
       5,     4,     8,    19,    17,     6,    -1,    -1,     5,     3,
299
       8,    21,    17,     6,    -1,    -1,     5,    25,     5,    24,
300
      26,     6,    27,    23,    28,     6,    -1,     7,    -1,    -1,
301
       5,     8,     6,    -1,     9,    10,    -1,     5,     8,     6,
302
      -1,    -1,    -1,     5,    29,     6,    -1,    -1,    29,     5,
303
       8,     8,     6,    -1
304
};
305
 
306
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
307
static const unsigned short yyrline[] =
308
{
309
       0,    54,    54,    54,    92,    93,    98,    97,   175,   176,
310
     177,   178,   182,   181,   229,   228,   256,   255,   363,   364,
311
     368,   373,   379,   380,   383,   384,   386,   388
312
};
313
#endif
314
 
315
#if YYDEBUG || YYERROR_VERBOSE
316
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
317
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
318
static const char *const yytname[] =
319
{
320
  "$end", "error", "$undefined", "COND", "REPEAT", "'('", "')'", "TYPE",
321
  "NAME", "NUMBER", "UNIT", "$accept", "top", "@1", "it_list", "it", "@2",
322
  "it_field_list", "repeat_it_field", "@3", "cond_it_field", "@4",
323
  "it_field", "@5", "attr_type", "attr_desc", "attr_size", "attr_id",
324
  "enums", "enum_list", 0
325
};
326
#endif
327
 
328
# ifdef YYPRINT
329
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
330
   token YYLEX-NUM.  */
331
static const unsigned short yytoknum[] =
332
{
333
       0,   256,   257,   258,   259,    40,    41,   260,   261,   262,
334
     263
335
};
336
# endif
337
 
338
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
339
static const unsigned char yyr1[] =
340
{
341
       0,    11,    13,    12,    14,    14,    16,    15,    17,    17,
342
      17,    17,    19,    18,    21,    20,    23,    22,    24,    24,
343
      25,    26,    27,    27,    28,    28,    29,    29
344
};
345
 
346
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
347
static const unsigned char yyr2[] =
348
{
349
       0,     2,     0,     2,     2,     0,     0,     6,     2,     2,
350
       2,     0,     0,     6,     0,     6,     0,    10,     1,     0,
351
       3,     2,     3,     0,     0,     3,     0,     5
352
};
353
 
354
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
355
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
356
   means the default is an error.  */
357
static const unsigned char yydefact[] =
358
{
359
       2,     0,     5,     1,     0,     3,     5,     0,     4,     6,
360
      11,     0,     0,    11,    11,    11,     0,     0,     0,     0,
361
       7,    10,     9,     8,    14,    12,     0,    19,    11,    11,
362
      20,    18,     0,     0,     0,     0,     0,    15,    13,    21,
363
      23,     0,    16,     0,    24,    22,    26,     0,     0,    17,
364
       0,    25,     0,     0,    27
365
};
366
 
367
/* YYDEFGOTO[NTERM-NUM]. */
368
static const yysigned_char yydefgoto[] =
369
{
370
      -1,     1,     2,     5,     6,    10,    12,    13,    29,    14,
371
      28,    15,    44,    32,    19,    36,    42,    47,    48
372
};
373
 
374
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
375
   STATE-NUM.  */
376
#define YYPACT_NINF -14
377
static const yysigned_char yypact[] =
378
{
379
     -14,     8,     4,   -14,     2,   -14,     4,     3,   -14,   -14,
380
       6,     0,     7,     6,     6,     6,     9,    10,    11,    15,
381
     -14,   -14,   -14,   -14,   -14,   -14,    16,    14,     6,     6,
382
     -14,   -14,     5,    17,    18,    19,    20,   -14,   -14,   -14,
383
      22,    23,   -14,    24,    27,   -14,   -14,    28,     1,   -14,
384
      25,   -14,    29,    30,   -14
385
};
386
 
387
/* YYPGOTO[NTERM-NUM].  */
388
static const yysigned_char yypgoto[] =
389
{
390
     -14,   -14,   -14,    32,   -14,   -14,   -13,   -14,   -14,   -14,
391
     -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14
392
};
393
 
394
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
395
   positive, shift that token.  If negative, reduce the rule which
396
   number is the opposite.  If zero, do what YYDEFACT says.
397
   If YYTABLE_NINF, syntax error.  */
398
#define YYTABLE_NINF -1
399
static const unsigned char yytable[] =
400
{
401
      21,    22,    23,    16,    17,    18,    50,    51,     3,     4,
402
       7,    11,     9,    20,    35,    33,    34,    24,    25,    26,
403
      27,    31,    30,    37,    38,     0,    40,    41,     0,    39,
404
      45,    43,    46,    52,    49,     0,    54,    53,     8
405
};
406
 
407
static const yysigned_char yycheck[] =
408
{
409
      13,    14,    15,     3,     4,     5,     5,     6,     0,     5,
410
       8,     5,     9,     6,     9,    28,    29,     8,     8,     8,
411
       5,     7,     6,     6,     6,    -1,     6,     5,    -1,    10,
412
       6,     8,     5,     8,     6,    -1,     6,     8,     6
413
};
414
 
415
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
416
   symbol of state STATE-NUM.  */
417
static const unsigned char yystos[] =
418
{
419
       0,    12,    13,     0,     5,    14,    15,     8,    14,     9,
420
      16,     5,    17,    18,    20,    22,     3,     4,     5,    25,
421
       6,    17,    17,    17,     8,     8,     8,     5,    21,    19,
422
       6,     7,    24,    17,    17,     9,    26,     6,     6,    10,
423
       6,     5,    27,     8,    23,     6,     5,    28,    29,     6,
424
       5,     6,     8,     8,     6
425
};
426
 
427
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
428
# define YYSIZE_T __SIZE_TYPE__
429
#endif
430
#if ! defined (YYSIZE_T) && defined (size_t)
431
# define YYSIZE_T size_t
432
#endif
433
#if ! defined (YYSIZE_T)
434
# if defined (__STDC__) || defined (__cplusplus)
435
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
436
#  define YYSIZE_T size_t
437
# endif
438
#endif
439
#if ! defined (YYSIZE_T)
440
# define YYSIZE_T unsigned int
441
#endif
442
 
443
#define yyerrok         (yyerrstatus = 0)
444
#define yyclearin       (yychar = YYEMPTY)
445
#define YYEMPTY         (-2)
446
#define YYEOF           0
447
 
448
#define YYACCEPT        goto yyacceptlab
449
#define YYABORT         goto yyabortlab
450
#define YYERROR         goto yyerrorlab
451
 
452
 
453
/* Like YYERROR except do call yyerror.  This remains here temporarily
454
   to ease the transition to the new meaning of YYERROR, for GCC.
455
   Once GCC version 2 has supplanted version 1, this can go.  */
456
 
457
#define YYFAIL          goto yyerrlab
458
 
459
#define YYRECOVERING()  (!!yyerrstatus)
460
 
461
#define YYBACKUP(Token, Value)                                  \
462
do                                                              \
463
  if (yychar == YYEMPTY && yylen == 1)                          \
464
    {                                                           \
465
      yychar = (Token);                                         \
466
      yylval = (Value);                                         \
467
      yytoken = YYTRANSLATE (yychar);                           \
468
      YYPOPSTACK;                                               \
469
      goto yybackup;                                            \
470
    }                                                           \
471
  else                                                          \
472
    {                                                           \
473
      yyerror ("syntax error: cannot back up");\
474
      YYERROR;                                                  \
475
    }                                                           \
476
while (0)
477
 
478
#define YYTERROR        1
479
#define YYERRCODE       256
480
 
481
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
482
   are run).  */
483
 
484
#ifndef YYLLOC_DEFAULT
485
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
486
   ((Current).first_line   = (Rhs)[1].first_line,       \
487
    (Current).first_column = (Rhs)[1].first_column,     \
488
    (Current).last_line    = (Rhs)[N].last_line,        \
489
    (Current).last_column  = (Rhs)[N].last_column)
490
#endif
491
 
492
/* YYLEX -- calling `yylex' with the right arguments.  */
493
 
494
#ifdef YYLEX_PARAM
495
# define YYLEX yylex (YYLEX_PARAM)
496
#else
497
# define YYLEX yylex ()
498
#endif
499
 
500
/* Enable debugging if requested.  */
501
#if YYDEBUG
502
 
503
# ifndef YYFPRINTF
504
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
505
#  define YYFPRINTF fprintf
506
# endif
507
 
508
# define YYDPRINTF(Args)                        \
509
do {                                            \
510
  if (yydebug)                                  \
511
    YYFPRINTF Args;                             \
512
} while (0)
513
 
514
# define YYDSYMPRINT(Args)                      \
515
do {                                            \
516
  if (yydebug)                                  \
517
    yysymprint Args;                            \
518
} while (0)
519
 
520
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
521
do {                                                            \
522
  if (yydebug)                                                  \
523
    {                                                           \
524
      YYFPRINTF (stderr, "%s ", Title);                         \
525
      yysymprint (stderr,                                       \
526
                  Token, Value);        \
527
      YYFPRINTF (stderr, "\n");                                 \
528
    }                                                           \
529
} while (0)
530
 
531
/*------------------------------------------------------------------.
532
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
533
| TOP (included).                                                   |
534
`------------------------------------------------------------------*/
535
 
536
#if defined (__STDC__) || defined (__cplusplus)
537
static void
538
yy_stack_print (short *bottom, short *top)
539
#else
540
static void
541
yy_stack_print (bottom, top)
542
    short *bottom;
543
    short *top;
544
#endif
545
{
546
  YYFPRINTF (stderr, "Stack now");
547
  for (/* Nothing. */; bottom <= top; ++bottom)
548
    YYFPRINTF (stderr, " %d", *bottom);
549
  YYFPRINTF (stderr, "\n");
550
}
551
 
552
# define YY_STACK_PRINT(Bottom, Top)                            \
553
do {                                                            \
554
  if (yydebug)                                                  \
555
    yy_stack_print ((Bottom), (Top));                           \
556
} while (0)
557
 
558
 
559
/*------------------------------------------------.
560
| Report that the YYRULE is going to be reduced.  |
561
`------------------------------------------------*/
562
 
563
#if defined (__STDC__) || defined (__cplusplus)
564
static void
565
yy_reduce_print (int yyrule)
566
#else
567
static void
568
yy_reduce_print (yyrule)
569
    int yyrule;
570
#endif
571
{
572
  int yyi;
573
  unsigned int yylno = yyrline[yyrule];
574
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
575
             yyrule - 1, yylno);
576
  /* Print the symbols being reduced, and their result.  */
577
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
578
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
579
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
580
}
581
 
582
# define YY_REDUCE_PRINT(Rule)          \
583
do {                                    \
584
  if (yydebug)                          \
585
    yy_reduce_print (Rule);             \
586
} while (0)
587
 
588
/* Nonzero means print parse trace.  It is left uninitialized so that
589
   multiple parsers can coexist.  */
590
int yydebug;
591
#else /* !YYDEBUG */
592
# define YYDPRINTF(Args)
593
# define YYDSYMPRINT(Args)
594
# define YYDSYMPRINTF(Title, Token, Value, Location)
595
# define YY_STACK_PRINT(Bottom, Top)
596
# define YY_REDUCE_PRINT(Rule)
597
#endif /* !YYDEBUG */
598
 
599
 
600
/* YYINITDEPTH -- initial size of the parser's stacks.  */
601
#ifndef YYINITDEPTH
602
# define YYINITDEPTH 200
603
#endif
604
 
605
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
606
   if the built-in stack extension method is used).
607
 
608
   Do not make this value too large; the results are undefined if
609
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
610
   evaluated with infinite-precision integer arithmetic.  */
611
 
612
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
613
# undef YYMAXDEPTH
614
#endif
615
 
616
#ifndef YYMAXDEPTH
617
# define YYMAXDEPTH 10000
618
#endif
619
 
620
 
621
 
622
#if YYERROR_VERBOSE
623
 
624
# ifndef yystrlen
625
#  if defined (__GLIBC__) && defined (_STRING_H)
626
#   define yystrlen strlen
627
#  else
628
/* Return the length of YYSTR.  */
629
static YYSIZE_T
630
#   if defined (__STDC__) || defined (__cplusplus)
631
yystrlen (const char *yystr)
632
#   else
633
yystrlen (yystr)
634
     const char *yystr;
635
#   endif
636
{
637
  register const char *yys = yystr;
638
 
639
  while (*yys++ != '\0')
640
    continue;
641
 
642
  return yys - yystr - 1;
643
}
644
#  endif
645
# endif
646
 
647
# ifndef yystpcpy
648
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
649
#   define yystpcpy stpcpy
650
#  else
651
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
652
   YYDEST.  */
653
static char *
654
#   if defined (__STDC__) || defined (__cplusplus)
655
yystpcpy (char *yydest, const char *yysrc)
656
#   else
657
yystpcpy (yydest, yysrc)
658
     char *yydest;
659
     const char *yysrc;
660
#   endif
661
{
662
  register char *yyd = yydest;
663
  register const char *yys = yysrc;
664
 
665
  while ((*yyd++ = *yys++) != '\0')
666
    continue;
667
 
668
  return yyd - 1;
669
}
670
#  endif
671
# endif
672
 
673
#endif /* !YYERROR_VERBOSE */
674
 
675
 
676
 
677
#if YYDEBUG
678
/*--------------------------------.
679
| Print this symbol on YYOUTPUT.  |
680
`--------------------------------*/
681
 
682
#if defined (__STDC__) || defined (__cplusplus)
683
static void
684
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
685
#else
686
static void
687
yysymprint (yyoutput, yytype, yyvaluep)
688
    FILE *yyoutput;
689
    int yytype;
690
    YYSTYPE *yyvaluep;
691
#endif
692
{
693
  /* Pacify ``unused variable'' warnings.  */
694
  (void) yyvaluep;
695
 
696
  if (yytype < YYNTOKENS)
697
    {
698
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
699
# ifdef YYPRINT
700
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
701
# endif
702
    }
703
  else
704
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
705
 
706
  switch (yytype)
707
    {
708
      default:
709
        break;
710
    }
711
  YYFPRINTF (yyoutput, ")");
712
}
713
 
714
#endif /* ! YYDEBUG */
715
/*-----------------------------------------------.
716
| Release the memory associated to this symbol.  |
717
`-----------------------------------------------*/
718
 
719
#if defined (__STDC__) || defined (__cplusplus)
720
static void
721
yydestruct (int yytype, YYSTYPE *yyvaluep)
722
#else
723
static void
724
yydestruct (yytype, yyvaluep)
725
    int yytype;
726
    YYSTYPE *yyvaluep;
727
#endif
728
{
729
  /* Pacify ``unused variable'' warnings.  */
730
  (void) yyvaluep;
731
 
732
  switch (yytype)
733
    {
734
 
735
      default:
736
        break;
737
    }
738
}
739
 
740
 
741
/* Prevent warnings from -Wmissing-prototypes.  */
742
 
743
#ifdef YYPARSE_PARAM
744
# if defined (__STDC__) || defined (__cplusplus)
745
int yyparse (void *YYPARSE_PARAM);
746
# else
747
int yyparse ();
748
# endif
749
#else /* ! YYPARSE_PARAM */
750
#if defined (__STDC__) || defined (__cplusplus)
751
int yyparse (void);
752
#else
753
int yyparse ();
754
#endif
755
#endif /* ! YYPARSE_PARAM */
756
 
757
 
758
 
759
/* The lookahead symbol.  */
760
int yychar;
761
 
762
/* The semantic value of the lookahead symbol.  */
763
YYSTYPE yylval;
764
 
765
/* Number of syntax errors so far.  */
766
int yynerrs;
767
 
768
 
769
 
770
/*----------.
771
| yyparse.  |
772
`----------*/
773
 
774
#ifdef YYPARSE_PARAM
775
# if defined (__STDC__) || defined (__cplusplus)
776
int yyparse (void *YYPARSE_PARAM)
777
# else
778
int yyparse (YYPARSE_PARAM)
779
  void *YYPARSE_PARAM;
780
# endif
781
#else /* ! YYPARSE_PARAM */
782
#if defined (__STDC__) || defined (__cplusplus)
783
int
784
yyparse (void)
785
#else
786
int
787
yyparse ()
788
 
789
#endif
790
#endif
791
{
792
 
793
  register int yystate;
794
  register int yyn;
795
  int yyresult;
796
  /* Number of tokens to shift before error messages enabled.  */
797
  int yyerrstatus;
798
  /* Lookahead token as an internal (translated) token number.  */
799
  int yytoken = 0;
800
 
801
  /* Three stacks and their tools:
802
     `yyss': related to states,
803
     `yyvs': related to semantic values,
804
     `yyls': related to locations.
805
 
806
     Refer to the stacks thru separate pointers, to allow yyoverflow
807
     to reallocate them elsewhere.  */
808
 
809
  /* The state stack.  */
810
  short yyssa[YYINITDEPTH];
811
  short *yyss = yyssa;
812
  register short *yyssp;
813
 
814
  /* The semantic value stack.  */
815
  YYSTYPE yyvsa[YYINITDEPTH];
816
  YYSTYPE *yyvs = yyvsa;
817
  register YYSTYPE *yyvsp;
818
 
819
 
820
 
821
#define YYPOPSTACK   (yyvsp--, yyssp--)
822
 
823
  YYSIZE_T yystacksize = YYINITDEPTH;
824
 
825
  /* The variables used to return semantic value and location from the
826
     action routines.  */
827
  YYSTYPE yyval;
828
 
829
 
830
  /* When reducing, the number of symbols on the RHS of the reduced
831
     rule.  */
832
  int yylen;
833
 
834
  YYDPRINTF ((stderr, "Starting parse\n"));
835
 
836
  yystate = 0;
837
  yyerrstatus = 0;
838
  yynerrs = 0;
839
  yychar = YYEMPTY;             /* Cause a token to be read.  */
840
 
841
  /* Initialize stack pointers.
842
     Waste one element of value and location stack
843
     so that they stay on the same level as the state stack.
844
     The wasted elements are never initialized.  */
845
 
846
  yyssp = yyss;
847
  yyvsp = yyvs;
848
 
849
  goto yysetstate;
850
 
851
/*------------------------------------------------------------.
852
| yynewstate -- Push a new state, which is found in yystate.  |
853
`------------------------------------------------------------*/
854
 yynewstate:
855
  /* In all cases, when you get here, the value and location stacks
856
     have just been pushed. so pushing a state here evens the stacks.
857
     */
858
  yyssp++;
859
 
860
 yysetstate:
861
  *yyssp = yystate;
862
 
863
  if (yyss + yystacksize - 1 <= yyssp)
864
    {
865
      /* Get the current used size of the three stacks, in elements.  */
866
      YYSIZE_T yysize = yyssp - yyss + 1;
867
 
868
#ifdef yyoverflow
869
      {
870
        /* Give user a chance to reallocate the stack. Use copies of
871
           these so that the &'s don't force the real ones into
872
           memory.  */
873
        YYSTYPE *yyvs1 = yyvs;
874
        short *yyss1 = yyss;
875
 
876
 
877
        /* Each stack pointer address is followed by the size of the
878
           data in use in that stack, in bytes.  This used to be a
879
           conditional around just the two extra args, but that might
880
           be undefined if yyoverflow is a macro.  */
881
        yyoverflow ("parser stack overflow",
882
                    &yyss1, yysize * sizeof (*yyssp),
883
                    &yyvs1, yysize * sizeof (*yyvsp),
884
 
885
                    &yystacksize);
886
 
887
        yyss = yyss1;
888
        yyvs = yyvs1;
889
      }
890
#else /* no yyoverflow */
891
# ifndef YYSTACK_RELOCATE
892
      goto yyoverflowlab;
893
# else
894
      /* Extend the stack our own way.  */
895
      if (YYMAXDEPTH <= yystacksize)
896
        goto yyoverflowlab;
897
      yystacksize *= 2;
898
      if (YYMAXDEPTH < yystacksize)
899
        yystacksize = YYMAXDEPTH;
900
 
901
      {
902
        short *yyss1 = yyss;
903
        union yyalloc *yyptr =
904
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
905
        if (! yyptr)
906
          goto yyoverflowlab;
907
        YYSTACK_RELOCATE (yyss);
908
        YYSTACK_RELOCATE (yyvs);
909
 
910
#  undef YYSTACK_RELOCATE
911
        if (yyss1 != yyssa)
912
          YYSTACK_FREE (yyss1);
913
      }
914
# endif
915
#endif /* no yyoverflow */
916
 
917
      yyssp = yyss + yysize - 1;
918
      yyvsp = yyvs + yysize - 1;
919
 
920
 
921
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
922
                  (unsigned long int) yystacksize));
923
 
924
      if (yyss + yystacksize - 1 <= yyssp)
925
        YYABORT;
926
    }
927
 
928
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
929
 
930
  goto yybackup;
931
 
932
/*-----------.
933
| yybackup.  |
934
`-----------*/
935
yybackup:
936
 
937
/* Do appropriate processing given the current state.  */
938
/* Read a lookahead token if we need one and don't already have one.  */
939
/* yyresume: */
940
 
941
  /* First try to decide what to do without reference to lookahead token.  */
942
 
943
  yyn = yypact[yystate];
944
  if (yyn == YYPACT_NINF)
945
    goto yydefault;
946
 
947
  /* Not known => get a lookahead token if don't already have one.  */
948
 
949
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
950
  if (yychar == YYEMPTY)
951
    {
952
      YYDPRINTF ((stderr, "Reading a token: "));
953
      yychar = YYLEX;
954
    }
955
 
956
  if (yychar <= YYEOF)
957
    {
958
      yychar = yytoken = YYEOF;
959
      YYDPRINTF ((stderr, "Now at end of input.\n"));
960
    }
961
  else
962
    {
963
      yytoken = YYTRANSLATE (yychar);
964
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
965
    }
966
 
967
  /* If the proper action on seeing token YYTOKEN is to reduce or to
968
     detect an error, take that action.  */
969
  yyn += yytoken;
970
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
971
    goto yydefault;
972
  yyn = yytable[yyn];
973
  if (yyn <= 0)
974
    {
975
      if (yyn == 0 || yyn == YYTABLE_NINF)
976
        goto yyerrlab;
977
      yyn = -yyn;
978
      goto yyreduce;
979
    }
980
 
981
  if (yyn == YYFINAL)
982
    YYACCEPT;
983
 
984
  /* Shift the lookahead token.  */
985
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
986
 
987
  /* Discard the token being shifted unless it is eof.  */
988
  if (yychar != YYEOF)
989
    yychar = YYEMPTY;
990
 
991
  *++yyvsp = yylval;
992
 
993
 
994
  /* Count tokens shifted since error; after three, turn off error
995
     status.  */
996
  if (yyerrstatus)
997
    yyerrstatus--;
998
 
999
  yystate = yyn;
1000
  goto yynewstate;
1001
 
1002
 
1003
/*-----------------------------------------------------------.
1004
| yydefault -- do the default action for the current state.  |
1005
`-----------------------------------------------------------*/
1006
yydefault:
1007
  yyn = yydefact[yystate];
1008
  if (yyn == 0)
1009
    goto yyerrlab;
1010
  goto yyreduce;
1011
 
1012
 
1013
/*-----------------------------.
1014
| yyreduce -- Do a reduction.  |
1015
`-----------------------------*/
1016
yyreduce:
1017
  /* yyn is the number of a rule to reduce with.  */
1018
  yylen = yyr2[yyn];
1019
 
1020
  /* If YYLEN is nonzero, implement the default value of the action:
1021
     `$$ = $1'.
1022
 
1023
     Otherwise, the following line sets YYVAL to garbage.
1024
     This behavior is undocumented and Bison
1025
     users should not rely upon it.  Assigning to YYVAL
1026
     unconditionally makes the parser a bit smaller, and it avoids a
1027
     GCC warning that YYVAL may be used uninitialized.  */
1028
  yyval = yyvsp[1-yylen];
1029
 
1030
 
1031
  YY_REDUCE_PRINT (yyn);
1032
  switch (yyn)
1033
    {
1034
        case 2:
1035
#line 54 "sysinfo.y"
1036
    {
1037
  switch (writecode)
1038
    {
1039
    case 'i':
1040
      printf("#ifdef SYSROFF_SWAP_IN\n");
1041
      break;
1042
    case 'p':
1043
      printf("#ifdef SYSROFF_p\n");
1044
      break;
1045
    case 'd':
1046
      break;
1047
    case 'g':
1048
      printf("#ifdef SYSROFF_SWAP_OUT\n");
1049
      break;
1050
    case 'c':
1051
      printf("#ifdef SYSROFF_PRINT\n");
1052
      printf("#include <stdio.h>\n");
1053
      printf("#include <stdlib.h>\n");
1054
      printf("#include <ansidecl.h>\n");
1055
      break;
1056
    }
1057
 }
1058
    break;
1059
 
1060
  case 3:
1061
#line 76 "sysinfo.y"
1062
    {
1063
  switch (writecode) {
1064
  case 'i':
1065
  case 'p':
1066
  case 'g':
1067
  case 'c':
1068
    printf("#endif\n");
1069
    break;
1070
  case 'd':
1071
    break;
1072
  }
1073
}
1074
    break;
1075
 
1076
  case 6:
1077
#line 98 "sysinfo.y"
1078
    {
1079
        it = yyvsp[-1].s; code = yyvsp[0].i;
1080
        switch (writecode)
1081
          {
1082
          case 'd':
1083
            printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code);
1084
            printf("struct IT_%s;\n", it);
1085
            printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n",
1086
                   yyvsp[-1].s, it);
1087
            printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n",
1088
                   yyvsp[-1].s, it);
1089
            printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n",
1090
                   yyvsp[-1].s, it);
1091
            printf("struct IT_%s { \n", it);
1092
            break;
1093
          case 'i':
1094
            printf("void sysroff_swap_%s_in(ptr)\n",yyvsp[-1].s);
1095
            printf("struct IT_%s *ptr;\n", it);
1096
            printf("{\n");
1097
            printf("unsigned char raw[255];\n");
1098
            printf("\tint idx = 0 ;\n");
1099
            printf("\tint size;\n");
1100
            printf("memset(raw,0,255);\n");
1101
            printf("memset(ptr,0,sizeof(*ptr));\n");
1102
            printf("size = fillup(raw);\n");
1103
            break;
1104
          case 'g':
1105
            printf("void sysroff_swap_%s_out(file,ptr)\n",yyvsp[-1].s);
1106
            printf("FILE * file;\n");
1107
            printf("struct IT_%s *ptr;\n", it);
1108
            printf("{\n");
1109
            printf("\tunsigned char raw[255];\n");
1110
            printf("\tint idx = 16 ;\n");
1111
            printf("\tmemset (raw, 0, 255);\n");
1112
            printf("\tcode = IT_%s_CODE;\n", it);
1113
            break;
1114
          case 'o':
1115
            printf("void sysroff_swap_%s_out(abfd,ptr)\n",yyvsp[-1].s);
1116
            printf("bfd * abfd;\n");
1117
            printf("struct IT_%s *ptr;\n",it);
1118
            printf("{\n");
1119
            printf("int idx = 0 ;\n");
1120
            break;
1121
          case 'c':
1122
            printf("void sysroff_print_%s_out(ptr)\n",yyvsp[-1].s);
1123
            printf("struct IT_%s *ptr;\n", it);
1124
            printf("{\n");
1125
            printf("itheader(\"%s\", IT_%s_CODE);\n",yyvsp[-1].s,yyvsp[-1].s);
1126
            break;
1127
 
1128
          case 't':
1129
            break;
1130
          }
1131
 
1132
      }
1133
    break;
1134
 
1135
  case 7:
1136
#line 155 "sysinfo.y"
1137
    {
1138
  switch (writecode) {
1139
  case 'd':
1140
    printf("};\n");
1141
    break;
1142
  case 'g':
1143
    printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it);
1144
 
1145
  case 'i':
1146
 
1147
  case 'o':
1148
  case 'c':
1149
    printf("}\n");
1150
  }
1151
}
1152
    break;
1153
 
1154
  case 12:
1155
#line 182 "sysinfo.y"
1156
    {
1157
          rdepth++;
1158
          switch (writecode)
1159
            {
1160
            case 'c':
1161
              if (rdepth==1)
1162
              printf("\tprintf(\"repeat %%d\\n\", %s);\n",yyvsp[0].s);
1163
              if (rdepth==2)
1164
              printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",yyvsp[0].s);
1165
            case 'i':
1166
            case 'g':
1167
            case 'o':
1168
 
1169
              if (rdepth==1)
1170
                {
1171
              printf("\t{ int n; for (n = 0; n < %s; n++) {\n",    yyvsp[0].s);
1172
            }
1173
              if (rdepth == 2) {
1174
              printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n",    yyvsp[0].s);
1175
            }
1176
 
1177
              break;
1178
            }
1179
 
1180
          oldrepeat = repeat;
1181
         repeat = yyvsp[0].s;
1182
        }
1183
    break;
1184
 
1185
  case 13:
1186
#line 212 "sysinfo.y"
1187
    {
1188
          repeat = oldrepeat;
1189
          oldrepeat =0;
1190
          rdepth--;
1191
          switch (writecode)
1192
            {
1193
            case 'i':
1194
            case 'g':
1195
            case 'o':
1196
            case 'c':
1197
          printf("\t}}\n");
1198
        }
1199
        }
1200
    break;
1201
 
1202
  case 14:
1203
#line 229 "sysinfo.y"
1204
    {
1205
          switch (writecode)
1206
            {
1207
            case 'i':
1208
            case 'g':
1209
            case 'o':
1210
            case 'c':
1211
              printf("\tif (%s) {\n", yyvsp[0].s);
1212
              break;
1213
            }
1214
        }
1215
    break;
1216
 
1217
  case 15:
1218
#line 242 "sysinfo.y"
1219
    {
1220
          switch (writecode)
1221
            {
1222
            case 'i':
1223
            case 'g':
1224
            case 'o':
1225
            case 'c':
1226
          printf("\t}\n");
1227
        }
1228
        }
1229
    break;
1230
 
1231
  case 16:
1232
#line 256 "sysinfo.y"
1233
    {name = yyvsp[0].s; }
1234
    break;
1235
 
1236
  case 17:
1237
#line 258 "sysinfo.y"
1238
    {
1239
          char *desc = yyvsp[-8].s;
1240
          char *type = yyvsp[-6].s;
1241
          int size = yyvsp[-5].i;
1242
          char *id = yyvsp[-3].s;
1243
char *p = names[rdepth];
1244
char *ptr = pnames[rdepth];
1245
          switch (writecode)
1246
            {
1247
            case 'g':
1248
              if (size % 8)
1249
                {
1250
 
1251
                  printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n",
1252
                         id,
1253
                         names[rdepth], size);
1254
 
1255
                }
1256
              else {
1257
                printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n",
1258
                       type,
1259
                       id,
1260
                       names[rdepth],size/8);
1261
                }
1262
              break;
1263
            case 'i':
1264
              {
1265
 
1266
                if (rdepth >= 1)
1267
 
1268
                  {
1269
                    printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n",
1270
                           id,
1271
                           id,
1272
                           type,
1273
                           repeat,
1274
                           id);
1275
                  }
1276
 
1277
                if (rdepth == 2)
1278
                  {
1279
                    printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n",
1280
                           id,
1281
                           id,
1282
                           type,
1283
                           repeat,
1284
                           id);
1285
                  }
1286
 
1287
              }
1288
 
1289
              if (size % 8)
1290
                {
1291
                  printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n",
1292
                         id,
1293
                         names[rdepth],
1294
                         size);
1295
                }
1296
              else {
1297
                printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n",
1298
                       id,
1299
                       names[rdepth],
1300
                       type,
1301
                       size/8);
1302
                }
1303
              break;
1304
            case 'o':
1305
              printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type,size/8,size%8,id,names[rdepth]);
1306
              break;
1307
            case 'd':
1308
              if (repeat)
1309
                printf("\t/* repeat %s */\n", repeat);
1310
 
1311
                  if (type[0] == 'I') {
1312
                  printf("\tint %s%s; \t/* %s */\n",ptr,id, desc);
1313
                }
1314
                  else if (type[0] =='C') {
1315
                  printf("\tchar %s*%s;\t /* %s */\n",ptr,id, desc);
1316
                }
1317
              else {
1318
                printf("\tbarray %s%s;\t /* %s */\n",ptr,id, desc);
1319
              }
1320
                  break;
1321
                case 'c':
1322
              printf("tabout();\n");
1323
                  printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc, id);
1324
 
1325
                  if (type[0] == 'I')
1326
                  printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id,p);
1327
                  else   if (type[0] == 'C')
1328
                  printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id,p);
1329
 
1330
                  else   if (type[0] == 'B')
1331
                    {
1332
                  printf("\tpbarray(&ptr->%s%s);\n", id,p);
1333
                }
1334
              else abort();
1335
                  break;
1336
                }
1337
        }
1338
    break;
1339
 
1340
  case 18:
1341
#line 363 "sysinfo.y"
1342
    { yyval.s = yyvsp[0].s; }
1343
    break;
1344
 
1345
  case 19:
1346
#line 364 "sysinfo.y"
1347
    { yyval.s = "INT";}
1348
    break;
1349
 
1350
  case 20:
1351
#line 369 "sysinfo.y"
1352
    { yyval.s = yyvsp[-1].s; }
1353
    break;
1354
 
1355
  case 21:
1356
#line 374 "sysinfo.y"
1357
    { yyval.i = yyvsp[-1].i * yyvsp[0].i; }
1358
    break;
1359
 
1360
  case 22:
1361
#line 379 "sysinfo.y"
1362
    { yyval.s = yyvsp[-1].s; }
1363
    break;
1364
 
1365
  case 23:
1366
#line 380 "sysinfo.y"
1367
    { yyval.s = "dummy";}
1368
    break;
1369
 
1370
  case 27:
1371
#line 388 "sysinfo.y"
1372
    {
1373
          switch (writecode)
1374
            {
1375
            case 'd':
1376
              printf("#define %s %s\n", yyvsp[-2].s,yyvsp[-1].s);
1377
              break;
1378
            case 'c':
1379
                printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],yyvsp[-1].s,yyvsp[-2].s);
1380
            }
1381
        }
1382
    break;
1383
 
1384
 
1385
    }
1386
 
1387
/* Line 1000 of yacc.c.  */
1388
#line 1389 "sysinfo.c"
1389
 
1390
  yyvsp -= yylen;
1391
  yyssp -= yylen;
1392
 
1393
 
1394
  YY_STACK_PRINT (yyss, yyssp);
1395
 
1396
  *++yyvsp = yyval;
1397
 
1398
 
1399
  /* Now `shift' the result of the reduction.  Determine what state
1400
     that goes to, based on the state we popped back to and the rule
1401
     number reduced by.  */
1402
 
1403
  yyn = yyr1[yyn];
1404
 
1405
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1406
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1407
    yystate = yytable[yystate];
1408
  else
1409
    yystate = yydefgoto[yyn - YYNTOKENS];
1410
 
1411
  goto yynewstate;
1412
 
1413
 
1414
/*------------------------------------.
1415
| yyerrlab -- here on detecting error |
1416
`------------------------------------*/
1417
yyerrlab:
1418
  /* If not already recovering from an error, report this error.  */
1419
  if (!yyerrstatus)
1420
    {
1421
      ++yynerrs;
1422
#if YYERROR_VERBOSE
1423
      yyn = yypact[yystate];
1424
 
1425
      if (YYPACT_NINF < yyn && yyn < YYLAST)
1426
        {
1427
          YYSIZE_T yysize = 0;
1428
          int yytype = YYTRANSLATE (yychar);
1429
          const char* yyprefix;
1430
          char *yymsg;
1431
          int yyx;
1432
 
1433
          /* Start YYX at -YYN if negative to avoid negative indexes in
1434
             YYCHECK.  */
1435
          int yyxbegin = yyn < 0 ? -yyn : 0;
1436
 
1437
          /* Stay within bounds of both yycheck and yytname.  */
1438
          int yychecklim = YYLAST - yyn;
1439
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1440
          int yycount = 0;
1441
 
1442
          yyprefix = ", expecting ";
1443
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1444
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1445
              {
1446
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1447
                yycount += 1;
1448
                if (yycount == 5)
1449
                  {
1450
                    yysize = 0;
1451
                    break;
1452
                  }
1453
              }
1454
          yysize += (sizeof ("syntax error, unexpected ")
1455
                     + yystrlen (yytname[yytype]));
1456
          yymsg = (char *) YYSTACK_ALLOC (yysize);
1457
          if (yymsg != 0)
1458
            {
1459
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1460
              yyp = yystpcpy (yyp, yytname[yytype]);
1461
 
1462
              if (yycount < 5)
1463
                {
1464
                  yyprefix = ", expecting ";
1465
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1466
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1467
                      {
1468
                        yyp = yystpcpy (yyp, yyprefix);
1469
                        yyp = yystpcpy (yyp, yytname[yyx]);
1470
                        yyprefix = " or ";
1471
                      }
1472
                }
1473
              yyerror (yymsg);
1474
              YYSTACK_FREE (yymsg);
1475
            }
1476
          else
1477
            yyerror ("syntax error; also virtual memory exhausted");
1478
        }
1479
      else
1480
#endif /* YYERROR_VERBOSE */
1481
        yyerror ("syntax error");
1482
    }
1483
 
1484
 
1485
 
1486
  if (yyerrstatus == 3)
1487
    {
1488
      /* If just tried and failed to reuse lookahead token after an
1489
         error, discard it.  */
1490
 
1491
      if (yychar <= YYEOF)
1492
        {
1493
          /* If at end of input, pop the error token,
1494
             then the rest of the stack, then return failure.  */
1495
          if (yychar == YYEOF)
1496
             for (;;)
1497
               {
1498
                 YYPOPSTACK;
1499
                 if (yyssp == yyss)
1500
                   YYABORT;
1501
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1502
                 yydestruct (yystos[*yyssp], yyvsp);
1503
               }
1504
        }
1505
      else
1506
        {
1507
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1508
          yydestruct (yytoken, &yylval);
1509
          yychar = YYEMPTY;
1510
 
1511
        }
1512
    }
1513
 
1514
  /* Else will try to reuse lookahead token after shifting the error
1515
     token.  */
1516
  goto yyerrlab1;
1517
 
1518
 
1519
/*---------------------------------------------------.
1520
| yyerrorlab -- error raised explicitly by YYERROR.  |
1521
`---------------------------------------------------*/
1522
yyerrorlab:
1523
 
1524
#ifdef __GNUC__
1525
  /* Pacify GCC when the user code never invokes YYERROR and the label
1526
     yyerrorlab therefore never appears in user code.  */
1527
  if (0)
1528
     goto yyerrorlab;
1529
#endif
1530
 
1531
  yyvsp -= yylen;
1532
  yyssp -= yylen;
1533
  yystate = *yyssp;
1534
  goto yyerrlab1;
1535
 
1536
 
1537
/*-------------------------------------------------------------.
1538
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1539
`-------------------------------------------------------------*/
1540
yyerrlab1:
1541
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1542
 
1543
  for (;;)
1544
    {
1545
      yyn = yypact[yystate];
1546
      if (yyn != YYPACT_NINF)
1547
        {
1548
          yyn += YYTERROR;
1549
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1550
            {
1551
              yyn = yytable[yyn];
1552
              if (0 < yyn)
1553
                break;
1554
            }
1555
        }
1556
 
1557
      /* Pop the current state because it cannot handle the error token.  */
1558
      if (yyssp == yyss)
1559
        YYABORT;
1560
 
1561
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1562
      yydestruct (yystos[yystate], yyvsp);
1563
      YYPOPSTACK;
1564
      yystate = *yyssp;
1565
      YY_STACK_PRINT (yyss, yyssp);
1566
    }
1567
 
1568
  if (yyn == YYFINAL)
1569
    YYACCEPT;
1570
 
1571
  YYDPRINTF ((stderr, "Shifting error token, "));
1572
 
1573
  *++yyvsp = yylval;
1574
 
1575
 
1576
  yystate = yyn;
1577
  goto yynewstate;
1578
 
1579
 
1580
/*-------------------------------------.
1581
| yyacceptlab -- YYACCEPT comes here.  |
1582
`-------------------------------------*/
1583
yyacceptlab:
1584
  yyresult = 0;
1585
  goto yyreturn;
1586
 
1587
/*-----------------------------------.
1588
| yyabortlab -- YYABORT comes here.  |
1589
`-----------------------------------*/
1590
yyabortlab:
1591
  yyresult = 1;
1592
  goto yyreturn;
1593
 
1594
#ifndef yyoverflow
1595
/*----------------------------------------------.
1596
| yyoverflowlab -- parser overflow comes here.  |
1597
`----------------------------------------------*/
1598
yyoverflowlab:
1599
  yyerror ("parser stack overflow");
1600
  yyresult = 2;
1601
  /* Fall through.  */
1602
#endif
1603
 
1604
yyreturn:
1605
#ifndef yyoverflow
1606
  if (yyss != yyssa)
1607
    YYSTACK_FREE (yyss);
1608
#endif
1609
  return yyresult;
1610
}
1611
 
1612
 
1613
#line 403 "sysinfo.y"
1614
 
1615
/* four modes
1616
 
1617
   -d write structure definitions for sysroff in host format
1618
   -i write functions to swap into sysroff format in
1619
   -o write functions to swap into sysroff format out
1620
   -c write code to print info in human form */
1621
 
1622
int yydebug;
1623
 
1624
int
1625
main (int ac, char **av)
1626
{
1627
  yydebug=0;
1628
  if (ac > 1)
1629
    writecode = av[1][1];
1630
if (writecode == 'd')
1631
  {
1632
    printf("typedef struct { unsigned char *data; int len; } barray; \n");
1633
    printf("typedef  int INT;\n");
1634
    printf("typedef  char * CHARS;\n");
1635
 
1636
  }
1637
  yyparse();
1638
return 0;
1639
}
1640
 
1641
static int
1642
yyerror (char *s)
1643
{
1644
  fprintf(stderr, "%s\n" , s);
1645
  return 0;
1646
}
1647
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.