OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [binutils/] [nlmheader.c] - Blame information for rev 320

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.