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)
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. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
90 PSEUDOPREEMPTION
= 279,
108 #define CODESTART 259
109 #define COPYRIGHT 260
113 #define DESCRIPTION 264
126 #define OS_DOMAIN 277
128 #define PSEUDOPREEMPTION 279
129 #define REENTRANT 280
130 #define SCREENNAME 281
134 #define SYNCHRONIZE 285
135 #define THREADNAME 286
141 #define QUOTED_STRING 292
146 /* Copy the first part of user declarations. */
147 #line 1 "nlmheader.y"
148 /* nlmheader.y - parse NLM header specification keywords.
149 Copyright 1993, 1994, 1995, 1997, 1998, 2001, 2002, 2003, 2005, 2007
150 Free Software Foundation, Inc.
152 This file is part of GNU Binutils.
154 This program is free software; you can redistribute it and/or modify
155 it under the terms of the GNU General Public License as published by
156 the Free Software Foundation; either version 3 of the License, or
157 (at your option) any later version.
159 This program is distributed in the hope that it will be useful,
160 but WITHOUT ANY WARRANTY; without even the implied warranty of
161 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
162 GNU General Public License for more details.
164 You should have received a copy of the GNU General Public License
165 along with this program; if not, write to the Free Software
166 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
167 MA 02110-1301, USA. */
169 /* Written by Ian Lance Taylor <ian@cygnus.com>.
171 This bison file parses the commands recognized by the NetWare NLM
172 linker, except for lists of object files. It stores the
173 information in global variables.
175 This implementation is based on the description in the NetWare Tool
176 Maker Specification manual, edition 1.0. */
179 #include "safe-ctype.h"
181 #include "nlm/common.h"
182 #include "nlm/internal.h"
186 /* Information is stored in the structures pointed to by these
189 Nlm_Internal_Fixed_Header
*fixed_hdr
;
190 Nlm_Internal_Variable_Header
*var_hdr
;
191 Nlm_Internal_Version_Header
*version_hdr
;
192 Nlm_Internal_Copyright_Header
*copyright_hdr
;
193 Nlm_Internal_Extended_Header
*extended_hdr
;
195 /* Procedure named by CHECK. */
196 char *check_procedure
;
197 /* File named by CUSTOM. */
199 /* Whether to generate debugging information (DEBUG). */
200 bfd_boolean debug_info
;
201 /* Procedure named by EXIT. */
202 char *exit_procedure
;
203 /* Exported symbols (EXPORT). */
204 struct string_list
*export_symbols
;
205 /* List of files from INPUT. */
206 struct string_list
*input_files
;
207 /* Map file name (MAP, FULLMAP). */
209 /* Whether a full map has been requested (FULLMAP). */
210 bfd_boolean full_map
;
211 /* File named by HELP. */
213 /* Imported symbols (IMPORT). */
214 struct string_list
*import_symbols
;
215 /* File named by MESSAGES. */
217 /* Autoload module list (MODULE). */
218 struct string_list
*modules
;
219 /* File named by OUTPUT. */
221 /* File named by SHARELIB. */
223 /* Start procedure name (START). */
224 char *start_procedure
;
227 /* RPC description file (XDCDATA). */
230 /* The number of serious errors that have occurred. */
233 /* The current symbol prefix when reading a list of import or export
235 static char *symbol_prefix
;
237 /* Parser error message handler. */
238 #define yyerror(msg) nlmheader_error (msg);
240 /* Local functions. */
241 static int yylex (void);
242 static void nlmlex_file_push (const char *);
243 static bfd_boolean
nlmlex_file_open (const char *);
244 static int nlmlex_buf_init (void);
245 static char nlmlex_buf_add (int);
246 static long nlmlex_get_number (const char *);
247 static void nlmheader_identify (void);
248 static void nlmheader_warn (const char *, int);
249 static void nlmheader_error (const char *);
250 static struct string_list
* string_list_cons (char *, struct string_list
*);
251 static struct string_list
* string_list_append (struct string_list
*,
252 struct string_list
*);
253 static struct string_list
* string_list_append1 (struct string_list
*,
255 static char *xstrdup (const char *);
259 /* Enabling traces. */
264 /* Enabling verbose error messages. */
265 #ifdef YYERROR_VERBOSE
266 # undef YYERROR_VERBOSE
267 # define YYERROR_VERBOSE 1
269 # define YYERROR_VERBOSE 0
272 /* Enabling the token table. */
273 #ifndef YYTOKEN_TABLE
274 # define YYTOKEN_TABLE 0
277 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
278 typedef union YYSTYPE
279 #line 113 "nlmheader.y"
282 struct string_list
*list
;
284 /* Line 193 of yacc.c. */
285 #line 286 "nlmheader.c"
287 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
288 # define YYSTYPE_IS_DECLARED 1
289 # define YYSTYPE_IS_TRIVIAL 1
294 /* Copy the second part of user declarations. */
297 /* Line 216 of yacc.c. */
298 #line 299 "nlmheader.c"
305 typedef YYTYPE_UINT8 yytype_uint8
;
307 typedef unsigned char yytype_uint8
;
311 typedef YYTYPE_INT8 yytype_int8
;
312 #elif (defined __STDC__ || defined __C99__FUNC__ \
313 || defined __cplusplus || defined _MSC_VER)
314 typedef signed char yytype_int8
;
316 typedef short int yytype_int8
;
320 typedef YYTYPE_UINT16 yytype_uint16
;
322 typedef unsigned short int yytype_uint16
;
326 typedef YYTYPE_INT16 yytype_int16
;
328 typedef short int yytype_int16
;
332 # ifdef __SIZE_TYPE__
333 # define YYSIZE_T __SIZE_TYPE__
334 # elif defined size_t
335 # define YYSIZE_T size_t
336 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
337 || defined __cplusplus || defined _MSC_VER)
338 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
339 # define YYSIZE_T size_t
341 # define YYSIZE_T unsigned int
345 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
348 # if defined YYENABLE_NLS && YYENABLE_NLS
350 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
351 # define YY_(msgid) dgettext ("bison-runtime", msgid)
355 # define YY_(msgid) msgid
359 /* Suppress unused-variable warnings by "using" E. */
360 #if ! defined lint || defined __GNUC__
361 # define YYUSE(e) ((void) (e))
363 # define YYUSE(e) /* empty */
366 /* Identity function, used to suppress warnings about constant conditions. */
370 #if (defined __STDC__ || defined __C99__FUNC__ \
371 || defined __cplusplus || defined _MSC_VER)
384 #if ! defined yyoverflow || YYERROR_VERBOSE
386 /* The parser invokes alloca or malloc; define the necessary symbols. */
388 # ifdef YYSTACK_USE_ALLOCA
389 # if YYSTACK_USE_ALLOCA
391 # define YYSTACK_ALLOC __builtin_alloca
392 # elif defined __BUILTIN_VA_ARG_INCR
393 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
395 # define YYSTACK_ALLOC __alloca
396 # elif defined _MSC_VER
397 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
398 # define alloca _alloca
400 # define YYSTACK_ALLOC alloca
401 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
402 || defined __cplusplus || defined _MSC_VER)
403 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
412 # ifdef YYSTACK_ALLOC
413 /* Pacify GCC's `empty if-body' warning. */
414 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
415 # ifndef YYSTACK_ALLOC_MAXIMUM
416 /* The OS might guarantee only one guard page at the bottom of the stack,
417 and a page size can be as small as 4096 bytes. So we cannot safely
418 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
419 to allow for a few compiler-allocated temporary stack slots. */
420 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
423 # define YYSTACK_ALLOC YYMALLOC
424 # define YYSTACK_FREE YYFREE
425 # ifndef YYSTACK_ALLOC_MAXIMUM
426 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
428 # if (defined __cplusplus && ! defined _STDLIB_H \
429 && ! ((defined YYMALLOC || defined malloc) \
430 && (defined YYFREE || defined free)))
431 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
437 # define YYMALLOC malloc
438 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
439 || defined __cplusplus || defined _MSC_VER)
440 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
445 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
446 || defined __cplusplus || defined _MSC_VER)
447 void free (void *); /* INFRINGES ON USER NAME SPACE */
451 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
454 #if (! defined yyoverflow \
455 && (! defined __cplusplus \
456 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
458 /* A type that is properly aligned for any stack member. */
465 /* The size of the maximum gap between one aligned stack and the next. */
466 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
468 /* The size of an array large to enough to hold all stacks, each with
470 # define YYSTACK_BYTES(N) \
471 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
472 + YYSTACK_GAP_MAXIMUM)
474 /* Copy COUNT objects from FROM to TO. The source and destination do
477 # if defined __GNUC__ && 1 < __GNUC__
478 # define YYCOPY(To, From, Count) \
479 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
481 # define YYCOPY(To, From, Count) \
485 for (yyi = 0; yyi < (Count); yyi++) \
486 (To)[yyi] = (From)[yyi]; \
492 /* Relocate STACK from its old location to the new one. The
493 local variables YYSIZE and YYSTACKSIZE give the old and new number of
494 elements in the stack, and YYPTR gives the new location of the
495 stack. Advance YYPTR to a properly aligned location for the next
497 # define YYSTACK_RELOCATE(Stack) \
500 YYSIZE_T yynewbytes; \
501 YYCOPY (&yyptr->Stack, Stack, yysize); \
502 Stack = &yyptr->Stack; \
503 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
504 yyptr += yynewbytes / sizeof (*yyptr); \
510 /* YYFINAL -- State number of the termination state. */
512 /* YYLAST -- Last index in YYTABLE. */
515 /* YYNTOKENS -- Number of terminals. */
517 /* YYNNTS -- Number of nonterminals. */
519 /* YYNRULES -- Number of rules. */
521 /* YYNRULES -- Number of states. */
524 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
526 #define YYMAXUTOK 292
528 #define YYTRANSLATE(YYX) \
529 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
531 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
532 static const yytype_uint8 yytranslate
[] =
534 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 38, 39, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
560 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
561 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
562 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
567 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
569 static const yytype_uint8 yyprhs
[] =
571 0, 0, 3, 5, 6, 9, 12, 15, 18, 21,
572 26, 28, 31, 34, 35, 39, 42, 45, 47, 50,
573 53, 54, 58, 61, 63, 66, 69, 72, 74, 76,
574 79, 81, 83, 86, 89, 92, 95, 97, 100, 103,
575 105, 110, 114, 117, 118, 120, 122, 124, 127, 130,
579 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
580 static const yytype_int8 yyrhs
[] =
582 41, 0, -1, 42, -1, -1, 43, 42, -1, 3,
583 36, -1, 4, 36, -1, 5, 37, -1, 6, 36,
584 -1, 7, 36, 36, 36, -1, 8, -1, 9, 37,
585 -1, 10, 36, -1, -1, 11, 44, 46, -1, 12,
586 36, -1, 13, 36, -1, 14, -1, 14, 36, -1,
587 15, 36, -1, -1, 16, 45, 46, -1, 17, 50,
588 -1, 18, -1, 18, 36, -1, 19, 36, -1, 20,
589 50, -1, 21, -1, 22, -1, 23, 36, -1, 24,
590 -1, 25, -1, 26, 37, -1, 27, 36, -1, 28,
591 36, -1, 29, 36, -1, 30, -1, 31, 37, -1,
592 32, 36, -1, 33, -1, 34, 36, 36, 36, -1,
593 34, 36, 36, -1, 35, 36, -1, -1, 47, -1,
594 49, -1, 48, -1, 47, 49, -1, 47, 48, -1,
595 38, 36, 39, -1, 36, -1, -1, 36, 50, -1
598 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
599 static const yytype_uint16 yyrline
[] =
601 0, 144, 144, 149, 151, 157, 161, 166, 183, 187,
602 205, 209, 225, 230, 229, 237, 242, 247, 252, 257,
603 262, 261, 269, 273, 277, 281, 285, 289, 293, 297,
604 304, 308, 312, 328, 332, 337, 341, 345, 361, 366,
605 370, 394, 410, 420, 423, 434, 438, 442, 446, 455,
610 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
611 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
612 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
613 static const char *const yytname
[] =
615 "$end", "error", "$undefined", "CHECK", "CODESTART", "COPYRIGHT",
616 "CUSTOM", "DATE", "DEBUG", "DESCRIPTION", "EXIT", "EXPORT", "FLAG_ON",
617 "FLAG_OFF", "FULLMAP", "HELP", "IMPORT", "INPUT", "MAP", "MESSAGES",
618 "MODULE", "MULTIPLE", "OS_DOMAIN", "OUTPUT", "PSEUDOPREEMPTION",
619 "REENTRANT", "SCREENNAME", "SHARELIB", "STACK", "START", "SYNCHRONIZE",
620 "THREADNAME", "TYPE", "VERBOSE", "VERSIONK", "XDCDATA", "STRING",
621 "QUOTED_STRING", "'('", "')'", "$accept", "file", "commands", "command",
622 "@1", "@2", "symbol_list_opt", "symbol_list", "symbol_prefix", "symbol",
628 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
630 static const yytype_uint16 yytoknum
[] =
632 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
633 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
634 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
635 285, 286, 287, 288, 289, 290, 291, 292, 40, 41
639 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
640 static const yytype_uint8 yyr1
[] =
642 0, 40, 41, 42, 42, 43, 43, 43, 43, 43,
643 43, 43, 43, 44, 43, 43, 43, 43, 43, 43,
644 45, 43, 43, 43, 43, 43, 43, 43, 43, 43,
645 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
646 43, 43, 43, 46, 46, 47, 47, 47, 47, 48,
650 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
651 static const yytype_uint8 yyr2
[] =
653 0, 2, 1, 0, 2, 2, 2, 2, 2, 4,
654 1, 2, 2, 0, 3, 2, 2, 1, 2, 2,
655 0, 3, 2, 1, 2, 2, 2, 1, 1, 2,
656 1, 1, 2, 2, 2, 2, 1, 2, 2, 1,
657 4, 3, 2, 0, 1, 1, 1, 2, 2, 3,
661 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
662 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
663 means the default is an error. */
664 static const yytype_uint8 yydefact
[] =
666 3, 0, 0, 0, 0, 0, 10, 0, 0, 13,
667 0, 0, 17, 0, 20, 51, 23, 0, 51, 27,
668 28, 0, 30, 31, 0, 0, 0, 0, 36, 0,
669 0, 39, 0, 0, 0, 2, 3, 5, 6, 7,
670 8, 0, 11, 12, 43, 15, 16, 18, 19, 43,
671 51, 22, 24, 25, 26, 29, 32, 33, 34, 35,
672 37, 38, 0, 42, 1, 4, 0, 50, 0, 14,
673 44, 46, 45, 21, 52, 41, 9, 0, 48, 47,
677 /* YYDEFGOTO[NTERM-NUM]. */
678 static const yytype_int8 yydefgoto
[] =
680 -1, 34, 35, 36, 44, 49, 69, 70, 71, 72,
684 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
686 #define YYPACT_NINF -20
687 static const yytype_int8 yypact
[] =
689 -3, -1, 1, 2, 4, 5, -20, 6, 8, -20,
690 9, 10, 11, 12, -20, 13, 14, 16, 13, -20,
691 -20, 17, -20, -20, 18, 20, 21, 22, -20, 23,
692 25, -20, 26, 27, 38, -20, -3, -20, -20, -20,
693 -20, 28, -20, -20, -2, -20, -20, -20, -20, -2,
694 13, -20, -20, -20, -20, -20, -20, -20, -20, -20,
695 -20, -20, 30, -20, -20, -20, 31, -20, 32, -20,
696 -2, -20, -20, -20, -20, 33, -20, 3, -20, -20,
700 /* YYPGOTO[NTERM-NUM]. */
701 static const yytype_int8 yypgoto
[] =
703 -20, -20, 34, -20, -20, -20, 24, -20, -19, -16,
707 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
708 positive, shift that token. If negative, reduce the rule which
709 number is the opposite. If zero, do what YYDEFACT says.
710 If YYTABLE_NINF, syntax error. */
711 #define YYTABLE_NINF -1
712 static const yytype_uint8 yytable
[] =
714 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
715 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
716 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
717 31, 32, 33, 54, 67, 37, 68, 38, 64, 39,
718 40, 41, 81, 42, 43, 45, 46, 47, 48, 50,
719 52, 78, 53, 55, 79, 56, 57, 58, 59, 0,
720 60, 61, 62, 63, 66, 74, 75, 76, 77, 80,
724 static const yytype_int8 yycheck
[] =
726 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
727 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
728 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
729 33, 34, 35, 18, 36, 36, 38, 36, 0, 37,
730 36, 36, 39, 37, 36, 36, 36, 36, 36, 36,
731 36, 70, 36, 36, 70, 37, 36, 36, 36, -1,
732 37, 36, 36, 36, 36, 50, 36, 36, 36, 36,
736 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
737 symbol of state STATE-NUM. */
738 static const yytype_uint8 yystos
[] =
740 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
741 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
742 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
743 32, 33, 34, 35, 41, 42, 43, 36, 36, 37,
744 36, 36, 37, 36, 44, 36, 36, 36, 36, 45,
745 36, 50, 36, 36, 50, 36, 37, 36, 36, 36,
746 37, 36, 36, 36, 0, 42, 36, 36, 38, 46,
747 47, 48, 49, 46, 50, 36, 36, 36, 48, 49,
751 #define yyerrok (yyerrstatus = 0)
752 #define yyclearin (yychar = YYEMPTY)
756 #define YYACCEPT goto yyacceptlab
757 #define YYABORT goto yyabortlab
758 #define YYERROR goto yyerrorlab
761 /* Like YYERROR except do call yyerror. This remains here temporarily
762 to ease the transition to the new meaning of YYERROR, for GCC.
763 Once GCC version 2 has supplanted version 1, this can go. */
765 #define YYFAIL goto yyerrlab
767 #define YYRECOVERING() (!!yyerrstatus)
769 #define YYBACKUP(Token, Value) \
771 if (yychar == YYEMPTY && yylen == 1) \
775 yytoken = YYTRANSLATE (yychar); \
781 yyerror (YY_("syntax error: cannot back up")); \
788 #define YYERRCODE 256
791 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
792 If N is 0, then set CURRENT to the empty location which ends
793 the previous symbol: RHS[0] (always defined). */
795 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
796 #ifndef YYLLOC_DEFAULT
797 # define YYLLOC_DEFAULT(Current, Rhs, N) \
801 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
802 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
803 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
804 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
808 (Current).first_line = (Current).last_line = \
809 YYRHSLOC (Rhs, 0).last_line; \
810 (Current).first_column = (Current).last_column = \
811 YYRHSLOC (Rhs, 0).last_column; \
817 /* YY_LOCATION_PRINT -- Print the location on the stream.
818 This macro was not mandated originally: define only if we know
819 we won't break user code: when these are the locations we know. */
821 #ifndef YY_LOCATION_PRINT
822 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
823 # define YY_LOCATION_PRINT(File, Loc) \
824 fprintf (File, "%d.%d-%d.%d", \
825 (Loc).first_line, (Loc).first_column, \
826 (Loc).last_line, (Loc).last_column)
828 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
833 /* YYLEX -- calling `yylex' with the right arguments. */
836 # define YYLEX yylex (YYLEX_PARAM)
838 # define YYLEX yylex ()
841 /* Enable debugging if requested. */
845 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
846 # define YYFPRINTF fprintf
849 # define YYDPRINTF(Args) \
855 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
859 YYFPRINTF (stderr, "%s ", Title); \
860 yy_symbol_print (stderr, \
862 YYFPRINTF (stderr, "\n"); \
867 /*--------------------------------.
868 | Print this symbol on YYOUTPUT. |
869 `--------------------------------*/
872 #if (defined __STDC__ || defined __C99__FUNC__ \
873 || defined __cplusplus || defined _MSC_VER)
875 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
878 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
881 YYSTYPE
const * const yyvaluep
;
887 if (yytype
< YYNTOKENS
)
888 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
900 /*--------------------------------.
901 | Print this symbol on YYOUTPUT. |
902 `--------------------------------*/
904 #if (defined __STDC__ || defined __C99__FUNC__ \
905 || defined __cplusplus || defined _MSC_VER)
907 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
910 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
913 YYSTYPE
const * const yyvaluep
;
916 if (yytype
< YYNTOKENS
)
917 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
919 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
921 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
922 YYFPRINTF (yyoutput
, ")");
925 /*------------------------------------------------------------------.
926 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
928 `------------------------------------------------------------------*/
930 #if (defined __STDC__ || defined __C99__FUNC__ \
931 || defined __cplusplus || defined _MSC_VER)
933 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
936 yy_stack_print (bottom
, top
)
937 yytype_int16
*bottom
;
941 YYFPRINTF (stderr
, "Stack now");
942 for (; bottom
<= top
; ++bottom
)
943 YYFPRINTF (stderr
, " %d", *bottom
);
944 YYFPRINTF (stderr
, "\n");
947 # define YY_STACK_PRINT(Bottom, Top) \
950 yy_stack_print ((Bottom), (Top)); \
954 /*------------------------------------------------.
955 | Report that the YYRULE is going to be reduced. |
956 `------------------------------------------------*/
958 #if (defined __STDC__ || defined __C99__FUNC__ \
959 || defined __cplusplus || defined _MSC_VER)
961 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
964 yy_reduce_print (yyvsp
, yyrule
)
969 int yynrhs
= yyr2
[yyrule
];
971 unsigned long int yylno
= yyrline
[yyrule
];
972 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
974 /* The symbols being reduced. */
975 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
977 fprintf (stderr
, " $%d = ", yyi
+ 1);
978 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
979 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
981 fprintf (stderr
, "\n");
985 # define YY_REDUCE_PRINT(Rule) \
988 yy_reduce_print (yyvsp, Rule); \
991 /* Nonzero means print parse trace. It is left uninitialized so that
992 multiple parsers can coexist. */
995 # define YYDPRINTF(Args)
996 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
997 # define YY_STACK_PRINT(Bottom, Top)
998 # define YY_REDUCE_PRINT(Rule)
999 #endif /* !YYDEBUG */
1002 /* YYINITDEPTH -- initial size of the parser's stacks. */
1004 # define YYINITDEPTH 200
1007 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1008 if the built-in stack extension method is used).
1010 Do not make this value too large; the results are undefined if
1011 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1012 evaluated with infinite-precision integer arithmetic. */
1015 # define YYMAXDEPTH 10000
1023 # if defined __GLIBC__ && defined _STRING_H
1024 # define yystrlen strlen
1026 /* Return the length of YYSTR. */
1027 #if (defined __STDC__ || defined __C99__FUNC__ \
1028 || defined __cplusplus || defined _MSC_VER)
1030 yystrlen (const char *yystr
)
1038 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1046 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1047 # define yystpcpy stpcpy
1049 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1051 #if (defined __STDC__ || defined __C99__FUNC__ \
1052 || defined __cplusplus || defined _MSC_VER)
1054 yystpcpy (char *yydest
, const char *yysrc
)
1057 yystpcpy (yydest
, yysrc
)
1063 const char *yys
= yysrc
;
1065 while ((*yyd
++ = *yys
++) != '\0')
1074 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1075 quotes and backslashes, so that it's suitable for yyerror. The
1076 heuristic is that double-quoting is unnecessary unless the string
1077 contains an apostrophe, a comma, or backslash (other than
1078 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1079 null, do not copy; instead, return the length of what the result
1082 yytnamerr (char *yyres
, const char *yystr
)
1087 char const *yyp
= yystr
;
1094 goto do_not_strip_quotes
;
1098 goto do_not_strip_quotes
;
1111 do_not_strip_quotes
: ;
1115 return yystrlen (yystr
);
1117 return yystpcpy (yyres
, yystr
) - yyres
;
1121 /* Copy into YYRESULT an error message about the unexpected token
1122 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1123 including the terminating null byte. If YYRESULT is null, do not
1124 copy anything; just return the number of bytes that would be
1125 copied. As a special case, return 0 if an ordinary "syntax error"
1126 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1127 size calculation. */
1129 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1131 int yyn
= yypact
[yystate
];
1133 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1137 int yytype
= YYTRANSLATE (yychar
);
1138 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1139 YYSIZE_T yysize
= yysize0
;
1141 int yysize_overflow
= 0;
1142 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1143 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1147 /* This is so xgettext sees the translatable formats that are
1148 constructed on the fly. */
1149 YY_("syntax error, unexpected %s");
1150 YY_("syntax error, unexpected %s, expecting %s");
1151 YY_("syntax error, unexpected %s, expecting %s or %s");
1152 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1153 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1157 static char const yyunexpected
[] = "syntax error, unexpected %s";
1158 static char const yyexpecting
[] = ", expecting %s";
1159 static char const yyor
[] = " or %s";
1160 char yyformat
[sizeof yyunexpected
1161 + sizeof yyexpecting
- 1
1162 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1163 * (sizeof yyor
- 1))];
1164 char const *yyprefix
= yyexpecting
;
1166 /* Start YYX at -YYN if negative to avoid negative indexes in
1168 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1170 /* Stay within bounds of both yycheck and yytname. */
1171 int yychecklim
= YYLAST
- yyn
+ 1;
1172 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1175 yyarg
[0] = yytname
[yytype
];
1176 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1178 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1179 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1181 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1185 yyformat
[sizeof yyunexpected
- 1] = '\0';
1188 yyarg
[yycount
++] = yytname
[yyx
];
1189 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1190 yysize_overflow
|= (yysize1
< yysize
);
1192 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1196 yyf
= YY_(yyformat
);
1197 yysize1
= yysize
+ yystrlen (yyf
);
1198 yysize_overflow
|= (yysize1
< yysize
);
1201 if (yysize_overflow
)
1202 return YYSIZE_MAXIMUM
;
1206 /* Avoid sprintf, as that infringes on the user's name space.
1207 Don't have undefined behavior even if the translation
1208 produced a string with the wrong number of "%s"s. */
1209 char *yyp
= yyresult
;
1211 while ((*yyp
= *yyf
) != '\0')
1213 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1215 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1228 #endif /* YYERROR_VERBOSE */
1231 /*-----------------------------------------------.
1232 | Release the memory associated to this symbol. |
1233 `-----------------------------------------------*/
1236 #if (defined __STDC__ || defined __C99__FUNC__ \
1237 || defined __cplusplus || defined _MSC_VER)
1239 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1242 yydestruct (yymsg
, yytype
, yyvaluep
)
1252 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1263 /* Prevent warnings from -Wmissing-prototypes. */
1265 #ifdef YYPARSE_PARAM
1266 #if defined __STDC__ || defined __cplusplus
1267 int yyparse (void *YYPARSE_PARAM
);
1271 #else /* ! YYPARSE_PARAM */
1272 #if defined __STDC__ || defined __cplusplus
1277 #endif /* ! YYPARSE_PARAM */
1281 /* The look-ahead symbol. */
1284 /* The semantic value of the look-ahead symbol. */
1287 /* Number of syntax errors so far. */
1296 #ifdef YYPARSE_PARAM
1297 #if (defined __STDC__ || defined __C99__FUNC__ \
1298 || defined __cplusplus || defined _MSC_VER)
1300 yyparse (void *YYPARSE_PARAM
)
1303 yyparse (YYPARSE_PARAM
)
1304 void *YYPARSE_PARAM
;
1306 #else /* ! YYPARSE_PARAM */
1307 #if (defined __STDC__ || defined __C99__FUNC__ \
1308 || defined __cplusplus || defined _MSC_VER)
1322 /* Number of tokens to shift before error messages enabled. */
1324 /* Look-ahead token as an internal (translated) token number. */
1327 /* Buffer for error messages, and its allocated size. */
1329 char *yymsg
= yymsgbuf
;
1330 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1333 /* Three stacks and their tools:
1334 `yyss': related to states,
1335 `yyvs': related to semantic values,
1336 `yyls': related to locations.
1338 Refer to the stacks thru separate pointers, to allow yyoverflow
1339 to reallocate them elsewhere. */
1341 /* The state stack. */
1342 yytype_int16 yyssa
[YYINITDEPTH
];
1343 yytype_int16
*yyss
= yyssa
;
1344 yytype_int16
*yyssp
;
1346 /* The semantic value stack. */
1347 YYSTYPE yyvsa
[YYINITDEPTH
];
1348 YYSTYPE
*yyvs
= yyvsa
;
1353 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1355 YYSIZE_T yystacksize
= YYINITDEPTH
;
1357 /* The variables used to return semantic value and location from the
1362 /* The number of symbols on the RHS of the reduced rule.
1363 Keep to zero when no symbol should be popped. */
1366 YYDPRINTF ((stderr
, "Starting parse\n"));
1371 yychar
= YYEMPTY
; /* Cause a token to be read. */
1373 /* Initialize stack pointers.
1374 Waste one element of value and location stack
1375 so that they stay on the same level as the state stack.
1376 The wasted elements are never initialized. */
1383 /*------------------------------------------------------------.
1384 | yynewstate -- Push a new state, which is found in yystate. |
1385 `------------------------------------------------------------*/
1387 /* In all cases, when you get here, the value and location stacks
1388 have just been pushed. So pushing a state here evens the stacks. */
1394 if (yyss
+ yystacksize
- 1 <= yyssp
)
1396 /* Get the current used size of the three stacks, in elements. */
1397 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1401 /* Give user a chance to reallocate the stack. Use copies of
1402 these so that the &'s don't force the real ones into
1404 YYSTYPE
*yyvs1
= yyvs
;
1405 yytype_int16
*yyss1
= yyss
;
1408 /* Each stack pointer address is followed by the size of the
1409 data in use in that stack, in bytes. This used to be a
1410 conditional around just the two extra args, but that might
1411 be undefined if yyoverflow is a macro. */
1412 yyoverflow (YY_("memory exhausted"),
1413 &yyss1
, yysize
* sizeof (*yyssp
),
1414 &yyvs1
, yysize
* sizeof (*yyvsp
),
1421 #else /* no yyoverflow */
1422 # ifndef YYSTACK_RELOCATE
1423 goto yyexhaustedlab
;
1425 /* Extend the stack our own way. */
1426 if (YYMAXDEPTH
<= yystacksize
)
1427 goto yyexhaustedlab
;
1429 if (YYMAXDEPTH
< yystacksize
)
1430 yystacksize
= YYMAXDEPTH
;
1433 yytype_int16
*yyss1
= yyss
;
1434 union yyalloc
*yyptr
=
1435 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1437 goto yyexhaustedlab
;
1438 YYSTACK_RELOCATE (yyss
);
1439 YYSTACK_RELOCATE (yyvs
);
1441 # undef YYSTACK_RELOCATE
1443 YYSTACK_FREE (yyss1
);
1446 #endif /* no yyoverflow */
1448 yyssp
= yyss
+ yysize
- 1;
1449 yyvsp
= yyvs
+ yysize
- 1;
1452 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1453 (unsigned long int) yystacksize
));
1455 if (yyss
+ yystacksize
- 1 <= yyssp
)
1459 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1468 /* Do appropriate processing given the current state. Read a
1469 look-ahead token if we need one and don't already have one. */
1471 /* First try to decide what to do without reference to look-ahead token. */
1472 yyn
= yypact
[yystate
];
1473 if (yyn
== YYPACT_NINF
)
1476 /* Not known => get a look-ahead token if don't already have one. */
1478 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1479 if (yychar
== YYEMPTY
)
1481 YYDPRINTF ((stderr
, "Reading a token: "));
1485 if (yychar
<= YYEOF
)
1487 yychar
= yytoken
= YYEOF
;
1488 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1492 yytoken
= YYTRANSLATE (yychar
);
1493 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1496 /* If the proper action on seeing token YYTOKEN is to reduce or to
1497 detect an error, take that action. */
1499 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1504 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1513 /* Count tokens shifted since error; after three, turn off error
1518 /* Shift the look-ahead token. */
1519 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1521 /* Discard the shifted token unless it is eof. */
1522 if (yychar
!= YYEOF
)
1531 /*-----------------------------------------------------------.
1532 | yydefault -- do the default action for the current state. |
1533 `-----------------------------------------------------------*/
1535 yyn
= yydefact
[yystate
];
1541 /*-----------------------------.
1542 | yyreduce -- Do a reduction. |
1543 `-----------------------------*/
1545 /* yyn is the number of a rule to reduce with. */
1548 /* If YYLEN is nonzero, implement the default value of the action:
1551 Otherwise, the following line sets YYVAL to garbage.
1552 This behavior is undocumented and Bison
1553 users should not rely upon it. Assigning to YYVAL
1554 unconditionally makes the parser a bit smaller, and it avoids a
1555 GCC warning that YYVAL may be used uninitialized. */
1556 yyval
= yyvsp
[1-yylen
];
1559 YY_REDUCE_PRINT (yyn
);
1563 #line 158 "nlmheader.y"
1565 check_procedure
= (yyvsp
[(2) - (2)].string
);
1570 #line 162 "nlmheader.y"
1572 nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
1573 free ((yyvsp
[(2) - (2)].string
));
1578 #line 167 "nlmheader.y"
1582 strncpy (copyright_hdr
->stamp
, "CoPyRiGhT=", 10);
1583 len
= strlen ((yyvsp
[(2) - (2)].string
));
1584 if (len
>= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
)
1586 nlmheader_warn (_("copyright string is too long"),
1587 NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
- 1);
1588 len
= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
- 1;
1590 copyright_hdr
->copyrightMessageLength
= len
;
1591 strncpy (copyright_hdr
->copyrightMessage
, (yyvsp
[(2) - (2)].string
), len
);
1592 copyright_hdr
->copyrightMessage
[len
] = '\0';
1593 free ((yyvsp
[(2) - (2)].string
));
1598 #line 184 "nlmheader.y"
1600 custom_file
= (yyvsp
[(2) - (2)].string
);
1605 #line 188 "nlmheader.y"
1607 /* We don't set the version stamp here, because we use the
1608 version stamp to detect whether the required VERSION
1609 keyword was given. */
1610 version_hdr
->month
= nlmlex_get_number ((yyvsp
[(2) - (4)].string
));
1611 version_hdr
->day
= nlmlex_get_number ((yyvsp
[(3) - (4)].string
));
1612 version_hdr
->year
= nlmlex_get_number ((yyvsp
[(4) - (4)].string
));
1613 free ((yyvsp
[(2) - (4)].string
));
1614 free ((yyvsp
[(3) - (4)].string
));
1615 free ((yyvsp
[(4) - (4)].string
));
1616 if (version_hdr
->month
< 1 || version_hdr
->month
> 12)
1617 nlmheader_warn (_("illegal month"), -1);
1618 if (version_hdr
->day
< 1 || version_hdr
->day
> 31)
1619 nlmheader_warn (_("illegal day"), -1);
1620 if (version_hdr
->year
< 1900 || version_hdr
->year
> 3000)
1621 nlmheader_warn (_("illegal year"), -1);
1626 #line 206 "nlmheader.y"
1633 #line 210 "nlmheader.y"
1637 len
= strlen ((yyvsp
[(2) - (2)].string
));
1638 if (len
> NLM_MAX_DESCRIPTION_LENGTH
)
1640 nlmheader_warn (_("description string is too long"),
1641 NLM_MAX_DESCRIPTION_LENGTH
);
1642 len
= NLM_MAX_DESCRIPTION_LENGTH
;
1644 var_hdr
->descriptionLength
= len
;
1645 strncpy (var_hdr
->descriptionText
, (yyvsp
[(2) - (2)].string
), len
);
1646 var_hdr
->descriptionText
[len
] = '\0';
1647 free ((yyvsp
[(2) - (2)].string
));
1652 #line 226 "nlmheader.y"
1654 exit_procedure
= (yyvsp
[(2) - (2)].string
);
1659 #line 230 "nlmheader.y"
1661 symbol_prefix
= NULL
;
1666 #line 234 "nlmheader.y"
1668 export_symbols
= string_list_append (export_symbols
, (yyvsp
[(3) - (3)].list
));
1673 #line 238 "nlmheader.y"
1675 fixed_hdr
->flags
|= nlmlex_get_number ((yyvsp
[(2) - (2)].string
));
1676 free ((yyvsp
[(2) - (2)].string
));
1681 #line 243 "nlmheader.y"
1683 fixed_hdr
->flags
&=~ nlmlex_get_number ((yyvsp
[(2) - (2)].string
));
1684 free ((yyvsp
[(2) - (2)].string
));
1689 #line 248 "nlmheader.y"
1697 #line 253 "nlmheader.y"
1699 map_file
= (yyvsp
[(2) - (2)].string
);
1705 #line 258 "nlmheader.y"
1707 help_file
= (yyvsp
[(2) - (2)].string
);
1712 #line 262 "nlmheader.y"
1714 symbol_prefix
= NULL
;
1719 #line 266 "nlmheader.y"
1721 import_symbols
= string_list_append (import_symbols
, (yyvsp
[(3) - (3)].list
));
1726 #line 270 "nlmheader.y"
1728 input_files
= string_list_append (input_files
, (yyvsp
[(2) - (2)].list
));
1733 #line 274 "nlmheader.y"
1740 #line 278 "nlmheader.y"
1742 map_file
= (yyvsp
[(2) - (2)].string
);
1747 #line 282 "nlmheader.y"
1749 message_file
= (yyvsp
[(2) - (2)].string
);
1754 #line 286 "nlmheader.y"
1756 modules
= string_list_append (modules
, (yyvsp
[(2) - (2)].list
));
1761 #line 290 "nlmheader.y"
1763 fixed_hdr
->flags
|= 0x2;
1768 #line 294 "nlmheader.y"
1770 fixed_hdr
->flags
|= 0x10;
1775 #line 298 "nlmheader.y"
1777 if (output_file
== NULL
)
1778 output_file
= (yyvsp
[(2) - (2)].string
);
1780 nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
1785 #line 305 "nlmheader.y"
1787 fixed_hdr
->flags
|= 0x8;
1792 #line 309 "nlmheader.y"
1794 fixed_hdr
->flags
|= 0x1;
1799 #line 313 "nlmheader.y"
1803 len
= strlen ((yyvsp
[(2) - (2)].string
));
1804 if (len
>= NLM_MAX_SCREEN_NAME_LENGTH
)
1806 nlmheader_warn (_("screen name is too long"),
1807 NLM_MAX_SCREEN_NAME_LENGTH
);
1808 len
= NLM_MAX_SCREEN_NAME_LENGTH
;
1810 var_hdr
->screenNameLength
= len
;
1811 strncpy (var_hdr
->screenName
, (yyvsp
[(2) - (2)].string
), len
);
1812 var_hdr
->screenName
[NLM_MAX_SCREEN_NAME_LENGTH
] = '\0';
1813 free ((yyvsp
[(2) - (2)].string
));
1818 #line 329 "nlmheader.y"
1820 sharelib_file
= (yyvsp
[(2) - (2)].string
);
1825 #line 333 "nlmheader.y"
1827 var_hdr
->stackSize
= nlmlex_get_number ((yyvsp
[(2) - (2)].string
));
1828 free ((yyvsp
[(2) - (2)].string
));
1833 #line 338 "nlmheader.y"
1835 start_procedure
= (yyvsp
[(2) - (2)].string
);
1840 #line 342 "nlmheader.y"
1842 fixed_hdr
->flags
|= 0x4;
1847 #line 346 "nlmheader.y"
1851 len
= strlen ((yyvsp
[(2) - (2)].string
));
1852 if (len
>= NLM_MAX_THREAD_NAME_LENGTH
)
1854 nlmheader_warn (_("thread name is too long"),
1855 NLM_MAX_THREAD_NAME_LENGTH
);
1856 len
= NLM_MAX_THREAD_NAME_LENGTH
;
1858 var_hdr
->threadNameLength
= len
;
1859 strncpy (var_hdr
->threadName
, (yyvsp
[(2) - (2)].string
), len
);
1860 var_hdr
->threadName
[len
] = '\0';
1861 free ((yyvsp
[(2) - (2)].string
));
1866 #line 362 "nlmheader.y"
1868 fixed_hdr
->moduleType
= nlmlex_get_number ((yyvsp
[(2) - (2)].string
));
1869 free ((yyvsp
[(2) - (2)].string
));
1874 #line 367 "nlmheader.y"
1881 #line 371 "nlmheader.y"
1885 strncpy (version_hdr
->stamp
, "VeRsIoN#", 8);
1886 version_hdr
->majorVersion
= nlmlex_get_number ((yyvsp
[(2) - (4)].string
));
1887 val
= nlmlex_get_number ((yyvsp
[(3) - (4)].string
));
1888 if (val
< 0 || val
> 99)
1889 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1892 version_hdr
->minorVersion
= val
;
1893 val
= nlmlex_get_number ((yyvsp
[(4) - (4)].string
));
1895 nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
1898 version_hdr
->revision
= 0;
1900 version_hdr
->revision
= val
;
1901 free ((yyvsp
[(2) - (4)].string
));
1902 free ((yyvsp
[(3) - (4)].string
));
1903 free ((yyvsp
[(4) - (4)].string
));
1908 #line 395 "nlmheader.y"
1912 strncpy (version_hdr
->stamp
, "VeRsIoN#", 8);
1913 version_hdr
->majorVersion
= nlmlex_get_number ((yyvsp
[(2) - (3)].string
));
1914 val
= nlmlex_get_number ((yyvsp
[(3) - (3)].string
));
1915 if (val
< 0 || val
> 99)
1916 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1919 version_hdr
->minorVersion
= val
;
1920 version_hdr
->revision
= 0;
1921 free ((yyvsp
[(2) - (3)].string
));
1922 free ((yyvsp
[(3) - (3)].string
));
1927 #line 411 "nlmheader.y"
1929 rpc_file
= (yyvsp
[(2) - (2)].string
);
1934 #line 420 "nlmheader.y"
1936 (yyval
.list
) = NULL
;
1941 #line 424 "nlmheader.y"
1943 (yyval
.list
) = (yyvsp
[(1) - (1)].list
);
1948 #line 435 "nlmheader.y"
1950 (yyval
.list
) = string_list_cons ((yyvsp
[(1) - (1)].string
), NULL
);
1955 #line 439 "nlmheader.y"
1957 (yyval
.list
) = NULL
;
1962 #line 443 "nlmheader.y"
1964 (yyval
.list
) = string_list_append1 ((yyvsp
[(1) - (2)].list
), (yyvsp
[(2) - (2)].string
));
1969 #line 447 "nlmheader.y"
1971 (yyval
.list
) = (yyvsp
[(1) - (2)].list
);
1976 #line 456 "nlmheader.y"
1978 if (symbol_prefix
!= NULL
)
1979 free (symbol_prefix
);
1980 symbol_prefix
= (yyvsp
[(2) - (3)].string
);
1985 #line 467 "nlmheader.y"
1987 if (symbol_prefix
== NULL
)
1988 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1991 (yyval
.string
) = xmalloc (strlen (symbol_prefix
) + strlen ((yyvsp
[(1) - (1)].string
)) + 2);
1992 sprintf ((yyval
.string
), "%s@%s", symbol_prefix
, (yyvsp
[(1) - (1)].string
));
1993 free ((yyvsp
[(1) - (1)].string
));
1999 #line 483 "nlmheader.y"
2001 (yyval
.list
) = NULL
;
2006 #line 487 "nlmheader.y"
2008 (yyval
.list
) = string_list_cons ((yyvsp
[(1) - (2)].string
), (yyvsp
[(2) - (2)].list
));
2013 /* Line 1267 of yacc.c. */
2014 #line 2015 "nlmheader.c"
2017 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2021 YY_STACK_PRINT (yyss
, yyssp
);
2026 /* Now `shift' the result of the reduction. Determine what state
2027 that goes to, based on the state we popped back to and the rule
2028 number reduced by. */
2032 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2033 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2034 yystate
= yytable
[yystate
];
2036 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2041 /*------------------------------------.
2042 | yyerrlab -- here on detecting error |
2043 `------------------------------------*/
2045 /* If not already recovering from an error, report this error. */
2049 #if ! YYERROR_VERBOSE
2050 yyerror (YY_("syntax error"));
2053 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2054 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2056 YYSIZE_T yyalloc
= 2 * yysize
;
2057 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2058 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2059 if (yymsg
!= yymsgbuf
)
2060 YYSTACK_FREE (yymsg
);
2061 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2063 yymsg_alloc
= yyalloc
;
2067 yymsg_alloc
= sizeof yymsgbuf
;
2071 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2073 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2078 yyerror (YY_("syntax error"));
2080 goto yyexhaustedlab
;
2088 if (yyerrstatus
== 3)
2090 /* If just tried and failed to reuse look-ahead token after an
2091 error, discard it. */
2093 if (yychar
<= YYEOF
)
2095 /* Return failure if at end of input. */
2096 if (yychar
== YYEOF
)
2101 yydestruct ("Error: discarding",
2107 /* Else will try to reuse look-ahead token after shifting the error
2112 /*---------------------------------------------------.
2113 | yyerrorlab -- error raised explicitly by YYERROR. |
2114 `---------------------------------------------------*/
2117 /* Pacify compilers like GCC when the user code never invokes
2118 YYERROR and the label yyerrorlab therefore never appears in user
2120 if (/*CONSTCOND*/ 0)
2123 /* Do not reclaim the symbols of the rule which action triggered
2127 YY_STACK_PRINT (yyss
, yyssp
);
2132 /*-------------------------------------------------------------.
2133 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2134 `-------------------------------------------------------------*/
2136 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2140 yyn
= yypact
[yystate
];
2141 if (yyn
!= YYPACT_NINF
)
2144 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2152 /* Pop the current state because it cannot handle the error token. */
2157 yydestruct ("Error: popping",
2158 yystos
[yystate
], yyvsp
);
2161 YY_STACK_PRINT (yyss
, yyssp
);
2170 /* Shift the error token. */
2171 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2177 /*-------------------------------------.
2178 | yyacceptlab -- YYACCEPT comes here. |
2179 `-------------------------------------*/
2184 /*-----------------------------------.
2185 | yyabortlab -- YYABORT comes here. |
2186 `-----------------------------------*/
2192 /*-------------------------------------------------.
2193 | yyexhaustedlab -- memory exhaustion comes here. |
2194 `-------------------------------------------------*/
2196 yyerror (YY_("memory exhausted"));
2202 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2203 yydestruct ("Cleanup: discarding lookahead",
2205 /* Do not reclaim the symbols of the rule which action triggered
2206 this YYABORT or YYACCEPT. */
2208 YY_STACK_PRINT (yyss
, yyssp
);
2209 while (yyssp
!= yyss
)
2211 yydestruct ("Cleanup: popping",
2212 yystos
[*yyssp
], yyvsp
);
2217 YYSTACK_FREE (yyss
);
2220 if (yymsg
!= yymsgbuf
)
2221 YYSTACK_FREE (yymsg
);
2223 /* Make sure YYID is used. */
2224 return YYID (yyresult
);
2228 #line 492 "nlmheader.y"
2231 /* If strerror is just a macro, we want to use the one from libiberty
2232 since it will handle undefined values. */
2234 extern char *strerror
PARAMS ((int));
2236 /* The lexer is simple, too simple for flex. Keywords are only
2237 recognized at the start of lines. Everything else must be an
2238 argument. A comma is treated as whitespace. */
2240 /* The states the lexer can be in. */
2244 /* At the beginning of a line. */
2246 /* In the middle of a line. */
2250 /* We need to keep a stack of files to handle file inclusion. */
2254 /* The file to read from. */
2256 /* The name of the file. */
2258 /* The current line number. */
2260 /* The current state. */
2261 enum lex_state state
;
2262 /* The next file on the stack. */
2266 /* The current input file. */
2268 static struct input current
;
2270 /* The character which introduces comments. */
2271 #define COMMENT_CHAR '#'
2273 /* Start the lexer going on the main input file. */
2276 nlmlex_file (const char *name
)
2278 current
.next
= NULL
;
2279 return nlmlex_file_open (name
);
2282 /* Start the lexer going on a subsidiary input file. */
2285 nlmlex_file_push (const char *name
)
2289 push
= (struct input
*) xmalloc (sizeof (struct input
));
2291 if (nlmlex_file_open (name
))
2292 current
.next
= push
;
2300 /* Start lexing from a file. */
2303 nlmlex_file_open (const char *name
)
2305 current
.file
= fopen (name
, "r");
2306 if (current
.file
== NULL
)
2308 fprintf (stderr
, "%s:%s: %s\n", program_name
, name
, strerror (errno
));
2312 current
.name
= xstrdup (name
);
2314 current
.state
= BEGINNING_OF_LINE
;
2318 /* Table used to turn keywords into tokens. */
2320 struct keyword_tokens_struct
2322 const char *keyword
;
2326 static struct keyword_tokens_struct keyword_tokens
[] =
2329 { "CODESTART", CODESTART
},
2330 { "COPYRIGHT", COPYRIGHT
},
2331 { "CUSTOM", CUSTOM
},
2334 { "DESCRIPTION", DESCRIPTION
},
2336 { "EXPORT", EXPORT
},
2337 { "FLAG_ON", FLAG_ON
},
2338 { "FLAG_OFF", FLAG_OFF
},
2339 { "FULLMAP", FULLMAP
},
2341 { "IMPORT", IMPORT
},
2344 { "MESSAGES", MESSAGES
},
2345 { "MODULE", MODULE
},
2346 { "MULTIPLE", MULTIPLE
},
2347 { "OS_DOMAIN", OS_DOMAIN
},
2348 { "OUTPUT", OUTPUT
},
2349 { "PSEUDOPREEMPTION", PSEUDOPREEMPTION
},
2350 { "REENTRANT", REENTRANT
},
2351 { "SCREENNAME", SCREENNAME
},
2352 { "SHARELIB", SHARELIB
},
2354 { "STACKSIZE", STACK
},
2356 { "SYNCHRONIZE", SYNCHRONIZE
},
2357 { "THREADNAME", THREADNAME
},
2359 { "VERBOSE", VERBOSE
},
2360 { "VERSION", VERSIONK
},
2361 { "XDCDATA", XDCDATA
}
2364 #define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
2366 /* The lexer accumulates strings in these variables. */
2367 static char *lex_buf
;
2368 static int lex_size
;
2371 /* Start accumulating strings into the buffer. */
2372 #define BUF_INIT() \
2373 ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
2376 nlmlex_buf_init (void)
2379 lex_buf
= xmalloc (lex_size
+ 1);
2384 /* Finish a string in the buffer. */
2385 #define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
2387 /* Accumulate a character into the buffer. */
2388 #define BUF_ADD(c) \
2389 ((void) (lex_pos < lex_size \
2390 ? lex_buf[lex_pos++] = (c) \
2391 : nlmlex_buf_add (c)))
2394 nlmlex_buf_add (int c
)
2396 if (lex_pos
>= lex_size
)
2399 lex_buf
= xrealloc (lex_buf
, lex_size
+ 1);
2402 return lex_buf
[lex_pos
++] = c
;
2405 /* The lexer proper. This is called by the bison generated parsing
2415 c
= getc (current
.file
);
2417 /* Commas are treated as whitespace characters. */
2418 while (ISSPACE (c
) || c
== ',')
2420 current
.state
= IN_LINE
;
2424 current
.state
= BEGINNING_OF_LINE
;
2426 c
= getc (current
.file
);
2429 /* At the end of the file we either pop to the previous file or
2433 fclose (current
.file
);
2434 free (current
.name
);
2435 if (current
.next
== NULL
)
2441 next
= current
.next
;
2448 /* A comment character always means to drop everything until the
2450 if (c
== COMMENT_CHAR
)
2454 c
= getc (current
.file
);
2458 current
.state
= BEGINNING_OF_LINE
;
2462 /* An '@' introduces an include file. */
2467 c
= getc (current
.file
);
2471 while (ISSPACE (c
));
2473 while (! ISSPACE (c
) && c
!= EOF
)
2476 c
= getc (current
.file
);
2480 ungetc (c
, current
.file
);
2482 nlmlex_file_push (lex_buf
);
2486 /* A non-space character at the start of a line must be the start of
2488 if (current
.state
== BEGINNING_OF_LINE
)
2491 while (ISALNUM (c
) || c
== '_')
2493 BUF_ADD (TOUPPER (c
));
2494 c
= getc (current
.file
);
2498 if (c
!= EOF
&& ! ISSPACE (c
) && c
!= ',')
2500 nlmheader_identify ();
2501 fprintf (stderr
, _("%s:%d: illegal character in keyword: %c\n"),
2502 current
.name
, current
.lineno
, c
);
2508 for (i
= 0; i
< KEYWORD_COUNT
; i
++)
2510 if (lex_buf
[0] == keyword_tokens
[i
].keyword
[0]
2511 && strcmp (lex_buf
, keyword_tokens
[i
].keyword
) == 0)
2513 /* Pushing back the final whitespace avoids worrying
2515 ungetc (c
, current
.file
);
2516 current
.state
= IN_LINE
;
2517 return keyword_tokens
[i
].token
;
2521 nlmheader_identify ();
2522 fprintf (stderr
, _("%s:%d: unrecognized keyword: %s\n"),
2523 current
.name
, current
.lineno
, lex_buf
);
2527 /* Treat the rest of this line as a comment. */
2528 ungetc (COMMENT_CHAR
, current
.file
);
2532 /* Parentheses just represent themselves. */
2533 if (c
== '(' || c
== ')')
2536 /* Handle quoted strings. */
2537 if (c
== '"' || c
== '\'')
2543 start_lineno
= current
.lineno
;
2545 c
= getc (current
.file
);
2547 while (c
!= quote
&& c
!= EOF
)
2552 c
= getc (current
.file
);
2558 nlmheader_identify ();
2559 fprintf (stderr
, _("%s:%d: end of file in quoted string\n"),
2560 current
.name
, start_lineno
);
2564 /* FIXME: Possible memory leak. */
2565 yylval
.string
= xstrdup (lex_buf
);
2566 return QUOTED_STRING
;
2569 /* Gather a generic argument. */
2571 while (! ISSPACE (c
)
2573 && c
!= COMMENT_CHAR
2578 c
= getc (current
.file
);
2582 ungetc (c
, current
.file
);
2584 /* FIXME: Possible memory leak. */
2585 yylval
.string
= xstrdup (lex_buf
);
2589 /* Get a number from a string. */
2592 nlmlex_get_number (const char *s
)
2597 ret
= strtol (s
, &send
, 10);
2599 nlmheader_warn (_("bad number"), -1);
2603 /* Prefix the nlmconv warnings with a note as to where they come from.
2604 We don't use program_name on every warning, because then some
2605 versions of the emacs next-error function can't recognize the line
2609 nlmheader_identify (void)
2615 fprintf (stderr
, _("%s: problems in NLM command language input:\n"),
2621 /* Issue a warning. */
2624 nlmheader_warn (const char *s
, int imax
)
2626 nlmheader_identify ();
2627 fprintf (stderr
, "%s:%d: %s", current
.name
, current
.lineno
, s
);
2629 fprintf (stderr
, " (max %d)", imax
);
2630 fprintf (stderr
, "\n");
2633 /* Report an error. */
2636 nlmheader_error (const char *s
)
2638 nlmheader_warn (s
, -1);
2642 /* Add a string to a string list. */
2644 static struct string_list
*
2645 string_list_cons (char *s
, struct string_list
*l
)
2647 struct string_list
*ret
;
2649 ret
= (struct string_list
*) xmalloc (sizeof (struct string_list
));
2655 /* Append a string list to another string list. */
2657 static struct string_list
*
2658 string_list_append (struct string_list
*l1
, struct string_list
*l2
)
2660 register struct string_list
**pp
;
2662 for (pp
= &l1
; *pp
!= NULL
; pp
= &(*pp
)->next
)
2668 /* Append a string to a string list. */
2670 static struct string_list
*
2671 string_list_append1 (struct string_list
*l
, char *s
)
2673 struct string_list
*n
;
2674 register struct string_list
**pp
;
2676 n
= (struct string_list
*) xmalloc (sizeof (struct string_list
));
2679 for (pp
= &l
; *pp
!= NULL
; pp
= &(*pp
)->next
)
2685 /* Duplicate a string in memory. */
2688 xstrdup (const char *s
)
2694 ret
= xmalloc (len
+ 1);