1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.4"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
65 #line 1 "nlmheader.y" /* yacc.c:339 */
66 /* nlmheader.y - parse NLM header specification keywords.
67 Copyright (C) 1993-2018 Free Software Foundation, Inc.
69 This file is part of GNU Binutils.
71 This program is free software; you can redistribute it and/or modify
72 it under the terms of the GNU General Public License as published by
73 the Free Software Foundation; either version 3 of the License, or
74 (at your option) any later version.
76 This program is distributed in the hope that it will be useful,
77 but WITHOUT ANY WARRANTY; without even the implied warranty of
78 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79 GNU General Public License for more details.
81 You should have received a copy of the GNU General Public License
82 along with this program; if not, write to the Free Software
83 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
84 MA 02110-1301, USA. */
86 /* Written by Ian Lance Taylor <ian@cygnus.com>.
88 This bison file parses the commands recognized by the NetWare NLM
89 linker, except for lists of object files. It stores the
90 information in global variables.
92 This implementation is based on the description in the NetWare Tool
93 Maker Specification manual, edition 1.0. */
96 #include "safe-ctype.h"
98 #include "nlm/common.h"
99 #include "nlm/internal.h"
103 /* Information is stored in the structures pointed to by these
106 Nlm_Internal_Fixed_Header
*fixed_hdr
;
107 Nlm_Internal_Variable_Header
*var_hdr
;
108 Nlm_Internal_Version_Header
*version_hdr
;
109 Nlm_Internal_Copyright_Header
*copyright_hdr
;
110 Nlm_Internal_Extended_Header
*extended_hdr
;
112 /* Procedure named by CHECK. */
113 char *check_procedure
;
114 /* File named by CUSTOM. */
116 /* Whether to generate debugging information (DEBUG). */
117 bfd_boolean debug_info
;
118 /* Procedure named by EXIT. */
119 char *exit_procedure
;
120 /* Exported symbols (EXPORT). */
121 struct string_list
*export_symbols
;
122 /* List of files from INPUT. */
123 struct string_list
*input_files
;
124 /* Map file name (MAP, FULLMAP). */
126 /* Whether a full map has been requested (FULLMAP). */
127 bfd_boolean full_map
;
128 /* File named by HELP. */
130 /* Imported symbols (IMPORT). */
131 struct string_list
*import_symbols
;
132 /* File named by MESSAGES. */
134 /* Autoload module list (MODULE). */
135 struct string_list
*modules
;
136 /* File named by OUTPUT. */
138 /* File named by SHARELIB. */
140 /* Start procedure name (START). */
141 char *start_procedure
;
144 /* RPC description file (XDCDATA). */
147 /* The number of serious errors that have occurred. */
150 /* The current symbol prefix when reading a list of import or export
152 static char *symbol_prefix
;
154 /* Parser error message handler. */
155 #define yyerror(msg) nlmheader_error (msg);
157 /* Local functions. */
158 static int yylex (void);
159 static void nlmlex_file_push (const char *);
160 static bfd_boolean
nlmlex_file_open (const char *);
161 static int nlmlex_buf_init (void);
162 static char nlmlex_buf_add (int);
163 static long nlmlex_get_number (const char *);
164 static void nlmheader_identify (void);
165 static void nlmheader_warn (const char *, int);
166 static void nlmheader_error (const char *);
167 static struct string_list
* string_list_cons (char *, struct string_list
*);
168 static struct string_list
* string_list_append (struct string_list
*,
169 struct string_list
*);
170 static struct string_list
* string_list_append1 (struct string_list
*,
172 static char *xstrdup (const char *);
175 #line 176 "nlmheader.c" /* yacc.c:339 */
178 # if defined __cplusplus && 201103L <= __cplusplus
179 # define YY_NULLPTR nullptr
181 # define YY_NULLPTR 0
185 /* Enabling verbose error messages. */
186 #ifdef YYERROR_VERBOSE
187 # undef YYERROR_VERBOSE
188 # define YYERROR_VERBOSE 1
190 # define YYERROR_VERBOSE 0
193 /* In a future release of Bison, this section will be replaced
194 by #include "y.tab.h". */
195 #ifndef YY_YY_NLMHEADER_H_INCLUDED
196 # define YY_YY_NLMHEADER_H_INCLUDED
231 PSEUDOPREEMPTION
= 279,
249 #define CODESTART 259
250 #define COPYRIGHT 260
254 #define DESCRIPTION 264
267 #define OS_DOMAIN 277
269 #define PSEUDOPREEMPTION 279
270 #define REENTRANT 280
271 #define SCREENNAME 281
275 #define SYNCHRONIZE 285
276 #define THREADNAME 286
282 #define QUOTED_STRING 292
285 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
289 #line 112 "nlmheader.y" /* yacc.c:355 */
292 struct string_list
*list
;
294 #line 295 "nlmheader.c" /* yacc.c:355 */
297 typedef union YYSTYPE YYSTYPE
;
298 # define YYSTYPE_IS_TRIVIAL 1
299 # define YYSTYPE_IS_DECLARED 1
303 extern YYSTYPE yylval
;
307 #endif /* !YY_YY_NLMHEADER_H_INCLUDED */
309 /* Copy the second part of user declarations. */
311 #line 312 "nlmheader.c" /* yacc.c:358 */
318 typedef YYTYPE_UINT8 yytype_uint8
;
320 typedef unsigned char yytype_uint8
;
324 typedef YYTYPE_INT8 yytype_int8
;
326 typedef signed char yytype_int8
;
330 typedef YYTYPE_UINT16 yytype_uint16
;
332 typedef unsigned short int yytype_uint16
;
336 typedef YYTYPE_INT16 yytype_int16
;
338 typedef short int yytype_int16
;
342 # ifdef __SIZE_TYPE__
343 # define YYSIZE_T __SIZE_TYPE__
344 # elif defined size_t
345 # define YYSIZE_T size_t
346 # elif ! defined YYSIZE_T
347 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
348 # define YYSIZE_T size_t
350 # define YYSIZE_T unsigned int
354 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
357 # if defined YYENABLE_NLS && YYENABLE_NLS
359 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
360 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
364 # define YY_(Msgid) Msgid
369 # if (defined __GNUC__ \
370 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
371 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
372 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
374 # define YY_ATTRIBUTE(Spec) /* empty */
378 #ifndef YY_ATTRIBUTE_PURE
379 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
382 #ifndef YY_ATTRIBUTE_UNUSED
383 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
386 #if !defined _Noreturn \
387 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
388 # if defined _MSC_VER && 1200 <= _MSC_VER
389 # define _Noreturn __declspec (noreturn)
391 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
395 /* Suppress unused-variable warnings by "using" E. */
396 #if ! defined lint || defined __GNUC__
397 # define YYUSE(E) ((void) (E))
399 # define YYUSE(E) /* empty */
402 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
403 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
404 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
405 _Pragma ("GCC diagnostic push") \
406 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
407 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
408 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
409 _Pragma ("GCC diagnostic pop")
411 # define YY_INITIAL_VALUE(Value) Value
413 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
414 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
415 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
417 #ifndef YY_INITIAL_VALUE
418 # define YY_INITIAL_VALUE(Value) /* Nothing. */
422 #if ! defined yyoverflow || YYERROR_VERBOSE
424 /* The parser invokes alloca or malloc; define the necessary symbols. */
426 # ifdef YYSTACK_USE_ALLOCA
427 # if YYSTACK_USE_ALLOCA
429 # define YYSTACK_ALLOC __builtin_alloca
430 # elif defined __BUILTIN_VA_ARG_INCR
431 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
433 # define YYSTACK_ALLOC __alloca
434 # elif defined _MSC_VER
435 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
436 # define alloca _alloca
438 # define YYSTACK_ALLOC alloca
439 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
440 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
441 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
442 # ifndef EXIT_SUCCESS
443 # define EXIT_SUCCESS 0
450 # ifdef YYSTACK_ALLOC
451 /* Pacify GCC's 'empty if-body' warning. */
452 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
453 # ifndef YYSTACK_ALLOC_MAXIMUM
454 /* The OS might guarantee only one guard page at the bottom of the stack,
455 and a page size can be as small as 4096 bytes. So we cannot safely
456 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
457 to allow for a few compiler-allocated temporary stack slots. */
458 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
461 # define YYSTACK_ALLOC YYMALLOC
462 # define YYSTACK_FREE YYFREE
463 # ifndef YYSTACK_ALLOC_MAXIMUM
464 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
466 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
467 && ! ((defined YYMALLOC || defined malloc) \
468 && (defined YYFREE || defined free)))
469 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
470 # ifndef EXIT_SUCCESS
471 # define EXIT_SUCCESS 0
475 # define YYMALLOC malloc
476 # if ! defined malloc && ! defined EXIT_SUCCESS
477 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
482 # if ! defined free && ! defined EXIT_SUCCESS
483 void free (void *); /* INFRINGES ON USER NAME SPACE */
487 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
490 #if (! defined yyoverflow \
491 && (! defined __cplusplus \
492 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
494 /* A type that is properly aligned for any stack member. */
497 yytype_int16 yyss_alloc
;
501 /* The size of the maximum gap between one aligned stack and the next. */
502 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
504 /* The size of an array large to enough to hold all stacks, each with
506 # define YYSTACK_BYTES(N) \
507 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
508 + YYSTACK_GAP_MAXIMUM)
510 # define YYCOPY_NEEDED 1
512 /* Relocate STACK from its old location to the new one. The
513 local variables YYSIZE and YYSTACKSIZE give the old and new number of
514 elements in the stack, and YYPTR gives the new location of the
515 stack. Advance YYPTR to a properly aligned location for the next
517 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
520 YYSIZE_T yynewbytes; \
521 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
522 Stack = &yyptr->Stack_alloc; \
523 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
524 yyptr += yynewbytes / sizeof (*yyptr); \
530 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
531 /* Copy COUNT objects from SRC to DST. The source and destination do
534 # if defined __GNUC__ && 1 < __GNUC__
535 # define YYCOPY(Dst, Src, Count) \
536 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
538 # define YYCOPY(Dst, Src, Count) \
542 for (yyi = 0; yyi < (Count); yyi++) \
543 (Dst)[yyi] = (Src)[yyi]; \
548 #endif /* !YYCOPY_NEEDED */
550 /* YYFINAL -- State number of the termination state. */
552 /* YYLAST -- Last index in YYTABLE. */
555 /* YYNTOKENS -- Number of terminals. */
557 /* YYNNTS -- Number of nonterminals. */
559 /* YYNRULES -- Number of rules. */
561 /* YYNSTATES -- Number of states. */
564 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
565 by yylex, with out-of-bounds checking. */
567 #define YYMAXUTOK 292
569 #define YYTRANSLATE(YYX) \
570 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
572 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
573 as returned by yylex, without out-of-bounds checking. */
574 static const yytype_uint8 yytranslate
[] =
576 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 38, 39, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
602 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
603 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
604 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
609 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
610 static const yytype_uint16 yyrline
[] =
612 0, 143, 143, 148, 150, 156, 160, 165, 182, 186,
613 204, 208, 224, 229, 228, 236, 241, 246, 251, 256,
614 261, 260, 268, 272, 276, 280, 284, 288, 292, 296,
615 303, 307, 311, 327, 331, 336, 340, 344, 360, 365,
616 369, 393, 409, 419, 422, 433, 437, 441, 445, 454,
621 #if YYDEBUG || YYERROR_VERBOSE || 0
622 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
623 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
624 static const char *const yytname
[] =
626 "$end", "error", "$undefined", "CHECK", "CODESTART", "COPYRIGHT",
627 "CUSTOM", "DATE", "DEBUG_K", "DESCRIPTION", "EXIT", "EXPORT", "FLAG_ON",
628 "FLAG_OFF", "FULLMAP", "HELP", "IMPORT", "INPUT", "MAP", "MESSAGES",
629 "MODULE", "MULTIPLE", "OS_DOMAIN", "OUTPUT", "PSEUDOPREEMPTION",
630 "REENTRANT", "SCREENNAME", "SHARELIB", "STACK", "START", "SYNCHRONIZE",
631 "THREADNAME", "TYPE", "VERBOSE", "VERSIONK", "XDCDATA", "STRING",
632 "QUOTED_STRING", "'('", "')'", "$accept", "file", "commands", "command",
633 "$@1", "$@2", "symbol_list_opt", "symbol_list", "symbol_prefix",
634 "symbol", "string_list", YY_NULLPTR
639 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
640 (internal) symbol number NUM (which must be that of a token). */
641 static const yytype_uint16 yytoknum
[] =
643 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
644 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
645 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
646 285, 286, 287, 288, 289, 290, 291, 292, 40, 41
650 #define YYPACT_NINF -20
652 #define yypact_value_is_default(Yystate) \
653 (!!((Yystate) == (-20)))
655 #define YYTABLE_NINF -1
657 #define yytable_value_is_error(Yytable_value) \
660 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
662 static const yytype_int8 yypact
[] =
664 -3, -1, 1, 2, 4, 5, -20, 6, 8, -20,
665 9, 10, 11, 12, -20, 13, 14, 16, 13, -20,
666 -20, 17, -20, -20, 18, 20, 21, 22, -20, 23,
667 25, -20, 26, 27, 38, -20, -3, -20, -20, -20,
668 -20, 28, -20, -20, -2, -20, -20, -20, -20, -2,
669 13, -20, -20, -20, -20, -20, -20, -20, -20, -20,
670 -20, -20, 30, -20, -20, -20, 31, -20, 32, -20,
671 -2, -20, -20, -20, -20, 33, -20, 3, -20, -20,
675 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
676 Performed when YYTABLE does not specify something else to do. Zero
677 means the default is an error. */
678 static const yytype_uint8 yydefact
[] =
680 3, 0, 0, 0, 0, 0, 10, 0, 0, 13,
681 0, 0, 17, 0, 20, 51, 23, 0, 51, 27,
682 28, 0, 30, 31, 0, 0, 0, 0, 36, 0,
683 0, 39, 0, 0, 0, 2, 3, 5, 6, 7,
684 8, 0, 11, 12, 43, 15, 16, 18, 19, 43,
685 51, 22, 24, 25, 26, 29, 32, 33, 34, 35,
686 37, 38, 0, 42, 1, 4, 0, 50, 0, 14,
687 44, 46, 45, 21, 52, 41, 9, 0, 48, 47,
691 /* YYPGOTO[NTERM-NUM]. */
692 static const yytype_int8 yypgoto
[] =
694 -20, -20, 34, -20, -20, -20, 24, -20, -19, -16,
698 /* YYDEFGOTO[NTERM-NUM]. */
699 static const yytype_int8 yydefgoto
[] =
701 -1, 34, 35, 36, 44, 49, 69, 70, 71, 72,
705 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
706 positive, shift that token. If negative, reduce the rule whose
707 number is the opposite. If YYTABLE_NINF, syntax error. */
708 static const yytype_uint8 yytable
[] =
710 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
711 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
712 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
713 31, 32, 33, 54, 67, 37, 68, 38, 64, 39,
714 40, 41, 81, 42, 43, 45, 46, 47, 48, 50,
715 52, 78, 53, 55, 79, 56, 57, 58, 59, 0,
716 60, 61, 62, 63, 66, 74, 75, 76, 77, 80,
720 static const yytype_int8 yycheck
[] =
722 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
723 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
724 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
725 33, 34, 35, 18, 36, 36, 38, 36, 0, 37,
726 36, 36, 39, 37, 36, 36, 36, 36, 36, 36,
727 36, 70, 36, 36, 70, 37, 36, 36, 36, -1,
728 37, 36, 36, 36, 36, 50, 36, 36, 36, 36,
732 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
733 symbol of state STATE-NUM. */
734 static const yytype_uint8 yystos
[] =
736 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
737 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
738 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
739 32, 33, 34, 35, 41, 42, 43, 36, 36, 37,
740 36, 36, 37, 36, 44, 36, 36, 36, 36, 45,
741 36, 50, 36, 36, 50, 36, 37, 36, 36, 36,
742 37, 36, 36, 36, 0, 42, 36, 36, 38, 46,
743 47, 48, 49, 46, 50, 36, 36, 36, 48, 49,
747 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
748 static const yytype_uint8 yyr1
[] =
750 0, 40, 41, 42, 42, 43, 43, 43, 43, 43,
751 43, 43, 43, 44, 43, 43, 43, 43, 43, 43,
752 45, 43, 43, 43, 43, 43, 43, 43, 43, 43,
753 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
754 43, 43, 43, 46, 46, 47, 47, 47, 47, 48,
758 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
759 static const yytype_uint8 yyr2
[] =
761 0, 2, 1, 0, 2, 2, 2, 2, 2, 4,
762 1, 2, 2, 0, 3, 2, 2, 1, 2, 2,
763 0, 3, 2, 1, 2, 2, 2, 1, 1, 2,
764 1, 1, 2, 2, 2, 2, 1, 2, 2, 1,
765 4, 3, 2, 0, 1, 1, 1, 2, 2, 3,
770 #define yyerrok (yyerrstatus = 0)
771 #define yyclearin (yychar = YYEMPTY)
775 #define YYACCEPT goto yyacceptlab
776 #define YYABORT goto yyabortlab
777 #define YYERROR goto yyerrorlab
780 #define YYRECOVERING() (!!yyerrstatus)
782 #define YYBACKUP(Token, Value) \
784 if (yychar == YYEMPTY) \
788 YYPOPSTACK (yylen); \
794 yyerror (YY_("syntax error: cannot back up")); \
799 /* Error token number */
801 #define YYERRCODE 256
805 /* Enable debugging if requested. */
809 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
810 # define YYFPRINTF fprintf
813 # define YYDPRINTF(Args) \
819 /* This macro is provided for backward compatibility. */
820 #ifndef YY_LOCATION_PRINT
821 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
825 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
829 YYFPRINTF (stderr, "%s ", Title); \
830 yy_symbol_print (stderr, \
832 YYFPRINTF (stderr, "\n"); \
837 /*----------------------------------------.
838 | Print this symbol's value on YYOUTPUT. |
839 `----------------------------------------*/
842 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
844 FILE *yyo
= yyoutput
;
849 if (yytype
< YYNTOKENS
)
850 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
856 /*--------------------------------.
857 | Print this symbol on YYOUTPUT. |
858 `--------------------------------*/
861 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
863 YYFPRINTF (yyoutput
, "%s %s (",
864 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
866 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
867 YYFPRINTF (yyoutput
, ")");
870 /*------------------------------------------------------------------.
871 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
873 `------------------------------------------------------------------*/
876 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
878 YYFPRINTF (stderr
, "Stack now");
879 for (; yybottom
<= yytop
; yybottom
++)
881 int yybot
= *yybottom
;
882 YYFPRINTF (stderr
, " %d", yybot
);
884 YYFPRINTF (stderr
, "\n");
887 # define YY_STACK_PRINT(Bottom, Top) \
890 yy_stack_print ((Bottom), (Top)); \
894 /*------------------------------------------------.
895 | Report that the YYRULE is going to be reduced. |
896 `------------------------------------------------*/
899 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
)
901 unsigned long int yylno
= yyrline
[yyrule
];
902 int yynrhs
= yyr2
[yyrule
];
904 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
906 /* The symbols being reduced. */
907 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
909 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
910 yy_symbol_print (stderr
,
911 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
912 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
914 YYFPRINTF (stderr
, "\n");
918 # define YY_REDUCE_PRINT(Rule) \
921 yy_reduce_print (yyssp, yyvsp, Rule); \
924 /* Nonzero means print parse trace. It is left uninitialized so that
925 multiple parsers can coexist. */
928 # define YYDPRINTF(Args)
929 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
930 # define YY_STACK_PRINT(Bottom, Top)
931 # define YY_REDUCE_PRINT(Rule)
932 #endif /* !YYDEBUG */
935 /* YYINITDEPTH -- initial size of the parser's stacks. */
937 # define YYINITDEPTH 200
940 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
941 if the built-in stack extension method is used).
943 Do not make this value too large; the results are undefined if
944 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
945 evaluated with infinite-precision integer arithmetic. */
948 # define YYMAXDEPTH 10000
955 # if defined __GLIBC__ && defined _STRING_H
956 # define yystrlen strlen
958 /* Return the length of YYSTR. */
960 yystrlen (const char *yystr
)
963 for (yylen
= 0; yystr
[yylen
]; yylen
++)
971 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
972 # define yystpcpy stpcpy
974 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
977 yystpcpy (char *yydest
, const char *yysrc
)
980 const char *yys
= yysrc
;
982 while ((*yyd
++ = *yys
++) != '\0')
991 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
992 quotes and backslashes, so that it's suitable for yyerror. The
993 heuristic is that double-quoting is unnecessary unless the string
994 contains an apostrophe, a comma, or backslash (other than
995 backslash-backslash). YYSTR is taken from yytname. If YYRES is
996 null, do not copy; instead, return the length of what the result
999 yytnamerr (char *yyres
, const char *yystr
)
1004 char const *yyp
= yystr
;
1011 goto do_not_strip_quotes
;
1015 goto do_not_strip_quotes
;
1028 do_not_strip_quotes
: ;
1032 return yystrlen (yystr
);
1034 return yystpcpy (yyres
, yystr
) - yyres
;
1038 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1039 about the unexpected token YYTOKEN for the state stack whose top is
1042 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1043 not large enough to hold the message. In that case, also set
1044 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1045 required number of bytes is too large to store. */
1047 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1048 yytype_int16
*yyssp
, int yytoken
)
1050 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1051 YYSIZE_T yysize
= yysize0
;
1052 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1053 /* Internationalized format string. */
1054 const char *yyformat
= YY_NULLPTR
;
1055 /* Arguments of yyformat. */
1056 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1057 /* Number of reported tokens (one for the "unexpected", one per
1061 /* There are many possibilities here to consider:
1062 - If this state is a consistent state with a default action, then
1063 the only way this function was invoked is if the default action
1064 is an error action. In that case, don't check for expected
1065 tokens because there are none.
1066 - The only way there can be no lookahead present (in yychar) is if
1067 this state is a consistent state with a default action. Thus,
1068 detecting the absence of a lookahead is sufficient to determine
1069 that there is no unexpected or expected token to report. In that
1070 case, just report a simple "syntax error".
1071 - Don't assume there isn't a lookahead just because this state is a
1072 consistent state with a default action. There might have been a
1073 previous inconsistent state, consistent state with a non-default
1074 action, or user semantic action that manipulated yychar.
1075 - Of course, the expected token list depends on states to have
1076 correct lookahead information, and it depends on the parser not
1077 to perform extra reductions after fetching a lookahead from the
1078 scanner and before detecting a syntax error. Thus, state merging
1079 (from LALR or IELR) and default reductions corrupt the expected
1080 token list. However, the list is correct for canonical LR with
1081 one exception: it will still contain any token that will not be
1082 accepted due to an error action in a later state.
1084 if (yytoken
!= YYEMPTY
)
1086 int yyn
= yypact
[*yyssp
];
1087 yyarg
[yycount
++] = yytname
[yytoken
];
1088 if (!yypact_value_is_default (yyn
))
1090 /* Start YYX at -YYN if negative to avoid negative indexes in
1091 YYCHECK. In other words, skip the first -YYN actions for
1092 this state because they are default actions. */
1093 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1094 /* Stay within bounds of both yycheck and yytname. */
1095 int yychecklim
= YYLAST
- yyn
+ 1;
1096 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1099 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1100 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1101 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1103 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1109 yyarg
[yycount
++] = yytname
[yyx
];
1111 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1112 if (! (yysize
<= yysize1
1113 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1123 # define YYCASE_(N, S) \
1127 YYCASE_(0, YY_("syntax error"));
1128 YYCASE_(1, YY_("syntax error, unexpected %s"));
1129 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1130 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1131 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1132 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1137 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1138 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1143 if (*yymsg_alloc
< yysize
)
1145 *yymsg_alloc
= 2 * yysize
;
1146 if (! (yysize
<= *yymsg_alloc
1147 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1148 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1152 /* Avoid sprintf, as that infringes on the user's name space.
1153 Don't have undefined behavior even if the translation
1154 produced a string with the wrong number of "%s"s. */
1158 while ((*yyp
= *yyformat
) != '\0')
1159 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1161 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1172 #endif /* YYERROR_VERBOSE */
1174 /*-----------------------------------------------.
1175 | Release the memory associated to this symbol. |
1176 `-----------------------------------------------*/
1179 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1184 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1186 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1188 YY_IGNORE_MAYBE_UNINITIALIZED_END
1194 /* The lookahead symbol. */
1197 /* The semantic value of the lookahead symbol. */
1199 /* Number of syntax errors so far. */
1211 /* Number of tokens to shift before error messages enabled. */
1214 /* The stacks and their tools:
1215 'yyss': related to states.
1216 'yyvs': related to semantic values.
1218 Refer to the stacks through separate pointers, to allow yyoverflow
1219 to reallocate them elsewhere. */
1221 /* The state stack. */
1222 yytype_int16 yyssa
[YYINITDEPTH
];
1224 yytype_int16
*yyssp
;
1226 /* The semantic value stack. */
1227 YYSTYPE yyvsa
[YYINITDEPTH
];
1231 YYSIZE_T yystacksize
;
1235 /* Lookahead token as an internal (translated) token number. */
1237 /* The variables used to return semantic value and location from the
1242 /* Buffer for error messages, and its allocated size. */
1244 char *yymsg
= yymsgbuf
;
1245 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1248 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1250 /* The number of symbols on the RHS of the reduced rule.
1251 Keep to zero when no symbol should be popped. */
1254 yyssp
= yyss
= yyssa
;
1255 yyvsp
= yyvs
= yyvsa
;
1256 yystacksize
= YYINITDEPTH
;
1258 YYDPRINTF ((stderr
, "Starting parse\n"));
1263 yychar
= YYEMPTY
; /* Cause a token to be read. */
1266 /*------------------------------------------------------------.
1267 | yynewstate -- Push a new state, which is found in yystate. |
1268 `------------------------------------------------------------*/
1270 /* In all cases, when you get here, the value and location stacks
1271 have just been pushed. So pushing a state here evens the stacks. */
1277 if (yyss
+ yystacksize
- 1 <= yyssp
)
1279 /* Get the current used size of the three stacks, in elements. */
1280 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1284 /* Give user a chance to reallocate the stack. Use copies of
1285 these so that the &'s don't force the real ones into
1287 YYSTYPE
*yyvs1
= yyvs
;
1288 yytype_int16
*yyss1
= yyss
;
1290 /* Each stack pointer address is followed by the size of the
1291 data in use in that stack, in bytes. This used to be a
1292 conditional around just the two extra args, but that might
1293 be undefined if yyoverflow is a macro. */
1294 yyoverflow (YY_("memory exhausted"),
1295 &yyss1
, yysize
* sizeof (*yyssp
),
1296 &yyvs1
, yysize
* sizeof (*yyvsp
),
1302 #else /* no yyoverflow */
1303 # ifndef YYSTACK_RELOCATE
1304 goto yyexhaustedlab
;
1306 /* Extend the stack our own way. */
1307 if (YYMAXDEPTH
<= yystacksize
)
1308 goto yyexhaustedlab
;
1310 if (YYMAXDEPTH
< yystacksize
)
1311 yystacksize
= YYMAXDEPTH
;
1314 yytype_int16
*yyss1
= yyss
;
1315 union yyalloc
*yyptr
=
1316 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1318 goto yyexhaustedlab
;
1319 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1320 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1321 # undef YYSTACK_RELOCATE
1323 YYSTACK_FREE (yyss1
);
1326 #endif /* no yyoverflow */
1328 yyssp
= yyss
+ yysize
- 1;
1329 yyvsp
= yyvs
+ yysize
- 1;
1331 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1332 (unsigned long int) yystacksize
));
1334 if (yyss
+ yystacksize
- 1 <= yyssp
)
1338 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1340 if (yystate
== YYFINAL
)
1350 /* Do appropriate processing given the current state. Read a
1351 lookahead token if we need one and don't already have one. */
1353 /* First try to decide what to do without reference to lookahead token. */
1354 yyn
= yypact
[yystate
];
1355 if (yypact_value_is_default (yyn
))
1358 /* Not known => get a lookahead token if don't already have one. */
1360 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1361 if (yychar
== YYEMPTY
)
1363 YYDPRINTF ((stderr
, "Reading a token: "));
1367 if (yychar
<= YYEOF
)
1369 yychar
= yytoken
= YYEOF
;
1370 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1374 yytoken
= YYTRANSLATE (yychar
);
1375 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1378 /* If the proper action on seeing token YYTOKEN is to reduce or to
1379 detect an error, take that action. */
1381 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1386 if (yytable_value_is_error (yyn
))
1392 /* Count tokens shifted since error; after three, turn off error
1397 /* Shift the lookahead token. */
1398 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1400 /* Discard the shifted token. */
1404 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1406 YY_IGNORE_MAYBE_UNINITIALIZED_END
1411 /*-----------------------------------------------------------.
1412 | yydefault -- do the default action for the current state. |
1413 `-----------------------------------------------------------*/
1415 yyn
= yydefact
[yystate
];
1421 /*-----------------------------.
1422 | yyreduce -- Do a reduction. |
1423 `-----------------------------*/
1425 /* yyn is the number of a rule to reduce with. */
1428 /* If YYLEN is nonzero, implement the default value of the action:
1431 Otherwise, the following line sets YYVAL to garbage.
1432 This behavior is undocumented and Bison
1433 users should not rely upon it. Assigning to YYVAL
1434 unconditionally makes the parser a bit smaller, and it avoids a
1435 GCC warning that YYVAL may be used uninitialized. */
1436 yyval
= yyvsp
[1-yylen
];
1439 YY_REDUCE_PRINT (yyn
);
1443 #line 157 "nlmheader.y" /* yacc.c:1646 */
1445 check_procedure
= (yyvsp
[0].string
);
1447 #line 1448 "nlmheader.c" /* yacc.c:1646 */
1451 #line 161 "nlmheader.y" /* yacc.c:1646 */
1453 nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
1454 free ((yyvsp
[0].string
));
1456 #line 1457 "nlmheader.c" /* yacc.c:1646 */
1460 #line 166 "nlmheader.y" /* yacc.c:1646 */
1464 strncpy (copyright_hdr
->stamp
, "CoPyRiGhT=", 10);
1465 len
= strlen ((yyvsp
[0].string
));
1466 if (len
>= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
)
1468 nlmheader_warn (_("copyright string is too long"),
1469 NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
- 1);
1470 len
= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH
- 1;
1472 copyright_hdr
->copyrightMessageLength
= len
;
1473 strncpy (copyright_hdr
->copyrightMessage
, (yyvsp
[0].string
), len
);
1474 copyright_hdr
->copyrightMessage
[len
] = '\0';
1475 free ((yyvsp
[0].string
));
1477 #line 1478 "nlmheader.c" /* yacc.c:1646 */
1481 #line 183 "nlmheader.y" /* yacc.c:1646 */
1483 custom_file
= (yyvsp
[0].string
);
1485 #line 1486 "nlmheader.c" /* yacc.c:1646 */
1489 #line 187 "nlmheader.y" /* yacc.c:1646 */
1491 /* We don't set the version stamp here, because we use the
1492 version stamp to detect whether the required VERSION
1493 keyword was given. */
1494 version_hdr
->month
= nlmlex_get_number ((yyvsp
[-2].string
));
1495 version_hdr
->day
= nlmlex_get_number ((yyvsp
[-1].string
));
1496 version_hdr
->year
= nlmlex_get_number ((yyvsp
[0].string
));
1497 free ((yyvsp
[-2].string
));
1498 free ((yyvsp
[-1].string
));
1499 free ((yyvsp
[0].string
));
1500 if (version_hdr
->month
< 1 || version_hdr
->month
> 12)
1501 nlmheader_warn (_("illegal month"), -1);
1502 if (version_hdr
->day
< 1 || version_hdr
->day
> 31)
1503 nlmheader_warn (_("illegal day"), -1);
1504 if (version_hdr
->year
< 1900 || version_hdr
->year
> 3000)
1505 nlmheader_warn (_("illegal year"), -1);
1507 #line 1508 "nlmheader.c" /* yacc.c:1646 */
1511 #line 205 "nlmheader.y" /* yacc.c:1646 */
1515 #line 1516 "nlmheader.c" /* yacc.c:1646 */
1519 #line 209 "nlmheader.y" /* yacc.c:1646 */
1523 len
= strlen ((yyvsp
[0].string
));
1524 if (len
> NLM_MAX_DESCRIPTION_LENGTH
)
1526 nlmheader_warn (_("description string is too long"),
1527 NLM_MAX_DESCRIPTION_LENGTH
);
1528 len
= NLM_MAX_DESCRIPTION_LENGTH
;
1530 var_hdr
->descriptionLength
= len
;
1531 strncpy (var_hdr
->descriptionText
, (yyvsp
[0].string
), len
);
1532 var_hdr
->descriptionText
[len
] = '\0';
1533 free ((yyvsp
[0].string
));
1535 #line 1536 "nlmheader.c" /* yacc.c:1646 */
1539 #line 225 "nlmheader.y" /* yacc.c:1646 */
1541 exit_procedure
= (yyvsp
[0].string
);
1543 #line 1544 "nlmheader.c" /* yacc.c:1646 */
1547 #line 229 "nlmheader.y" /* yacc.c:1646 */
1549 symbol_prefix
= NULL
;
1551 #line 1552 "nlmheader.c" /* yacc.c:1646 */
1555 #line 233 "nlmheader.y" /* yacc.c:1646 */
1557 export_symbols
= string_list_append (export_symbols
, (yyvsp
[0].list
));
1559 #line 1560 "nlmheader.c" /* yacc.c:1646 */
1563 #line 237 "nlmheader.y" /* yacc.c:1646 */
1565 fixed_hdr
->flags
|= nlmlex_get_number ((yyvsp
[0].string
));
1566 free ((yyvsp
[0].string
));
1568 #line 1569 "nlmheader.c" /* yacc.c:1646 */
1572 #line 242 "nlmheader.y" /* yacc.c:1646 */
1574 fixed_hdr
->flags
&=~ nlmlex_get_number ((yyvsp
[0].string
));
1575 free ((yyvsp
[0].string
));
1577 #line 1578 "nlmheader.c" /* yacc.c:1646 */
1581 #line 247 "nlmheader.y" /* yacc.c:1646 */
1586 #line 1587 "nlmheader.c" /* yacc.c:1646 */
1590 #line 252 "nlmheader.y" /* yacc.c:1646 */
1592 map_file
= (yyvsp
[0].string
);
1595 #line 1596 "nlmheader.c" /* yacc.c:1646 */
1599 #line 257 "nlmheader.y" /* yacc.c:1646 */
1601 help_file
= (yyvsp
[0].string
);
1603 #line 1604 "nlmheader.c" /* yacc.c:1646 */
1607 #line 261 "nlmheader.y" /* yacc.c:1646 */
1609 symbol_prefix
= NULL
;
1611 #line 1612 "nlmheader.c" /* yacc.c:1646 */
1615 #line 265 "nlmheader.y" /* yacc.c:1646 */
1617 import_symbols
= string_list_append (import_symbols
, (yyvsp
[0].list
));
1619 #line 1620 "nlmheader.c" /* yacc.c:1646 */
1623 #line 269 "nlmheader.y" /* yacc.c:1646 */
1625 input_files
= string_list_append (input_files
, (yyvsp
[0].list
));
1627 #line 1628 "nlmheader.c" /* yacc.c:1646 */
1631 #line 273 "nlmheader.y" /* yacc.c:1646 */
1635 #line 1636 "nlmheader.c" /* yacc.c:1646 */
1639 #line 277 "nlmheader.y" /* yacc.c:1646 */
1641 map_file
= (yyvsp
[0].string
);
1643 #line 1644 "nlmheader.c" /* yacc.c:1646 */
1647 #line 281 "nlmheader.y" /* yacc.c:1646 */
1649 message_file
= (yyvsp
[0].string
);
1651 #line 1652 "nlmheader.c" /* yacc.c:1646 */
1655 #line 285 "nlmheader.y" /* yacc.c:1646 */
1657 modules
= string_list_append (modules
, (yyvsp
[0].list
));
1659 #line 1660 "nlmheader.c" /* yacc.c:1646 */
1663 #line 289 "nlmheader.y" /* yacc.c:1646 */
1665 fixed_hdr
->flags
|= 0x2;
1667 #line 1668 "nlmheader.c" /* yacc.c:1646 */
1671 #line 293 "nlmheader.y" /* yacc.c:1646 */
1673 fixed_hdr
->flags
|= 0x10;
1675 #line 1676 "nlmheader.c" /* yacc.c:1646 */
1679 #line 297 "nlmheader.y" /* yacc.c:1646 */
1681 if (output_file
== NULL
)
1682 output_file
= (yyvsp
[0].string
);
1684 nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
1686 #line 1687 "nlmheader.c" /* yacc.c:1646 */
1690 #line 304 "nlmheader.y" /* yacc.c:1646 */
1692 fixed_hdr
->flags
|= 0x8;
1694 #line 1695 "nlmheader.c" /* yacc.c:1646 */
1698 #line 308 "nlmheader.y" /* yacc.c:1646 */
1700 fixed_hdr
->flags
|= 0x1;
1702 #line 1703 "nlmheader.c" /* yacc.c:1646 */
1706 #line 312 "nlmheader.y" /* yacc.c:1646 */
1710 len
= strlen ((yyvsp
[0].string
));
1711 if (len
>= NLM_MAX_SCREEN_NAME_LENGTH
)
1713 nlmheader_warn (_("screen name is too long"),
1714 NLM_MAX_SCREEN_NAME_LENGTH
);
1715 len
= NLM_MAX_SCREEN_NAME_LENGTH
;
1717 var_hdr
->screenNameLength
= len
;
1718 strncpy (var_hdr
->screenName
, (yyvsp
[0].string
), len
);
1719 var_hdr
->screenName
[NLM_MAX_SCREEN_NAME_LENGTH
] = '\0';
1720 free ((yyvsp
[0].string
));
1722 #line 1723 "nlmheader.c" /* yacc.c:1646 */
1726 #line 328 "nlmheader.y" /* yacc.c:1646 */
1728 sharelib_file
= (yyvsp
[0].string
);
1730 #line 1731 "nlmheader.c" /* yacc.c:1646 */
1734 #line 332 "nlmheader.y" /* yacc.c:1646 */
1736 var_hdr
->stackSize
= nlmlex_get_number ((yyvsp
[0].string
));
1737 free ((yyvsp
[0].string
));
1739 #line 1740 "nlmheader.c" /* yacc.c:1646 */
1743 #line 337 "nlmheader.y" /* yacc.c:1646 */
1745 start_procedure
= (yyvsp
[0].string
);
1747 #line 1748 "nlmheader.c" /* yacc.c:1646 */
1751 #line 341 "nlmheader.y" /* yacc.c:1646 */
1753 fixed_hdr
->flags
|= 0x4;
1755 #line 1756 "nlmheader.c" /* yacc.c:1646 */
1759 #line 345 "nlmheader.y" /* yacc.c:1646 */
1763 len
= strlen ((yyvsp
[0].string
));
1764 if (len
>= NLM_MAX_THREAD_NAME_LENGTH
)
1766 nlmheader_warn (_("thread name is too long"),
1767 NLM_MAX_THREAD_NAME_LENGTH
);
1768 len
= NLM_MAX_THREAD_NAME_LENGTH
;
1770 var_hdr
->threadNameLength
= len
;
1771 strncpy (var_hdr
->threadName
, (yyvsp
[0].string
), len
);
1772 var_hdr
->threadName
[len
] = '\0';
1773 free ((yyvsp
[0].string
));
1775 #line 1776 "nlmheader.c" /* yacc.c:1646 */
1779 #line 361 "nlmheader.y" /* yacc.c:1646 */
1781 fixed_hdr
->moduleType
= nlmlex_get_number ((yyvsp
[0].string
));
1782 free ((yyvsp
[0].string
));
1784 #line 1785 "nlmheader.c" /* yacc.c:1646 */
1788 #line 366 "nlmheader.y" /* yacc.c:1646 */
1792 #line 1793 "nlmheader.c" /* yacc.c:1646 */
1796 #line 370 "nlmheader.y" /* yacc.c:1646 */
1800 strncpy (version_hdr
->stamp
, "VeRsIoN#", 8);
1801 version_hdr
->majorVersion
= nlmlex_get_number ((yyvsp
[-2].string
));
1802 val
= nlmlex_get_number ((yyvsp
[-1].string
));
1803 if (val
< 0 || val
> 99)
1804 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1807 version_hdr
->minorVersion
= val
;
1808 val
= nlmlex_get_number ((yyvsp
[0].string
));
1810 nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
1813 version_hdr
->revision
= 0;
1815 version_hdr
->revision
= val
;
1816 free ((yyvsp
[-2].string
));
1817 free ((yyvsp
[-1].string
));
1818 free ((yyvsp
[0].string
));
1820 #line 1821 "nlmheader.c" /* yacc.c:1646 */
1824 #line 394 "nlmheader.y" /* yacc.c:1646 */
1828 strncpy (version_hdr
->stamp
, "VeRsIoN#", 8);
1829 version_hdr
->majorVersion
= nlmlex_get_number ((yyvsp
[-1].string
));
1830 val
= nlmlex_get_number ((yyvsp
[0].string
));
1831 if (val
< 0 || val
> 99)
1832 nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1835 version_hdr
->minorVersion
= val
;
1836 version_hdr
->revision
= 0;
1837 free ((yyvsp
[-1].string
));
1838 free ((yyvsp
[0].string
));
1840 #line 1841 "nlmheader.c" /* yacc.c:1646 */
1844 #line 410 "nlmheader.y" /* yacc.c:1646 */
1846 rpc_file
= (yyvsp
[0].string
);
1848 #line 1849 "nlmheader.c" /* yacc.c:1646 */
1852 #line 419 "nlmheader.y" /* yacc.c:1646 */
1854 (yyval
.list
) = NULL
;
1856 #line 1857 "nlmheader.c" /* yacc.c:1646 */
1860 #line 423 "nlmheader.y" /* yacc.c:1646 */
1862 (yyval
.list
) = (yyvsp
[0].list
);
1864 #line 1865 "nlmheader.c" /* yacc.c:1646 */
1868 #line 434 "nlmheader.y" /* yacc.c:1646 */
1870 (yyval
.list
) = string_list_cons ((yyvsp
[0].string
), NULL
);
1872 #line 1873 "nlmheader.c" /* yacc.c:1646 */
1876 #line 438 "nlmheader.y" /* yacc.c:1646 */
1878 (yyval
.list
) = NULL
;
1880 #line 1881 "nlmheader.c" /* yacc.c:1646 */
1884 #line 442 "nlmheader.y" /* yacc.c:1646 */
1886 (yyval
.list
) = string_list_append1 ((yyvsp
[-1].list
), (yyvsp
[0].string
));
1888 #line 1889 "nlmheader.c" /* yacc.c:1646 */
1892 #line 446 "nlmheader.y" /* yacc.c:1646 */
1894 (yyval
.list
) = (yyvsp
[-1].list
);
1896 #line 1897 "nlmheader.c" /* yacc.c:1646 */
1900 #line 455 "nlmheader.y" /* yacc.c:1646 */
1902 if (symbol_prefix
!= NULL
)
1903 free (symbol_prefix
);
1904 symbol_prefix
= (yyvsp
[-1].string
);
1906 #line 1907 "nlmheader.c" /* yacc.c:1646 */
1910 #line 466 "nlmheader.y" /* yacc.c:1646 */
1912 if (symbol_prefix
== NULL
)
1913 (yyval
.string
) = (yyvsp
[0].string
);
1916 (yyval
.string
) = xmalloc (strlen (symbol_prefix
) + strlen ((yyvsp
[0].string
)) + 2);
1917 sprintf ((yyval
.string
), "%s@%s", symbol_prefix
, (yyvsp
[0].string
));
1918 free ((yyvsp
[0].string
));
1921 #line 1922 "nlmheader.c" /* yacc.c:1646 */
1925 #line 482 "nlmheader.y" /* yacc.c:1646 */
1927 (yyval
.list
) = NULL
;
1929 #line 1930 "nlmheader.c" /* yacc.c:1646 */
1933 #line 486 "nlmheader.y" /* yacc.c:1646 */
1935 (yyval
.list
) = string_list_cons ((yyvsp
[-1].string
), (yyvsp
[0].list
));
1937 #line 1938 "nlmheader.c" /* yacc.c:1646 */
1941 #line 1942 "nlmheader.c" /* yacc.c:1646 */
1944 /* User semantic actions sometimes alter yychar, and that requires
1945 that yytoken be updated with the new translation. We take the
1946 approach of translating immediately before every use of yytoken.
1947 One alternative is translating here after every semantic action,
1948 but that translation would be missed if the semantic action invokes
1949 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1950 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1951 incorrect destructor might then be invoked immediately. In the
1952 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1953 to an incorrect destructor call or verbose syntax error message
1954 before the lookahead is translated. */
1955 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1959 YY_STACK_PRINT (yyss
, yyssp
);
1963 /* Now 'shift' the result of the reduction. Determine what state
1964 that goes to, based on the state we popped back to and the rule
1965 number reduced by. */
1969 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1970 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1971 yystate
= yytable
[yystate
];
1973 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1978 /*--------------------------------------.
1979 | yyerrlab -- here on detecting error. |
1980 `--------------------------------------*/
1982 /* Make sure we have latest lookahead translation. See comments at
1983 user semantic actions for why this is necessary. */
1984 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
1986 /* If not already recovering from an error, report this error. */
1990 #if ! YYERROR_VERBOSE
1991 yyerror (YY_("syntax error"));
1993 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1996 char const *yymsgp
= YY_("syntax error");
1997 int yysyntax_error_status
;
1998 yysyntax_error_status
= YYSYNTAX_ERROR
;
1999 if (yysyntax_error_status
== 0)
2001 else if (yysyntax_error_status
== 1)
2003 if (yymsg
!= yymsgbuf
)
2004 YYSTACK_FREE (yymsg
);
2005 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2009 yymsg_alloc
= sizeof yymsgbuf
;
2010 yysyntax_error_status
= 2;
2014 yysyntax_error_status
= YYSYNTAX_ERROR
;
2019 if (yysyntax_error_status
== 2)
2020 goto yyexhaustedlab
;
2022 # undef YYSYNTAX_ERROR
2028 if (yyerrstatus
== 3)
2030 /* If just tried and failed to reuse lookahead token after an
2031 error, discard it. */
2033 if (yychar
<= YYEOF
)
2035 /* Return failure if at end of input. */
2036 if (yychar
== YYEOF
)
2041 yydestruct ("Error: discarding",
2047 /* Else will try to reuse lookahead token after shifting the error
2052 /*---------------------------------------------------.
2053 | yyerrorlab -- error raised explicitly by YYERROR. |
2054 `---------------------------------------------------*/
2057 /* Pacify compilers like GCC when the user code never invokes
2058 YYERROR and the label yyerrorlab therefore never appears in user
2060 if (/*CONSTCOND*/ 0)
2063 /* Do not reclaim the symbols of the rule whose action triggered
2067 YY_STACK_PRINT (yyss
, yyssp
);
2072 /*-------------------------------------------------------------.
2073 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2074 `-------------------------------------------------------------*/
2076 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2080 yyn
= yypact
[yystate
];
2081 if (!yypact_value_is_default (yyn
))
2084 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2092 /* Pop the current state because it cannot handle the error token. */
2097 yydestruct ("Error: popping",
2098 yystos
[yystate
], yyvsp
);
2101 YY_STACK_PRINT (yyss
, yyssp
);
2104 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2106 YY_IGNORE_MAYBE_UNINITIALIZED_END
2109 /* Shift the error token. */
2110 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2116 /*-------------------------------------.
2117 | yyacceptlab -- YYACCEPT comes here. |
2118 `-------------------------------------*/
2123 /*-----------------------------------.
2124 | yyabortlab -- YYABORT comes here. |
2125 `-----------------------------------*/
2130 #if !defined yyoverflow || YYERROR_VERBOSE
2131 /*-------------------------------------------------.
2132 | yyexhaustedlab -- memory exhaustion comes here. |
2133 `-------------------------------------------------*/
2135 yyerror (YY_("memory exhausted"));
2141 if (yychar
!= YYEMPTY
)
2143 /* Make sure we have latest lookahead translation. See comments at
2144 user semantic actions for why this is necessary. */
2145 yytoken
= YYTRANSLATE (yychar
);
2146 yydestruct ("Cleanup: discarding lookahead",
2149 /* Do not reclaim the symbols of the rule whose action triggered
2150 this YYABORT or YYACCEPT. */
2152 YY_STACK_PRINT (yyss
, yyssp
);
2153 while (yyssp
!= yyss
)
2155 yydestruct ("Cleanup: popping",
2156 yystos
[*yyssp
], yyvsp
);
2161 YYSTACK_FREE (yyss
);
2164 if (yymsg
!= yymsgbuf
)
2165 YYSTACK_FREE (yymsg
);
2169 #line 491 "nlmheader.y" /* yacc.c:1906 */
2172 /* If strerror is just a macro, we want to use the one from libiberty
2173 since it will handle undefined values. */
2175 extern char *strerror (int);
2177 /* The lexer is simple, too simple for flex. Keywords are only
2178 recognized at the start of lines. Everything else must be an
2179 argument. A comma is treated as whitespace. */
2181 /* The states the lexer can be in. */
2185 /* At the beginning of a line. */
2187 /* In the middle of a line. */
2191 /* We need to keep a stack of files to handle file inclusion. */
2195 /* The file to read from. */
2197 /* The name of the file. */
2199 /* The current line number. */
2201 /* The current state. */
2202 enum lex_state state
;
2203 /* The next file on the stack. */
2207 /* The current input file. */
2209 static struct input current
;
2211 /* The character which introduces comments. */
2212 #define COMMENT_CHAR '#'
2214 /* Start the lexer going on the main input file. */
2217 nlmlex_file (const char *name
)
2219 current
.next
= NULL
;
2220 return nlmlex_file_open (name
);
2223 /* Start the lexer going on a subsidiary input file. */
2226 nlmlex_file_push (const char *name
)
2230 push
= (struct input
*) xmalloc (sizeof (struct input
));
2232 if (nlmlex_file_open (name
))
2233 current
.next
= push
;
2241 /* Start lexing from a file. */
2244 nlmlex_file_open (const char *name
)
2246 current
.file
= fopen (name
, "r");
2247 if (current
.file
== NULL
)
2249 fprintf (stderr
, "%s:%s: %s\n", program_name
, name
, strerror (errno
));
2253 current
.name
= xstrdup (name
);
2255 current
.state
= BEGINNING_OF_LINE
;
2259 /* Table used to turn keywords into tokens. */
2261 struct keyword_tokens_struct
2263 const char *keyword
;
2267 static struct keyword_tokens_struct keyword_tokens
[] =
2270 { "CODESTART", CODESTART
},
2271 { "COPYRIGHT", COPYRIGHT
},
2272 { "CUSTOM", CUSTOM
},
2274 { "DEBUG", DEBUG_K
},
2275 { "DESCRIPTION", DESCRIPTION
},
2277 { "EXPORT", EXPORT
},
2278 { "FLAG_ON", FLAG_ON
},
2279 { "FLAG_OFF", FLAG_OFF
},
2280 { "FULLMAP", FULLMAP
},
2282 { "IMPORT", IMPORT
},
2285 { "MESSAGES", MESSAGES
},
2286 { "MODULE", MODULE
},
2287 { "MULTIPLE", MULTIPLE
},
2288 { "OS_DOMAIN", OS_DOMAIN
},
2289 { "OUTPUT", OUTPUT
},
2290 { "PSEUDOPREEMPTION", PSEUDOPREEMPTION
},
2291 { "REENTRANT", REENTRANT
},
2292 { "SCREENNAME", SCREENNAME
},
2293 { "SHARELIB", SHARELIB
},
2295 { "STACKSIZE", STACK
},
2297 { "SYNCHRONIZE", SYNCHRONIZE
},
2298 { "THREADNAME", THREADNAME
},
2300 { "VERBOSE", VERBOSE
},
2301 { "VERSION", VERSIONK
},
2302 { "XDCDATA", XDCDATA
}
2305 #define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
2307 /* The lexer accumulates strings in these variables. */
2308 static char *lex_buf
;
2309 static int lex_size
;
2312 /* Start accumulating strings into the buffer. */
2313 #define BUF_INIT() \
2314 ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
2317 nlmlex_buf_init (void)
2320 lex_buf
= xmalloc (lex_size
+ 1);
2325 /* Finish a string in the buffer. */
2326 #define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
2328 /* Accumulate a character into the buffer. */
2329 #define BUF_ADD(c) \
2330 ((void) (lex_pos < lex_size \
2331 ? lex_buf[lex_pos++] = (c) \
2332 : nlmlex_buf_add (c)))
2335 nlmlex_buf_add (int c
)
2337 if (lex_pos
>= lex_size
)
2340 lex_buf
= xrealloc (lex_buf
, lex_size
+ 1);
2343 return lex_buf
[lex_pos
++] = c
;
2346 /* The lexer proper. This is called by the bison generated parsing
2356 c
= getc (current
.file
);
2358 /* Commas are treated as whitespace characters. */
2359 while (ISSPACE (c
) || c
== ',')
2361 current
.state
= IN_LINE
;
2365 current
.state
= BEGINNING_OF_LINE
;
2367 c
= getc (current
.file
);
2370 /* At the end of the file we either pop to the previous file or
2374 fclose (current
.file
);
2375 free (current
.name
);
2376 if (current
.next
== NULL
)
2382 next
= current
.next
;
2389 /* A comment character always means to drop everything until the
2391 if (c
== COMMENT_CHAR
)
2395 c
= getc (current
.file
);
2399 current
.state
= BEGINNING_OF_LINE
;
2403 /* An '@' introduces an include file. */
2408 c
= getc (current
.file
);
2412 while (ISSPACE (c
));
2414 while (! ISSPACE (c
) && c
!= EOF
)
2417 c
= getc (current
.file
);
2421 ungetc (c
, current
.file
);
2423 nlmlex_file_push (lex_buf
);
2427 /* A non-space character at the start of a line must be the start of
2429 if (current
.state
== BEGINNING_OF_LINE
)
2432 while (ISALNUM (c
) || c
== '_')
2434 BUF_ADD (TOUPPER (c
));
2435 c
= getc (current
.file
);
2439 if (c
!= EOF
&& ! ISSPACE (c
) && c
!= ',')
2441 nlmheader_identify ();
2442 fprintf (stderr
, _("%s:%d: illegal character in keyword: %c\n"),
2443 current
.name
, current
.lineno
, c
);
2449 for (i
= 0; i
< KEYWORD_COUNT
; i
++)
2451 if (lex_buf
[0] == keyword_tokens
[i
].keyword
[0]
2452 && strcmp (lex_buf
, keyword_tokens
[i
].keyword
) == 0)
2454 /* Pushing back the final whitespace avoids worrying
2456 ungetc (c
, current
.file
);
2457 current
.state
= IN_LINE
;
2458 return keyword_tokens
[i
].token
;
2462 nlmheader_identify ();
2463 fprintf (stderr
, _("%s:%d: unrecognized keyword: %s\n"),
2464 current
.name
, current
.lineno
, lex_buf
);
2468 /* Treat the rest of this line as a comment. */
2469 ungetc (COMMENT_CHAR
, current
.file
);
2473 /* Parentheses just represent themselves. */
2474 if (c
== '(' || c
== ')')
2477 /* Handle quoted strings. */
2478 if (c
== '"' || c
== '\'')
2484 start_lineno
= current
.lineno
;
2486 c
= getc (current
.file
);
2488 while (c
!= quote
&& c
!= EOF
)
2493 c
= getc (current
.file
);
2499 nlmheader_identify ();
2500 fprintf (stderr
, _("%s:%d: end of file in quoted string\n"),
2501 current
.name
, start_lineno
);
2505 /* FIXME: Possible memory leak. */
2506 yylval
.string
= xstrdup (lex_buf
);
2507 return QUOTED_STRING
;
2510 /* Gather a generic argument. */
2512 while (! ISSPACE (c
)
2514 && c
!= COMMENT_CHAR
2519 c
= getc (current
.file
);
2523 ungetc (c
, current
.file
);
2525 /* FIXME: Possible memory leak. */
2526 yylval
.string
= xstrdup (lex_buf
);
2530 /* Get a number from a string. */
2533 nlmlex_get_number (const char *s
)
2538 ret
= strtol (s
, &send
, 10);
2540 nlmheader_warn (_("bad number"), -1);
2544 /* Prefix the nlmconv warnings with a note as to where they come from.
2545 We don't use program_name on every warning, because then some
2546 versions of the emacs next-error function can't recognize the line
2550 nlmheader_identify (void)
2556 fprintf (stderr
, _("%s: problems in NLM command language input:\n"),
2562 /* Issue a warning. */
2565 nlmheader_warn (const char *s
, int imax
)
2567 nlmheader_identify ();
2568 fprintf (stderr
, "%s:%d: %s", current
.name
, current
.lineno
, s
);
2570 fprintf (stderr
, " (max %d)", imax
);
2571 fprintf (stderr
, "\n");
2574 /* Report an error. */
2577 nlmheader_error (const char *s
)
2579 nlmheader_warn (s
, -1);
2583 /* Add a string to a string list. */
2585 static struct string_list
*
2586 string_list_cons (char *s
, struct string_list
*l
)
2588 struct string_list
*ret
;
2590 ret
= (struct string_list
*) xmalloc (sizeof (struct string_list
));
2596 /* Append a string list to another string list. */
2598 static struct string_list
*
2599 string_list_append (struct string_list
*l1
, struct string_list
*l2
)
2601 register struct string_list
**pp
;
2603 for (pp
= &l1
; *pp
!= NULL
; pp
= &(*pp
)->next
)
2609 /* Append a string to a string list. */
2611 static struct string_list
*
2612 string_list_append1 (struct string_list
*l
, char *s
)
2614 struct string_list
*n
;
2615 register struct string_list
**pp
;
2617 n
= (struct string_list
*) xmalloc (sizeof (struct string_list
));
2620 for (pp
= &l
; *pp
!= NULL
; pp
= &(*pp
)->next
)
2626 /* Duplicate a string in memory. */
2629 xstrdup (const char *s
)
2635 ret
= xmalloc (len
+ 1);