1 /* A Bison parser, made by GNU Bison 2.3.  */
2 
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7 
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2, or (at your option)
11    any later version.
12 
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.
17 
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.  */
22 
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.
32 
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35 
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38 
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.  */
45 
46 /* Identify Bison output.  */
47 #define YYBISON 1
48 
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51 
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54 
55 /* Pure parsers.  */
56 #define YYPURE 0
57 
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60 
61 
62 
63 /* Tokens.  */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66    /* Put the tokens into the symbol table, so that GDB and other debuggers
67       know about them.  */
68    enum yytokentype {
69      CHECK = 258,
70      CODESTART = 259,
71      COPYRIGHT = 260,
72      CUSTOM = 261,
73      DATE = 262,
74      DEBUG_K = 263,
75      DESCRIPTION = 264,
76      EXIT = 265,
77      EXPORT = 266,
78      FLAG_ON = 267,
79      FLAG_OFF = 268,
80      FULLMAP = 269,
81      HELP = 270,
82      IMPORT = 271,
83      INPUT = 272,
84      MAP = 273,
85      MESSAGES = 274,
86      MODULE = 275,
87      MULTIPLE = 276,
88      OS_DOMAIN = 277,
89      OUTPUT = 278,
90      PSEUDOPREEMPTION = 279,
91      REENTRANT = 280,
92      SCREENNAME = 281,
93      SHARELIB = 282,
94      STACK = 283,
95      START = 284,
96      SYNCHRONIZE = 285,
97      THREADNAME = 286,
98      TYPE = 287,
99      VERBOSE = 288,
100      VERSIONK = 289,
101      XDCDATA = 290,
102      STRING = 291,
103      QUOTED_STRING = 292
104    };
105 #endif
106 /* Tokens.  */
107 #define CHECK 258
108 #define CODESTART 259
109 #define COPYRIGHT 260
110 #define CUSTOM 261
111 #define DATE 262
112 #define DEBUG_K 263
113 #define DESCRIPTION 264
114 #define EXIT 265
115 #define EXPORT 266
116 #define FLAG_ON 267
117 #define FLAG_OFF 268
118 #define FULLMAP 269
119 #define HELP 270
120 #define IMPORT 271
121 #define INPUT 272
122 #define MAP 273
123 #define MESSAGES 274
124 #define MODULE 275
125 #define MULTIPLE 276
126 #define OS_DOMAIN 277
127 #define OUTPUT 278
128 #define PSEUDOPREEMPTION 279
129 #define REENTRANT 280
130 #define SCREENNAME 281
131 #define SHARELIB 282
132 #define STACK 283
133 #define START 284
134 #define SYNCHRONIZE 285
135 #define THREADNAME 286
136 #define TYPE 287
137 #define VERBOSE 288
138 #define VERSIONK 289
139 #define XDCDATA 290
140 #define STRING 291
141 #define QUOTED_STRING 292
142 
143 
144 
145 
146 /* Copy the first part of user declarations.  */
147 #line 1 "nlmheader.y"
148 /* nlmheader.y - parse NLM header specification keywords.
149      Copyright (C) 1993-2016 Free Software Foundation, Inc.
150 
151      This file is part of GNU Binutils.
152 
153      This program is free software; you can redistribute it and/or modify
154      it under the terms of the GNU General Public License as published by
155      the Free Software Foundation; either version 3 of the License, or
156      (at your option) any later version.
157 
158      This program is distributed in the hope that it will be useful,
159      but WITHOUT ANY WARRANTY; without even the implied warranty of
160      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
161      GNU General Public License for more details.
162 
163      You should have received a copy of the GNU General Public License
164      along with this program; if not, write to the Free Software
165      Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
166      MA 02110-1301, USA.  */
167 
168 /* Written by Ian Lance Taylor <ian@cygnus.com>.
169 
170    This bison file parses the commands recognized by the NetWare NLM
171    linker, except for lists of object files.  It stores the
172    information in global variables.
173 
174    This implementation is based on the description in the NetWare Tool
175    Maker Specification manual, edition 1.0.  */
176 
177 #include "sysdep.h"
178 #include "safe-ctype.h"
179 #include "bfd.h"
180 #include "nlm/common.h"
181 #include "nlm/internal.h"
182 #include "bucomm.h"
183 #include "nlmconv.h"
184 
185 /* Information is stored in the structures pointed to by these
186    variables.  */
187 
188 Nlm_Internal_Fixed_Header *fixed_hdr;
189 Nlm_Internal_Variable_Header *var_hdr;
190 Nlm_Internal_Version_Header *version_hdr;
191 Nlm_Internal_Copyright_Header *copyright_hdr;
192 Nlm_Internal_Extended_Header *extended_hdr;
193 
194 /* Procedure named by CHECK.  */
195 char *check_procedure;
196 /* File named by CUSTOM.  */
197 char *custom_file;
198 /* Whether to generate debugging information (DEBUG).  */
199 bfd_boolean debug_info;
200 /* Procedure named by EXIT.  */
201 char *exit_procedure;
202 /* Exported symbols (EXPORT).  */
203 struct string_list *export_symbols;
204 /* List of files from INPUT.  */
205 struct string_list *input_files;
206 /* Map file name (MAP, FULLMAP).  */
207 char *map_file;
208 /* Whether a full map has been requested (FULLMAP).  */
209 bfd_boolean full_map;
210 /* File named by HELP.  */
211 char *help_file;
212 /* Imported symbols (IMPORT).  */
213 struct string_list *import_symbols;
214 /* File named by MESSAGES.  */
215 char *message_file;
216 /* Autoload module list (MODULE).  */
217 struct string_list *modules;
218 /* File named by OUTPUT.  */
219 char *output_file;
220 /* File named by SHARELIB.  */
221 char *sharelib_file;
222 /* Start procedure name (START).  */
223 char *start_procedure;
224 /* VERBOSE.  */
225 bfd_boolean verbose;
226 /* RPC description file (XDCDATA).  */
227 char *rpc_file;
228 
229 /* The number of serious errors that have occurred.  */
230 int parse_errors;
231 
232 /* The current symbol prefix when reading a list of import or export
233    symbols.  */
234 static char *symbol_prefix;
235 
236 /* Parser error message handler.  */
237 #define yyerror(msg) nlmheader_error (msg);
238 
239 /* Local functions.  */
240 static int yylex (void);
241 static void nlmlex_file_push (const char *);
242 static bfd_boolean nlmlex_file_open (const char *);
243 static int nlmlex_buf_init (void);
244 static char nlmlex_buf_add (int);
245 static long nlmlex_get_number (const char *);
246 static void nlmheader_identify (void);
247 static void nlmheader_warn (const char *, int);
248 static void nlmheader_error (const char *);
249 static struct string_list * string_list_cons (char *, struct string_list *);
250 static struct string_list * string_list_append (struct string_list *,
251 						struct string_list *);
252 static struct string_list * string_list_append1 (struct string_list *,
253 						 char *);
254 static char *xstrdup (const char *);
255 
256 
257 
258 /* Enabling traces.  */
259 #ifndef YYDEBUG
260 # define YYDEBUG 0
261 #endif
262 
263 /* Enabling verbose error messages.  */
264 #ifdef YYERROR_VERBOSE
265 # undef YYERROR_VERBOSE
266 # define YYERROR_VERBOSE 1
267 #else
268 # define YYERROR_VERBOSE 0
269 #endif
270 
271 /* Enabling the token table.  */
272 #ifndef YYTOKEN_TABLE
273 # define YYTOKEN_TABLE 0
274 #endif
275 
276 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
277 typedef union YYSTYPE
278 #line 112 "nlmheader.y"
279 {
280   char *string;
281   struct string_list *list;
282 }
283 /* Line 193 of yacc.c.  */
284 #line 285 "nlmheader.c"
285 	YYSTYPE;
286 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
287 # define YYSTYPE_IS_DECLARED 1
288 # define YYSTYPE_IS_TRIVIAL 1
289 #endif
290 
291 
292 
293 /* Copy the second part of user declarations.  */
294 
295 
296 /* Line 216 of yacc.c.  */
297 #line 298 "nlmheader.c"
298 
299 #ifdef short
300 # undef short
301 #endif
302 
303 #ifdef YYTYPE_UINT8
304 typedef YYTYPE_UINT8 yytype_uint8;
305 #else
306 typedef unsigned char yytype_uint8;
307 #endif
308 
309 #ifdef YYTYPE_INT8
310 typedef YYTYPE_INT8 yytype_int8;
311 #elif (defined __STDC__ || defined __C99__FUNC__ \
312      || defined __cplusplus || defined _MSC_VER)
313 typedef signed char yytype_int8;
314 #else
315 typedef short int yytype_int8;
316 #endif
317 
318 #ifdef YYTYPE_UINT16
319 typedef YYTYPE_UINT16 yytype_uint16;
320 #else
321 typedef unsigned short int yytype_uint16;
322 #endif
323 
324 #ifdef YYTYPE_INT16
325 typedef YYTYPE_INT16 yytype_int16;
326 #else
327 typedef short int yytype_int16;
328 #endif
329 
330 #ifndef YYSIZE_T
331 # ifdef __SIZE_TYPE__
332 #  define YYSIZE_T __SIZE_TYPE__
333 # elif defined size_t
334 #  define YYSIZE_T size_t
335 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
336      || defined __cplusplus || defined _MSC_VER)
337 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
338 #  define YYSIZE_T size_t
339 # else
340 #  define YYSIZE_T unsigned int
341 # endif
342 #endif
343 
344 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
345 
346 #ifndef YY_
347 # if defined YYENABLE_NLS && YYENABLE_NLS
348 #  if ENABLE_NLS
349 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
350 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
351 #  endif
352 # endif
353 # ifndef YY_
354 #  define YY_(msgid) msgid
355 # endif
356 #endif
357 
358 /* Suppress unused-variable warnings by "using" E.  */
359 #if ! defined lint || defined __GNUC__
360 # define YYUSE(e) ((void) (e))
361 #else
362 # define YYUSE(e) /* empty */
363 #endif
364 
365 /* Identity function, used to suppress warnings about constant conditions.  */
366 #ifndef lint
367 # define YYID(n) (n)
368 #else
369 #if (defined __STDC__ || defined __C99__FUNC__ \
370      || defined __cplusplus || defined _MSC_VER)
371 static int
YYID(int i)372 YYID (int i)
373 #else
374 static int
375 YYID (i)
376     int i;
377 #endif
378 {
379   return i;
380 }
381 #endif
382 
383 #if ! defined yyoverflow || YYERROR_VERBOSE
384 
385 /* The parser invokes alloca or malloc; define the necessary symbols.  */
386 
387 # ifdef YYSTACK_USE_ALLOCA
388 #  if YYSTACK_USE_ALLOCA
389 #   ifdef __GNUC__
390 #    define YYSTACK_ALLOC __builtin_alloca
391 #   elif defined __BUILTIN_VA_ARG_INCR
392 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
393 #   elif defined _AIX
394 #    define YYSTACK_ALLOC __alloca
395 #   elif defined _MSC_VER
396 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
397 #    define alloca _alloca
398 #   else
399 #    define YYSTACK_ALLOC alloca
400 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
401      || defined __cplusplus || defined _MSC_VER)
402 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
403 #     ifndef _STDLIB_H
404 #      define _STDLIB_H 1
405 #     endif
406 #    endif
407 #   endif
408 #  endif
409 # endif
410 
411 # ifdef YYSTACK_ALLOC
412    /* Pacify GCC's `empty if-body' warning.  */
413 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
414 #  ifndef YYSTACK_ALLOC_MAXIMUM
415     /* The OS might guarantee only one guard page at the bottom of the stack,
416        and a page size can be as small as 4096 bytes.  So we cannot safely
417        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
418        to allow for a few compiler-allocated temporary stack slots.  */
419 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
420 #  endif
421 # else
422 #  define YYSTACK_ALLOC YYMALLOC
423 #  define YYSTACK_FREE YYFREE
424 #  ifndef YYSTACK_ALLOC_MAXIMUM
425 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
426 #  endif
427 #  if (defined __cplusplus && ! defined _STDLIB_H \
428        && ! ((defined YYMALLOC || defined malloc) \
429 	     && (defined YYFREE || defined free)))
430 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
431 #   ifndef _STDLIB_H
432 #    define _STDLIB_H 1
433 #   endif
434 #  endif
435 #  ifndef YYMALLOC
436 #   define YYMALLOC malloc
437 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
438      || defined __cplusplus || defined _MSC_VER)
439 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
440 #   endif
441 #  endif
442 #  ifndef YYFREE
443 #   define YYFREE free
444 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
445      || defined __cplusplus || defined _MSC_VER)
446 void free (void *); /* INFRINGES ON USER NAME SPACE */
447 #   endif
448 #  endif
449 # endif
450 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
451 
452 
453 #if (! defined yyoverflow \
454      && (! defined __cplusplus \
455 	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
456 
457 /* A type that is properly aligned for any stack member.  */
458 union yyalloc
459 {
460   yytype_int16 yyss;
461   YYSTYPE yyvs;
462   };
463 
464 /* The size of the maximum gap between one aligned stack and the next.  */
465 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
466 
467 /* The size of an array large to enough to hold all stacks, each with
468    N elements.  */
469 # define YYSTACK_BYTES(N) \
470      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
471       + YYSTACK_GAP_MAXIMUM)
472 
473 /* Copy COUNT objects from FROM to TO.  The source and destination do
474    not overlap.  */
475 # ifndef YYCOPY
476 #  if defined __GNUC__ && 1 < __GNUC__
477 #   define YYCOPY(To, From, Count) \
478       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
479 #  else
480 #   define YYCOPY(To, From, Count)		\
481       do					\
482 	{					\
483 	  YYSIZE_T yyi;				\
484 	  for (yyi = 0; yyi < (Count); yyi++)	\
485 	    (To)[yyi] = (From)[yyi];		\
486 	}					\
487       while (YYID (0))
488 #  endif
489 # endif
490 
491 /* Relocate STACK from its old location to the new one.  The
492    local variables YYSIZE and YYSTACKSIZE give the old and new number of
493    elements in the stack, and YYPTR gives the new location of the
494    stack.  Advance YYPTR to a properly aligned location for the next
495    stack.  */
496 # define YYSTACK_RELOCATE(Stack)					\
497     do									\
498       {									\
499 	YYSIZE_T yynewbytes;						\
500 	YYCOPY (&yyptr->Stack, Stack, yysize);				\
501 	Stack = &yyptr->Stack;						\
502 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
503 	yyptr += yynewbytes / sizeof (*yyptr);				\
504       }									\
505     while (YYID (0))
506 
507 #endif
508 
509 /* YYFINAL -- State number of the termination state.  */
510 #define YYFINAL  64
511 /* YYLAST -- Last index in YYTABLE.  */
512 #define YYLAST   73
513 
514 /* YYNTOKENS -- Number of terminals.  */
515 #define YYNTOKENS  40
516 /* YYNNTS -- Number of nonterminals.  */
517 #define YYNNTS  11
518 /* YYNRULES -- Number of rules.  */
519 #define YYNRULES  52
520 /* YYNRULES -- Number of states.  */
521 #define YYNSTATES  82
522 
523 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
524 #define YYUNDEFTOK  2
525 #define YYMAXUTOK   292
526 
527 #define YYTRANSLATE(YYX)						\
528   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
529 
530 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
531 static const yytype_uint8 yytranslate[] =
532 {
533        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
534        2,     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       38,    39,     2,     2,     2,     2,     2,     2,     2,     2,
538        2,     2,     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,     1,     2,     3,     4,
559        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
560       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
561       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
562       35,    36,    37
563 };
564 
565 #if YYDEBUG
566 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
567    YYRHS.  */
568 static const yytype_uint8 yyprhs[] =
569 {
570        0,     0,     3,     5,     6,     9,    12,    15,    18,    21,
571       26,    28,    31,    34,    35,    39,    42,    45,    47,    50,
572       53,    54,    58,    61,    63,    66,    69,    72,    74,    76,
573       79,    81,    83,    86,    89,    92,    95,    97,   100,   103,
574      105,   110,   114,   117,   118,   120,   122,   124,   127,   130,
575      134,   136,   137
576 };
577 
578 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
579 static const yytype_int8 yyrhs[] =
580 {
581       41,     0,    -1,    42,    -1,    -1,    43,    42,    -1,     3,
582       36,    -1,     4,    36,    -1,     5,    37,    -1,     6,    36,
583       -1,     7,    36,    36,    36,    -1,     8,    -1,     9,    37,
584       -1,    10,    36,    -1,    -1,    11,    44,    46,    -1,    12,
585       36,    -1,    13,    36,    -1,    14,    -1,    14,    36,    -1,
586       15,    36,    -1,    -1,    16,    45,    46,    -1,    17,    50,
587       -1,    18,    -1,    18,    36,    -1,    19,    36,    -1,    20,
588       50,    -1,    21,    -1,    22,    -1,    23,    36,    -1,    24,
589       -1,    25,    -1,    26,    37,    -1,    27,    36,    -1,    28,
590       36,    -1,    29,    36,    -1,    30,    -1,    31,    37,    -1,
591       32,    36,    -1,    33,    -1,    34,    36,    36,    36,    -1,
592       34,    36,    36,    -1,    35,    36,    -1,    -1,    47,    -1,
593       49,    -1,    48,    -1,    47,    49,    -1,    47,    48,    -1,
594       38,    36,    39,    -1,    36,    -1,    -1,    36,    50,    -1
595 };
596 
597 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
598 static const yytype_uint16 yyrline[] =
599 {
600        0,   143,   143,   148,   150,   156,   160,   165,   182,   186,
601      204,   208,   224,   229,   228,   236,   241,   246,   251,   256,
602      261,   260,   268,   272,   276,   280,   284,   288,   292,   296,
603      303,   307,   311,   327,   331,   336,   340,   344,   360,   365,
604      369,   393,   409,   419,   422,   433,   437,   441,   445,   454,
605      465,   482,   485
606 };
607 #endif
608 
609 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
610 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
611    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
612 static const char *const yytname[] =
613 {
614   "$end", "error", "$undefined", "CHECK", "CODESTART", "COPYRIGHT",
615   "CUSTOM", "DATE", "DEBUG_K", "DESCRIPTION", "EXIT", "EXPORT", "FLAG_ON",
616   "FLAG_OFF", "FULLMAP", "HELP", "IMPORT", "INPUT", "MAP", "MESSAGES",
617   "MODULE", "MULTIPLE", "OS_DOMAIN", "OUTPUT", "PSEUDOPREEMPTION",
618   "REENTRANT", "SCREENNAME", "SHARELIB", "STACK", "START", "SYNCHRONIZE",
619   "THREADNAME", "TYPE", "VERBOSE", "VERSIONK", "XDCDATA", "STRING",
620   "QUOTED_STRING", "'('", "')'", "$accept", "file", "commands", "command",
621   "@1", "@2", "symbol_list_opt", "symbol_list", "symbol_prefix", "symbol",
622   "string_list", 0
623 };
624 #endif
625 
626 # ifdef YYPRINT
627 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
628    token YYLEX-NUM.  */
629 static const yytype_uint16 yytoknum[] =
630 {
631        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
632      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
633      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
634      285,   286,   287,   288,   289,   290,   291,   292,    40,    41
635 };
636 # endif
637 
638 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
639 static const yytype_uint8 yyr1[] =
640 {
641        0,    40,    41,    42,    42,    43,    43,    43,    43,    43,
642       43,    43,    43,    44,    43,    43,    43,    43,    43,    43,
643       45,    43,    43,    43,    43,    43,    43,    43,    43,    43,
644       43,    43,    43,    43,    43,    43,    43,    43,    43,    43,
645       43,    43,    43,    46,    46,    47,    47,    47,    47,    48,
646       49,    50,    50
647 };
648 
649 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
650 static const yytype_uint8 yyr2[] =
651 {
652        0,     2,     1,     0,     2,     2,     2,     2,     2,     4,
653        1,     2,     2,     0,     3,     2,     2,     1,     2,     2,
654        0,     3,     2,     1,     2,     2,     2,     1,     1,     2,
655        1,     1,     2,     2,     2,     2,     1,     2,     2,     1,
656        4,     3,     2,     0,     1,     1,     1,     2,     2,     3,
657        1,     0,     2
658 };
659 
660 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
661    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
662    means the default is an error.  */
663 static const yytype_uint8 yydefact[] =
664 {
665        3,     0,     0,     0,     0,     0,    10,     0,     0,    13,
666        0,     0,    17,     0,    20,    51,    23,     0,    51,    27,
667       28,     0,    30,    31,     0,     0,     0,     0,    36,     0,
668        0,    39,     0,     0,     0,     2,     3,     5,     6,     7,
669        8,     0,    11,    12,    43,    15,    16,    18,    19,    43,
670       51,    22,    24,    25,    26,    29,    32,    33,    34,    35,
671       37,    38,     0,    42,     1,     4,     0,    50,     0,    14,
672       44,    46,    45,    21,    52,    41,     9,     0,    48,    47,
673       40,    49
674 };
675 
676 /* YYDEFGOTO[NTERM-NUM].  */
677 static const yytype_int8 yydefgoto[] =
678 {
679       -1,    34,    35,    36,    44,    49,    69,    70,    71,    72,
680       51
681 };
682 
683 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
684    STATE-NUM.  */
685 #define YYPACT_NINF -20
686 static const yytype_int8 yypact[] =
687 {
688       -3,    -1,     1,     2,     4,     5,   -20,     6,     8,   -20,
689        9,    10,    11,    12,   -20,    13,    14,    16,    13,   -20,
690      -20,    17,   -20,   -20,    18,    20,    21,    22,   -20,    23,
691       25,   -20,    26,    27,    38,   -20,    -3,   -20,   -20,   -20,
692      -20,    28,   -20,   -20,    -2,   -20,   -20,   -20,   -20,    -2,
693       13,   -20,   -20,   -20,   -20,   -20,   -20,   -20,   -20,   -20,
694      -20,   -20,    30,   -20,   -20,   -20,    31,   -20,    32,   -20,
695       -2,   -20,   -20,   -20,   -20,    33,   -20,     3,   -20,   -20,
696      -20,   -20
697 };
698 
699 /* YYPGOTO[NTERM-NUM].  */
700 static const yytype_int8 yypgoto[] =
701 {
702      -20,   -20,    34,   -20,   -20,   -20,    24,   -20,   -19,   -16,
703       15
704 };
705 
706 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
707    positive, shift that token.  If negative, reduce the rule which
708    number is the opposite.  If zero, do what YYDEFACT says.
709    If YYTABLE_NINF, syntax error.  */
710 #define YYTABLE_NINF -1
711 static const yytype_uint8 yytable[] =
712 {
713        1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
714       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
715       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
716       31,    32,    33,    54,    67,    37,    68,    38,    64,    39,
717       40,    41,    81,    42,    43,    45,    46,    47,    48,    50,
718       52,    78,    53,    55,    79,    56,    57,    58,    59,     0,
719       60,    61,    62,    63,    66,    74,    75,    76,    77,    80,
720       65,     0,     0,    73
721 };
722 
723 static const yytype_int8 yycheck[] =
724 {
725        3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
726       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
727       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
728       33,    34,    35,    18,    36,    36,    38,    36,     0,    37,
729       36,    36,    39,    37,    36,    36,    36,    36,    36,    36,
730       36,    70,    36,    36,    70,    37,    36,    36,    36,    -1,
731       37,    36,    36,    36,    36,    50,    36,    36,    36,    36,
732       36,    -1,    -1,    49
733 };
734 
735 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
736    symbol of state STATE-NUM.  */
737 static const yytype_uint8 yystos[] =
738 {
739        0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
740       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
741       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
742       32,    33,    34,    35,    41,    42,    43,    36,    36,    37,
743       36,    36,    37,    36,    44,    36,    36,    36,    36,    45,
744       36,    50,    36,    36,    50,    36,    37,    36,    36,    36,
745       37,    36,    36,    36,     0,    42,    36,    36,    38,    46,
746       47,    48,    49,    46,    50,    36,    36,    36,    48,    49,
747       36,    39
748 };
749 
750 #define yyerrok		(yyerrstatus = 0)
751 #define yyclearin	(yychar = YYEMPTY)
752 #define YYEMPTY		(-2)
753 #define YYEOF		0
754 
755 #define YYACCEPT	goto yyacceptlab
756 #define YYABORT		goto yyabortlab
757 #define YYERROR		goto yyerrorlab
758 
759 
760 /* Like YYERROR except do call yyerror.  This remains here temporarily
761    to ease the transition to the new meaning of YYERROR, for GCC.
762    Once GCC version 2 has supplanted version 1, this can go.  */
763 
764 #define YYFAIL		goto yyerrlab
765 
766 #define YYRECOVERING()  (!!yyerrstatus)
767 
768 #define YYBACKUP(Token, Value)					\
769 do								\
770   if (yychar == YYEMPTY && yylen == 1)				\
771     {								\
772       yychar = (Token);						\
773       yylval = (Value);						\
774       yytoken = YYTRANSLATE (yychar);				\
775       YYPOPSTACK (1);						\
776       goto yybackup;						\
777     }								\
778   else								\
779     {								\
780       yyerror (YY_("syntax error: cannot back up")); \
781       YYERROR;							\
782     }								\
783 while (YYID (0))
784 
785 
786 #define YYTERROR	1
787 #define YYERRCODE	256
788 
789 
790 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
791    If N is 0, then set CURRENT to the empty location which ends
792    the previous symbol: RHS[0] (always defined).  */
793 
794 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
795 #ifndef YYLLOC_DEFAULT
796 # define YYLLOC_DEFAULT(Current, Rhs, N)				\
797     do									\
798       if (YYID (N))                                                    \
799 	{								\
800 	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
801 	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
802 	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
803 	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
804 	}								\
805       else								\
806 	{								\
807 	  (Current).first_line   = (Current).last_line   =		\
808 	    YYRHSLOC (Rhs, 0).last_line;				\
809 	  (Current).first_column = (Current).last_column =		\
810 	    YYRHSLOC (Rhs, 0).last_column;				\
811 	}								\
812     while (YYID (0))
813 #endif
814 
815 
816 /* YY_LOCATION_PRINT -- Print the location on the stream.
817    This macro was not mandated originally: define only if we know
818    we won't break user code: when these are the locations we know.  */
819 
820 #ifndef YY_LOCATION_PRINT
821 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
822 #  define YY_LOCATION_PRINT(File, Loc)			\
823      fprintf (File, "%d.%d-%d.%d",			\
824 	      (Loc).first_line, (Loc).first_column,	\
825 	      (Loc).last_line,  (Loc).last_column)
826 # else
827 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
828 # endif
829 #endif
830 
831 
832 /* YYLEX -- calling `yylex' with the right arguments.  */
833 
834 #ifdef YYLEX_PARAM
835 # define YYLEX yylex (YYLEX_PARAM)
836 #else
837 # define YYLEX yylex ()
838 #endif
839 
840 /* Enable debugging if requested.  */
841 #if YYDEBUG
842 
843 # ifndef YYFPRINTF
844 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
845 #  define YYFPRINTF fprintf
846 # endif
847 
848 # define YYDPRINTF(Args)			\
849 do {						\
850   if (yydebug)					\
851     YYFPRINTF Args;				\
852 } while (YYID (0))
853 
854 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
855 do {									  \
856   if (yydebug)								  \
857     {									  \
858       YYFPRINTF (stderr, "%s ", Title);					  \
859       yy_symbol_print (stderr,						  \
860 		  Type, Value); \
861       YYFPRINTF (stderr, "\n");						  \
862     }									  \
863 } while (YYID (0))
864 
865 
866 /*--------------------------------.
867 | Print this symbol on YYOUTPUT.  |
868 `--------------------------------*/
869 
870 /*ARGSUSED*/
871 #if (defined __STDC__ || defined __C99__FUNC__ \
872      || defined __cplusplus || defined _MSC_VER)
873 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)874 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
875 #else
876 static void
877 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
878     FILE *yyoutput;
879     int yytype;
880     YYSTYPE const * const yyvaluep;
881 #endif
882 {
883   if (!yyvaluep)
884     return;
885 # ifdef YYPRINT
886   if (yytype < YYNTOKENS)
887     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
888 # else
889   YYUSE (yyoutput);
890 # endif
891   switch (yytype)
892     {
893       default:
894 	break;
895     }
896 }
897 
898 
899 /*--------------------------------.
900 | Print this symbol on YYOUTPUT.  |
901 `--------------------------------*/
902 
903 #if (defined __STDC__ || defined __C99__FUNC__ \
904      || defined __cplusplus || defined _MSC_VER)
905 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)906 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
907 #else
908 static void
909 yy_symbol_print (yyoutput, yytype, yyvaluep)
910     FILE *yyoutput;
911     int yytype;
912     YYSTYPE const * const yyvaluep;
913 #endif
914 {
915   if (yytype < YYNTOKENS)
916     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
917   else
918     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
919 
920   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
921   YYFPRINTF (yyoutput, ")");
922 }
923 
924 /*------------------------------------------------------------------.
925 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
926 | TOP (included).                                                   |
927 `------------------------------------------------------------------*/
928 
929 #if (defined __STDC__ || defined __C99__FUNC__ \
930      || defined __cplusplus || defined _MSC_VER)
931 static void
yy_stack_print(yytype_int16 * bottom,yytype_int16 * top)932 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
933 #else
934 static void
935 yy_stack_print (bottom, top)
936     yytype_int16 *bottom;
937     yytype_int16 *top;
938 #endif
939 {
940   YYFPRINTF (stderr, "Stack now");
941   for (; bottom <= top; ++bottom)
942     YYFPRINTF (stderr, " %d", *bottom);
943   YYFPRINTF (stderr, "\n");
944 }
945 
946 # define YY_STACK_PRINT(Bottom, Top)				\
947 do {								\
948   if (yydebug)							\
949     yy_stack_print ((Bottom), (Top));				\
950 } while (YYID (0))
951 
952 
953 /*------------------------------------------------.
954 | Report that the YYRULE is going to be reduced.  |
955 `------------------------------------------------*/
956 
957 #if (defined __STDC__ || defined __C99__FUNC__ \
958      || defined __cplusplus || defined _MSC_VER)
959 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)960 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
961 #else
962 static void
963 yy_reduce_print (yyvsp, yyrule)
964     YYSTYPE *yyvsp;
965     int yyrule;
966 #endif
967 {
968   int yynrhs = yyr2[yyrule];
969   int yyi;
970   unsigned long int yylno = yyrline[yyrule];
971   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
972 	     yyrule - 1, yylno);
973   /* The symbols being reduced.  */
974   for (yyi = 0; yyi < yynrhs; yyi++)
975     {
976       fprintf (stderr, "   $%d = ", yyi + 1);
977       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
978 		       &(yyvsp[(yyi + 1) - (yynrhs)])
979 		       		       );
980       fprintf (stderr, "\n");
981     }
982 }
983 
984 # define YY_REDUCE_PRINT(Rule)		\
985 do {					\
986   if (yydebug)				\
987     yy_reduce_print (yyvsp, Rule); \
988 } while (YYID (0))
989 
990 /* Nonzero means print parse trace.  It is left uninitialized so that
991    multiple parsers can coexist.  */
992 int yydebug;
993 #else /* !YYDEBUG */
994 # define YYDPRINTF(Args)
995 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
996 # define YY_STACK_PRINT(Bottom, Top)
997 # define YY_REDUCE_PRINT(Rule)
998 #endif /* !YYDEBUG */
999 
1000 
1001 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1002 #ifndef	YYINITDEPTH
1003 # define YYINITDEPTH 200
1004 #endif
1005 
1006 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1007    if the built-in stack extension method is used).
1008 
1009    Do not make this value too large; the results are undefined if
1010    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1011    evaluated with infinite-precision integer arithmetic.  */
1012 
1013 #ifndef YYMAXDEPTH
1014 # define YYMAXDEPTH 10000
1015 #endif
1016 
1017 
1018 
1019 #if YYERROR_VERBOSE
1020 
1021 # ifndef yystrlen
1022 #  if defined __GLIBC__ && defined _STRING_H
1023 #   define yystrlen strlen
1024 #  else
1025 /* Return the length of YYSTR.  */
1026 #if (defined __STDC__ || defined __C99__FUNC__ \
1027      || defined __cplusplus || defined _MSC_VER)
1028 static YYSIZE_T
yystrlen(const char * yystr)1029 yystrlen (const char *yystr)
1030 #else
1031 static YYSIZE_T
1032 yystrlen (yystr)
1033     const char *yystr;
1034 #endif
1035 {
1036   YYSIZE_T yylen;
1037   for (yylen = 0; yystr[yylen]; yylen++)
1038     continue;
1039   return yylen;
1040 }
1041 #  endif
1042 # endif
1043 
1044 # ifndef yystpcpy
1045 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1046 #   define yystpcpy stpcpy
1047 #  else
1048 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1049    YYDEST.  */
1050 #if (defined __STDC__ || defined __C99__FUNC__ \
1051      || defined __cplusplus || defined _MSC_VER)
1052 static char *
yystpcpy(char * yydest,const char * yysrc)1053 yystpcpy (char *yydest, const char *yysrc)
1054 #else
1055 static char *
1056 yystpcpy (yydest, yysrc)
1057     char *yydest;
1058     const char *yysrc;
1059 #endif
1060 {
1061   char *yyd = yydest;
1062   const char *yys = yysrc;
1063 
1064   while ((*yyd++ = *yys++) != '\0')
1065     continue;
1066 
1067   return yyd - 1;
1068 }
1069 #  endif
1070 # endif
1071 
1072 # ifndef yytnamerr
1073 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1074    quotes and backslashes, so that it's suitable for yyerror.  The
1075    heuristic is that double-quoting is unnecessary unless the string
1076    contains an apostrophe, a comma, or backslash (other than
1077    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1078    null, do not copy; instead, return the length of what the result
1079    would have been.  */
1080 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1081 yytnamerr (char *yyres, const char *yystr)
1082 {
1083   if (*yystr == '"')
1084     {
1085       YYSIZE_T yyn = 0;
1086       char const *yyp = yystr;
1087 
1088       for (;;)
1089 	switch (*++yyp)
1090 	  {
1091 	  case '\'':
1092 	  case ',':
1093 	    goto do_not_strip_quotes;
1094 
1095 	  case '\\':
1096 	    if (*++yyp != '\\')
1097 	      goto do_not_strip_quotes;
1098 	    /* Fall through.  */
1099 	  default:
1100 	    if (yyres)
1101 	      yyres[yyn] = *yyp;
1102 	    yyn++;
1103 	    break;
1104 
1105 	  case '"':
1106 	    if (yyres)
1107 	      yyres[yyn] = '\0';
1108 	    return yyn;
1109 	  }
1110     do_not_strip_quotes: ;
1111     }
1112 
1113   if (! yyres)
1114     return yystrlen (yystr);
1115 
1116   return yystpcpy (yyres, yystr) - yyres;
1117 }
1118 # endif
1119 
1120 /* Copy into YYRESULT an error message about the unexpected token
1121    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1122    including the terminating null byte.  If YYRESULT is null, do not
1123    copy anything; just return the number of bytes that would be
1124    copied.  As a special case, return 0 if an ordinary "syntax error"
1125    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1126    size calculation.  */
1127 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)1128 yysyntax_error (char *yyresult, int yystate, int yychar)
1129 {
1130   int yyn = yypact[yystate];
1131 
1132   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1133     return 0;
1134   else
1135     {
1136       int yytype = YYTRANSLATE (yychar);
1137       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1138       YYSIZE_T yysize = yysize0;
1139       YYSIZE_T yysize1;
1140       int yysize_overflow = 0;
1141       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1142       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1143       int yyx;
1144 
1145 # if 0
1146       /* This is so xgettext sees the translatable formats that are
1147 	 constructed on the fly.  */
1148       YY_("syntax error, unexpected %s");
1149       YY_("syntax error, unexpected %s, expecting %s");
1150       YY_("syntax error, unexpected %s, expecting %s or %s");
1151       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1152       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1153 # endif
1154       char *yyfmt;
1155       char const *yyf;
1156       static char const yyunexpected[] = "syntax error, unexpected %s";
1157       static char const yyexpecting[] = ", expecting %s";
1158       static char const yyor[] = " or %s";
1159       char yyformat[sizeof yyunexpected
1160 		    + sizeof yyexpecting - 1
1161 		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1162 		       * (sizeof yyor - 1))];
1163       char const *yyprefix = yyexpecting;
1164 
1165       /* Start YYX at -YYN if negative to avoid negative indexes in
1166 	 YYCHECK.  */
1167       int yyxbegin = yyn < 0 ? -yyn : 0;
1168 
1169       /* Stay within bounds of both yycheck and yytname.  */
1170       int yychecklim = YYLAST - yyn + 1;
1171       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1172       int yycount = 1;
1173 
1174       yyarg[0] = yytname[yytype];
1175       yyfmt = yystpcpy (yyformat, yyunexpected);
1176 
1177       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1178 	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1179 	  {
1180 	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1181 	      {
1182 		yycount = 1;
1183 		yysize = yysize0;
1184 		yyformat[sizeof yyunexpected - 1] = '\0';
1185 		break;
1186 	      }
1187 	    yyarg[yycount++] = yytname[yyx];
1188 	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1189 	    yysize_overflow |= (yysize1 < yysize);
1190 	    yysize = yysize1;
1191 	    yyfmt = yystpcpy (yyfmt, yyprefix);
1192 	    yyprefix = yyor;
1193 	  }
1194 
1195       yyf = YY_(yyformat);
1196       yysize1 = yysize + yystrlen (yyf);
1197       yysize_overflow |= (yysize1 < yysize);
1198       yysize = yysize1;
1199 
1200       if (yysize_overflow)
1201 	return YYSIZE_MAXIMUM;
1202 
1203       if (yyresult)
1204 	{
1205 	  /* Avoid sprintf, as that infringes on the user's name space.
1206 	     Don't have undefined behavior even if the translation
1207 	     produced a string with the wrong number of "%s"s.  */
1208 	  char *yyp = yyresult;
1209 	  int yyi = 0;
1210 	  while ((*yyp = *yyf) != '\0')
1211 	    {
1212 	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1213 		{
1214 		  yyp += yytnamerr (yyp, yyarg[yyi++]);
1215 		  yyf += 2;
1216 		}
1217 	      else
1218 		{
1219 		  yyp++;
1220 		  yyf++;
1221 		}
1222 	    }
1223 	}
1224       return yysize;
1225     }
1226 }
1227 #endif /* YYERROR_VERBOSE */
1228 
1229 
1230 /*-----------------------------------------------.
1231 | Release the memory associated to this symbol.  |
1232 `-----------------------------------------------*/
1233 
1234 /*ARGSUSED*/
1235 #if (defined __STDC__ || defined __C99__FUNC__ \
1236      || defined __cplusplus || defined _MSC_VER)
1237 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1238 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1239 #else
1240 static void
1241 yydestruct (yymsg, yytype, yyvaluep)
1242     const char *yymsg;
1243     int yytype;
1244     YYSTYPE *yyvaluep;
1245 #endif
1246 {
1247   YYUSE (yyvaluep);
1248 
1249   if (!yymsg)
1250     yymsg = "Deleting";
1251   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1252 
1253   switch (yytype)
1254     {
1255 
1256       default:
1257 	break;
1258     }
1259 }
1260 
1261 
1262 /* Prevent warnings from -Wmissing-prototypes.  */
1263 
1264 #ifdef YYPARSE_PARAM
1265 #if defined __STDC__ || defined __cplusplus
1266 int yyparse (void *YYPARSE_PARAM);
1267 #else
1268 int yyparse ();
1269 #endif
1270 #else /* ! YYPARSE_PARAM */
1271 #if defined __STDC__ || defined __cplusplus
1272 int yyparse (void);
1273 #else
1274 int yyparse ();
1275 #endif
1276 #endif /* ! YYPARSE_PARAM */
1277 
1278 
1279 
1280 /* The look-ahead symbol.  */
1281 int yychar;
1282 
1283 /* The semantic value of the look-ahead symbol.  */
1284 YYSTYPE yylval;
1285 
1286 /* Number of syntax errors so far.  */
1287 int yynerrs;
1288 
1289 
1290 
1291 /*----------.
1292 | yyparse.  |
1293 `----------*/
1294 
1295 #ifdef YYPARSE_PARAM
1296 #if (defined __STDC__ || defined __C99__FUNC__ \
1297      || defined __cplusplus || defined _MSC_VER)
1298 int
yyparse(void * YYPARSE_PARAM)1299 yyparse (void *YYPARSE_PARAM)
1300 #else
1301 int
1302 yyparse (YYPARSE_PARAM)
1303     void *YYPARSE_PARAM;
1304 #endif
1305 #else /* ! YYPARSE_PARAM */
1306 #if (defined __STDC__ || defined __C99__FUNC__ \
1307      || defined __cplusplus || defined _MSC_VER)
1308 int
1309 yyparse (void)
1310 #else
1311 int
1312 yyparse ()
1313 
1314 #endif
1315 #endif
1316 {
1317 
1318   int yystate;
1319   int yyn;
1320   int yyresult;
1321   /* Number of tokens to shift before error messages enabled.  */
1322   int yyerrstatus;
1323   /* Look-ahead token as an internal (translated) token number.  */
1324   int yytoken = 0;
1325 #if YYERROR_VERBOSE
1326   /* Buffer for error messages, and its allocated size.  */
1327   char yymsgbuf[128];
1328   char *yymsg = yymsgbuf;
1329   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1330 #endif
1331 
1332   /* Three stacks and their tools:
1333      `yyss': related to states,
1334      `yyvs': related to semantic values,
1335      `yyls': related to locations.
1336 
1337      Refer to the stacks thru separate pointers, to allow yyoverflow
1338      to reallocate them elsewhere.  */
1339 
1340   /* The state stack.  */
1341   yytype_int16 yyssa[YYINITDEPTH];
1342   yytype_int16 *yyss = yyssa;
1343   yytype_int16 *yyssp;
1344 
1345   /* The semantic value stack.  */
1346   YYSTYPE yyvsa[YYINITDEPTH];
1347   YYSTYPE *yyvs = yyvsa;
1348   YYSTYPE *yyvsp;
1349 
1350 
1351 
1352 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1353 
1354   YYSIZE_T yystacksize = YYINITDEPTH;
1355 
1356   /* The variables used to return semantic value and location from the
1357      action routines.  */
1358   YYSTYPE yyval;
1359 
1360 
1361   /* The number of symbols on the RHS of the reduced rule.
1362      Keep to zero when no symbol should be popped.  */
1363   int yylen = 0;
1364 
1365   YYDPRINTF ((stderr, "Starting parse\n"));
1366 
1367   yystate = 0;
1368   yyerrstatus = 0;
1369   yynerrs = 0;
1370   yychar = YYEMPTY;		/* Cause a token to be read.  */
1371 
1372   /* Initialize stack pointers.
1373      Waste one element of value and location stack
1374      so that they stay on the same level as the state stack.
1375      The wasted elements are never initialized.  */
1376 
1377   yyssp = yyss;
1378   yyvsp = yyvs;
1379 
1380   goto yysetstate;
1381 
1382 /*------------------------------------------------------------.
1383 | yynewstate -- Push a new state, which is found in yystate.  |
1384 `------------------------------------------------------------*/
1385  yynewstate:
1386   /* In all cases, when you get here, the value and location stacks
1387      have just been pushed.  So pushing a state here evens the stacks.  */
1388   yyssp++;
1389 
1390  yysetstate:
1391   *yyssp = yystate;
1392 
1393   if (yyss + yystacksize - 1 <= yyssp)
1394     {
1395       /* Get the current used size of the three stacks, in elements.  */
1396       YYSIZE_T yysize = yyssp - yyss + 1;
1397 
1398 #ifdef yyoverflow
1399       {
1400 	/* Give user a chance to reallocate the stack.  Use copies of
1401 	   these so that the &'s don't force the real ones into
1402 	   memory.  */
1403 	YYSTYPE *yyvs1 = yyvs;
1404 	yytype_int16 *yyss1 = yyss;
1405 
1406 
1407 	/* Each stack pointer address is followed by the size of the
1408 	   data in use in that stack, in bytes.  This used to be a
1409 	   conditional around just the two extra args, but that might
1410 	   be undefined if yyoverflow is a macro.  */
1411 	yyoverflow (YY_("memory exhausted"),
1412 		    &yyss1, yysize * sizeof (*yyssp),
1413 		    &yyvs1, yysize * sizeof (*yyvsp),
1414 
1415 		    &yystacksize);
1416 
1417 	yyss = yyss1;
1418 	yyvs = yyvs1;
1419       }
1420 #else /* no yyoverflow */
1421 # ifndef YYSTACK_RELOCATE
1422       goto yyexhaustedlab;
1423 # else
1424       /* Extend the stack our own way.  */
1425       if (YYMAXDEPTH <= yystacksize)
1426 	goto yyexhaustedlab;
1427       yystacksize *= 2;
1428       if (YYMAXDEPTH < yystacksize)
1429 	yystacksize = YYMAXDEPTH;
1430 
1431       {
1432 	yytype_int16 *yyss1 = yyss;
1433 	union yyalloc *yyptr =
1434 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1435 	if (! yyptr)
1436 	  goto yyexhaustedlab;
1437 	YYSTACK_RELOCATE (yyss);
1438 	YYSTACK_RELOCATE (yyvs);
1439 
1440 #  undef YYSTACK_RELOCATE
1441 	if (yyss1 != yyssa)
1442 	  YYSTACK_FREE (yyss1);
1443       }
1444 # endif
1445 #endif /* no yyoverflow */
1446 
1447       yyssp = yyss + yysize - 1;
1448       yyvsp = yyvs + yysize - 1;
1449 
1450 
1451       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1452 		  (unsigned long int) yystacksize));
1453 
1454       if (yyss + yystacksize - 1 <= yyssp)
1455 	YYABORT;
1456     }
1457 
1458   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1459 
1460   goto yybackup;
1461 
1462 /*-----------.
1463 | yybackup.  |
1464 `-----------*/
1465 yybackup:
1466 
1467   /* Do appropriate processing given the current state.  Read a
1468      look-ahead token if we need one and don't already have one.  */
1469 
1470   /* First try to decide what to do without reference to look-ahead token.  */
1471   yyn = yypact[yystate];
1472   if (yyn == YYPACT_NINF)
1473     goto yydefault;
1474 
1475   /* Not known => get a look-ahead token if don't already have one.  */
1476 
1477   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1478   if (yychar == YYEMPTY)
1479     {
1480       YYDPRINTF ((stderr, "Reading a token: "));
1481       yychar = YYLEX;
1482     }
1483 
1484   if (yychar <= YYEOF)
1485     {
1486       yychar = yytoken = YYEOF;
1487       YYDPRINTF ((stderr, "Now at end of input.\n"));
1488     }
1489   else
1490     {
1491       yytoken = YYTRANSLATE (yychar);
1492       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1493     }
1494 
1495   /* If the proper action on seeing token YYTOKEN is to reduce or to
1496      detect an error, take that action.  */
1497   yyn += yytoken;
1498   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1499     goto yydefault;
1500   yyn = yytable[yyn];
1501   if (yyn <= 0)
1502     {
1503       if (yyn == 0 || yyn == YYTABLE_NINF)
1504 	goto yyerrlab;
1505       yyn = -yyn;
1506       goto yyreduce;
1507     }
1508 
1509   if (yyn == YYFINAL)
1510     YYACCEPT;
1511 
1512   /* Count tokens shifted since error; after three, turn off error
1513      status.  */
1514   if (yyerrstatus)
1515     yyerrstatus--;
1516 
1517   /* Shift the look-ahead token.  */
1518   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1519 
1520   /* Discard the shifted token unless it is eof.  */
1521   if (yychar != YYEOF)
1522     yychar = YYEMPTY;
1523 
1524   yystate = yyn;
1525   *++yyvsp = yylval;
1526 
1527   goto yynewstate;
1528 
1529 
1530 /*-----------------------------------------------------------.
1531 | yydefault -- do the default action for the current state.  |
1532 `-----------------------------------------------------------*/
1533 yydefault:
1534   yyn = yydefact[yystate];
1535   if (yyn == 0)
1536     goto yyerrlab;
1537   goto yyreduce;
1538 
1539 
1540 /*-----------------------------.
1541 | yyreduce -- Do a reduction.  |
1542 `-----------------------------*/
1543 yyreduce:
1544   /* yyn is the number of a rule to reduce with.  */
1545   yylen = yyr2[yyn];
1546 
1547   /* If YYLEN is nonzero, implement the default value of the action:
1548      `$$ = $1'.
1549 
1550      Otherwise, the following line sets YYVAL to garbage.
1551      This behavior is undocumented and Bison
1552      users should not rely upon it.  Assigning to YYVAL
1553      unconditionally makes the parser a bit smaller, and it avoids a
1554      GCC warning that YYVAL may be used uninitialized.  */
1555   yyval = yyvsp[1-yylen];
1556 
1557 
1558   YY_REDUCE_PRINT (yyn);
1559   switch (yyn)
1560     {
1561         case 5:
1562 #line 157 "nlmheader.y"
1563     {
1564 	    check_procedure = (yyvsp[(2) - (2)].string);
1565 	  }
1566     break;
1567 
1568   case 6:
1569 #line 161 "nlmheader.y"
1570     {
1571 	    nlmheader_warn (_("CODESTART is not implemented; sorry"), -1);
1572 	    free ((yyvsp[(2) - (2)].string));
1573 	  }
1574     break;
1575 
1576   case 7:
1577 #line 166 "nlmheader.y"
1578     {
1579 	    int len;
1580 
1581 	    strncpy (copyright_hdr->stamp, "CoPyRiGhT=", 10);
1582 	    len = strlen ((yyvsp[(2) - (2)].string));
1583 	    if (len >= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH)
1584 	      {
1585 		nlmheader_warn (_("copyright string is too long"),
1586 				NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1);
1587 		len = NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1;
1588 	      }
1589 	    copyright_hdr->copyrightMessageLength = len;
1590 	    strncpy (copyright_hdr->copyrightMessage, (yyvsp[(2) - (2)].string), len);
1591 	    copyright_hdr->copyrightMessage[len] = '\0';
1592 	    free ((yyvsp[(2) - (2)].string));
1593 	  }
1594     break;
1595 
1596   case 8:
1597 #line 183 "nlmheader.y"
1598     {
1599 	    custom_file = (yyvsp[(2) - (2)].string);
1600 	  }
1601     break;
1602 
1603   case 9:
1604 #line 187 "nlmheader.y"
1605     {
1606 	    /* We don't set the version stamp here, because we use the
1607 	       version stamp to detect whether the required VERSION
1608 	       keyword was given.  */
1609 	    version_hdr->month = nlmlex_get_number ((yyvsp[(2) - (4)].string));
1610 	    version_hdr->day = nlmlex_get_number ((yyvsp[(3) - (4)].string));
1611 	    version_hdr->year = nlmlex_get_number ((yyvsp[(4) - (4)].string));
1612 	    free ((yyvsp[(2) - (4)].string));
1613 	    free ((yyvsp[(3) - (4)].string));
1614 	    free ((yyvsp[(4) - (4)].string));
1615 	    if (version_hdr->month < 1 || version_hdr->month > 12)
1616 	      nlmheader_warn (_("illegal month"), -1);
1617 	    if (version_hdr->day < 1 || version_hdr->day > 31)
1618 	      nlmheader_warn (_("illegal day"), -1);
1619 	    if (version_hdr->year < 1900 || version_hdr->year > 3000)
1620 	      nlmheader_warn (_("illegal year"), -1);
1621 	  }
1622     break;
1623 
1624   case 10:
1625 #line 205 "nlmheader.y"
1626     {
1627 	    debug_info = TRUE;
1628 	  }
1629     break;
1630 
1631   case 11:
1632 #line 209 "nlmheader.y"
1633     {
1634 	    int len;
1635 
1636 	    len = strlen ((yyvsp[(2) - (2)].string));
1637 	    if (len > NLM_MAX_DESCRIPTION_LENGTH)
1638 	      {
1639 		nlmheader_warn (_("description string is too long"),
1640 				NLM_MAX_DESCRIPTION_LENGTH);
1641 		len = NLM_MAX_DESCRIPTION_LENGTH;
1642 	      }
1643 	    var_hdr->descriptionLength = len;
1644 	    strncpy (var_hdr->descriptionText, (yyvsp[(2) - (2)].string), len);
1645 	    var_hdr->descriptionText[len] = '\0';
1646 	    free ((yyvsp[(2) - (2)].string));
1647 	  }
1648     break;
1649 
1650   case 12:
1651 #line 225 "nlmheader.y"
1652     {
1653 	    exit_procedure = (yyvsp[(2) - (2)].string);
1654 	  }
1655     break;
1656 
1657   case 13:
1658 #line 229 "nlmheader.y"
1659     {
1660 	    symbol_prefix = NULL;
1661 	  }
1662     break;
1663 
1664   case 14:
1665 #line 233 "nlmheader.y"
1666     {
1667 	    export_symbols = string_list_append (export_symbols, (yyvsp[(3) - (3)].list));
1668 	  }
1669     break;
1670 
1671   case 15:
1672 #line 237 "nlmheader.y"
1673     {
1674 	    fixed_hdr->flags |= nlmlex_get_number ((yyvsp[(2) - (2)].string));
1675 	    free ((yyvsp[(2) - (2)].string));
1676 	  }
1677     break;
1678 
1679   case 16:
1680 #line 242 "nlmheader.y"
1681     {
1682 	    fixed_hdr->flags &=~ nlmlex_get_number ((yyvsp[(2) - (2)].string));
1683 	    free ((yyvsp[(2) - (2)].string));
1684 	  }
1685     break;
1686 
1687   case 17:
1688 #line 247 "nlmheader.y"
1689     {
1690 	    map_file = "";
1691 	    full_map = TRUE;
1692 	  }
1693     break;
1694 
1695   case 18:
1696 #line 252 "nlmheader.y"
1697     {
1698 	    map_file = (yyvsp[(2) - (2)].string);
1699 	    full_map = TRUE;
1700 	  }
1701     break;
1702 
1703   case 19:
1704 #line 257 "nlmheader.y"
1705     {
1706 	    help_file = (yyvsp[(2) - (2)].string);
1707 	  }
1708     break;
1709 
1710   case 20:
1711 #line 261 "nlmheader.y"
1712     {
1713 	    symbol_prefix = NULL;
1714 	  }
1715     break;
1716 
1717   case 21:
1718 #line 265 "nlmheader.y"
1719     {
1720 	    import_symbols = string_list_append (import_symbols, (yyvsp[(3) - (3)].list));
1721 	  }
1722     break;
1723 
1724   case 22:
1725 #line 269 "nlmheader.y"
1726     {
1727 	    input_files = string_list_append (input_files, (yyvsp[(2) - (2)].list));
1728 	  }
1729     break;
1730 
1731   case 23:
1732 #line 273 "nlmheader.y"
1733     {
1734 	    map_file = "";
1735 	  }
1736     break;
1737 
1738   case 24:
1739 #line 277 "nlmheader.y"
1740     {
1741 	    map_file = (yyvsp[(2) - (2)].string);
1742 	  }
1743     break;
1744 
1745   case 25:
1746 #line 281 "nlmheader.y"
1747     {
1748 	    message_file = (yyvsp[(2) - (2)].string);
1749 	  }
1750     break;
1751 
1752   case 26:
1753 #line 285 "nlmheader.y"
1754     {
1755 	    modules = string_list_append (modules, (yyvsp[(2) - (2)].list));
1756 	  }
1757     break;
1758 
1759   case 27:
1760 #line 289 "nlmheader.y"
1761     {
1762 	    fixed_hdr->flags |= 0x2;
1763 	  }
1764     break;
1765 
1766   case 28:
1767 #line 293 "nlmheader.y"
1768     {
1769 	    fixed_hdr->flags |= 0x10;
1770 	  }
1771     break;
1772 
1773   case 29:
1774 #line 297 "nlmheader.y"
1775     {
1776 	    if (output_file == NULL)
1777 	      output_file = (yyvsp[(2) - (2)].string);
1778 	    else
1779 	      nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1);
1780 	  }
1781     break;
1782 
1783   case 30:
1784 #line 304 "nlmheader.y"
1785     {
1786 	    fixed_hdr->flags |= 0x8;
1787 	  }
1788     break;
1789 
1790   case 31:
1791 #line 308 "nlmheader.y"
1792     {
1793 	    fixed_hdr->flags |= 0x1;
1794 	  }
1795     break;
1796 
1797   case 32:
1798 #line 312 "nlmheader.y"
1799     {
1800 	    int len;
1801 
1802 	    len = strlen ((yyvsp[(2) - (2)].string));
1803 	    if (len >= NLM_MAX_SCREEN_NAME_LENGTH)
1804 	      {
1805 		nlmheader_warn (_("screen name is too long"),
1806 				NLM_MAX_SCREEN_NAME_LENGTH);
1807 		len = NLM_MAX_SCREEN_NAME_LENGTH;
1808 	      }
1809 	    var_hdr->screenNameLength = len;
1810 	    strncpy (var_hdr->screenName, (yyvsp[(2) - (2)].string), len);
1811 	    var_hdr->screenName[NLM_MAX_SCREEN_NAME_LENGTH] = '\0';
1812 	    free ((yyvsp[(2) - (2)].string));
1813 	  }
1814     break;
1815 
1816   case 33:
1817 #line 328 "nlmheader.y"
1818     {
1819 	    sharelib_file = (yyvsp[(2) - (2)].string);
1820 	  }
1821     break;
1822 
1823   case 34:
1824 #line 332 "nlmheader.y"
1825     {
1826 	    var_hdr->stackSize = nlmlex_get_number ((yyvsp[(2) - (2)].string));
1827 	    free ((yyvsp[(2) - (2)].string));
1828 	  }
1829     break;
1830 
1831   case 35:
1832 #line 337 "nlmheader.y"
1833     {
1834 	    start_procedure = (yyvsp[(2) - (2)].string);
1835 	  }
1836     break;
1837 
1838   case 36:
1839 #line 341 "nlmheader.y"
1840     {
1841 	    fixed_hdr->flags |= 0x4;
1842 	  }
1843     break;
1844 
1845   case 37:
1846 #line 345 "nlmheader.y"
1847     {
1848 	    int len;
1849 
1850 	    len = strlen ((yyvsp[(2) - (2)].string));
1851 	    if (len >= NLM_MAX_THREAD_NAME_LENGTH)
1852 	      {
1853 		nlmheader_warn (_("thread name is too long"),
1854 				NLM_MAX_THREAD_NAME_LENGTH);
1855 		len = NLM_MAX_THREAD_NAME_LENGTH;
1856 	      }
1857 	    var_hdr->threadNameLength = len;
1858 	    strncpy (var_hdr->threadName, (yyvsp[(2) - (2)].string), len);
1859 	    var_hdr->threadName[len] = '\0';
1860 	    free ((yyvsp[(2) - (2)].string));
1861 	  }
1862     break;
1863 
1864   case 38:
1865 #line 361 "nlmheader.y"
1866     {
1867 	    fixed_hdr->moduleType = nlmlex_get_number ((yyvsp[(2) - (2)].string));
1868 	    free ((yyvsp[(2) - (2)].string));
1869 	  }
1870     break;
1871 
1872   case 39:
1873 #line 366 "nlmheader.y"
1874     {
1875 	    verbose = TRUE;
1876 	  }
1877     break;
1878 
1879   case 40:
1880 #line 370 "nlmheader.y"
1881     {
1882 	    long val;
1883 
1884 	    strncpy (version_hdr->stamp, "VeRsIoN#", 8);
1885 	    version_hdr->majorVersion = nlmlex_get_number ((yyvsp[(2) - (4)].string));
1886 	    val = nlmlex_get_number ((yyvsp[(3) - (4)].string));
1887 	    if (val < 0 || val > 99)
1888 	      nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1889 			      -1);
1890 	    else
1891 	      version_hdr->minorVersion = val;
1892 	    val = nlmlex_get_number ((yyvsp[(4) - (4)].string));
1893 	    if (val < 0)
1894 	      nlmheader_warn (_("illegal revision number (must be between 0 and 26)"),
1895 			      -1);
1896 	    else if (val > 26)
1897 	      version_hdr->revision = 0;
1898 	    else
1899 	      version_hdr->revision = val;
1900 	    free ((yyvsp[(2) - (4)].string));
1901 	    free ((yyvsp[(3) - (4)].string));
1902 	    free ((yyvsp[(4) - (4)].string));
1903 	  }
1904     break;
1905 
1906   case 41:
1907 #line 394 "nlmheader.y"
1908     {
1909 	    long val;
1910 
1911 	    strncpy (version_hdr->stamp, "VeRsIoN#", 8);
1912 	    version_hdr->majorVersion = nlmlex_get_number ((yyvsp[(2) - (3)].string));
1913 	    val = nlmlex_get_number ((yyvsp[(3) - (3)].string));
1914 	    if (val < 0 || val > 99)
1915 	      nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"),
1916 			      -1);
1917 	    else
1918 	      version_hdr->minorVersion = val;
1919 	    version_hdr->revision = 0;
1920 	    free ((yyvsp[(2) - (3)].string));
1921 	    free ((yyvsp[(3) - (3)].string));
1922 	  }
1923     break;
1924 
1925   case 42:
1926 #line 410 "nlmheader.y"
1927     {
1928 	    rpc_file = (yyvsp[(2) - (2)].string);
1929 	  }
1930     break;
1931 
1932   case 43:
1933 #line 419 "nlmheader.y"
1934     {
1935 	    (yyval.list) = NULL;
1936 	  }
1937     break;
1938 
1939   case 44:
1940 #line 423 "nlmheader.y"
1941     {
1942 	    (yyval.list) = (yyvsp[(1) - (1)].list);
1943 	  }
1944     break;
1945 
1946   case 45:
1947 #line 434 "nlmheader.y"
1948     {
1949 	    (yyval.list) = string_list_cons ((yyvsp[(1) - (1)].string), NULL);
1950 	  }
1951     break;
1952 
1953   case 46:
1954 #line 438 "nlmheader.y"
1955     {
1956 	    (yyval.list) = NULL;
1957 	  }
1958     break;
1959 
1960   case 47:
1961 #line 442 "nlmheader.y"
1962     {
1963 	    (yyval.list) = string_list_append1 ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].string));
1964 	  }
1965     break;
1966 
1967   case 48:
1968 #line 446 "nlmheader.y"
1969     {
1970 	    (yyval.list) = (yyvsp[(1) - (2)].list);
1971 	  }
1972     break;
1973 
1974   case 49:
1975 #line 455 "nlmheader.y"
1976     {
1977 	    if (symbol_prefix != NULL)
1978 	      free (symbol_prefix);
1979 	    symbol_prefix = (yyvsp[(2) - (3)].string);
1980 	  }
1981     break;
1982 
1983   case 50:
1984 #line 466 "nlmheader.y"
1985     {
1986 	    if (symbol_prefix == NULL)
1987 	      (yyval.string) = (yyvsp[(1) - (1)].string);
1988 	    else
1989 	      {
1990 		(yyval.string) = xmalloc (strlen (symbol_prefix) + strlen ((yyvsp[(1) - (1)].string)) + 2);
1991 		sprintf ((yyval.string), "%s@%s", symbol_prefix, (yyvsp[(1) - (1)].string));
1992 		free ((yyvsp[(1) - (1)].string));
1993 	      }
1994 	  }
1995     break;
1996 
1997   case 51:
1998 #line 482 "nlmheader.y"
1999     {
2000 	    (yyval.list) = NULL;
2001 	  }
2002     break;
2003 
2004   case 52:
2005 #line 486 "nlmheader.y"
2006     {
2007 	    (yyval.list) = string_list_cons ((yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].list));
2008 	  }
2009     break;
2010 
2011 
2012 /* Line 1267 of yacc.c.  */
2013 #line 2014 "nlmheader.c"
2014       default: break;
2015     }
2016   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2017 
2018   YYPOPSTACK (yylen);
2019   yylen = 0;
2020   YY_STACK_PRINT (yyss, yyssp);
2021 
2022   *++yyvsp = yyval;
2023 
2024 
2025   /* Now `shift' the result of the reduction.  Determine what state
2026      that goes to, based on the state we popped back to and the rule
2027      number reduced by.  */
2028 
2029   yyn = yyr1[yyn];
2030 
2031   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2032   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2033     yystate = yytable[yystate];
2034   else
2035     yystate = yydefgoto[yyn - YYNTOKENS];
2036 
2037   goto yynewstate;
2038 
2039 
2040 /*------------------------------------.
2041 | yyerrlab -- here on detecting error |
2042 `------------------------------------*/
2043 yyerrlab:
2044   /* If not already recovering from an error, report this error.  */
2045   if (!yyerrstatus)
2046     {
2047       ++yynerrs;
2048 #if ! YYERROR_VERBOSE
2049       yyerror (YY_("syntax error"));
2050 #else
2051       {
2052 	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2053 	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2054 	  {
2055 	    YYSIZE_T yyalloc = 2 * yysize;
2056 	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2057 	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
2058 	    if (yymsg != yymsgbuf)
2059 	      YYSTACK_FREE (yymsg);
2060 	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2061 	    if (yymsg)
2062 	      yymsg_alloc = yyalloc;
2063 	    else
2064 	      {
2065 		yymsg = yymsgbuf;
2066 		yymsg_alloc = sizeof yymsgbuf;
2067 	      }
2068 	  }
2069 
2070 	if (0 < yysize && yysize <= yymsg_alloc)
2071 	  {
2072 	    (void) yysyntax_error (yymsg, yystate, yychar);
2073 	    yyerror (yymsg);
2074 	  }
2075 	else
2076 	  {
2077 	    yyerror (YY_("syntax error"));
2078 	    if (yysize != 0)
2079 	      goto yyexhaustedlab;
2080 	  }
2081       }
2082 #endif
2083     }
2084 
2085 
2086 
2087   if (yyerrstatus == 3)
2088     {
2089       /* If just tried and failed to reuse look-ahead token after an
2090 	 error, discard it.  */
2091 
2092       if (yychar <= YYEOF)
2093 	{
2094 	  /* Return failure if at end of input.  */
2095 	  if (yychar == YYEOF)
2096 	    YYABORT;
2097 	}
2098       else
2099 	{
2100 	  yydestruct ("Error: discarding",
2101 		      yytoken, &yylval);
2102 	  yychar = YYEMPTY;
2103 	}
2104     }
2105 
2106   /* Else will try to reuse look-ahead token after shifting the error
2107      token.  */
2108   goto yyerrlab1;
2109 
2110 
2111 /*---------------------------------------------------.
2112 | yyerrorlab -- error raised explicitly by YYERROR.  |
2113 `---------------------------------------------------*/
2114 yyerrorlab:
2115 
2116   /* Pacify compilers like GCC when the user code never invokes
2117      YYERROR and the label yyerrorlab therefore never appears in user
2118      code.  */
2119   if (/*CONSTCOND*/ 0)
2120      goto yyerrorlab;
2121 
2122   /* Do not reclaim the symbols of the rule which action triggered
2123      this YYERROR.  */
2124   YYPOPSTACK (yylen);
2125   yylen = 0;
2126   YY_STACK_PRINT (yyss, yyssp);
2127   yystate = *yyssp;
2128   goto yyerrlab1;
2129 
2130 
2131 /*-------------------------------------------------------------.
2132 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2133 `-------------------------------------------------------------*/
2134 yyerrlab1:
2135   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
2136 
2137   for (;;)
2138     {
2139       yyn = yypact[yystate];
2140       if (yyn != YYPACT_NINF)
2141 	{
2142 	  yyn += YYTERROR;
2143 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2144 	    {
2145 	      yyn = yytable[yyn];
2146 	      if (0 < yyn)
2147 		break;
2148 	    }
2149 	}
2150 
2151       /* Pop the current state because it cannot handle the error token.  */
2152       if (yyssp == yyss)
2153 	YYABORT;
2154 
2155 
2156       yydestruct ("Error: popping",
2157 		  yystos[yystate], yyvsp);
2158       YYPOPSTACK (1);
2159       yystate = *yyssp;
2160       YY_STACK_PRINT (yyss, yyssp);
2161     }
2162 
2163   if (yyn == YYFINAL)
2164     YYACCEPT;
2165 
2166   *++yyvsp = yylval;
2167 
2168 
2169   /* Shift the error token.  */
2170   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2171 
2172   yystate = yyn;
2173   goto yynewstate;
2174 
2175 
2176 /*-------------------------------------.
2177 | yyacceptlab -- YYACCEPT comes here.  |
2178 `-------------------------------------*/
2179 yyacceptlab:
2180   yyresult = 0;
2181   goto yyreturn;
2182 
2183 /*-----------------------------------.
2184 | yyabortlab -- YYABORT comes here.  |
2185 `-----------------------------------*/
2186 yyabortlab:
2187   yyresult = 1;
2188   goto yyreturn;
2189 
2190 #ifndef yyoverflow
2191 /*-------------------------------------------------.
2192 | yyexhaustedlab -- memory exhaustion comes here.  |
2193 `-------------------------------------------------*/
2194 yyexhaustedlab:
2195   yyerror (YY_("memory exhausted"));
2196   yyresult = 2;
2197   /* Fall through.  */
2198 #endif
2199 
2200 yyreturn:
2201   if (yychar != YYEOF && yychar != YYEMPTY)
2202      yydestruct ("Cleanup: discarding lookahead",
2203 		 yytoken, &yylval);
2204   /* Do not reclaim the symbols of the rule which action triggered
2205      this YYABORT or YYACCEPT.  */
2206   YYPOPSTACK (yylen);
2207   YY_STACK_PRINT (yyss, yyssp);
2208   while (yyssp != yyss)
2209     {
2210       yydestruct ("Cleanup: popping",
2211 		  yystos[*yyssp], yyvsp);
2212       YYPOPSTACK (1);
2213     }
2214 #ifndef yyoverflow
2215   if (yyss != yyssa)
2216     YYSTACK_FREE (yyss);
2217 #endif
2218 #if YYERROR_VERBOSE
2219   if (yymsg != yymsgbuf)
2220     YYSTACK_FREE (yymsg);
2221 #endif
2222   /* Make sure YYID is used.  */
2223   return YYID (yyresult);
2224 }
2225 
2226 
2227 #line 491 "nlmheader.y"
2228 
2229 
2230 /* If strerror is just a macro, we want to use the one from libiberty
2231    since it will handle undefined values.  */
2232 #undef strerror
2233 extern char *strerror (int);
2234 
2235 /* The lexer is simple, too simple for flex.  Keywords are only
2236    recognized at the start of lines.  Everything else must be an
2237    argument.  A comma is treated as whitespace.  */
2238 
2239 /* The states the lexer can be in.  */
2240 
2241 enum lex_state
2242 {
2243   /* At the beginning of a line.  */
2244   BEGINNING_OF_LINE,
2245   /* In the middle of a line.  */
2246   IN_LINE
2247 };
2248 
2249 /* We need to keep a stack of files to handle file inclusion.  */
2250 
2251 struct input
2252 {
2253   /* The file to read from.  */
2254   FILE *file;
2255   /* The name of the file.  */
2256   char *name;
2257   /* The current line number.  */
2258   int lineno;
2259   /* The current state.  */
2260   enum lex_state state;
2261   /* The next file on the stack.  */
2262   struct input *next;
2263 };
2264 
2265 /* The current input file.  */
2266 
2267 static struct input current;
2268 
2269 /* The character which introduces comments.  */
2270 #define COMMENT_CHAR '#'
2271 
2272 /* Start the lexer going on the main input file.  */
2273 
2274 bfd_boolean
nlmlex_file(const char * name)2275 nlmlex_file (const char *name)
2276 {
2277   current.next = NULL;
2278   return nlmlex_file_open (name);
2279 }
2280 
2281 /* Start the lexer going on a subsidiary input file.  */
2282 
2283 static void
nlmlex_file_push(const char * name)2284 nlmlex_file_push (const char *name)
2285 {
2286   struct input *push;
2287 
2288   push = (struct input *) xmalloc (sizeof (struct input));
2289   *push = current;
2290   if (nlmlex_file_open (name))
2291     current.next = push;
2292   else
2293     {
2294       current = *push;
2295       free (push);
2296     }
2297 }
2298 
2299 /* Start lexing from a file.  */
2300 
2301 static bfd_boolean
nlmlex_file_open(const char * name)2302 nlmlex_file_open (const char *name)
2303 {
2304   current.file = fopen (name, "r");
2305   if (current.file == NULL)
2306     {
2307       fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno));
2308       ++parse_errors;
2309       return FALSE;
2310     }
2311   current.name = xstrdup (name);
2312   current.lineno = 1;
2313   current.state = BEGINNING_OF_LINE;
2314   return TRUE;
2315 }
2316 
2317 /* Table used to turn keywords into tokens.  */
2318 
2319 struct keyword_tokens_struct
2320 {
2321   const char *keyword;
2322   int token;
2323 };
2324 
2325 static struct keyword_tokens_struct keyword_tokens[] =
2326 {
2327   { "CHECK", CHECK },
2328   { "CODESTART", CODESTART },
2329   { "COPYRIGHT", COPYRIGHT },
2330   { "CUSTOM", CUSTOM },
2331   { "DATE", DATE },
2332   { "DEBUG", DEBUG_K },
2333   { "DESCRIPTION", DESCRIPTION },
2334   { "EXIT", EXIT },
2335   { "EXPORT", EXPORT },
2336   { "FLAG_ON", FLAG_ON },
2337   { "FLAG_OFF", FLAG_OFF },
2338   { "FULLMAP", FULLMAP },
2339   { "HELP", HELP },
2340   { "IMPORT", IMPORT },
2341   { "INPUT", INPUT },
2342   { "MAP", MAP },
2343   { "MESSAGES", MESSAGES },
2344   { "MODULE", MODULE },
2345   { "MULTIPLE", MULTIPLE },
2346   { "OS_DOMAIN", OS_DOMAIN },
2347   { "OUTPUT", OUTPUT },
2348   { "PSEUDOPREEMPTION", PSEUDOPREEMPTION },
2349   { "REENTRANT", REENTRANT },
2350   { "SCREENNAME", SCREENNAME },
2351   { "SHARELIB", SHARELIB },
2352   { "STACK", STACK },
2353   { "STACKSIZE", STACK },
2354   { "START", START },
2355   { "SYNCHRONIZE", SYNCHRONIZE },
2356   { "THREADNAME", THREADNAME },
2357   { "TYPE", TYPE },
2358   { "VERBOSE", VERBOSE },
2359   { "VERSION", VERSIONK },
2360   { "XDCDATA", XDCDATA }
2361 };
2362 
2363 #define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0]))
2364 
2365 /* The lexer accumulates strings in these variables.  */
2366 static char *lex_buf;
2367 static int lex_size;
2368 static int lex_pos;
2369 
2370 /* Start accumulating strings into the buffer.  */
2371 #define BUF_INIT() \
2372   ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ()))
2373 
2374 static int
nlmlex_buf_init(void)2375 nlmlex_buf_init (void)
2376 {
2377   lex_size = 10;
2378   lex_buf = xmalloc (lex_size + 1);
2379   lex_pos = 0;
2380   return 0;
2381 }
2382 
2383 /* Finish a string in the buffer.  */
2384 #define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0'))
2385 
2386 /* Accumulate a character into the buffer.  */
2387 #define BUF_ADD(c) \
2388   ((void) (lex_pos < lex_size \
2389 	   ? lex_buf[lex_pos++] = (c) \
2390 	   : nlmlex_buf_add (c)))
2391 
2392 static char
nlmlex_buf_add(int c)2393 nlmlex_buf_add (int c)
2394 {
2395   if (lex_pos >= lex_size)
2396     {
2397       lex_size *= 2;
2398       lex_buf = xrealloc (lex_buf, lex_size + 1);
2399     }
2400 
2401   return lex_buf[lex_pos++] = c;
2402 }
2403 
2404 /* The lexer proper.  This is called by the bison generated parsing
2405    code.  */
2406 
2407 static int
yylex(void)2408 yylex (void)
2409 {
2410   int c;
2411 
2412 tail_recurse:
2413 
2414   c = getc (current.file);
2415 
2416   /* Commas are treated as whitespace characters.  */
2417   while (ISSPACE (c) || c == ',')
2418     {
2419       current.state = IN_LINE;
2420       if (c == '\n')
2421 	{
2422 	  ++current.lineno;
2423 	  current.state = BEGINNING_OF_LINE;
2424 	}
2425       c = getc (current.file);
2426     }
2427 
2428   /* At the end of the file we either pop to the previous file or
2429      finish up.  */
2430   if (c == EOF)
2431     {
2432       fclose (current.file);
2433       free (current.name);
2434       if (current.next == NULL)
2435 	return 0;
2436       else
2437 	{
2438 	  struct input *next;
2439 
2440 	  next = current.next;
2441 	  current = *next;
2442 	  free (next);
2443 	  goto tail_recurse;
2444 	}
2445     }
2446 
2447   /* A comment character always means to drop everything until the
2448      next newline.  */
2449   if (c == COMMENT_CHAR)
2450     {
2451       do
2452 	{
2453 	  c = getc (current.file);
2454 	}
2455       while (c != '\n');
2456       ++current.lineno;
2457       current.state = BEGINNING_OF_LINE;
2458       goto tail_recurse;
2459     }
2460 
2461   /* An '@' introduces an include file.  */
2462   if (c == '@')
2463     {
2464       do
2465 	{
2466 	  c = getc (current.file);
2467 	  if (c == '\n')
2468 	    ++current.lineno;
2469 	}
2470       while (ISSPACE (c));
2471       BUF_INIT ();
2472       while (! ISSPACE (c) && c != EOF)
2473 	{
2474 	  BUF_ADD (c);
2475 	  c = getc (current.file);
2476 	}
2477       BUF_FINISH ();
2478 
2479       ungetc (c, current.file);
2480 
2481       nlmlex_file_push (lex_buf);
2482       goto tail_recurse;
2483     }
2484 
2485   /* A non-space character at the start of a line must be the start of
2486      a keyword.  */
2487   if (current.state == BEGINNING_OF_LINE)
2488     {
2489       BUF_INIT ();
2490       while (ISALNUM (c) || c == '_')
2491 	{
2492 	  BUF_ADD (TOUPPER (c));
2493 	  c = getc (current.file);
2494 	}
2495       BUF_FINISH ();
2496 
2497       if (c != EOF && ! ISSPACE (c) && c != ',')
2498 	{
2499 	  nlmheader_identify ();
2500 	  fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
2501 		   current.name, current.lineno, c);
2502 	}
2503       else
2504 	{
2505 	  unsigned int i;
2506 
2507 	  for (i = 0; i < KEYWORD_COUNT; i++)
2508 	    {
2509 	      if (lex_buf[0] == keyword_tokens[i].keyword[0]
2510 		  && strcmp (lex_buf, keyword_tokens[i].keyword) == 0)
2511 		{
2512 		  /* Pushing back the final whitespace avoids worrying
2513 		     about \n here.  */
2514 		  ungetc (c, current.file);
2515 		  current.state = IN_LINE;
2516 		  return keyword_tokens[i].token;
2517 		}
2518 	    }
2519 
2520 	  nlmheader_identify ();
2521 	  fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"),
2522 		   current.name, current.lineno, lex_buf);
2523 	}
2524 
2525       ++parse_errors;
2526       /* Treat the rest of this line as a comment.  */
2527       ungetc (COMMENT_CHAR, current.file);
2528       goto tail_recurse;
2529     }
2530 
2531   /* Parentheses just represent themselves.  */
2532   if (c == '(' || c == ')')
2533     return c;
2534 
2535   /* Handle quoted strings.  */
2536   if (c == '"' || c == '\'')
2537     {
2538       int quote;
2539       int start_lineno;
2540 
2541       quote = c;
2542       start_lineno = current.lineno;
2543 
2544       c = getc (current.file);
2545       BUF_INIT ();
2546       while (c != quote && c != EOF)
2547 	{
2548 	  BUF_ADD (c);
2549 	  if (c == '\n')
2550 	    ++current.lineno;
2551 	  c = getc (current.file);
2552 	}
2553       BUF_FINISH ();
2554 
2555       if (c == EOF)
2556 	{
2557 	  nlmheader_identify ();
2558 	  fprintf (stderr, _("%s:%d: end of file in quoted string\n"),
2559 		   current.name, start_lineno);
2560 	  ++parse_errors;
2561 	}
2562 
2563       /* FIXME: Possible memory leak.  */
2564       yylval.string = xstrdup (lex_buf);
2565       return QUOTED_STRING;
2566     }
2567 
2568   /* Gather a generic argument.  */
2569   BUF_INIT ();
2570   while (! ISSPACE (c)
2571 	 && c != ','
2572 	 && c != COMMENT_CHAR
2573 	 && c != '('
2574 	 && c != ')')
2575     {
2576       BUF_ADD (c);
2577       c = getc (current.file);
2578     }
2579   BUF_FINISH ();
2580 
2581   ungetc (c, current.file);
2582 
2583   /* FIXME: Possible memory leak.  */
2584   yylval.string = xstrdup (lex_buf);
2585   return STRING;
2586 }
2587 
2588 /* Get a number from a string.  */
2589 
2590 static long
nlmlex_get_number(const char * s)2591 nlmlex_get_number (const char *s)
2592 {
2593   long ret;
2594   char *send;
2595 
2596   ret = strtol (s, &send, 10);
2597   if (*send != '\0')
2598     nlmheader_warn (_("bad number"), -1);
2599   return ret;
2600 }
2601 
2602 /* Prefix the nlmconv warnings with a note as to where they come from.
2603    We don't use program_name on every warning, because then some
2604    versions of the emacs next-error function can't recognize the line
2605    number.  */
2606 
2607 static void
nlmheader_identify(void)2608 nlmheader_identify (void)
2609 {
2610   static int done;
2611 
2612   if (! done)
2613     {
2614       fprintf (stderr, _("%s: problems in NLM command language input:\n"),
2615 	       program_name);
2616       done = 1;
2617     }
2618 }
2619 
2620 /* Issue a warning.  */
2621 
2622 static void
nlmheader_warn(const char * s,int imax)2623 nlmheader_warn (const char *s, int imax)
2624 {
2625   nlmheader_identify ();
2626   fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s);
2627   if (imax != -1)
2628     fprintf (stderr, " (max %d)", imax);
2629   fprintf (stderr, "\n");
2630 }
2631 
2632 /* Report an error.  */
2633 
2634 static void
nlmheader_error(const char * s)2635 nlmheader_error (const char *s)
2636 {
2637   nlmheader_warn (s, -1);
2638   ++parse_errors;
2639 }
2640 
2641 /* Add a string to a string list.  */
2642 
2643 static struct string_list *
string_list_cons(char * s,struct string_list * l)2644 string_list_cons (char *s, struct string_list *l)
2645 {
2646   struct string_list *ret;
2647 
2648   ret = (struct string_list *) xmalloc (sizeof (struct string_list));
2649   ret->next = l;
2650   ret->string = s;
2651   return ret;
2652 }
2653 
2654 /* Append a string list to another string list.  */
2655 
2656 static struct string_list *
string_list_append(struct string_list * l1,struct string_list * l2)2657 string_list_append (struct string_list *l1, struct string_list *l2)
2658 {
2659   register struct string_list **pp;
2660 
2661   for (pp = &l1; *pp != NULL; pp = &(*pp)->next)
2662     ;
2663   *pp = l2;
2664   return l1;
2665 }
2666 
2667 /* Append a string to a string list.  */
2668 
2669 static struct string_list *
string_list_append1(struct string_list * l,char * s)2670 string_list_append1 (struct string_list *l, char *s)
2671 {
2672   struct string_list *n;
2673   register struct string_list **pp;
2674 
2675   n = (struct string_list *) xmalloc (sizeof (struct string_list));
2676   n->next = NULL;
2677   n->string = s;
2678   for (pp = &l; *pp != NULL; pp = &(*pp)->next)
2679     ;
2680   *pp = n;
2681   return l;
2682 }
2683 
2684 /* Duplicate a string in memory.  */
2685 
2686 static char *
xstrdup(const char * s)2687 xstrdup (const char *s)
2688 {
2689   unsigned long len;
2690   char *ret;
2691 
2692   len = strlen (s);
2693   ret = xmalloc (len + 1);
2694   strcpy (ret, s);
2695   return ret;
2696 }
2697 
2698