No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / lib / sl / slc-gram.c
blobf726b42e093e5072862d3715b11423ec2d49dc4b
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 LITERAL = 258,
70 STRING = 259
72 #endif
73 /* Tokens. */
74 #define LITERAL 258
75 #define STRING 259
80 /* Copy the first part of user declarations. */
81 #line 1 "slc-gram.y"
84 * Copyright (c) 2004-2006 Kungliga Tekniska Högskolan
85 * (Royal Institute of Technology, Stockholm, Sweden).
86 * All rights reserved.
88 * Redistribution and use in source and binary forms, with or without
89 * modification, are permitted provided that the following conditions
90 * are met:
92 * 1. Redistributions of source code must retain the above copyright
93 * notice, this list of conditions and the following disclaimer.
95 * 2. Redistributions in binary form must reproduce the above copyright
96 * notice, this list of conditions and the following disclaimer in the
97 * documentation and/or other materials provided with the distribution.
99 * 3. Neither the name of the Institute nor the names of its contributors
100 * may be used to endorse or promote products derived from this software
101 * without specific prior written permission.
103 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
104 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
105 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
106 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
107 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
108 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
109 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
110 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
111 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
112 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
113 * SUCH DAMAGE.
116 #ifdef HAVE_CONFIG_H
117 #include <config.h>
118 __RCSID("$Heimdal: slc-gram.y 20767 2007-06-01 11:24:52Z lha $"
119 "$NetBSD$");
120 #endif
122 #include <stdio.h>
123 #include <stdlib.h>
124 #include <err.h>
125 #include <ctype.h>
126 #include <limits.h>
127 #include <getarg.h>
128 #include <vers.h>
129 #include <roken.h>
131 #include "slc.h"
132 extern FILE *yyin;
133 extern struct assignment *assignment;
136 /* Enabling traces. */
137 #ifndef YYDEBUG
138 # define YYDEBUG 0
139 #endif
141 /* Enabling verbose error messages. */
142 #ifdef YYERROR_VERBOSE
143 # undef YYERROR_VERBOSE
144 # define YYERROR_VERBOSE 1
145 #else
146 # define YYERROR_VERBOSE 0
147 #endif
149 /* Enabling the token table. */
150 #ifndef YYTOKEN_TABLE
151 # define YYTOKEN_TABLE 0
152 #endif
154 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
155 typedef union YYSTYPE
156 #line 54 "slc-gram.y"
158 char *string;
159 struct assignment *assignment;
161 /* Line 193 of yacc.c. */
162 #line 162 "slc-gram.c"
163 YYSTYPE;
164 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
165 # define YYSTYPE_IS_DECLARED 1
166 # define YYSTYPE_IS_TRIVIAL 1
167 #endif
171 /* Copy the second part of user declarations. */
174 /* Line 216 of yacc.c. */
175 #line 175 "slc-gram.c"
177 #ifdef short
178 # undef short
179 #endif
181 #ifdef YYTYPE_UINT8
182 typedef YYTYPE_UINT8 yytype_uint8;
183 #else
184 typedef unsigned char yytype_uint8;
185 #endif
187 #ifdef YYTYPE_INT8
188 typedef YYTYPE_INT8 yytype_int8;
189 #elif (defined __STDC__ || defined __C99__FUNC__ \
190 || defined __cplusplus || defined _MSC_VER)
191 typedef signed char yytype_int8;
192 #else
193 typedef short int yytype_int8;
194 #endif
196 #ifdef YYTYPE_UINT16
197 typedef YYTYPE_UINT16 yytype_uint16;
198 #else
199 typedef unsigned short int yytype_uint16;
200 #endif
202 #ifdef YYTYPE_INT16
203 typedef YYTYPE_INT16 yytype_int16;
204 #else
205 typedef short int yytype_int16;
206 #endif
208 #ifndef YYSIZE_T
209 # ifdef __SIZE_TYPE__
210 # define YYSIZE_T __SIZE_TYPE__
211 # elif defined size_t
212 # define YYSIZE_T size_t
213 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
214 || defined __cplusplus || defined _MSC_VER)
215 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
216 # define YYSIZE_T size_t
217 # else
218 # define YYSIZE_T unsigned int
219 # endif
220 #endif
222 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
224 #ifndef YY_
225 # if defined YYENABLE_NLS && YYENABLE_NLS
226 # if ENABLE_NLS
227 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
228 # define YY_(msgid) dgettext ("bison-runtime", msgid)
229 # endif
230 # endif
231 # ifndef YY_
232 # define YY_(msgid) msgid
233 # endif
234 #endif
236 /* Suppress unused-variable warnings by "using" E. */
237 #if ! defined lint || defined __GNUC__
238 # define YYUSE(e) ((void) (e))
239 #else
240 # define YYUSE(e) /* empty */
241 #endif
243 /* Identity function, used to suppress warnings about constant conditions. */
244 #ifndef lint
245 # define YYID(n) (n)
246 #else
247 #if (defined __STDC__ || defined __C99__FUNC__ \
248 || defined __cplusplus || defined _MSC_VER)
249 static int
250 YYID (int i)
251 #else
252 static int
253 YYID (i)
254 int i;
255 #endif
257 return i;
259 #endif
261 #if ! defined yyoverflow || YYERROR_VERBOSE
263 /* The parser invokes alloca or malloc; define the necessary symbols. */
265 # ifdef YYSTACK_USE_ALLOCA
266 # if YYSTACK_USE_ALLOCA
267 # ifdef __GNUC__
268 # define YYSTACK_ALLOC __builtin_alloca
269 # elif defined __BUILTIN_VA_ARG_INCR
270 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
271 # elif defined _AIX
272 # define YYSTACK_ALLOC __alloca
273 # elif defined _MSC_VER
274 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
275 # define alloca _alloca
276 # else
277 # define YYSTACK_ALLOC alloca
278 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
279 || defined __cplusplus || defined _MSC_VER)
280 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
281 # ifndef _STDLIB_H
282 # define _STDLIB_H 1
283 # endif
284 # endif
285 # endif
286 # endif
287 # endif
289 # ifdef YYSTACK_ALLOC
290 /* Pacify GCC's `empty if-body' warning. */
291 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
292 # ifndef YYSTACK_ALLOC_MAXIMUM
293 /* The OS might guarantee only one guard page at the bottom of the stack,
294 and a page size can be as small as 4096 bytes. So we cannot safely
295 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
296 to allow for a few compiler-allocated temporary stack slots. */
297 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
298 # endif
299 # else
300 # define YYSTACK_ALLOC YYMALLOC
301 # define YYSTACK_FREE YYFREE
302 # ifndef YYSTACK_ALLOC_MAXIMUM
303 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
304 # endif
305 # if (defined __cplusplus && ! defined _STDLIB_H \
306 && ! ((defined YYMALLOC || defined malloc) \
307 && (defined YYFREE || defined free)))
308 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
309 # ifndef _STDLIB_H
310 # define _STDLIB_H 1
311 # endif
312 # endif
313 # ifndef YYMALLOC
314 # define YYMALLOC malloc
315 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
316 || defined __cplusplus || defined _MSC_VER)
317 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
318 # endif
319 # endif
320 # ifndef YYFREE
321 # define YYFREE free
322 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
323 || defined __cplusplus || defined _MSC_VER)
324 void free (void *); /* INFRINGES ON USER NAME SPACE */
325 # endif
326 # endif
327 # endif
328 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
331 #if (! defined yyoverflow \
332 && (! defined __cplusplus \
333 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
335 /* A type that is properly aligned for any stack member. */
336 union yyalloc
338 yytype_int16 yyss;
339 YYSTYPE yyvs;
342 /* The size of the maximum gap between one aligned stack and the next. */
343 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
345 /* The size of an array large to enough to hold all stacks, each with
346 N elements. */
347 # define YYSTACK_BYTES(N) \
348 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
349 + YYSTACK_GAP_MAXIMUM)
351 /* Copy COUNT objects from FROM to TO. The source and destination do
352 not overlap. */
353 # ifndef YYCOPY
354 # if defined __GNUC__ && 1 < __GNUC__
355 # define YYCOPY(To, From, Count) \
356 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
357 # else
358 # define YYCOPY(To, From, Count) \
359 do \
361 YYSIZE_T yyi; \
362 for (yyi = 0; yyi < (Count); yyi++) \
363 (To)[yyi] = (From)[yyi]; \
365 while (YYID (0))
366 # endif
367 # endif
369 /* Relocate STACK from its old location to the new one. The
370 local variables YYSIZE and YYSTACKSIZE give the old and new number of
371 elements in the stack, and YYPTR gives the new location of the
372 stack. Advance YYPTR to a properly aligned location for the next
373 stack. */
374 # define YYSTACK_RELOCATE(Stack) \
375 do \
377 YYSIZE_T yynewbytes; \
378 YYCOPY (&yyptr->Stack, Stack, yysize); \
379 Stack = &yyptr->Stack; \
380 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
381 yyptr += yynewbytes / sizeof (*yyptr); \
383 while (YYID (0))
385 #endif
387 /* YYFINAL -- State number of the termination state. */
388 #define YYFINAL 6
389 /* YYLAST -- Last index in YYTABLE. */
390 #define YYLAST 7
392 /* YYNTOKENS -- Number of terminals. */
393 #define YYNTOKENS 8
394 /* YYNNTS -- Number of nonterminals. */
395 #define YYNNTS 4
396 /* YYNRULES -- Number of rules. */
397 #define YYNRULES 6
398 /* YYNRULES -- Number of states. */
399 #define YYNSTATES 12
401 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
402 #define YYUNDEFTOK 2
403 #define YYMAXUTOK 259
405 #define YYTRANSLATE(YYX) \
406 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
408 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
409 static const yytype_uint8 yytranslate[] =
411 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 5, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 6, 2, 7, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 1, 2, 3, 4
439 #if YYDEBUG
440 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
441 YYRHS. */
442 static const yytype_uint8 yyprhs[] =
444 0, 0, 3, 5, 8, 10, 14
447 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
448 static const yytype_int8 yyrhs[] =
450 9, 0, -1, 10, -1, 11, 10, -1, 11, -1,
451 3, 5, 4, -1, 3, 5, 6, 10, 7, -1
454 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
455 static const yytype_uint8 yyrline[] =
457 0, 67, 67, 73, 78, 81, 90
459 #endif
461 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
462 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
463 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
464 static const char *const yytname[] =
466 "$end", "error", "$undefined", "LITERAL", "STRING", "'='", "'{'", "'}'",
467 "$accept", "start", "assignments", "assignment", 0
469 #endif
471 # ifdef YYPRINT
472 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
473 token YYLEX-NUM. */
474 static const yytype_uint16 yytoknum[] =
476 0, 256, 257, 258, 259, 61, 123, 125
478 # endif
480 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
481 static const yytype_uint8 yyr1[] =
483 0, 8, 9, 10, 10, 11, 11
486 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
487 static const yytype_uint8 yyr2[] =
489 0, 2, 1, 2, 1, 3, 5
492 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
493 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
494 means the default is an error. */
495 static const yytype_uint8 yydefact[] =
497 0, 0, 0, 2, 4, 0, 1, 3, 5, 0,
498 0, 6
501 /* YYDEFGOTO[NTERM-NUM]. */
502 static const yytype_int8 yydefgoto[] =
504 -1, 2, 3, 4
507 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
508 STATE-NUM. */
509 #define YYPACT_NINF -5
510 static const yytype_int8 yypact[] =
512 -1, 1, 4, -5, -1, -3, -5, -5, -5, -1,
513 0, -5
516 /* YYPGOTO[NTERM-NUM]. */
517 static const yytype_int8 yypgoto[] =
519 -5, -5, -4, -5
522 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
523 positive, shift that token. If negative, reduce the rule which
524 number is the opposite. If zero, do what YYDEFACT says.
525 If YYTABLE_NINF, syntax error. */
526 #define YYTABLE_NINF -1
527 static const yytype_uint8 yytable[] =
529 7, 8, 1, 9, 6, 10, 5, 11
532 static const yytype_uint8 yycheck[] =
534 4, 4, 3, 6, 0, 9, 5, 7
537 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
538 symbol of state STATE-NUM. */
539 static const yytype_uint8 yystos[] =
541 0, 3, 9, 10, 11, 5, 0, 10, 4, 6,
542 10, 7
545 #define yyerrok (yyerrstatus = 0)
546 #define yyclearin (yychar = YYEMPTY)
547 #define YYEMPTY (-2)
548 #define YYEOF 0
550 #define YYACCEPT goto yyacceptlab
551 #define YYABORT goto yyabortlab
552 #define YYERROR goto yyerrorlab
555 /* Like YYERROR except do call yyerror. This remains here temporarily
556 to ease the transition to the new meaning of YYERROR, for GCC.
557 Once GCC version 2 has supplanted version 1, this can go. */
559 #define YYFAIL goto yyerrlab
561 #define YYRECOVERING() (!!yyerrstatus)
563 #define YYBACKUP(Token, Value) \
564 do \
565 if (yychar == YYEMPTY && yylen == 1) \
567 yychar = (Token); \
568 yylval = (Value); \
569 yytoken = YYTRANSLATE (yychar); \
570 YYPOPSTACK (1); \
571 goto yybackup; \
573 else \
575 yyerror (YY_("syntax error: cannot back up")); \
576 YYERROR; \
578 while (YYID (0))
581 #define YYTERROR 1
582 #define YYERRCODE 256
585 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
586 If N is 0, then set CURRENT to the empty location which ends
587 the previous symbol: RHS[0] (always defined). */
589 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
590 #ifndef YYLLOC_DEFAULT
591 # define YYLLOC_DEFAULT(Current, Rhs, N) \
592 do \
593 if (YYID (N)) \
595 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
596 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
597 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
598 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
600 else \
602 (Current).first_line = (Current).last_line = \
603 YYRHSLOC (Rhs, 0).last_line; \
604 (Current).first_column = (Current).last_column = \
605 YYRHSLOC (Rhs, 0).last_column; \
607 while (YYID (0))
608 #endif
611 /* YY_LOCATION_PRINT -- Print the location on the stream.
612 This macro was not mandated originally: define only if we know
613 we won't break user code: when these are the locations we know. */
615 #ifndef YY_LOCATION_PRINT
616 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
617 # define YY_LOCATION_PRINT(File, Loc) \
618 fprintf (File, "%d.%d-%d.%d", \
619 (Loc).first_line, (Loc).first_column, \
620 (Loc).last_line, (Loc).last_column)
621 # else
622 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
623 # endif
624 #endif
627 /* YYLEX -- calling `yylex' with the right arguments. */
629 #ifdef YYLEX_PARAM
630 # define YYLEX yylex (YYLEX_PARAM)
631 #else
632 # define YYLEX yylex ()
633 #endif
635 /* Enable debugging if requested. */
636 #if YYDEBUG
638 # ifndef YYFPRINTF
639 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
640 # define YYFPRINTF fprintf
641 # endif
643 # define YYDPRINTF(Args) \
644 do { \
645 if (yydebug) \
646 YYFPRINTF Args; \
647 } while (YYID (0))
649 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
650 do { \
651 if (yydebug) \
653 YYFPRINTF (stderr, "%s ", Title); \
654 yy_symbol_print (stderr, \
655 Type, Value); \
656 YYFPRINTF (stderr, "\n"); \
658 } while (YYID (0))
661 /*--------------------------------.
662 | Print this symbol on YYOUTPUT. |
663 `--------------------------------*/
665 /*ARGSUSED*/
666 #if (defined __STDC__ || defined __C99__FUNC__ \
667 || defined __cplusplus || defined _MSC_VER)
668 static void
669 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
670 #else
671 static void
672 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
673 FILE *yyoutput;
674 int yytype;
675 YYSTYPE const * const yyvaluep;
676 #endif
678 if (!yyvaluep)
679 return;
680 # ifdef YYPRINT
681 if (yytype < YYNTOKENS)
682 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
683 # else
684 YYUSE (yyoutput);
685 # endif
686 switch (yytype)
688 default:
689 break;
694 /*--------------------------------.
695 | Print this symbol on YYOUTPUT. |
696 `--------------------------------*/
698 #if (defined __STDC__ || defined __C99__FUNC__ \
699 || defined __cplusplus || defined _MSC_VER)
700 static void
701 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
702 #else
703 static void
704 yy_symbol_print (yyoutput, yytype, yyvaluep)
705 FILE *yyoutput;
706 int yytype;
707 YYSTYPE const * const yyvaluep;
708 #endif
710 if (yytype < YYNTOKENS)
711 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
712 else
713 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
715 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
716 YYFPRINTF (yyoutput, ")");
719 /*------------------------------------------------------------------.
720 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
721 | TOP (included). |
722 `------------------------------------------------------------------*/
724 #if (defined __STDC__ || defined __C99__FUNC__ \
725 || defined __cplusplus || defined _MSC_VER)
726 static void
727 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
728 #else
729 static void
730 yy_stack_print (bottom, top)
731 yytype_int16 *bottom;
732 yytype_int16 *top;
733 #endif
735 YYFPRINTF (stderr, "Stack now");
736 for (; bottom <= top; ++bottom)
737 YYFPRINTF (stderr, " %d", *bottom);
738 YYFPRINTF (stderr, "\n");
741 # define YY_STACK_PRINT(Bottom, Top) \
742 do { \
743 if (yydebug) \
744 yy_stack_print ((Bottom), (Top)); \
745 } while (YYID (0))
748 /*------------------------------------------------.
749 | Report that the YYRULE is going to be reduced. |
750 `------------------------------------------------*/
752 #if (defined __STDC__ || defined __C99__FUNC__ \
753 || defined __cplusplus || defined _MSC_VER)
754 static void
755 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
756 #else
757 static void
758 yy_reduce_print (yyvsp, yyrule)
759 YYSTYPE *yyvsp;
760 int yyrule;
761 #endif
763 int yynrhs = yyr2[yyrule];
764 int yyi;
765 unsigned long int yylno = yyrline[yyrule];
766 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
767 yyrule - 1, yylno);
768 /* The symbols being reduced. */
769 for (yyi = 0; yyi < yynrhs; yyi++)
771 fprintf (stderr, " $%d = ", yyi + 1);
772 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
773 &(yyvsp[(yyi + 1) - (yynrhs)])
775 fprintf (stderr, "\n");
779 # define YY_REDUCE_PRINT(Rule) \
780 do { \
781 if (yydebug) \
782 yy_reduce_print (yyvsp, Rule); \
783 } while (YYID (0))
785 /* Nonzero means print parse trace. It is left uninitialized so that
786 multiple parsers can coexist. */
787 int yydebug;
788 #else /* !YYDEBUG */
789 # define YYDPRINTF(Args)
790 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
791 # define YY_STACK_PRINT(Bottom, Top)
792 # define YY_REDUCE_PRINT(Rule)
793 #endif /* !YYDEBUG */
796 /* YYINITDEPTH -- initial size of the parser's stacks. */
797 #ifndef YYINITDEPTH
798 # define YYINITDEPTH 200
799 #endif
801 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
802 if the built-in stack extension method is used).
804 Do not make this value too large; the results are undefined if
805 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
806 evaluated with infinite-precision integer arithmetic. */
808 #ifndef YYMAXDEPTH
809 # define YYMAXDEPTH 10000
810 #endif
814 #if YYERROR_VERBOSE
816 # ifndef yystrlen
817 # if defined __GLIBC__ && defined _STRING_H
818 # define yystrlen strlen
819 # else
820 /* Return the length of YYSTR. */
821 #if (defined __STDC__ || defined __C99__FUNC__ \
822 || defined __cplusplus || defined _MSC_VER)
823 static YYSIZE_T
824 yystrlen (const char *yystr)
825 #else
826 static YYSIZE_T
827 yystrlen (yystr)
828 const char *yystr;
829 #endif
831 YYSIZE_T yylen;
832 for (yylen = 0; yystr[yylen]; yylen++)
833 continue;
834 return yylen;
836 # endif
837 # endif
839 # ifndef yystpcpy
840 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
841 # define yystpcpy stpcpy
842 # else
843 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
844 YYDEST. */
845 #if (defined __STDC__ || defined __C99__FUNC__ \
846 || defined __cplusplus || defined _MSC_VER)
847 static char *
848 yystpcpy (char *yydest, const char *yysrc)
849 #else
850 static char *
851 yystpcpy (yydest, yysrc)
852 char *yydest;
853 const char *yysrc;
854 #endif
856 char *yyd = yydest;
857 const char *yys = yysrc;
859 while ((*yyd++ = *yys++) != '\0')
860 continue;
862 return yyd - 1;
864 # endif
865 # endif
867 # ifndef yytnamerr
868 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
869 quotes and backslashes, so that it's suitable for yyerror. The
870 heuristic is that double-quoting is unnecessary unless the string
871 contains an apostrophe, a comma, or backslash (other than
872 backslash-backslash). YYSTR is taken from yytname. If YYRES is
873 null, do not copy; instead, return the length of what the result
874 would have been. */
875 static YYSIZE_T
876 yytnamerr (char *yyres, const char *yystr)
878 if (*yystr == '"')
880 YYSIZE_T yyn = 0;
881 char const *yyp = yystr;
883 for (;;)
884 switch (*++yyp)
886 case '\'':
887 case ',':
888 goto do_not_strip_quotes;
890 case '\\':
891 if (*++yyp != '\\')
892 goto do_not_strip_quotes;
893 /* Fall through. */
894 default:
895 if (yyres)
896 yyres[yyn] = *yyp;
897 yyn++;
898 break;
900 case '"':
901 if (yyres)
902 yyres[yyn] = '\0';
903 return yyn;
905 do_not_strip_quotes: ;
908 if (! yyres)
909 return yystrlen (yystr);
911 return yystpcpy (yyres, yystr) - yyres;
913 # endif
915 /* Copy into YYRESULT an error message about the unexpected token
916 YYCHAR while in state YYSTATE. Return the number of bytes copied,
917 including the terminating null byte. If YYRESULT is null, do not
918 copy anything; just return the number of bytes that would be
919 copied. As a special case, return 0 if an ordinary "syntax error"
920 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
921 size calculation. */
922 static YYSIZE_T
923 yysyntax_error (char *yyresult, int yystate, int yychar)
925 int yyn = yypact[yystate];
927 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
928 return 0;
929 else
931 int yytype = YYTRANSLATE (yychar);
932 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
933 YYSIZE_T yysize = yysize0;
934 YYSIZE_T yysize1;
935 int yysize_overflow = 0;
936 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
937 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
938 int yyx;
940 # if 0
941 /* This is so xgettext sees the translatable formats that are
942 constructed on the fly. */
943 YY_("syntax error, unexpected %s");
944 YY_("syntax error, unexpected %s, expecting %s");
945 YY_("syntax error, unexpected %s, expecting %s or %s");
946 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
947 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
948 # endif
949 char *yyfmt;
950 char const *yyf;
951 static char const yyunexpected[] = "syntax error, unexpected %s";
952 static char const yyexpecting[] = ", expecting %s";
953 static char const yyor[] = " or %s";
954 char yyformat[sizeof yyunexpected
955 + sizeof yyexpecting - 1
956 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
957 * (sizeof yyor - 1))];
958 char const *yyprefix = yyexpecting;
960 /* Start YYX at -YYN if negative to avoid negative indexes in
961 YYCHECK. */
962 int yyxbegin = yyn < 0 ? -yyn : 0;
964 /* Stay within bounds of both yycheck and yytname. */
965 int yychecklim = YYLAST - yyn + 1;
966 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
967 int yycount = 1;
969 yyarg[0] = yytname[yytype];
970 yyfmt = yystpcpy (yyformat, yyunexpected);
972 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
973 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
975 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
977 yycount = 1;
978 yysize = yysize0;
979 yyformat[sizeof yyunexpected - 1] = '\0';
980 break;
982 yyarg[yycount++] = yytname[yyx];
983 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
984 yysize_overflow |= (yysize1 < yysize);
985 yysize = yysize1;
986 yyfmt = yystpcpy (yyfmt, yyprefix);
987 yyprefix = yyor;
990 yyf = YY_(yyformat);
991 yysize1 = yysize + yystrlen (yyf);
992 yysize_overflow |= (yysize1 < yysize);
993 yysize = yysize1;
995 if (yysize_overflow)
996 return YYSIZE_MAXIMUM;
998 if (yyresult)
1000 /* Avoid sprintf, as that infringes on the user's name space.
1001 Don't have undefined behavior even if the translation
1002 produced a string with the wrong number of "%s"s. */
1003 char *yyp = yyresult;
1004 int yyi = 0;
1005 while ((*yyp = *yyf) != '\0')
1007 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1009 yyp += yytnamerr (yyp, yyarg[yyi++]);
1010 yyf += 2;
1012 else
1014 yyp++;
1015 yyf++;
1019 return yysize;
1022 #endif /* YYERROR_VERBOSE */
1025 /*-----------------------------------------------.
1026 | Release the memory associated to this symbol. |
1027 `-----------------------------------------------*/
1029 /*ARGSUSED*/
1030 #if (defined __STDC__ || defined __C99__FUNC__ \
1031 || defined __cplusplus || defined _MSC_VER)
1032 static void
1033 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1034 #else
1035 static void
1036 yydestruct (yymsg, yytype, yyvaluep)
1037 const char *yymsg;
1038 int yytype;
1039 YYSTYPE *yyvaluep;
1040 #endif
1042 YYUSE (yyvaluep);
1044 if (!yymsg)
1045 yymsg = "Deleting";
1046 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1048 switch (yytype)
1051 default:
1052 break;
1057 /* Prevent warnings from -Wmissing-prototypes. */
1059 #ifdef YYPARSE_PARAM
1060 #if defined __STDC__ || defined __cplusplus
1061 int yyparse (void *YYPARSE_PARAM);
1062 #else
1063 int yyparse ();
1064 #endif
1065 #else /* ! YYPARSE_PARAM */
1066 #if defined __STDC__ || defined __cplusplus
1067 int yyparse (void);
1068 #else
1069 int yyparse ();
1070 #endif
1071 #endif /* ! YYPARSE_PARAM */
1075 /* The look-ahead symbol. */
1076 int yychar;
1078 /* The semantic value of the look-ahead symbol. */
1079 YYSTYPE yylval;
1081 /* Number of syntax errors so far. */
1082 int yynerrs;
1086 /*----------.
1087 | yyparse. |
1088 `----------*/
1090 #ifdef YYPARSE_PARAM
1091 #if (defined __STDC__ || defined __C99__FUNC__ \
1092 || defined __cplusplus || defined _MSC_VER)
1094 yyparse (void *YYPARSE_PARAM)
1095 #else
1097 yyparse (YYPARSE_PARAM)
1098 void *YYPARSE_PARAM;
1099 #endif
1100 #else /* ! YYPARSE_PARAM */
1101 #if (defined __STDC__ || defined __C99__FUNC__ \
1102 || defined __cplusplus || defined _MSC_VER)
1104 yyparse (void)
1105 #else
1107 yyparse ()
1109 #endif
1110 #endif
1113 int yystate;
1114 int yyn;
1115 int yyresult;
1116 /* Number of tokens to shift before error messages enabled. */
1117 int yyerrstatus;
1118 /* Look-ahead token as an internal (translated) token number. */
1119 int yytoken = 0;
1120 #if YYERROR_VERBOSE
1121 /* Buffer for error messages, and its allocated size. */
1122 char yymsgbuf[128];
1123 char *yymsg = yymsgbuf;
1124 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1125 #endif
1127 /* Three stacks and their tools:
1128 `yyss': related to states,
1129 `yyvs': related to semantic values,
1130 `yyls': related to locations.
1132 Refer to the stacks thru separate pointers, to allow yyoverflow
1133 to reallocate them elsewhere. */
1135 /* The state stack. */
1136 yytype_int16 yyssa[YYINITDEPTH];
1137 yytype_int16 *yyss = yyssa;
1138 yytype_int16 *yyssp;
1140 /* The semantic value stack. */
1141 YYSTYPE yyvsa[YYINITDEPTH];
1142 YYSTYPE *yyvs = yyvsa;
1143 YYSTYPE *yyvsp;
1147 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1149 YYSIZE_T yystacksize = YYINITDEPTH;
1151 /* The variables used to return semantic value and location from the
1152 action routines. */
1153 YYSTYPE yyval;
1156 /* The number of symbols on the RHS of the reduced rule.
1157 Keep to zero when no symbol should be popped. */
1158 int yylen = 0;
1160 YYDPRINTF ((stderr, "Starting parse\n"));
1162 yystate = 0;
1163 yyerrstatus = 0;
1164 yynerrs = 0;
1165 yychar = YYEMPTY; /* Cause a token to be read. */
1167 /* Initialize stack pointers.
1168 Waste one element of value and location stack
1169 so that they stay on the same level as the state stack.
1170 The wasted elements are never initialized. */
1172 yyssp = yyss;
1173 yyvsp = yyvs;
1175 goto yysetstate;
1177 /*------------------------------------------------------------.
1178 | yynewstate -- Push a new state, which is found in yystate. |
1179 `------------------------------------------------------------*/
1180 yynewstate:
1181 /* In all cases, when you get here, the value and location stacks
1182 have just been pushed. So pushing a state here evens the stacks. */
1183 yyssp++;
1185 yysetstate:
1186 *yyssp = yystate;
1188 if (yyss + yystacksize - 1 <= yyssp)
1190 /* Get the current used size of the three stacks, in elements. */
1191 YYSIZE_T yysize = yyssp - yyss + 1;
1193 #ifdef yyoverflow
1195 /* Give user a chance to reallocate the stack. Use copies of
1196 these so that the &'s don't force the real ones into
1197 memory. */
1198 YYSTYPE *yyvs1 = yyvs;
1199 yytype_int16 *yyss1 = yyss;
1202 /* Each stack pointer address is followed by the size of the
1203 data in use in that stack, in bytes. This used to be a
1204 conditional around just the two extra args, but that might
1205 be undefined if yyoverflow is a macro. */
1206 yyoverflow (YY_("memory exhausted"),
1207 &yyss1, yysize * sizeof (*yyssp),
1208 &yyvs1, yysize * sizeof (*yyvsp),
1210 &yystacksize);
1212 yyss = yyss1;
1213 yyvs = yyvs1;
1215 #else /* no yyoverflow */
1216 # ifndef YYSTACK_RELOCATE
1217 goto yyexhaustedlab;
1218 # else
1219 /* Extend the stack our own way. */
1220 if (YYMAXDEPTH <= yystacksize)
1221 goto yyexhaustedlab;
1222 yystacksize *= 2;
1223 if (YYMAXDEPTH < yystacksize)
1224 yystacksize = YYMAXDEPTH;
1227 yytype_int16 *yyss1 = yyss;
1228 union yyalloc *yyptr =
1229 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1230 if (! yyptr)
1231 goto yyexhaustedlab;
1232 YYSTACK_RELOCATE (yyss);
1233 YYSTACK_RELOCATE (yyvs);
1235 # undef YYSTACK_RELOCATE
1236 if (yyss1 != yyssa)
1237 YYSTACK_FREE (yyss1);
1239 # endif
1240 #endif /* no yyoverflow */
1242 yyssp = yyss + yysize - 1;
1243 yyvsp = yyvs + yysize - 1;
1246 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1247 (unsigned long int) yystacksize));
1249 if (yyss + yystacksize - 1 <= yyssp)
1250 YYABORT;
1253 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1255 goto yybackup;
1257 /*-----------.
1258 | yybackup. |
1259 `-----------*/
1260 yybackup:
1262 /* Do appropriate processing given the current state. Read a
1263 look-ahead token if we need one and don't already have one. */
1265 /* First try to decide what to do without reference to look-ahead token. */
1266 yyn = yypact[yystate];
1267 if (yyn == YYPACT_NINF)
1268 goto yydefault;
1270 /* Not known => get a look-ahead token if don't already have one. */
1272 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1273 if (yychar == YYEMPTY)
1275 YYDPRINTF ((stderr, "Reading a token: "));
1276 yychar = YYLEX;
1279 if (yychar <= YYEOF)
1281 yychar = yytoken = YYEOF;
1282 YYDPRINTF ((stderr, "Now at end of input.\n"));
1284 else
1286 yytoken = YYTRANSLATE (yychar);
1287 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1290 /* If the proper action on seeing token YYTOKEN is to reduce or to
1291 detect an error, take that action. */
1292 yyn += yytoken;
1293 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1294 goto yydefault;
1295 yyn = yytable[yyn];
1296 if (yyn <= 0)
1298 if (yyn == 0 || yyn == YYTABLE_NINF)
1299 goto yyerrlab;
1300 yyn = -yyn;
1301 goto yyreduce;
1304 if (yyn == YYFINAL)
1305 YYACCEPT;
1307 /* Count tokens shifted since error; after three, turn off error
1308 status. */
1309 if (yyerrstatus)
1310 yyerrstatus--;
1312 /* Shift the look-ahead token. */
1313 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1315 /* Discard the shifted token unless it is eof. */
1316 if (yychar != YYEOF)
1317 yychar = YYEMPTY;
1319 yystate = yyn;
1320 *++yyvsp = yylval;
1322 goto yynewstate;
1325 /*-----------------------------------------------------------.
1326 | yydefault -- do the default action for the current state. |
1327 `-----------------------------------------------------------*/
1328 yydefault:
1329 yyn = yydefact[yystate];
1330 if (yyn == 0)
1331 goto yyerrlab;
1332 goto yyreduce;
1335 /*-----------------------------.
1336 | yyreduce -- Do a reduction. |
1337 `-----------------------------*/
1338 yyreduce:
1339 /* yyn is the number of a rule to reduce with. */
1340 yylen = yyr2[yyn];
1342 /* If YYLEN is nonzero, implement the default value of the action:
1343 `$$ = $1'.
1345 Otherwise, the following line sets YYVAL to garbage.
1346 This behavior is undocumented and Bison
1347 users should not rely upon it. Assigning to YYVAL
1348 unconditionally makes the parser a bit smaller, and it avoids a
1349 GCC warning that YYVAL may be used uninitialized. */
1350 yyval = yyvsp[1-yylen];
1353 YY_REDUCE_PRINT (yyn);
1354 switch (yyn)
1356 case 2:
1357 #line 68 "slc-gram.y"
1359 assignment = (yyvsp[(1) - (1)].assignment);
1361 break;
1363 case 3:
1364 #line 74 "slc-gram.y"
1366 (yyvsp[(1) - (2)].assignment)->next = (yyvsp[(2) - (2)].assignment);
1367 (yyval.assignment) = (yyvsp[(1) - (2)].assignment);
1369 break;
1371 case 5:
1372 #line 82 "slc-gram.y"
1374 (yyval.assignment) = malloc(sizeof(*(yyval.assignment)));
1375 (yyval.assignment)->name = (yyvsp[(1) - (3)].string);
1376 (yyval.assignment)->type = a_value;
1377 (yyval.assignment)->lineno = lineno;
1378 (yyval.assignment)->u.value = (yyvsp[(3) - (3)].string);
1379 (yyval.assignment)->next = NULL;
1381 break;
1383 case 6:
1384 #line 91 "slc-gram.y"
1386 (yyval.assignment) = malloc(sizeof(*(yyval.assignment)));
1387 (yyval.assignment)->name = (yyvsp[(1) - (5)].string);
1388 (yyval.assignment)->type = a_assignment;
1389 (yyval.assignment)->lineno = lineno;
1390 (yyval.assignment)->u.assignment = (yyvsp[(4) - (5)].assignment);
1391 (yyval.assignment)->next = NULL;
1393 break;
1396 /* Line 1267 of yacc.c. */
1397 #line 1397 "slc-gram.c"
1398 default: break;
1400 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1402 YYPOPSTACK (yylen);
1403 yylen = 0;
1404 YY_STACK_PRINT (yyss, yyssp);
1406 *++yyvsp = yyval;
1409 /* Now `shift' the result of the reduction. Determine what state
1410 that goes to, based on the state we popped back to and the rule
1411 number reduced by. */
1413 yyn = yyr1[yyn];
1415 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1416 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1417 yystate = yytable[yystate];
1418 else
1419 yystate = yydefgoto[yyn - YYNTOKENS];
1421 goto yynewstate;
1424 /*------------------------------------.
1425 | yyerrlab -- here on detecting error |
1426 `------------------------------------*/
1427 yyerrlab:
1428 /* If not already recovering from an error, report this error. */
1429 if (!yyerrstatus)
1431 ++yynerrs;
1432 #if ! YYERROR_VERBOSE
1433 yyerror (YY_("syntax error"));
1434 #else
1436 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1437 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1439 YYSIZE_T yyalloc = 2 * yysize;
1440 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1441 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1442 if (yymsg != yymsgbuf)
1443 YYSTACK_FREE (yymsg);
1444 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1445 if (yymsg)
1446 yymsg_alloc = yyalloc;
1447 else
1449 yymsg = yymsgbuf;
1450 yymsg_alloc = sizeof yymsgbuf;
1454 if (0 < yysize && yysize <= yymsg_alloc)
1456 (void) yysyntax_error (yymsg, yystate, yychar);
1457 yyerror (yymsg);
1459 else
1461 yyerror (YY_("syntax error"));
1462 if (yysize != 0)
1463 goto yyexhaustedlab;
1466 #endif
1471 if (yyerrstatus == 3)
1473 /* If just tried and failed to reuse look-ahead token after an
1474 error, discard it. */
1476 if (yychar <= YYEOF)
1478 /* Return failure if at end of input. */
1479 if (yychar == YYEOF)
1480 YYABORT;
1482 else
1484 yydestruct ("Error: discarding",
1485 yytoken, &yylval);
1486 yychar = YYEMPTY;
1490 /* Else will try to reuse look-ahead token after shifting the error
1491 token. */
1492 goto yyerrlab1;
1495 /*---------------------------------------------------.
1496 | yyerrorlab -- error raised explicitly by YYERROR. |
1497 `---------------------------------------------------*/
1498 yyerrorlab:
1500 /* Pacify compilers like GCC when the user code never invokes
1501 YYERROR and the label yyerrorlab therefore never appears in user
1502 code. */
1503 if (/*CONSTCOND*/ 0)
1504 goto yyerrorlab;
1506 /* Do not reclaim the symbols of the rule which action triggered
1507 this YYERROR. */
1508 YYPOPSTACK (yylen);
1509 yylen = 0;
1510 YY_STACK_PRINT (yyss, yyssp);
1511 yystate = *yyssp;
1512 goto yyerrlab1;
1515 /*-------------------------------------------------------------.
1516 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1517 `-------------------------------------------------------------*/
1518 yyerrlab1:
1519 yyerrstatus = 3; /* Each real token shifted decrements this. */
1521 for (;;)
1523 yyn = yypact[yystate];
1524 if (yyn != YYPACT_NINF)
1526 yyn += YYTERROR;
1527 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1529 yyn = yytable[yyn];
1530 if (0 < yyn)
1531 break;
1535 /* Pop the current state because it cannot handle the error token. */
1536 if (yyssp == yyss)
1537 YYABORT;
1540 yydestruct ("Error: popping",
1541 yystos[yystate], yyvsp);
1542 YYPOPSTACK (1);
1543 yystate = *yyssp;
1544 YY_STACK_PRINT (yyss, yyssp);
1547 if (yyn == YYFINAL)
1548 YYACCEPT;
1550 *++yyvsp = yylval;
1553 /* Shift the error token. */
1554 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1556 yystate = yyn;
1557 goto yynewstate;
1560 /*-------------------------------------.
1561 | yyacceptlab -- YYACCEPT comes here. |
1562 `-------------------------------------*/
1563 yyacceptlab:
1564 yyresult = 0;
1565 goto yyreturn;
1567 /*-----------------------------------.
1568 | yyabortlab -- YYABORT comes here. |
1569 `-----------------------------------*/
1570 yyabortlab:
1571 yyresult = 1;
1572 goto yyreturn;
1574 #ifndef yyoverflow
1575 /*-------------------------------------------------.
1576 | yyexhaustedlab -- memory exhaustion comes here. |
1577 `-------------------------------------------------*/
1578 yyexhaustedlab:
1579 yyerror (YY_("memory exhausted"));
1580 yyresult = 2;
1581 /* Fall through. */
1582 #endif
1584 yyreturn:
1585 if (yychar != YYEOF && yychar != YYEMPTY)
1586 yydestruct ("Cleanup: discarding lookahead",
1587 yytoken, &yylval);
1588 /* Do not reclaim the symbols of the rule which action triggered
1589 this YYABORT or YYACCEPT. */
1590 YYPOPSTACK (yylen);
1591 YY_STACK_PRINT (yyss, yyssp);
1592 while (yyssp != yyss)
1594 yydestruct ("Cleanup: popping",
1595 yystos[*yyssp], yyvsp);
1596 YYPOPSTACK (1);
1598 #ifndef yyoverflow
1599 if (yyss != yyssa)
1600 YYSTACK_FREE (yyss);
1601 #endif
1602 #if YYERROR_VERBOSE
1603 if (yymsg != yymsgbuf)
1604 YYSTACK_FREE (yymsg);
1605 #endif
1606 /* Make sure YYID is used. */
1607 return YYID (yyresult);
1611 #line 101 "slc-gram.y"
1613 char *filename;
1614 FILE *cfile, *hfile;
1615 int error_flag;
1616 struct assignment *assignment;
1619 static void
1620 ex(struct assignment *a, const char *fmt, ...)
1622 va_list ap;
1623 fprintf(stderr, "%s:%d: ", a->name, a->lineno);
1624 va_start(ap, fmt);
1625 vfprintf(stderr, fmt, ap);
1626 va_end(ap);
1627 fprintf(stderr, "\n");
1632 static int
1633 check_option(struct assignment *as)
1635 struct assignment *a;
1636 int seen_long = 0;
1637 int seen_short = 0;
1638 int seen_type = 0;
1639 int seen_argument = 0;
1640 int seen_help = 0;
1641 int seen_default = 0;
1642 int ret = 0;
1644 for(a = as; a != NULL; a = a->next) {
1645 if(strcmp(a->name, "long") == 0)
1646 seen_long++;
1647 else if(strcmp(a->name, "short") == 0)
1648 seen_short++;
1649 else if(strcmp(a->name, "type") == 0)
1650 seen_type++;
1651 else if(strcmp(a->name, "argument") == 0)
1652 seen_argument++;
1653 else if(strcmp(a->name, "help") == 0)
1654 seen_help++;
1655 else if(strcmp(a->name, "default") == 0)
1656 seen_default++;
1657 else {
1658 ex(a, "unknown name");
1659 ret++;
1662 if(seen_long == 0 && seen_short == 0) {
1663 ex(as, "neither long nor short option");
1664 ret++;
1666 if(seen_long > 1) {
1667 ex(as, "multiple long options");
1668 ret++;
1670 if(seen_short > 1) {
1671 ex(as, "multiple short options");
1672 ret++;
1674 if(seen_type > 1) {
1675 ex(as, "multiple types");
1676 ret++;
1678 if(seen_argument > 1) {
1679 ex(as, "multiple arguments");
1680 ret++;
1682 if(seen_help > 1) {
1683 ex(as, "multiple help strings");
1684 ret++;
1686 if(seen_default > 1) {
1687 ex(as, "multiple default values");
1688 ret++;
1690 return ret;
1693 static int
1694 check_command(struct assignment *as)
1696 struct assignment *a;
1697 int seen_name = 0;
1698 int seen_function = 0;
1699 int seen_help = 0;
1700 int seen_argument = 0;
1701 int seen_minargs = 0;
1702 int seen_maxargs = 0;
1703 int ret = 0;
1704 for(a = as; a != NULL; a = a->next) {
1705 if(strcmp(a->name, "name") == 0)
1706 seen_name++;
1707 else if(strcmp(a->name, "function") == 0) {
1708 seen_function++;
1709 } else if(strcmp(a->name, "option") == 0)
1710 ret += check_option(a->u.assignment);
1711 else if(strcmp(a->name, "help") == 0) {
1712 seen_help++;
1713 } else if(strcmp(a->name, "argument") == 0) {
1714 seen_argument++;
1715 } else if(strcmp(a->name, "min_args") == 0) {
1716 seen_minargs++;
1717 } else if(strcmp(a->name, "max_args") == 0) {
1718 seen_maxargs++;
1719 } else {
1720 ex(a, "unknown name");
1721 ret++;
1724 if(seen_name == 0) {
1725 ex(as, "no command name");
1726 ret++;
1728 if(seen_function > 1) {
1729 ex(as, "multiple function names");
1730 ret++;
1732 if(seen_help > 1) {
1733 ex(as, "multiple help strings");
1734 ret++;
1736 if(seen_argument > 1) {
1737 ex(as, "multiple argument strings");
1738 ret++;
1740 if(seen_minargs > 1) {
1741 ex(as, "multiple min_args strings");
1742 ret++;
1744 if(seen_maxargs > 1) {
1745 ex(as, "multiple max_args strings");
1746 ret++;
1749 return ret;
1752 static int
1753 check(struct assignment *as)
1755 struct assignment *a;
1756 int ret = 0;
1757 for(a = as; a != NULL; a = a->next) {
1758 if(strcmp(a->name, "command")) {
1759 fprintf(stderr, "unknown type %s line %d\n", a->name, a->lineno);
1760 ret++;
1761 continue;
1763 if(a->type != a_assignment) {
1764 fprintf(stderr, "bad command definition %s line %d\n", a->name, a->lineno);
1765 ret++;
1766 continue;
1768 ret += check_command(a->u.assignment);
1770 return ret;
1773 static struct assignment *
1774 find_next(struct assignment *as, const char *name)
1776 for(as = as->next; as != NULL; as = as->next) {
1777 if(strcmp(as->name, name) == 0)
1778 return as;
1780 return NULL;
1783 static struct assignment *
1784 find(struct assignment *as, const char *name)
1786 for(; as != NULL; as = as->next) {
1787 if(strcmp(as->name, name) == 0)
1788 return as;
1790 return NULL;
1793 static void
1794 space(FILE *f, int level)
1796 fprintf(f, "%*.*s", level * 4, level * 4, " ");
1799 static void
1800 cprint(int level, const char *fmt, ...)
1802 va_list ap;
1803 va_start(ap, fmt);
1804 space(cfile, level);
1805 vfprintf(cfile, fmt, ap);
1806 va_end(ap);
1809 static void
1810 hprint(int level, const char *fmt, ...)
1812 va_list ap;
1813 va_start(ap, fmt);
1814 space(hfile, level);
1815 vfprintf(hfile, fmt, ap);
1816 va_end(ap);
1819 static void gen_name(char *str);
1821 static void
1822 gen_command(struct assignment *as)
1824 struct assignment *a, *b;
1825 char *f;
1826 a = find(as, "name");
1827 f = strdup(a->u.value);
1828 gen_name(f);
1829 cprint(1, " { ");
1830 fprintf(cfile, "\"%s\", ", a->u.value);
1831 fprintf(cfile, "%s_wrap, ", f);
1832 b = find(as, "argument");
1833 if(b)
1834 fprintf(cfile, "\"%s %s\", ", a->u.value, b->u.value);
1835 else
1836 fprintf(cfile, "\"%s\", ", a->u.value);
1837 b = find(as, "help");
1838 if(b)
1839 fprintf(cfile, "\"%s\"", b->u.value);
1840 else
1841 fprintf(cfile, "NULL");
1842 fprintf(cfile, " },\n");
1843 for(a = a->next; a != NULL; a = a->next)
1844 if(strcmp(a->name, "name") == 0)
1845 cprint(1, " { \"%s\" },\n", a->u.value);
1846 cprint(0, "\n");
1849 static void
1850 gen_name(char *str)
1852 char *p;
1853 for(p = str; *p != '\0'; p++)
1854 if(!isalnum((unsigned char)*p))
1855 *p = '_';
1858 static char *
1859 make_name(struct assignment *as)
1861 struct assignment *lopt;
1862 struct assignment *type;
1863 char *s;
1865 lopt = find(as, "long");
1866 if(lopt == NULL)
1867 lopt = find(as, "name");
1868 if(lopt == NULL)
1869 return NULL;
1871 type = find(as, "type");
1872 if(strcmp(type->u.value, "-flag") == 0)
1873 asprintf(&s, "%s_flag", lopt->u.value);
1874 else
1875 asprintf(&s, "%s_%s", lopt->u.value, type->u.value);
1876 gen_name(s);
1877 return s;
1881 static void defval_int(const char *name, struct assignment *defval)
1883 if(defval != NULL)
1884 cprint(1, "opt.%s = %s;\n", name, defval->u.value);
1885 else
1886 cprint(1, "opt.%s = 0;\n", name);
1888 static void defval_string(const char *name, struct assignment *defval)
1890 if(defval != NULL)
1891 cprint(1, "opt.%s = \"%s\";\n", name, defval->u.value);
1892 else
1893 cprint(1, "opt.%s = NULL;\n", name);
1895 static void defval_strings(const char *name, struct assignment *defval)
1897 cprint(1, "opt.%s.num_strings = 0;\n", name);
1898 cprint(1, "opt.%s.strings = NULL;\n", name);
1901 static void free_strings(const char *name)
1903 cprint(1, "free_getarg_strings (&opt.%s);\n", name);
1906 struct type_handler {
1907 const char *typename;
1908 const char *c_type;
1909 const char *getarg_type;
1910 void (*defval)(const char*, struct assignment*);
1911 void (*free)(const char*);
1912 } type_handlers[] = {
1913 { "integer",
1914 "int",
1915 "arg_integer",
1916 defval_int,
1917 NULL
1919 { "string",
1920 "char*",
1921 "arg_string",
1922 defval_string,
1923 NULL
1925 { "strings",
1926 "struct getarg_strings",
1927 "arg_strings",
1928 defval_strings,
1929 free_strings
1931 { "flag",
1932 "int",
1933 "arg_flag",
1934 defval_int,
1935 NULL
1937 { "-flag",
1938 "int",
1939 "arg_negative_flag",
1940 defval_int,
1941 NULL
1943 { NULL }
1946 static struct type_handler *find_handler(struct assignment *type)
1948 struct type_handler *th;
1949 for(th = type_handlers; th->typename != NULL; th++)
1950 if(strcmp(type->u.value, th->typename) == 0)
1951 return th;
1952 ex(type, "unknown type \"%s\"", type->u.value);
1953 exit(1);
1956 static void
1957 gen_options(struct assignment *opt1, const char *name)
1959 struct assignment *tmp;
1961 hprint(0, "struct %s_options {\n", name);
1963 for(tmp = opt1;
1964 tmp != NULL;
1965 tmp = find_next(tmp, "option")) {
1966 struct assignment *type;
1967 struct type_handler *th;
1968 char *s;
1970 s = make_name(tmp->u.assignment);
1971 type = find(tmp->u.assignment, "type");
1972 th = find_handler(type);
1973 hprint(1, "%s %s;\n", th->c_type, s);
1974 free(s);
1976 hprint(0, "};\n");
1979 static void
1980 gen_wrapper(struct assignment *as)
1982 struct assignment *name;
1983 struct assignment *arg;
1984 struct assignment *opt1;
1985 struct assignment *function;
1986 struct assignment *tmp;
1987 char *n, *f;
1988 int nargs = 0;
1990 name = find(as, "name");
1991 n = strdup(name->u.value);
1992 gen_name(n);
1993 arg = find(as, "argument");
1994 opt1 = find(as, "option");
1995 function = find(as, "function");
1996 if(function)
1997 f = function->u.value;
1998 else
1999 f = n;
2002 if(opt1 != NULL) {
2003 gen_options(opt1, n);
2004 hprint(0, "int %s(struct %s_options*, int, char **);\n", f, n);
2005 } else {
2006 hprint(0, "int %s(void*, int, char **);\n", f);
2009 fprintf(cfile, "static int\n");
2010 fprintf(cfile, "%s_wrap(int argc, char **argv)\n", n);
2011 fprintf(cfile, "{\n");
2012 if(opt1 != NULL)
2013 cprint(1, "struct %s_options opt;\n", n);
2014 cprint(1, "int ret;\n");
2015 cprint(1, "int optidx = 0;\n");
2016 cprint(1, "struct getargs args[] = {\n");
2017 for(tmp = find(as, "option");
2018 tmp != NULL;
2019 tmp = find_next(tmp, "option")) {
2020 struct assignment *type = find(tmp->u.assignment, "type");
2021 struct assignment *lopt = find(tmp->u.assignment, "long");
2022 struct assignment *sopt = find(tmp->u.assignment, "short");
2023 struct assignment *aarg = find(tmp->u.assignment, "argument");
2024 struct assignment *help = find(tmp->u.assignment, "help");
2026 struct type_handler *th;
2028 cprint(2, "{ ");
2029 if(lopt)
2030 fprintf(cfile, "\"%s\", ", lopt->u.value);
2031 else
2032 fprintf(cfile, "NULL, ");
2033 if(sopt)
2034 fprintf(cfile, "'%c', ", *sopt->u.value);
2035 else
2036 fprintf(cfile, "0, ");
2037 th = find_handler(type);
2038 fprintf(cfile, "%s, ", th->getarg_type);
2039 fprintf(cfile, "NULL, ");
2040 if(help)
2041 fprintf(cfile, "\"%s\", ", help->u.value);
2042 else
2043 fprintf(cfile, "NULL, ");
2044 if(aarg)
2045 fprintf(cfile, "\"%s\"", aarg->u.value);
2046 else
2047 fprintf(cfile, "NULL");
2048 fprintf(cfile, " },\n");
2050 cprint(2, "{ \"help\", 'h', arg_flag, NULL, NULL, NULL }\n");
2051 cprint(1, "};\n");
2052 cprint(1, "int help_flag = 0;\n");
2054 for(tmp = find(as, "option");
2055 tmp != NULL;
2056 tmp = find_next(tmp, "option")) {
2057 char *s;
2058 struct assignment *type = find(tmp->u.assignment, "type");
2060 struct assignment *defval = find(tmp->u.assignment, "default");
2062 struct type_handler *th;
2064 s = make_name(tmp->u.assignment);
2065 th = find_handler(type);
2066 (*th->defval)(s, defval);
2067 free(s);
2070 for(tmp = find(as, "option");
2071 tmp != NULL;
2072 tmp = find_next(tmp, "option")) {
2073 char *s;
2074 s = make_name(tmp->u.assignment);
2075 cprint(1, "args[%d].value = &opt.%s;\n", nargs++, s);
2076 free(s);
2078 cprint(1, "args[%d].value = &help_flag;\n", nargs++);
2079 cprint(1, "if(getarg(args, %d, argc, argv, &optidx))\n", nargs);
2080 cprint(2, "goto usage;\n");
2083 int min_args = -1;
2084 int max_args = -1;
2085 char *end;
2086 if(arg == NULL) {
2087 max_args = 0;
2088 } else {
2089 if((tmp = find(as, "min_args")) != NULL) {
2090 min_args = strtol(tmp->u.value, &end, 0);
2091 if(*end != '\0') {
2092 ex(tmp, "min_args is not numeric");
2093 exit(1);
2095 if(min_args < 0) {
2096 ex(tmp, "min_args must be non-negative");
2097 exit(1);
2100 if((tmp = find(as, "max_args")) != NULL) {
2101 max_args = strtol(tmp->u.value, &end, 0);
2102 if(*end != '\0') {
2103 ex(tmp, "max_args is not numeric");
2104 exit(1);
2106 if(max_args < 0) {
2107 ex(tmp, "max_args must be non-negative");
2108 exit(1);
2112 if(min_args != -1 || max_args != -1) {
2113 if(min_args == max_args) {
2114 cprint(1, "if(argc - optidx != %d) {\n",
2115 min_args);
2116 cprint(2, "fprintf(stderr, \"Need exactly %u parameters (%%u given).\\n\\n\", argc - optidx);\n", min_args);
2117 cprint(2, "goto usage;\n");
2118 cprint(1, "}\n");
2119 } else {
2120 if(max_args != -1) {
2121 cprint(1, "if(argc - optidx > %d) {\n", max_args);
2122 cprint(2, "fprintf(stderr, \"Arguments given (%%u) are more than expected (%u).\\n\\n\", argc - optidx);\n", max_args);
2123 cprint(2, "goto usage;\n");
2124 cprint(1, "}\n");
2126 if(min_args != -1) {
2127 cprint(1, "if(argc - optidx < %d) {\n", min_args);
2128 cprint(2, "fprintf(stderr, \"Arguments given (%%u) are less than expected (%u).\\n\\n\", argc - optidx);\n", min_args);
2129 cprint(2, "goto usage;\n");
2130 cprint(1, "}\n");
2136 cprint(1, "if(help_flag)\n");
2137 cprint(2, "goto usage;\n");
2139 cprint(1, "ret = %s(%s, argc - optidx, argv + optidx);\n",
2140 f, opt1 ? "&opt": "NULL");
2142 /* free allocated data */
2143 for(tmp = find(as, "option");
2144 tmp != NULL;
2145 tmp = find_next(tmp, "option")) {
2146 char *s;
2147 struct assignment *type = find(tmp->u.assignment, "type");
2148 struct type_handler *th;
2149 th = find_handler(type);
2150 if(th->free == NULL)
2151 continue;
2152 s = make_name(tmp->u.assignment);
2153 (*th->free)(s);
2154 free(s);
2156 cprint(1, "return ret;\n");
2158 cprint(0, "usage:\n");
2159 cprint(1, "arg_printusage (args, %d, \"%s\", \"%s\");\n", nargs,
2160 name->u.value, arg ? arg->u.value : "");
2161 /* free allocated data */
2162 for(tmp = find(as, "option");
2163 tmp != NULL;
2164 tmp = find_next(tmp, "option")) {
2165 char *s;
2166 struct assignment *type = find(tmp->u.assignment, "type");
2167 struct type_handler *th;
2168 th = find_handler(type);
2169 if(th->free == NULL)
2170 continue;
2171 s = make_name(tmp->u.assignment);
2172 (*th->free)(s);
2173 free(s);
2175 cprint(1, "return 0;\n");
2176 cprint(0, "}\n");
2177 cprint(0, "\n");
2180 char cname[PATH_MAX];
2181 char hname[PATH_MAX];
2183 static void
2184 gen(struct assignment *as)
2186 struct assignment *a;
2187 cprint(0, "#include <stdio.h>\n");
2188 cprint(0, "#include <getarg.h>\n");
2189 cprint(0, "#include <sl.h>\n");
2190 cprint(0, "#include \"%s\"\n\n", hname);
2192 hprint(0, "#include <stdio.h>\n");
2193 hprint(0, "#include <sl.h>\n");
2194 hprint(0, "\n");
2197 for(a = as; a != NULL; a = a->next)
2198 gen_wrapper(a->u.assignment);
2200 cprint(0, "SL_cmd commands[] = {\n");
2201 for(a = as; a != NULL; a = a->next)
2202 gen_command(a->u.assignment);
2203 cprint(1, "{ NULL }\n");
2204 cprint(0, "};\n");
2206 hprint(0, "extern SL_cmd commands[];\n");
2209 int version_flag;
2210 int help_flag;
2211 struct getargs args[] = {
2212 { "version", 0, arg_flag, &version_flag },
2213 { "help", 0, arg_flag, &help_flag }
2215 int num_args = sizeof(args) / sizeof(args[0]);
2217 static void
2218 usage(int code)
2220 arg_printusage(args, num_args, NULL, "command-table");
2221 exit(code);
2225 main(int argc, char **argv)
2227 char *p;
2229 int optidx = 0;
2231 setprogname(argv[0]);
2232 if(getarg(args, num_args, argc, argv, &optidx))
2233 usage(1);
2234 if(help_flag)
2235 usage(0);
2236 if(version_flag) {
2237 print_version(NULL);
2238 exit(0);
2241 if(argc == optidx)
2242 usage(1);
2244 filename = argv[optidx];
2245 yyin = fopen(filename, "r");
2246 if(yyin == NULL)
2247 err(1, "%s", filename);
2248 p = strrchr(filename, '/');
2249 if(p)
2250 strlcpy(cname, p + 1, sizeof(cname));
2251 else
2252 strlcpy(cname, filename, sizeof(cname));
2253 p = strrchr(cname, '.');
2254 if(p)
2255 *p = '\0';
2256 strlcpy(hname, cname, sizeof(hname));
2257 strlcat(cname, ".c", sizeof(cname));
2258 strlcat(hname, ".h", sizeof(hname));
2259 yyparse();
2260 if(error_flag)
2261 exit(1);
2262 if(check(assignment) == 0) {
2263 cfile = fopen(cname, "w");
2264 if(cfile == NULL)
2265 err(1, "%s", cname);
2266 hfile = fopen(hname, "w");
2267 if(hfile == NULL)
2268 err(1, "%s", hname);
2269 gen(assignment);
2270 fclose(cfile);
2271 fclose(hfile);
2273 fclose(yyin);
2274 return 0;