2 /* A Bison parser, made from sysinfo.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
20 extern char writecode
;
32 char *loop
[] = {"","n","m","/*BAD*/"};
33 char *names
[] = {" ","[n]","[n][m]"};
34 char *pnames
[]= {"","*","**"};
55 #define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 29)
57 static const char yytranslate
[] = { 0,
58 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
59 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
60 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
61 2, 2, 2, 2, 2, 2, 2, 2, 2, 5,
62 6, 2, 2, 2, 2, 2, 2, 2, 2, 2,
63 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
64 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
65 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
66 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
67 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
68 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
69 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
70 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
71 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
72 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
73 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
74 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
75 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
76 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
77 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 1, 3, 4, 7, 8,
88 static const short yyprhs
[] = { 0,
89 0, 1, 4, 7, 8, 9, 16, 19, 22, 25,
90 26, 27, 34, 35, 42, 43, 54, 56, 57, 61,
91 64, 68, 69, 70, 74, 75
94 static const short yyrhs
[] = { -1,
95 12, 13, 0, 14, 13, 0, 0, 0, 5, 8,
96 9, 15, 16, 6, 0, 21, 16, 0, 19, 16,
97 0, 17, 16, 0, 0, 0, 5, 4, 8, 18,
98 16, 6, 0, 0, 5, 3, 8, 20, 16, 6,
99 0, 0, 5, 24, 5, 23, 25, 6, 26, 22,
100 27, 6, 0, 7, 0, 0, 5, 8, 6, 0,
101 9, 10, 0, 5, 8, 6, 0, 0, 0, 5,
102 28, 6, 0, 0, 28, 5, 8, 8, 6, 0
108 static const short yyrline
[] = { 0,
109 38, 59, 75, 76, 79, 130, 150, 152, 153, 154,
110 157, 186, 204, 217, 230, 233, 338, 340, 343, 348,
111 354, 356, 359, 360, 362, 363
116 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
118 static const char * const yytname
[] = { "$","error","$undefined.","COND","REPEAT",
119 "'('","')'","TYPE","NAME","NUMBER","UNIT","top","@1","it_list","it","@2","it_field_list",
120 "repeat_it_field","@3","cond_it_field","@4","it_field","@5","attr_type","attr_desc",
121 "attr_size","attr_id","enums","enum_list", NULL
125 static const short yyr1
[] = { 0,
126 12, 11, 13, 13, 15, 14, 16, 16, 16, 16,
127 18, 17, 20, 19, 22, 21, 23, 23, 24, 25,
128 26, 26, 27, 27, 28, 28
131 static const short yyr2
[] = { 0,
132 0, 2, 2, 0, 0, 6, 2, 2, 2, 0,
133 0, 6, 0, 6, 0, 10, 1, 0, 3, 2,
137 static const short yydefact
[] = { 1,
138 4, 0, 2, 4, 0, 3, 5, 10, 0, 0,
139 10, 10, 10, 0, 0, 0, 0, 6, 9, 8,
140 7, 13, 11, 0, 18, 10, 10, 19, 17, 0,
141 0, 0, 0, 0, 14, 12, 20, 22, 0, 15,
142 0, 23, 21, 25, 0, 0, 16, 0, 24, 0,
146 static const short yydefgoto
[] = { 53,
147 1, 3, 4, 8, 10, 11, 27, 12, 26, 13,
148 42, 30, 17, 34, 40, 45, 46
151 static const short yypact
[] = {-32768,
152 3, 2,-32768, 3, 4,-32768,-32768, 6, 0, 8,
153 6, 6, 6, 9, 10, 11, 7,-32768,-32768,-32768,
154 -32768,-32768,-32768, 14, 15, 6, 6,-32768,-32768, 12,
155 17, 18, -1, 19,-32768,-32768,-32768, 21, 20,-32768,
156 23, 22,-32768,-32768, 24, 1,-32768, 25,-32768, 26,
157 29,-32768, 31, 32,-32768
160 static const short yypgoto
[] = {-32768,
161 -32768, 33,-32768,-32768, -11,-32768,-32768,-32768,-32768,-32768,
162 -32768,-32768,-32768,-32768,-32768,-32768,-32768
169 static const short yytable
[] = { 19,
170 20, 21, 14, 15, 16, 48, 49, 2, 37, 5,
171 9, 25, 7, 18, 31, 32, 22, 23, 24, 28,
172 33, 29, 35, 36, 38, 39, 44, 41, 43, 47,
173 54, 55, 50, 51, 52, 0, 6
176 static const short yycheck
[] = { 11,
177 12, 13, 3, 4, 5, 5, 6, 5, 10, 8,
178 5, 5, 9, 6, 26, 27, 8, 8, 8, 6,
179 9, 7, 6, 6, 6, 5, 5, 8, 6, 6,
182 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
183 #line 3 "/usr/share/misc/bison.simple"
184 /* This file comes from bison-1.28. */
186 /* Skeleton output parser for bison,
187 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
189 This program is free software; you can redistribute it and/or modify
190 it under the terms of the GNU General Public License as published by
191 the Free Software Foundation; either version 2, or (at your option)
194 This program is distributed in the hope that it will be useful,
195 but WITHOUT ANY WARRANTY; without even the implied warranty of
196 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
197 GNU General Public License for more details.
199 You should have received a copy of the GNU General Public License
200 along with this program; if not, write to the Free Software
201 Foundation, Inc., 59 Temple Place - Suite 330,
202 Boston, MA 02111-1307, USA. */
204 /* As a special exception, when this file is copied by Bison into a
205 Bison output file, you may use that output file without restriction.
206 This special exception was added by the Free Software Foundation
207 in version 1.24 of Bison. */
209 /* This is the parser code that is written into each bison parser
210 when the %semantic_parser declaration is not specified in the grammar.
211 It was written by Richard Stallman by simplifying the hairy parser
212 used when %semantic_parser is specified. */
214 #ifndef YYSTACK_USE_ALLOCA
216 #define YYSTACK_USE_ALLOCA
217 #else /* alloca not defined */
219 #define YYSTACK_USE_ALLOCA
220 #define alloca __builtin_alloca
221 #else /* not GNU C. */
222 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
223 #define YYSTACK_USE_ALLOCA
225 #else /* not sparc */
226 /* We think this test detects Watcom and Microsoft C. */
227 /* This used to test MSDOS, but that is a bad idea
228 since that symbol is in the user namespace. */
229 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
230 #if 0 /* No need for malloc.h, which pollutes the namespace;
231 instead, just don't use alloca. */
234 #else /* not MSDOS, or __TURBOC__ */
236 /* I don't know what this was needed for, but it pollutes the namespace.
237 So I turned it off. rms, 2 May 1997. */
238 /* #include <malloc.h> */
240 #define YYSTACK_USE_ALLOCA
241 #else /* not MSDOS, or __TURBOC__, or _AIX */
243 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
244 and on HPUX 10. Eventually we can turn this on. */
245 #define YYSTACK_USE_ALLOCA
246 #define alloca __builtin_alloca
249 #endif /* not _AIX */
250 #endif /* not MSDOS, or __TURBOC__ */
251 #endif /* not sparc */
252 #endif /* not GNU C */
253 #endif /* alloca not defined */
254 #endif /* YYSTACK_USE_ALLOCA not defined */
256 #ifdef YYSTACK_USE_ALLOCA
257 #define YYSTACK_ALLOC alloca
259 #define YYSTACK_ALLOC malloc
262 /* Note: there must be only one dollar sign in this file.
263 It is replaced by the list of actions, each action
264 as one case of the switch. */
266 #define yyerrok (yyerrstatus = 0)
267 #define yyclearin (yychar = YYEMPTY)
270 #define YYACCEPT goto yyacceptlab
271 #define YYABORT goto yyabortlab
272 #define YYERROR goto yyerrlab1
273 /* Like YYERROR except do call yyerror.
274 This remains here temporarily to ease the
275 transition to the new meaning of YYERROR, for GCC.
276 Once GCC version 2 has supplanted version 1, this can go. */
277 #define YYFAIL goto yyerrlab
278 #define YYRECOVERING() (!!yyerrstatus)
279 #define YYBACKUP(token, value) \
281 if (yychar == YYEMPTY && yylen == 1) \
282 { yychar = (token), yylval = (value); \
283 yychar1 = YYTRANSLATE (yychar); \
288 { yyerror ("syntax error: cannot back up"); YYERROR; } \
292 #define YYERRCODE 256
295 #define YYLEX yylex()
301 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
303 #define YYLEX yylex(&yylval, &yylloc)
305 #else /* not YYLSP_NEEDED */
307 #define YYLEX yylex(&yylval, YYLEX_PARAM)
309 #define YYLEX yylex(&yylval)
311 #endif /* not YYLSP_NEEDED */
314 /* If nonreentrant, generate the variables here */
318 int yychar
; /* the lookahead symbol */
319 YYSTYPE yylval
; /* the semantic value of the */
320 /* lookahead symbol */
323 YYLTYPE yylloc
; /* location data for the lookahead */
327 int yynerrs
; /* number of parse errors so far */
328 #endif /* not YYPURE */
331 int yydebug
; /* nonzero means print parse trace */
332 /* Since this is uninitialized, it does not stop multiple parsers
336 /* YYINITDEPTH indicates the initial size of the parser's stacks */
339 #define YYINITDEPTH 200
342 /* YYMAXDEPTH is the maximum size the stacks can grow to
343 (effective only if the built-in stack extension method is used). */
350 #define YYMAXDEPTH 10000
353 /* Define __yy_memcpy. Note that the size argument
354 should be passed with type unsigned int, because that is what the non-GCC
355 definitions require. With GCC, __builtin_memcpy takes an arg
356 of type size_t, but it can handle unsigned int. */
358 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
359 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
360 #else /* not GNU C or C++ */
363 /* This is the most reliable way to avoid incompatibilities
364 in available built-in functions on various systems. */
366 __yy_memcpy (to
, from
, count
)
371 register char *f
= from
;
372 register char *t
= to
;
373 register int i
= count
;
379 #else /* __cplusplus */
381 /* This is the most reliable way to avoid incompatibilities
382 in available built-in functions on various systems. */
384 __yy_memcpy (char *to
, char *from
, unsigned int count
)
386 register char *t
= to
;
387 register char *f
= from
;
388 register int i
= count
;
397 #line 217 "/usr/share/misc/bison.simple"
399 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
400 into yyparse. The argument should have type void *.
401 It should actually point to an object.
402 Grammar actions can access the variable by casting it
403 to the proper pointer type. */
407 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
408 #define YYPARSE_PARAM_DECL
409 #else /* not __cplusplus */
410 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
411 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
412 #endif /* not __cplusplus */
413 #else /* not YYPARSE_PARAM */
414 #define YYPARSE_PARAM_ARG
415 #define YYPARSE_PARAM_DECL
416 #endif /* not YYPARSE_PARAM */
418 /* Prevent warning if -Wstrict-prototypes. */
421 int yyparse (void *);
428 yyparse(YYPARSE_PARAM_ARG
)
431 register int yystate
;
433 register short *yyssp
;
434 register YYSTYPE
*yyvsp
;
435 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
436 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
438 short yyssa
[YYINITDEPTH
]; /* the state stack */
439 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
441 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
442 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
445 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
446 YYLTYPE
*yyls
= yylsa
;
449 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
451 #define YYPOPSTACK (yyvsp--, yyssp--)
454 int yystacksize
= YYINITDEPTH
;
455 int yyfree_stacks
= 0;
466 YYSTYPE yyval
; /* the variable used to return */
467 /* semantic values from the action */
474 fprintf(stderr
, "Starting parse\n");
480 yychar
= YYEMPTY
; /* Cause a token to be read. */
482 /* Initialize stack pointers.
483 Waste one element of value and location stack
484 so that they stay on the same level as the state stack.
485 The wasted elements are never initialized. */
493 /* Push a new state, which is found in yystate . */
494 /* In all cases, when you get here, the value and location stacks
495 have just been pushed. so pushing a state here evens the stacks. */
500 if (yyssp
>= yyss
+ yystacksize
- 1)
502 /* Give user a chance to reallocate the stack */
503 /* Use copies of these so that the &'s don't force the real ones into memory. */
504 YYSTYPE
*yyvs1
= yyvs
;
507 YYLTYPE
*yyls1
= yyls
;
510 /* Get the current used size of the three stacks, in elements. */
511 int size
= yyssp
- yyss
+ 1;
514 /* Each stack pointer address is followed by the size of
515 the data in use in that stack, in bytes. */
517 /* This used to be a conditional around just the two extra args,
518 but that might be undefined if yyoverflow is a macro. */
519 yyoverflow("parser stack overflow",
520 &yyss1
, size
* sizeof (*yyssp
),
521 &yyvs1
, size
* sizeof (*yyvsp
),
522 &yyls1
, size
* sizeof (*yylsp
),
525 yyoverflow("parser stack overflow",
526 &yyss1
, size
* sizeof (*yyssp
),
527 &yyvs1
, size
* sizeof (*yyvsp
),
531 yyss
= yyss1
; yyvs
= yyvs1
;
535 #else /* no yyoverflow */
536 /* Extend the stack our own way. */
537 if (yystacksize
>= YYMAXDEPTH
)
539 yyerror("parser stack overflow");
551 if (yystacksize
> YYMAXDEPTH
)
552 yystacksize
= YYMAXDEPTH
;
553 #ifndef YYSTACK_USE_ALLOCA
556 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
557 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
558 size
* (unsigned int) sizeof (*yyssp
));
559 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
560 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
561 size
* (unsigned int) sizeof (*yyvsp
));
563 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
564 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
565 size
* (unsigned int) sizeof (*yylsp
));
567 #endif /* no yyoverflow */
569 yyssp
= yyss
+ size
- 1;
570 yyvsp
= yyvs
+ size
- 1;
572 yylsp
= yyls
+ size
- 1;
577 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
580 if (yyssp
>= yyss
+ yystacksize
- 1)
586 fprintf(stderr
, "Entering state %d\n", yystate
);
592 /* Do appropriate processing given the current state. */
593 /* Read a lookahead token if we need one and don't already have one. */
596 /* First try to decide what to do without reference to lookahead token. */
598 yyn
= yypact
[yystate
];
602 /* Not known => get a lookahead token if don't already have one. */
604 /* yychar is either YYEMPTY or YYEOF
605 or a valid token in external form. */
607 if (yychar
== YYEMPTY
)
611 fprintf(stderr
, "Reading a token: ");
616 /* Convert token to internal form (in yychar1) for indexing tables with */
618 if (yychar
<= 0) /* This means end of input. */
621 yychar
= YYEOF
; /* Don't call YYLEX any more */
625 fprintf(stderr
, "Now at end of input.\n");
630 yychar1
= YYTRANSLATE(yychar
);
635 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
636 /* Give the individual parser a way to print the precise meaning
637 of a token, for further debugging info. */
639 YYPRINT (stderr
, yychar
, yylval
);
641 fprintf (stderr
, ")\n");
647 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
652 /* yyn is what to do for this token type in this state.
653 Negative => reduce, -yyn is rule number.
654 Positive => shift, yyn is new state.
655 New state is final state => don't bother to shift,
657 0, or most negative number => error. */
672 /* Shift the lookahead token. */
676 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
679 /* Discard the token being shifted unless it is eof. */
688 /* count tokens shifted since error; after three, turn off error status. */
689 if (yyerrstatus
) yyerrstatus
--;
694 /* Do the default action for the current state. */
697 yyn
= yydefact
[yystate
];
701 /* Do a reduction. yyn is the number of a rule to reduce with. */
705 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
712 fprintf (stderr
, "Reducing via rule %d (line %d), ",
715 /* Print the symbols being reduced, and their result. */
716 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
717 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
718 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
731 printf("#ifdef SYSROFF_SWAP_IN\n");
734 printf("#ifdef SYSROFF_p\n");
739 printf("#ifdef SYSROFF_SWAP_OUT\n");
742 printf("#ifdef SYSROFF_PRINT\n");
743 printf("#include <stdio.h>\n");
744 printf("#include <stdlib.h>\n");
767 it
= yyvsp
[-1].s
; code
= yyvsp
[0].i
;
771 printf("\n\n\n#define IT_%s_CODE 0x%x\n", it
,code
);
772 printf("struct IT_%s { \n", it
);
775 printf("void sysroff_swap_%s_in(ptr)\n",yyvsp
[-1].s
);
776 printf("struct IT_%s *ptr;\n", it
);
778 printf("char raw[255];\n");
779 printf("\tint idx = 0 ;\n");
780 printf("\tint size;\n");
781 printf("memset(raw,0,255);\n");
782 printf("memset(ptr,0,sizeof(*ptr));\n");
783 printf("size = fillup(raw);\n");
786 printf("void sysroff_swap_%s_out(file,ptr)\n",yyvsp
[-1].s
);
787 printf("FILE * file;\n");
788 printf("struct IT_%s *ptr;\n", it
);
790 printf("\tchar raw[255];\n");
791 printf("\tint idx = 16 ;\n");
792 printf("\tmemset (raw, 0, 255);\n");
793 printf("\tcode = IT_%s_CODE;\n", it
);
796 printf("void sysroff_swap_%s_out(abfd,ptr)\n",yyvsp
[-1].s
);
797 printf("bfd * abfd;\n");
798 printf("struct IT_%s *ptr;\n",it
);
800 printf("int idx = 0 ;\n");
803 printf("void sysroff_print_%s_out(ptr)\n",yyvsp
[-1].s
);
804 printf("struct IT_%s *ptr;\n", it
);
806 printf("itheader(\"%s\", IT_%s_CODE);\n",yyvsp
[-1].s
,yyvsp
[-1].s
);
816 #line 131 "sysinfo.y"
823 printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it
);
834 #line 158 "sysinfo.y"
841 printf("\tprintf(\"repeat %%d\\n\", %s);\n",yyvsp
[0].s
);
843 printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",yyvsp
[0].s
);
850 printf("\t{ int n; for (n = 0; n < %s; n++) {\n", yyvsp
[0].s
);
853 printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n", yyvsp
[0].s
);
864 #line 188 "sysinfo.y"
880 #line 205 "sysinfo.y"
888 printf("\tif (%s) {\n", yyvsp
[0].s
);
894 #line 218 "sysinfo.y"
907 #line 232 "sysinfo.y"
908 {name
= yyvsp
[0].s
; ;
911 #line 234 "sysinfo.y"
913 char *desc
= yyvsp
[-8].s
;
914 char *type
= yyvsp
[-6].s
;
915 int size
= yyvsp
[-5].i
;
916 char *id
= yyvsp
[-3].s
;
917 char *p
= names
[rdepth
];
918 char *ptr
= pnames
[rdepth
];
925 printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n",
927 names
[rdepth
], size
);
931 printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n",
934 names
[rdepth
],size
/8);
943 printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n",
953 printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n",
965 printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n",
971 printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n",
979 printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type
,size
/8,size
%8,id
,names
[rdepth
]);
983 printf("\t/* repeat %s */\n", repeat
);
985 if (type
[0] == 'I') {
986 printf("\tint %s%s; \t/* %s */\n",ptr
,id
, desc
);
988 else if (type
[0] =='C') {
989 printf("\tchar %s*%s;\t /* %s */\n",ptr
,id
, desc
);
992 printf("\tbarray %s%s;\t /* %s */\n",ptr
,id
, desc
);
996 printf("tabout();\n");
997 printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc
, id
);
1000 printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id
,p
);
1001 else if (type
[0] == 'C')
1002 printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id
,p
);
1004 else if (type
[0] == 'B')
1006 printf("\tpbarray(&ptr->%s%s);\n", id
,p
);
1014 #line 339 "sysinfo.y"
1015 { yyval
.s
= yyvsp
[0].s
; ;
1018 #line 340 "sysinfo.y"
1022 #line 345 "sysinfo.y"
1023 { yyval
.s
= yyvsp
[-1].s
; ;
1026 #line 350 "sysinfo.y"
1027 { yyval
.i
= yyvsp
[-1].i
* yyvsp
[0].i
; ;
1030 #line 355 "sysinfo.y"
1031 { yyval
.s
= yyvsp
[-1].s
; ;
1034 #line 356 "sysinfo.y"
1035 { yyval
.s
= "dummy";;
1038 #line 364 "sysinfo.y"
1043 printf("#define %s %s\n", yyvsp
[-2].s
,yyvsp
[-1].s
);
1046 printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name
, names
[rdepth
],yyvsp
[-1].s
,yyvsp
[-2].s
);
1051 /* the action file gets copied in in place of this dollarsign */
1052 #line 543 "/usr/share/misc/bison.simple"
1063 short *ssp1
= yyss
- 1;
1064 fprintf (stderr
, "state stack now");
1065 while (ssp1
!= yyssp
)
1066 fprintf (stderr
, " %d", *++ssp1
);
1067 fprintf (stderr
, "\n");
1077 yylsp
->first_line
= yylloc
.first_line
;
1078 yylsp
->first_column
= yylloc
.first_column
;
1079 yylsp
->last_line
= (yylsp
-1)->last_line
;
1080 yylsp
->last_column
= (yylsp
-1)->last_column
;
1085 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1086 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1090 /* Now "shift" the result of the reduction.
1091 Determine what state that goes to,
1092 based on the state we popped back to
1093 and the rule number reduced by. */
1097 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1098 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1099 yystate
= yytable
[yystate
];
1101 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1105 yyerrlab
: /* here on detecting error */
1108 /* If not already recovering from an error, report this error. */
1112 #ifdef YYERROR_VERBOSE
1113 yyn
= yypact
[yystate
];
1115 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1122 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1123 for (x
= (yyn
< 0 ? -yyn
: 0);
1124 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1125 if (yycheck
[x
+ yyn
] == x
)
1126 size
+= strlen(yytname
[x
]) + 15, count
++;
1127 msg
= (char *) malloc(size
+ 15);
1130 strcpy(msg
, "parse error");
1135 for (x
= (yyn
< 0 ? -yyn
: 0);
1136 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1137 if (yycheck
[x
+ yyn
] == x
)
1139 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1140 strcat(msg
, yytname
[x
]);
1149 yyerror ("parse error; also virtual memory exceeded");
1152 #endif /* YYERROR_VERBOSE */
1153 yyerror("parse error");
1157 yyerrlab1
: /* here on error raised explicitly by an action */
1159 if (yyerrstatus
== 3)
1161 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1163 /* return failure if at end of input */
1164 if (yychar
== YYEOF
)
1169 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1175 /* Else will try to reuse lookahead token
1176 after shifting the error token. */
1178 yyerrstatus
= 3; /* Each real token shifted decrements this */
1182 yyerrdefault
: /* current state does not do anything special for the error token. */
1185 /* This is wrong; only states that explicitly want error tokens
1186 should shift them. */
1187 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1188 if (yyn
) goto yydefault
;
1191 yyerrpop
: /* pop the current state because it cannot handle the error token */
1193 if (yyssp
== yyss
) YYABORT
;
1203 short *ssp1
= yyss
- 1;
1204 fprintf (stderr
, "Error: state stack now");
1205 while (ssp1
!= yyssp
)
1206 fprintf (stderr
, " %d", *++ssp1
);
1207 fprintf (stderr
, "\n");
1213 yyn
= yypact
[yystate
];
1218 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1237 fprintf(stderr
, "Shifting error token, ");
1249 /* YYACCEPT comes here. */
1261 /* YYABORT comes here. */
1272 #line 379 "sysinfo.y"
1276 -d write structure defintions for sysroff in host format
1277 -i write functions to swap into sysroff format in
1278 -o write functions to swap into sysroff format out
1279 -c write code to print info in human form */
1291 writecode
= av
[1][1];
1292 if (writecode
== 'd')
1294 printf("typedef struct { unsigned char *data; int len; } barray; \n");
1295 printf("typedef int INT;\n");
1296 printf("typedef char * CHARS;\n");
1307 fprintf(stderr
, "%s\n" , s
);