Home | History | Annotate | Line # | Download | only in ld
deffilep.c revision 1.6
      1  1.6  christos /* A Bison parser, made by GNU Bison 3.0.4.  */
      2  1.1  christos 
      3  1.6  christos /* Bison implementation for Yacc-like parsers in C
      4  1.1  christos 
      5  1.6  christos    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
      6  1.1  christos 
      7  1.6  christos    This program is free software: you can redistribute it and/or modify
      8  1.1  christos    it under the terms of the GNU General Public License as published by
      9  1.6  christos    the Free Software Foundation, either version 3 of the License, or
     10  1.6  christos    (at your option) any later version.
     11  1.1  christos 
     12  1.1  christos    This program is distributed in the hope that it will be useful,
     13  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  1.1  christos    GNU General Public License for more details.
     16  1.1  christos 
     17  1.1  christos    You should have received a copy of the GNU General Public License
     18  1.6  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     19  1.1  christos 
     20  1.1  christos /* As a special exception, you may create a larger work that contains
     21  1.1  christos    part or all of the Bison parser skeleton and distribute that work
     22  1.1  christos    under terms of your choice, so long as that work isn't itself a
     23  1.1  christos    parser generator using the skeleton or a modified version thereof
     24  1.1  christos    as a parser skeleton.  Alternatively, if you modify or redistribute
     25  1.1  christos    the parser skeleton itself, you may (at your option) remove this
     26  1.1  christos    special exception, which will cause the skeleton and the resulting
     27  1.1  christos    Bison output files to be licensed under the GNU General Public
     28  1.1  christos    License without this special exception.
     29  1.1  christos 
     30  1.1  christos    This special exception was added by the Free Software Foundation in
     31  1.1  christos    version 2.2 of Bison.  */
     32  1.1  christos 
     33  1.1  christos /* C LALR(1) parser skeleton written by Richard Stallman, by
     34  1.1  christos    simplifying the original so-called "semantic" parser.  */
     35  1.1  christos 
     36  1.1  christos /* All symbols defined below should begin with yy or YY, to avoid
     37  1.1  christos    infringing on user name space.  This should be done even for local
     38  1.1  christos    variables, as they might otherwise be expanded by user macros.
     39  1.1  christos    There are some unavoidable exceptions within include files to
     40  1.1  christos    define necessary library symbols; they are noted "INFRINGES ON
     41  1.1  christos    USER NAME SPACE" below.  */
     42  1.1  christos 
     43  1.1  christos /* Identify Bison output.  */
     44  1.1  christos #define YYBISON 1
     45  1.1  christos 
     46  1.1  christos /* Bison version.  */
     47  1.6  christos #define YYBISON_VERSION "3.0.4"
     48  1.1  christos 
     49  1.1  christos /* Skeleton name.  */
     50  1.1  christos #define YYSKELETON_NAME "yacc.c"
     51  1.1  christos 
     52  1.1  christos /* Pure parsers.  */
     53  1.1  christos #define YYPURE 0
     54  1.1  christos 
     55  1.6  christos /* Push parsers.  */
     56  1.6  christos #define YYPUSH 0
     57  1.1  christos 
     58  1.6  christos /* Pull parsers.  */
     59  1.6  christos #define YYPULL 1
     60  1.1  christos 
     61  1.1  christos 
     62  1.1  christos 
     63  1.1  christos 
     64  1.1  christos /* Copy the first part of user declarations.  */
     65  1.6  christos #line 1 "deffilep.y" /* yacc.c:339  */
     66  1.1  christos  /* deffilep.y - parser for .def files */
     67  1.1  christos 
     68  1.6  christos /*   Copyright (C) 1995-2018 Free Software Foundation, Inc.
     69  1.1  christos 
     70  1.1  christos      This file is part of GNU Binutils.
     71  1.1  christos 
     72  1.1  christos      This program is free software; you can redistribute it and/or modify
     73  1.1  christos      it under the terms of the GNU General Public License as published by
     74  1.1  christos      the Free Software Foundation; either version 3 of the License, or
     75  1.1  christos      (at your option) any later version.
     76  1.1  christos 
     77  1.1  christos      This program is distributed in the hope that it will be useful,
     78  1.1  christos      but WITHOUT ANY WARRANTY; without even the implied warranty of
     79  1.1  christos      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     80  1.1  christos      GNU General Public License for more details.
     81  1.1  christos 
     82  1.1  christos      You should have received a copy of the GNU General Public License
     83  1.1  christos      along with this program; if not, write to the Free Software
     84  1.1  christos      Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     85  1.1  christos      MA 02110-1301, USA.  */
     86  1.1  christos 
     87  1.1  christos #include "sysdep.h"
     88  1.1  christos #include "libiberty.h"
     89  1.1  christos #include "safe-ctype.h"
     90  1.1  christos #include "bfd.h"
     91  1.1  christos #include "ld.h"
     92  1.1  christos #include "ldmisc.h"
     93  1.1  christos #include "deffile.h"
     94  1.1  christos 
     95  1.1  christos #define TRACE 0
     96  1.1  christos 
     97  1.1  christos #define ROUND_UP(a, b) (((a)+((b)-1))&~((b)-1))
     98  1.1  christos 
     99  1.1  christos /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    100  1.1  christos    as well as gratuitiously global symbol names, so we can have multiple
    101  1.1  christos    yacc generated parsers in ld.  Note that these are only the variables
    102  1.1  christos    produced by yacc.  If other parser generators (bison, byacc, etc) produce
    103  1.1  christos    additional global names that conflict at link time, then those parser
    104  1.1  christos    generators need to be fixed instead of adding those names to this list.  */
    105  1.1  christos 
    106  1.1  christos #define	yymaxdepth def_maxdepth
    107  1.1  christos #define	yyparse	def_parse
    108  1.1  christos #define	yylex	def_lex
    109  1.1  christos #define	yyerror	def_error
    110  1.1  christos #define	yylval	def_lval
    111  1.1  christos #define	yychar	def_char
    112  1.1  christos #define	yydebug	def_debug
    113  1.3  christos #define	yypact	def_pact
    114  1.3  christos #define	yyr1	def_r1
    115  1.3  christos #define	yyr2	def_r2
    116  1.3  christos #define	yydef	def_def
    117  1.3  christos #define	yychk	def_chk
    118  1.3  christos #define	yypgo	def_pgo
    119  1.3  christos #define	yyact	def_act
    120  1.1  christos #define	yyexca	def_exca
    121  1.1  christos #define yyerrflag def_errflag
    122  1.1  christos #define yynerrs	def_nerrs
    123  1.1  christos #define	yyps	def_ps
    124  1.1  christos #define	yypv	def_pv
    125  1.1  christos #define	yys	def_s
    126  1.1  christos #define	yy_yys	def_yys
    127  1.1  christos #define	yystate	def_state
    128  1.1  christos #define	yytmp	def_tmp
    129  1.1  christos #define	yyv	def_v
    130  1.1  christos #define	yy_yyv	def_yyv
    131  1.1  christos #define	yyval	def_val
    132  1.1  christos #define	yylloc	def_lloc
    133  1.1  christos #define yyreds	def_reds		/* With YYDEBUG defined.  */
    134  1.1  christos #define yytoks	def_toks		/* With YYDEBUG defined.  */
    135  1.1  christos #define yylhs	def_yylhs
    136  1.1  christos #define yylen	def_yylen
    137  1.1  christos #define yydefred def_yydefred
    138  1.1  christos #define yydgoto	def_yydgoto
    139  1.1  christos #define yysindex def_yysindex
    140  1.1  christos #define yyrindex def_yyrindex
    141  1.1  christos #define yygindex def_yygindex
    142  1.1  christos #define yytable	 def_yytable
    143  1.1  christos #define yycheck	 def_yycheck
    144  1.1  christos 
    145  1.1  christos typedef struct def_pool_str {
    146  1.1  christos   struct def_pool_str *next;
    147  1.1  christos   char data[1];
    148  1.1  christos } def_pool_str;
    149  1.1  christos 
    150  1.1  christos static def_pool_str *pool_strs = NULL;
    151  1.1  christos 
    152  1.1  christos static char *def_pool_alloc (size_t sz);
    153  1.1  christos static char *def_pool_strdup (const char *str);
    154  1.1  christos static void def_pool_free (void);
    155  1.1  christos 
    156  1.1  christos static void def_description (const char *);
    157  1.1  christos static void def_exports (const char *, const char *, int, int, const char *);
    158  1.1  christos static void def_heapsize (int, int);
    159  1.1  christos static void def_import (const char *, const char *, const char *, const char *,
    160  1.1  christos 			int, const char *);
    161  1.3  christos static void def_image_name (const char *, bfd_vma, int);
    162  1.1  christos static void def_section (const char *, int);
    163  1.1  christos static void def_section_alt (const char *, const char *);
    164  1.1  christos static void def_stacksize (int, int);
    165  1.1  christos static void def_version (int, int);
    166  1.1  christos static void def_directive (char *);
    167  1.1  christos static void def_aligncomm (char *str, int align);
    168  1.1  christos static int def_parse (void);
    169  1.1  christos static int def_error (const char *);
    170  1.1  christos static int def_lex (void);
    171  1.1  christos 
    172  1.1  christos static int lex_forced_token = 0;
    173  1.1  christos static const char *lex_parse_string = 0;
    174  1.1  christos static const char *lex_parse_string_end = 0;
    175  1.1  christos 
    176  1.1  christos 
    177  1.6  christos #line 178 "deffilep.c" /* yacc.c:339  */
    178  1.1  christos 
    179  1.6  christos # ifndef YY_NULLPTR
    180  1.6  christos #  if defined __cplusplus && 201103L <= __cplusplus
    181  1.6  christos #   define YY_NULLPTR nullptr
    182  1.6  christos #  else
    183  1.6  christos #   define YY_NULLPTR 0
    184  1.6  christos #  endif
    185  1.6  christos # endif
    186  1.1  christos 
    187  1.1  christos /* Enabling verbose error messages.  */
    188  1.1  christos #ifdef YYERROR_VERBOSE
    189  1.1  christos # undef YYERROR_VERBOSE
    190  1.1  christos # define YYERROR_VERBOSE 1
    191  1.1  christos #else
    192  1.1  christos # define YYERROR_VERBOSE 0
    193  1.1  christos #endif
    194  1.1  christos 
    195  1.6  christos /* In a future release of Bison, this section will be replaced
    196  1.6  christos    by #include "y.tab.h".  */
    197  1.6  christos #ifndef YY_YY_DEFFILEP_H_INCLUDED
    198  1.6  christos # define YY_YY_DEFFILEP_H_INCLUDED
    199  1.6  christos /* Debug traces.  */
    200  1.6  christos #ifndef YYDEBUG
    201  1.6  christos # define YYDEBUG 0
    202  1.6  christos #endif
    203  1.6  christos #if YYDEBUG
    204  1.6  christos extern int yydebug;
    205  1.3  christos #endif
    206  1.3  christos 
    207  1.6  christos /* Token type.  */
    208  1.6  christos #ifndef YYTOKENTYPE
    209  1.6  christos # define YYTOKENTYPE
    210  1.6  christos   enum yytokentype
    211  1.6  christos   {
    212  1.6  christos     NAME = 258,
    213  1.6  christos     LIBRARY = 259,
    214  1.6  christos     DESCRIPTION = 260,
    215  1.6  christos     STACKSIZE_K = 261,
    216  1.6  christos     HEAPSIZE = 262,
    217  1.6  christos     CODE = 263,
    218  1.6  christos     DATAU = 264,
    219  1.6  christos     DATAL = 265,
    220  1.6  christos     SECTIONS = 266,
    221  1.6  christos     EXPORTS = 267,
    222  1.6  christos     IMPORTS = 268,
    223  1.6  christos     VERSIONK = 269,
    224  1.6  christos     BASE = 270,
    225  1.6  christos     CONSTANTU = 271,
    226  1.6  christos     CONSTANTL = 272,
    227  1.6  christos     PRIVATEU = 273,
    228  1.6  christos     PRIVATEL = 274,
    229  1.6  christos     ALIGNCOMM = 275,
    230  1.6  christos     READ = 276,
    231  1.6  christos     WRITE = 277,
    232  1.6  christos     EXECUTE = 278,
    233  1.6  christos     SHARED = 279,
    234  1.6  christos     NONAMEU = 280,
    235  1.6  christos     NONAMEL = 281,
    236  1.6  christos     DIRECTIVE = 282,
    237  1.6  christos     EQUAL = 283,
    238  1.6  christos     ID = 284,
    239  1.6  christos     DIGITS = 285
    240  1.6  christos   };
    241  1.6  christos #endif
    242  1.6  christos /* Tokens.  */
    243  1.6  christos #define NAME 258
    244  1.6  christos #define LIBRARY 259
    245  1.6  christos #define DESCRIPTION 260
    246  1.6  christos #define STACKSIZE_K 261
    247  1.6  christos #define HEAPSIZE 262
    248  1.6  christos #define CODE 263
    249  1.6  christos #define DATAU 264
    250  1.6  christos #define DATAL 265
    251  1.6  christos #define SECTIONS 266
    252  1.6  christos #define EXPORTS 267
    253  1.6  christos #define IMPORTS 268
    254  1.6  christos #define VERSIONK 269
    255  1.6  christos #define BASE 270
    256  1.6  christos #define CONSTANTU 271
    257  1.6  christos #define CONSTANTL 272
    258  1.6  christos #define PRIVATEU 273
    259  1.6  christos #define PRIVATEL 274
    260  1.6  christos #define ALIGNCOMM 275
    261  1.6  christos #define READ 276
    262  1.6  christos #define WRITE 277
    263  1.6  christos #define EXECUTE 278
    264  1.6  christos #define SHARED 279
    265  1.6  christos #define NONAMEU 280
    266  1.6  christos #define NONAMEL 281
    267  1.6  christos #define DIRECTIVE 282
    268  1.6  christos #define EQUAL 283
    269  1.6  christos #define ID 284
    270  1.6  christos #define DIGITS 285
    271  1.6  christos 
    272  1.6  christos /* Value type.  */
    273  1.1  christos #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
    274  1.6  christos 
    275  1.6  christos union YYSTYPE
    276  1.1  christos {
    277  1.6  christos #line 113 "deffilep.y" /* yacc.c:355  */
    278  1.6  christos 
    279  1.1  christos   char *id;
    280  1.1  christos   const char *id_const;
    281  1.1  christos   int number;
    282  1.3  christos   bfd_vma vma;
    283  1.1  christos   char *digits;
    284  1.6  christos 
    285  1.6  christos #line 286 "deffilep.c" /* yacc.c:355  */
    286  1.6  christos };
    287  1.6  christos 
    288  1.6  christos typedef union YYSTYPE YYSTYPE;
    289  1.6  christos # define YYSTYPE_IS_TRIVIAL 1
    290  1.5  christos # define YYSTYPE_IS_DECLARED 1
    291  1.1  christos #endif
    292  1.1  christos 
    293  1.1  christos 
    294  1.6  christos extern YYSTYPE yylval;
    295  1.6  christos 
    296  1.6  christos int yyparse (void);
    297  1.6  christos 
    298  1.6  christos #endif /* !YY_YY_DEFFILEP_H_INCLUDED  */
    299  1.3  christos 
    300  1.5  christos /* Copy the second part of user declarations.  */
    301  1.1  christos 
    302  1.6  christos #line 303 "deffilep.c" /* yacc.c:358  */
    303  1.1  christos 
    304  1.1  christos #ifdef short
    305  1.1  christos # undef short
    306  1.1  christos #endif
    307  1.1  christos 
    308  1.1  christos #ifdef YYTYPE_UINT8
    309  1.1  christos typedef YYTYPE_UINT8 yytype_uint8;
    310  1.1  christos #else
    311  1.1  christos typedef unsigned char yytype_uint8;
    312  1.1  christos #endif
    313  1.1  christos 
    314  1.1  christos #ifdef YYTYPE_INT8
    315  1.1  christos typedef YYTYPE_INT8 yytype_int8;
    316  1.6  christos #else
    317  1.5  christos typedef signed char yytype_int8;
    318  1.1  christos #endif
    319  1.1  christos 
    320  1.1  christos #ifdef YYTYPE_UINT16
    321  1.1  christos typedef YYTYPE_UINT16 yytype_uint16;
    322  1.1  christos #else
    323  1.1  christos typedef unsigned short int yytype_uint16;
    324  1.1  christos #endif
    325  1.1  christos 
    326  1.1  christos #ifdef YYTYPE_INT16
    327  1.1  christos typedef YYTYPE_INT16 yytype_int16;
    328  1.1  christos #else
    329  1.1  christos typedef short int yytype_int16;
    330  1.1  christos #endif
    331  1.1  christos 
    332  1.1  christos #ifndef YYSIZE_T
    333  1.1  christos # ifdef __SIZE_TYPE__
    334  1.1  christos #  define YYSIZE_T __SIZE_TYPE__
    335  1.1  christos # elif defined size_t
    336  1.1  christos #  define YYSIZE_T size_t
    337  1.6  christos # elif ! defined YYSIZE_T
    338  1.1  christos #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
    339  1.1  christos #  define YYSIZE_T size_t
    340  1.1  christos # else
    341  1.1  christos #  define YYSIZE_T unsigned int
    342  1.1  christos # endif
    343  1.1  christos #endif
    344  1.1  christos 
    345  1.1  christos #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
    346  1.1  christos 
    347  1.1  christos #ifndef YY_
    348  1.1  christos # if defined YYENABLE_NLS && YYENABLE_NLS
    349  1.1  christos #  if ENABLE_NLS
    350  1.1  christos #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
    351  1.6  christos #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
    352  1.1  christos #  endif
    353  1.1  christos # endif
    354  1.1  christos # ifndef YY_
    355  1.6  christos #  define YY_(Msgid) Msgid
    356  1.6  christos # endif
    357  1.6  christos #endif
    358  1.6  christos 
    359  1.6  christos #ifndef YY_ATTRIBUTE
    360  1.6  christos # if (defined __GNUC__                                               \
    361  1.6  christos       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
    362  1.6  christos      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
    363  1.6  christos #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
    364  1.6  christos # else
    365  1.6  christos #  define YY_ATTRIBUTE(Spec) /* empty */
    366  1.6  christos # endif
    367  1.6  christos #endif
    368  1.6  christos 
    369  1.6  christos #ifndef YY_ATTRIBUTE_PURE
    370  1.6  christos # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
    371  1.6  christos #endif
    372  1.6  christos 
    373  1.6  christos #ifndef YY_ATTRIBUTE_UNUSED
    374  1.6  christos # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
    375  1.6  christos #endif
    376  1.6  christos 
    377  1.6  christos #if !defined _Noreturn \
    378  1.6  christos      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
    379  1.6  christos # if defined _MSC_VER && 1200 <= _MSC_VER
    380  1.6  christos #  define _Noreturn __declspec (noreturn)
    381  1.6  christos # else
    382  1.6  christos #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
    383  1.1  christos # endif
    384  1.1  christos #endif
    385  1.1  christos 
    386  1.1  christos /* Suppress unused-variable warnings by "using" E.  */
    387  1.1  christos #if ! defined lint || defined __GNUC__
    388  1.6  christos # define YYUSE(E) ((void) (E))
    389  1.1  christos #else
    390  1.6  christos # define YYUSE(E) /* empty */
    391  1.1  christos #endif
    392  1.1  christos 
    393  1.6  christos #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
    394  1.6  christos /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
    395  1.6  christos # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
    396  1.6  christos     _Pragma ("GCC diagnostic push") \
    397  1.6  christos     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
    398  1.6  christos     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
    399  1.6  christos # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
    400  1.6  christos     _Pragma ("GCC diagnostic pop")
    401  1.1  christos #else
    402  1.6  christos # define YY_INITIAL_VALUE(Value) Value
    403  1.6  christos #endif
    404  1.6  christos #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    405  1.6  christos # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    406  1.6  christos # define YY_IGNORE_MAYBE_UNINITIALIZED_END
    407  1.3  christos #endif
    408  1.6  christos #ifndef YY_INITIAL_VALUE
    409  1.6  christos # define YY_INITIAL_VALUE(Value) /* Nothing. */
    410  1.1  christos #endif
    411  1.1  christos 
    412  1.6  christos 
    413  1.1  christos #if ! defined yyoverflow || YYERROR_VERBOSE
    414  1.1  christos 
    415  1.1  christos /* The parser invokes alloca or malloc; define the necessary symbols.  */
    416  1.1  christos 
    417  1.1  christos # ifdef YYSTACK_USE_ALLOCA
    418  1.1  christos #  if YYSTACK_USE_ALLOCA
    419  1.1  christos #   ifdef __GNUC__
    420  1.1  christos #    define YYSTACK_ALLOC __builtin_alloca
    421  1.1  christos #   elif defined __BUILTIN_VA_ARG_INCR
    422  1.1  christos #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
    423  1.1  christos #   elif defined _AIX
    424  1.1  christos #    define YYSTACK_ALLOC __alloca
    425  1.1  christos #   elif defined _MSC_VER
    426  1.1  christos #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
    427  1.1  christos #    define alloca _alloca
    428  1.1  christos #   else
    429  1.1  christos #    define YYSTACK_ALLOC alloca
    430  1.6  christos #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
    431  1.1  christos #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
    432  1.6  christos       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
    433  1.6  christos #     ifndef EXIT_SUCCESS
    434  1.6  christos #      define EXIT_SUCCESS 0
    435  1.1  christos #     endif
    436  1.1  christos #    endif
    437  1.1  christos #   endif
    438  1.1  christos #  endif
    439  1.1  christos # endif
    440  1.1  christos 
    441  1.1  christos # ifdef YYSTACK_ALLOC
    442  1.6  christos    /* Pacify GCC's 'empty if-body' warning.  */
    443  1.6  christos #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
    444  1.1  christos #  ifndef YYSTACK_ALLOC_MAXIMUM
    445  1.1  christos     /* The OS might guarantee only one guard page at the bottom of the stack,
    446  1.1  christos        and a page size can be as small as 4096 bytes.  So we cannot safely
    447  1.1  christos        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
    448  1.1  christos        to allow for a few compiler-allocated temporary stack slots.  */
    449  1.1  christos #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
    450  1.1  christos #  endif
    451  1.1  christos # else
    452  1.1  christos #  define YYSTACK_ALLOC YYMALLOC
    453  1.1  christos #  define YYSTACK_FREE YYFREE
    454  1.1  christos #  ifndef YYSTACK_ALLOC_MAXIMUM
    455  1.1  christos #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
    456  1.1  christos #  endif
    457  1.6  christos #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
    458  1.1  christos        && ! ((defined YYMALLOC || defined malloc) \
    459  1.6  christos              && (defined YYFREE || defined free)))
    460  1.1  christos #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
    461  1.6  christos #   ifndef EXIT_SUCCESS
    462  1.6  christos #    define EXIT_SUCCESS 0
    463  1.1  christos #   endif
    464  1.1  christos #  endif
    465  1.1  christos #  ifndef YYMALLOC
    466  1.1  christos #   define YYMALLOC malloc
    467  1.6  christos #   if ! defined malloc && ! defined EXIT_SUCCESS
    468  1.1  christos void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
    469  1.1  christos #   endif
    470  1.1  christos #  endif
    471  1.1  christos #  ifndef YYFREE
    472  1.1  christos #   define YYFREE free
    473  1.6  christos #   if ! defined free && ! defined EXIT_SUCCESS
    474  1.1  christos void free (void *); /* INFRINGES ON USER NAME SPACE */
    475  1.1  christos #   endif
    476  1.1  christos #  endif
    477  1.1  christos # endif
    478  1.1  christos #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
    479  1.1  christos 
    480  1.1  christos 
    481  1.1  christos #if (! defined yyoverflow \
    482  1.1  christos      && (! defined __cplusplus \
    483  1.6  christos          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
    484  1.1  christos 
    485  1.1  christos /* A type that is properly aligned for any stack member.  */
    486  1.1  christos union yyalloc
    487  1.1  christos {
    488  1.6  christos   yytype_int16 yyss_alloc;
    489  1.6  christos   YYSTYPE yyvs_alloc;
    490  1.6  christos };
    491  1.1  christos 
    492  1.1  christos /* The size of the maximum gap between one aligned stack and the next.  */
    493  1.1  christos # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
    494  1.1  christos 
    495  1.1  christos /* The size of an array large to enough to hold all stacks, each with
    496  1.1  christos    N elements.  */
    497  1.1  christos # define YYSTACK_BYTES(N) \
    498  1.1  christos      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
    499  1.1  christos       + YYSTACK_GAP_MAXIMUM)
    500  1.1  christos 
    501  1.6  christos # define YYCOPY_NEEDED 1
    502  1.1  christos 
    503  1.1  christos /* Relocate STACK from its old location to the new one.  The
    504  1.1  christos    local variables YYSIZE and YYSTACKSIZE give the old and new number of
    505  1.1  christos    elements in the stack, and YYPTR gives the new location of the
    506  1.1  christos    stack.  Advance YYPTR to a properly aligned location for the next
    507  1.1  christos    stack.  */
    508  1.6  christos # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    509  1.6  christos     do                                                                  \
    510  1.6  christos       {                                                                 \
    511  1.6  christos         YYSIZE_T yynewbytes;                                            \
    512  1.6  christos         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
    513  1.6  christos         Stack = &yyptr->Stack_alloc;                                    \
    514  1.6  christos         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
    515  1.6  christos         yyptr += yynewbytes / sizeof (*yyptr);                          \
    516  1.6  christos       }                                                                 \
    517  1.6  christos     while (0)
    518  1.1  christos 
    519  1.1  christos #endif
    520  1.1  christos 
    521  1.6  christos #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
    522  1.6  christos /* Copy COUNT objects from SRC to DST.  The source and destination do
    523  1.6  christos    not overlap.  */
    524  1.6  christos # ifndef YYCOPY
    525  1.6  christos #  if defined __GNUC__ && 1 < __GNUC__
    526  1.6  christos #   define YYCOPY(Dst, Src, Count) \
    527  1.6  christos       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
    528  1.6  christos #  else
    529  1.6  christos #   define YYCOPY(Dst, Src, Count)              \
    530  1.6  christos       do                                        \
    531  1.6  christos         {                                       \
    532  1.6  christos           YYSIZE_T yyi;                         \
    533  1.6  christos           for (yyi = 0; yyi < (Count); yyi++)   \
    534  1.6  christos             (Dst)[yyi] = (Src)[yyi];            \
    535  1.6  christos         }                                       \
    536  1.6  christos       while (0)
    537  1.6  christos #  endif
    538  1.6  christos # endif
    539  1.6  christos #endif /* !YYCOPY_NEEDED */
    540  1.6  christos 
    541  1.1  christos /* YYFINAL -- State number of the termination state.  */
    542  1.1  christos #define YYFINAL  69
    543  1.1  christos /* YYLAST -- Last index in YYTABLE.  */
    544  1.3  christos #define YYLAST   149
    545  1.1  christos 
    546  1.1  christos /* YYNTOKENS -- Number of terminals.  */
    547  1.1  christos #define YYNTOKENS  35
    548  1.1  christos /* YYNNTS -- Number of nonterminals.  */
    549  1.3  christos #define YYNNTS  27
    550  1.1  christos /* YYNRULES -- Number of rules.  */
    551  1.3  christos #define YYNRULES  99
    552  1.6  christos /* YYNSTATES -- Number of states.  */
    553  1.3  christos #define YYNSTATES  146
    554  1.1  christos 
    555  1.6  christos /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
    556  1.6  christos    by yylex, with out-of-bounds checking.  */
    557  1.1  christos #define YYUNDEFTOK  2
    558  1.1  christos #define YYMAXUTOK   285
    559  1.1  christos 
    560  1.6  christos #define YYTRANSLATE(YYX)                                                \
    561  1.1  christos   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
    562  1.1  christos 
    563  1.6  christos /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
    564  1.6  christos    as returned by yylex, without out-of-bounds checking.  */
    565  1.1  christos static const yytype_uint8 yytranslate[] =
    566  1.1  christos {
    567  1.1  christos        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    568  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    569  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    570  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    571  1.1  christos        2,     2,     2,     2,    32,     2,    31,     2,     2,     2,
    572  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    573  1.1  christos        2,    33,     2,     2,    34,     2,     2,     2,     2,     2,
    574  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    575  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    576  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    577  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    578  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    579  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    580  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    581  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    582  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    583  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    584  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    585  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    586  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    587  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    588  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    589  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    590  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    591  1.1  christos        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    592  1.1  christos        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
    593  1.1  christos        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
    594  1.1  christos       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
    595  1.1  christos       25,    26,    27,    28,    29,    30
    596  1.1  christos };
    597  1.1  christos 
    598  1.1  christos #if YYDEBUG
    599  1.6  christos   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
    600  1.1  christos static const yytype_uint16 yyrline[] =
    601  1.1  christos {
    602  1.3  christos        0,   138,   138,   139,   143,   144,   145,   146,   147,   148,
    603  1.3  christos      149,   150,   151,   152,   153,   154,   155,   156,   160,   162,
    604  1.3  christos      163,   170,   177,   178,   181,   182,   183,   184,   185,   186,
    605  1.3  christos      187,   188,   191,   192,   196,   198,   200,   202,   204,   206,
    606  1.3  christos      211,   212,   216,   217,   221,   222,   226,   227,   229,   230,
    607  1.3  christos      234,   235,   236,   237,   241,   242,   243,   244,   245,   246,
    608  1.3  christos      247,   248,   249,   250,   251,   252,   259,   260,   261,   262,
    609  1.3  christos      263,   264,   265,   266,   267,   268,   271,   272,   278,   284,
    610  1.3  christos      290,   298,   299,   302,   303,   307,   308,   312,   313,   316,
    611  1.3  christos      317,   320,   321,   327,   335,   336,   339,   340,   343,   345
    612  1.1  christos };
    613  1.1  christos #endif
    614  1.1  christos 
    615  1.6  christos #if YYDEBUG || YYERROR_VERBOSE || 0
    616  1.1  christos /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    617  1.1  christos    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
    618  1.1  christos static const char *const yytname[] =
    619  1.1  christos {
    620  1.1  christos   "$end", "error", "$undefined", "NAME", "LIBRARY", "DESCRIPTION",
    621  1.1  christos   "STACKSIZE_K", "HEAPSIZE", "CODE", "DATAU", "DATAL", "SECTIONS",
    622  1.1  christos   "EXPORTS", "IMPORTS", "VERSIONK", "BASE", "CONSTANTU", "CONSTANTL",
    623  1.1  christos   "PRIVATEU", "PRIVATEL", "ALIGNCOMM", "READ", "WRITE", "EXECUTE",
    624  1.1  christos   "SHARED", "NONAMEU", "NONAMEL", "DIRECTIVE", "EQUAL", "ID", "DIGITS",
    625  1.1  christos   "'.'", "','", "'='", "'@'", "$accept", "start", "command", "explist",
    626  1.1  christos   "expline", "exp_opt_list", "exp_opt", "implist", "impline", "seclist",
    627  1.1  christos   "secline", "attr_list", "opt_comma", "opt_number", "attr",
    628  1.1  christos   "keyword_as_name", "opt_name2", "opt_name", "opt_equalequal_name",
    629  1.1  christos   "opt_ordinal", "opt_equal_name", "opt_base", "anylang_id", "opt_digits",
    630  1.6  christos   "opt_id", "NUMBER", "VMA", YY_NULLPTR
    631  1.1  christos };
    632  1.1  christos #endif
    633  1.1  christos 
    634  1.1  christos # ifdef YYPRINT
    635  1.6  christos /* YYTOKNUM[NUM] -- (External) token number corresponding to the
    636  1.6  christos    (internal) symbol number NUM (which must be that of a token).  */
    637  1.1  christos static const yytype_uint16 yytoknum[] =
    638  1.1  christos {
    639  1.1  christos        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
    640  1.1  christos      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
    641  1.1  christos      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
    642  1.1  christos      285,    46,    44,    61,    64
    643  1.1  christos };
    644  1.1  christos # endif
    645  1.1  christos 
    646  1.6  christos #define YYPACT_NINF -82
    647  1.6  christos 
    648  1.6  christos #define yypact_value_is_default(Yystate) \
    649  1.6  christos   (!!((Yystate) == (-82)))
    650  1.6  christos 
    651  1.6  christos #define YYTABLE_NINF -48
    652  1.6  christos 
    653  1.6  christos #define yytable_value_is_error(Yytable_value) \
    654  1.6  christos   0
    655  1.3  christos 
    656  1.6  christos   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    657  1.6  christos      STATE-NUM.  */
    658  1.6  christos static const yytype_int8 yypact[] =
    659  1.5  christos {
    660  1.6  christos      122,    11,    11,   -25,     9,     9,    53,    53,   -17,    11,
    661  1.6  christos       14,     9,   -18,    20,    95,   -82,   -82,   -82,   -82,   -82,
    662  1.6  christos      -82,   -82,   -82,   -82,   -82,   -82,   -82,   -82,   -82,   -82,
    663  1.6  christos      -82,   -82,   -82,   -82,   -82,   -82,   -82,   -82,    29,    11,
    664  1.6  christos       47,   -82,    67,    67,   -82,   -82,    54,    54,   -82,   -82,
    665  1.6  christos      -82,   -82,    48,   -82,    48,   -14,   -17,   -82,    11,   -82,
    666  1.6  christos       58,    50,    14,   -82,    61,   -82,    64,    33,   -82,   -82,
    667  1.6  christos      -82,    11,    47,   -82,    11,    63,   -82,   -82,     9,   -82,
    668  1.6  christos      -82,   -82,    53,   -82,    48,   -82,   -82,    11,    60,    76,
    669  1.6  christos       81,   -82,     9,   -82,    83,     9,   -82,   -82,    84,   -82,
    670  1.6  christos      -82,   -82,     9,    79,   -26,    85,   -82,   -82,    88,   -82,
    671  1.6  christos      -82,   -82,   -82,    36,    89,    90,   -82,    55,   -82,   -82,
    672  1.6  christos      -82,   -82,   -82,   -82,   -82,   -82,   -82,   -82,    79,    79,
    673  1.6  christos      -82,    92,    13,    92,    92,    36,   -82,    59,   -82,   -82,
    674  1.6  christos      -82,   -82,    92,    92,   -82,   -82
    675  1.5  christos };
    676  1.3  christos 
    677  1.6  christos   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
    678  1.6  christos      Performed when YYTABLE does not specify something else to do.  Zero
    679  1.6  christos      means the default is an error.  */
    680  1.5  christos static const yytype_uint8 yydefact[] =
    681  1.5  christos {
    682  1.5  christos        0,    82,    82,     0,     0,     0,     0,     0,     0,    18,
    683  1.5  christos        0,     0,     0,     0,     0,     3,    66,    60,    73,    64,
    684  1.5  christos       55,    58,    59,    63,    65,    74,    54,    56,    57,    69,
    685  1.5  christos       70,    71,    75,    62,    72,    67,    68,    61,    76,     0,
    686  1.5  christos        0,    81,    90,    90,     6,    98,    49,    49,    50,    51,
    687  1.5  christos       52,    53,     9,    45,    10,     0,    11,    41,    12,    19,
    688  1.5  christos       88,     0,    13,    33,    14,    91,     0,     0,    16,     1,
    689  1.5  christos        2,     0,    77,    78,     0,     0,     4,     5,     0,     7,
    690  1.5  christos        8,    46,     0,    43,    42,    40,    20,     0,    86,     0,
    691  1.5  christos        0,    32,     0,    92,    95,     0,    80,    79,     0,    48,
    692  1.5  christos       44,    87,     0,    47,    84,     0,    15,    94,    97,    17,
    693  1.5  christos       99,    89,    85,    23,     0,     0,    39,     0,    96,    93,
    694  1.5  christos       28,    29,    26,    27,    30,    31,    24,    25,    47,    47,
    695  1.5  christos       83,    84,    84,    84,    84,    23,    38,     0,    36,    37,
    696  1.5  christos       21,    22,    84,    84,    34,    35
    697  1.5  christos };
    698  1.3  christos 
    699  1.6  christos   /* YYPGOTO[NTERM-NUM].  */
    700  1.6  christos static const yytype_int16 yypgoto[] =
    701  1.6  christos {
    702  1.6  christos      -82,   -82,   107,   -82,    65,   -11,   -82,   -82,    75,   -82,
    703  1.6  christos       82,    -4,   -81,    93,    57,   102,    -8,   141,   -75,   -82,
    704  1.6  christos      -82,   101,   -82,   -82,   -82,    -5,   -82
    705  1.6  christos };
    706  1.6  christos 
    707  1.6  christos   /* YYDEFGOTO[NTERM-NUM].  */
    708  1.5  christos static const yytype_int16 yydefgoto[] =
    709  1.5  christos {
    710  1.5  christos       -1,    14,    15,    58,    59,   128,   129,    62,    63,    56,
    711  1.5  christos       57,    52,    82,    79,    53,    40,    41,    42,   116,   103,
    712  1.5  christos       88,    76,    67,   108,   119,    46,   111
    713  1.5  christos };
    714  1.1  christos 
    715  1.6  christos   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
    716  1.6  christos      positive, shift that token.  If negative, reduce the rule whose
    717  1.6  christos      number is the opposite.  If YYTABLE_NINF, syntax error.  */
    718  1.1  christos static const yytype_int16 yytable[] =
    719  1.1  christos {
    720  1.3  christos       47,    60,   114,    54,    44,   115,    64,    48,    49,    50,
    721  1.1  christos       51,    65,    55,    66,    16,    83,    17,    18,    19,    20,
    722  1.3  christos       21,    22,   113,    23,    24,    25,    26,    27,    28,    29,
    723  1.1  christos       30,    73,    31,    32,    33,    34,    35,    36,    37,    45,
    724  1.3  christos       38,   114,    39,    61,   137,   120,   121,   134,   135,    68,
    725  1.3  christos       60,    84,   122,   123,   124,   125,   136,   138,   139,   140,
    726  1.3  christos       71,   126,   127,    96,    94,    95,    97,   144,   145,   -47,
    727  1.3  christos      -47,   -47,   -47,    99,    48,    49,    50,    51,    74,   101,
    728  1.3  christos       81,    89,    75,    90,   132,    45,    78,   106,   142,    45,
    729  1.3  christos      109,    87,    92,    93,   102,    69,    98,   112,     1,     2,
    730  1.3  christos        3,     4,     5,     6,     7,   104,     8,     9,    10,    11,
    731  1.3  christos      105,    81,   133,   107,   110,    12,   117,   118,   130,   131,
    732  1.3  christos      114,    70,    13,    86,   141,     1,     2,     3,     4,     5,
    733  1.3  christos        6,     7,   143,     8,     9,    10,    11,    91,    85,   100,
    734  1.3  christos       80,    72,    12,    43,    77,     0,     0,     0,     0,    13
    735  1.1  christos };
    736  1.1  christos 
    737  1.1  christos static const yytype_int16 yycheck[] =
    738  1.1  christos {
    739  1.1  christos        5,     9,    28,     7,    29,    31,    11,    21,    22,    23,
    740  1.1  christos       24,    29,    29,    31,     3,    29,     5,     6,     7,     8,
    741  1.1  christos        9,    10,   103,    12,    13,    14,    15,    16,    17,    18,
    742  1.1  christos       19,    39,    21,    22,    23,    24,    25,    26,    27,    30,
    743  1.3  christos       29,    28,    31,    29,    31,     9,    10,   128,   129,    29,
    744  1.3  christos       58,    55,    16,    17,    18,    19,   131,   132,   133,   134,
    745  1.3  christos       31,    25,    26,    71,    31,    32,    74,   142,   143,    21,
    746  1.3  christos       22,    23,    24,    78,    21,    22,    23,    24,    31,    87,
    747  1.3  christos       32,    31,    15,    33,    29,    30,    32,    92,    29,    30,
    748  1.3  christos       95,    33,    31,    29,    34,     0,    33,   102,     3,     4,
    749  1.3  christos        5,     6,     7,     8,     9,    29,    11,    12,    13,    14,
    750  1.3  christos       29,    32,   117,    30,    30,    20,    31,    29,    29,    29,
    751  1.3  christos       28,    14,    27,    58,   135,     3,     4,     5,     6,     7,
    752  1.3  christos        8,     9,   137,    11,    12,    13,    14,    62,    56,    82,
    753  1.3  christos       47,    39,    20,     2,    43,    -1,    -1,    -1,    -1,    27
    754  1.1  christos };
    755  1.1  christos 
    756  1.6  christos   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    757  1.6  christos      symbol of state STATE-NUM.  */
    758  1.1  christos static const yytype_uint8 yystos[] =
    759  1.1  christos {
    760  1.1  christos        0,     3,     4,     5,     6,     7,     8,     9,    11,    12,
    761  1.1  christos       13,    14,    20,    27,    36,    37,     3,     5,     6,     7,
    762  1.1  christos        8,     9,    10,    12,    13,    14,    15,    16,    17,    18,
    763  1.1  christos       19,    21,    22,    23,    24,    25,    26,    27,    29,    31,
    764  1.1  christos       50,    51,    52,    52,    29,    30,    60,    60,    21,    22,
    765  1.1  christos       23,    24,    46,    49,    46,    29,    44,    45,    38,    39,
    766  1.1  christos       51,    29,    42,    43,    60,    29,    31,    57,    29,     0,
    767  1.1  christos       37,    31,    50,    51,    31,    15,    56,    56,    32,    48,
    768  1.1  christos       48,    32,    47,    29,    46,    45,    39,    33,    55,    31,
    769  1.1  christos       33,    43,    31,    29,    31,    32,    51,    51,    33,    60,
    770  1.1  christos       49,    51,    34,    54,    29,    29,    60,    30,    58,    60,
    771  1.3  christos       30,    61,    60,    47,    28,    31,    53,    31,    29,    59,
    772  1.3  christos        9,    10,    16,    17,    18,    19,    25,    26,    40,    41,
    773  1.3  christos       29,    29,    29,    60,    47,    47,    53,    31,    53,    53,
    774  1.3  christos       53,    40,    29,    60,    53,    53
    775  1.1  christos };
    776  1.1  christos 
    777  1.6  christos   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
    778  1.6  christos static const yytype_uint8 yyr1[] =
    779  1.6  christos {
    780  1.6  christos        0,    35,    36,    36,    37,    37,    37,    37,    37,    37,
    781  1.6  christos       37,    37,    37,    37,    37,    37,    37,    37,    38,    38,
    782  1.6  christos       38,    39,    40,    40,    41,    41,    41,    41,    41,    41,
    783  1.6  christos       41,    41,    42,    42,    43,    43,    43,    43,    43,    43,
    784  1.6  christos       44,    44,    45,    45,    46,    46,    47,    47,    48,    48,
    785  1.6  christos       49,    49,    49,    49,    50,    50,    50,    50,    50,    50,
    786  1.6  christos       50,    50,    50,    50,    50,    50,    50,    50,    50,    50,
    787  1.6  christos       50,    50,    50,    50,    50,    50,    51,    51,    51,    51,
    788  1.6  christos       51,    52,    52,    53,    53,    54,    54,    55,    55,    56,
    789  1.6  christos       56,    57,    57,    57,    58,    58,    59,    59,    60,    61
    790  1.6  christos };
    791  1.1  christos 
    792  1.6  christos   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
    793  1.6  christos static const yytype_uint8 yyr2[] =
    794  1.6  christos {
    795  1.6  christos        0,     2,     2,     1,     3,     3,     2,     3,     3,     2,
    796  1.6  christos        2,     2,     2,     2,     2,     4,     2,     4,     0,     1,
    797  1.6  christos        2,     7,     3,     0,     1,     1,     1,     1,     1,     1,
    798  1.6  christos        1,     1,     2,     1,     8,     8,     6,     6,     6,     4,
    799  1.6  christos        2,     1,     2,     2,     3,     1,     1,     0,     2,     0,
    800  1.6  christos        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    801  1.6  christos        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    802  1.6  christos        1,     1,     1,     1,     1,     1,     1,     2,     2,     3,
    803  1.6  christos        3,     1,     0,     2,     0,     2,     0,     2,     0,     3,
    804  1.6  christos        0,     1,     2,     4,     1,     0,     1,     0,     1,     1
    805  1.6  christos };
    806  1.1  christos 
    807  1.1  christos 
    808  1.6  christos #define yyerrok         (yyerrstatus = 0)
    809  1.6  christos #define yyclearin       (yychar = YYEMPTY)
    810  1.6  christos #define YYEMPTY         (-2)
    811  1.6  christos #define YYEOF           0
    812  1.6  christos 
    813  1.6  christos #define YYACCEPT        goto yyacceptlab
    814  1.6  christos #define YYABORT         goto yyabortlab
    815  1.6  christos #define YYERROR         goto yyerrorlab
    816  1.1  christos 
    817  1.1  christos 
    818  1.1  christos #define YYRECOVERING()  (!!yyerrstatus)
    819  1.1  christos 
    820  1.6  christos #define YYBACKUP(Token, Value)                                  \
    821  1.6  christos do                                                              \
    822  1.6  christos   if (yychar == YYEMPTY)                                        \
    823  1.6  christos     {                                                           \
    824  1.6  christos       yychar = (Token);                                         \
    825  1.6  christos       yylval = (Value);                                         \
    826  1.6  christos       YYPOPSTACK (yylen);                                       \
    827  1.6  christos       yystate = *yyssp;                                         \
    828  1.6  christos       goto yybackup;                                            \
    829  1.6  christos     }                                                           \
    830  1.6  christos   else                                                          \
    831  1.6  christos     {                                                           \
    832  1.1  christos       yyerror (YY_("syntax error: cannot back up")); \
    833  1.6  christos       YYERROR;                                                  \
    834  1.6  christos     }                                                           \
    835  1.6  christos while (0)
    836  1.6  christos 
    837  1.6  christos /* Error token number */
    838  1.6  christos #define YYTERROR        1
    839  1.6  christos #define YYERRCODE       256
    840  1.5  christos 
    841  1.1  christos 
    842  1.1  christos 
    843  1.1  christos /* Enable debugging if requested.  */
    844  1.1  christos #if YYDEBUG
    845  1.1  christos 
    846  1.1  christos # ifndef YYFPRINTF
    847  1.1  christos #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
    848  1.1  christos #  define YYFPRINTF fprintf
    849  1.1  christos # endif
    850  1.1  christos 
    851  1.6  christos # define YYDPRINTF(Args)                        \
    852  1.6  christos do {                                            \
    853  1.6  christos   if (yydebug)                                  \
    854  1.6  christos     YYFPRINTF Args;                             \
    855  1.6  christos } while (0)
    856  1.6  christos 
    857  1.6  christos /* This macro is provided for backward compatibility. */
    858  1.6  christos #ifndef YY_LOCATION_PRINT
    859  1.6  christos # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
    860  1.6  christos #endif
    861  1.6  christos 
    862  1.3  christos 
    863  1.6  christos # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
    864  1.6  christos do {                                                                      \
    865  1.6  christos   if (yydebug)                                                            \
    866  1.6  christos     {                                                                     \
    867  1.6  christos       YYFPRINTF (stderr, "%s ", Title);                                   \
    868  1.6  christos       yy_symbol_print (stderr,                                            \
    869  1.6  christos                   Type, Value); \
    870  1.6  christos       YYFPRINTF (stderr, "\n");                                           \
    871  1.6  christos     }                                                                     \
    872  1.6  christos } while (0)
    873  1.1  christos 
    874  1.1  christos 
    875  1.6  christos /*----------------------------------------.
    876  1.6  christos | Print this symbol's value on YYOUTPUT.  |
    877  1.6  christos `----------------------------------------*/
    878  1.6  christos 
    879  1.1  christos static void
    880  1.1  christos yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
    881  1.1  christos {
    882  1.6  christos   FILE *yyo = yyoutput;
    883  1.6  christos   YYUSE (yyo);
    884  1.1  christos   if (!yyvaluep)
    885  1.1  christos     return;
    886  1.1  christos # ifdef YYPRINT
    887  1.1  christos   if (yytype < YYNTOKENS)
    888  1.1  christos     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
    889  1.1  christos # endif
    890  1.6  christos   YYUSE (yytype);
    891  1.1  christos }
    892  1.1  christos 
    893  1.1  christos 
    894  1.1  christos /*--------------------------------.
    895  1.1  christos | Print this symbol on YYOUTPUT.  |
    896  1.1  christos `--------------------------------*/
    897  1.1  christos 
    898  1.1  christos static void
    899  1.1  christos yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
    900  1.1  christos {
    901  1.6  christos   YYFPRINTF (yyoutput, "%s %s (",
    902  1.6  christos              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
    903  1.1  christos 
    904  1.1  christos   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
    905  1.1  christos   YYFPRINTF (yyoutput, ")");
    906  1.1  christos }
    907  1.1  christos 
    908  1.1  christos /*------------------------------------------------------------------.
    909  1.1  christos | yy_stack_print -- Print the state stack from its BOTTOM up to its |
    910  1.1  christos | TOP (included).                                                   |
    911  1.1  christos `------------------------------------------------------------------*/
    912  1.1  christos 
    913  1.1  christos static void
    914  1.6  christos yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
    915  1.1  christos {
    916  1.1  christos   YYFPRINTF (stderr, "Stack now");
    917  1.6  christos   for (; yybottom <= yytop; yybottom++)
    918  1.6  christos     {
    919  1.6  christos       int yybot = *yybottom;
    920  1.6  christos       YYFPRINTF (stderr, " %d", yybot);
    921  1.6  christos     }
    922  1.1  christos   YYFPRINTF (stderr, "\n");
    923  1.1  christos }
    924  1.1  christos 
    925  1.6  christos # define YY_STACK_PRINT(Bottom, Top)                            \
    926  1.6  christos do {                                                            \
    927  1.6  christos   if (yydebug)                                                  \
    928  1.6  christos     yy_stack_print ((Bottom), (Top));                           \
    929  1.6  christos } while (0)
    930  1.1  christos 
    931  1.1  christos 
    932  1.1  christos /*------------------------------------------------.
    933  1.1  christos | Report that the YYRULE is going to be reduced.  |
    934  1.1  christos `------------------------------------------------*/
    935  1.1  christos 
    936  1.1  christos static void
    937  1.6  christos yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
    938  1.1  christos {
    939  1.6  christos   unsigned long int yylno = yyrline[yyrule];
    940  1.1  christos   int yynrhs = yyr2[yyrule];
    941  1.1  christos   int yyi;
    942  1.1  christos   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
    943  1.6  christos              yyrule - 1, yylno);
    944  1.1  christos   /* The symbols being reduced.  */
    945  1.1  christos   for (yyi = 0; yyi < yynrhs; yyi++)
    946  1.1  christos     {
    947  1.6  christos       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
    948  1.6  christos       yy_symbol_print (stderr,
    949  1.6  christos                        yystos[yyssp[yyi + 1 - yynrhs]],
    950  1.6  christos                        &(yyvsp[(yyi + 1) - (yynrhs)])
    951  1.6  christos                                               );
    952  1.6  christos       YYFPRINTF (stderr, "\n");
    953  1.1  christos     }
    954  1.1  christos }
    955  1.1  christos 
    956  1.6  christos # define YY_REDUCE_PRINT(Rule)          \
    957  1.6  christos do {                                    \
    958  1.6  christos   if (yydebug)                          \
    959  1.6  christos     yy_reduce_print (yyssp, yyvsp, Rule); \
    960  1.6  christos } while (0)
    961  1.1  christos 
    962  1.1  christos /* Nonzero means print parse trace.  It is left uninitialized so that
    963  1.1  christos    multiple parsers can coexist.  */
    964  1.1  christos int yydebug;
    965  1.1  christos #else /* !YYDEBUG */
    966  1.1  christos # define YYDPRINTF(Args)
    967  1.1  christos # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
    968  1.1  christos # define YY_STACK_PRINT(Bottom, Top)
    969  1.1  christos # define YY_REDUCE_PRINT(Rule)
    970  1.1  christos #endif /* !YYDEBUG */
    971  1.1  christos 
    972  1.1  christos 
    973  1.1  christos /* YYINITDEPTH -- initial size of the parser's stacks.  */
    974  1.6  christos #ifndef YYINITDEPTH
    975  1.1  christos # define YYINITDEPTH 200
    976  1.1  christos #endif
    977  1.1  christos 
    978  1.1  christos /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
    979  1.1  christos    if the built-in stack extension method is used).
    980  1.1  christos 
    981  1.1  christos    Do not make this value too large; the results are undefined if
    982  1.1  christos    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
    983  1.1  christos    evaluated with infinite-precision integer arithmetic.  */
    984  1.1  christos 
    985  1.1  christos #ifndef YYMAXDEPTH
    986  1.1  christos # define YYMAXDEPTH 10000
    987  1.1  christos #endif
    988  1.1  christos 
    989  1.1  christos 
    990  1.1  christos #if YYERROR_VERBOSE
    991  1.1  christos 
    992  1.1  christos # ifndef yystrlen
    993  1.1  christos #  if defined __GLIBC__ && defined _STRING_H
    994  1.1  christos #   define yystrlen strlen
    995  1.1  christos #  else
    996  1.1  christos /* Return the length of YYSTR.  */
    997  1.1  christos static YYSIZE_T
    998  1.1  christos yystrlen (const char *yystr)
    999  1.1  christos {
   1000  1.1  christos   YYSIZE_T yylen;
   1001  1.1  christos   for (yylen = 0; yystr[yylen]; yylen++)
   1002  1.1  christos     continue;
   1003  1.1  christos   return yylen;
   1004  1.1  christos }
   1005  1.1  christos #  endif
   1006  1.1  christos # endif
   1007  1.1  christos 
   1008  1.1  christos # ifndef yystpcpy
   1009  1.1  christos #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
   1010  1.1  christos #   define yystpcpy stpcpy
   1011  1.1  christos #  else
   1012  1.1  christos /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   1013  1.1  christos    YYDEST.  */
   1014  1.1  christos static char *
   1015  1.1  christos yystpcpy (char *yydest, const char *yysrc)
   1016  1.1  christos {
   1017  1.1  christos   char *yyd = yydest;
   1018  1.1  christos   const char *yys = yysrc;
   1019  1.1  christos 
   1020  1.1  christos   while ((*yyd++ = *yys++) != '\0')
   1021  1.1  christos     continue;
   1022  1.1  christos 
   1023  1.1  christos   return yyd - 1;
   1024  1.1  christos }
   1025  1.1  christos #  endif
   1026  1.1  christos # endif
   1027  1.1  christos 
   1028  1.1  christos # ifndef yytnamerr
   1029  1.1  christos /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   1030  1.1  christos    quotes and backslashes, so that it's suitable for yyerror.  The
   1031  1.1  christos    heuristic is that double-quoting is unnecessary unless the string
   1032  1.1  christos    contains an apostrophe, a comma, or backslash (other than
   1033  1.1  christos    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   1034  1.1  christos    null, do not copy; instead, return the length of what the result
   1035  1.1  christos    would have been.  */
   1036  1.1  christos static YYSIZE_T
   1037  1.1  christos yytnamerr (char *yyres, const char *yystr)
   1038  1.1  christos {
   1039  1.1  christos   if (*yystr == '"')
   1040  1.1  christos     {
   1041  1.1  christos       YYSIZE_T yyn = 0;
   1042  1.1  christos       char const *yyp = yystr;
   1043  1.1  christos 
   1044  1.1  christos       for (;;)
   1045  1.6  christos         switch (*++yyp)
   1046  1.6  christos           {
   1047  1.6  christos           case '\'':
   1048  1.6  christos           case ',':
   1049  1.6  christos             goto do_not_strip_quotes;
   1050  1.6  christos 
   1051  1.6  christos           case '\\':
   1052  1.6  christos             if (*++yyp != '\\')
   1053  1.6  christos               goto do_not_strip_quotes;
   1054  1.6  christos             /* Fall through.  */
   1055  1.6  christos           default:
   1056  1.6  christos             if (yyres)
   1057  1.6  christos               yyres[yyn] = *yyp;
   1058  1.6  christos             yyn++;
   1059  1.6  christos             break;
   1060  1.6  christos 
   1061  1.6  christos           case '"':
   1062  1.6  christos             if (yyres)
   1063  1.6  christos               yyres[yyn] = '\0';
   1064  1.6  christos             return yyn;
   1065  1.6  christos           }
   1066  1.1  christos     do_not_strip_quotes: ;
   1067  1.1  christos     }
   1068  1.1  christos 
   1069  1.1  christos   if (! yyres)
   1070  1.1  christos     return yystrlen (yystr);
   1071  1.1  christos 
   1072  1.1  christos   return yystpcpy (yyres, yystr) - yyres;
   1073  1.1  christos }
   1074  1.1  christos # endif
   1075  1.1  christos 
   1076  1.6  christos /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
   1077  1.6  christos    about the unexpected token YYTOKEN for the state stack whose top is
   1078  1.6  christos    YYSSP.
   1079  1.6  christos 
   1080  1.6  christos    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
   1081  1.6  christos    not large enough to hold the message.  In that case, also set
   1082  1.6  christos    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
   1083  1.6  christos    required number of bytes is too large to store.  */
   1084  1.6  christos static int
   1085  1.6  christos yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
   1086  1.6  christos                 yytype_int16 *yyssp, int yytoken)
   1087  1.1  christos {
   1088  1.6  christos   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
   1089  1.6  christos   YYSIZE_T yysize = yysize0;
   1090  1.6  christos   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   1091  1.6  christos   /* Internationalized format string. */
   1092  1.6  christos   const char *yyformat = YY_NULLPTR;
   1093  1.6  christos   /* Arguments of yyformat. */
   1094  1.6  christos   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   1095  1.6  christos   /* Number of reported tokens (one for the "unexpected", one per
   1096  1.6  christos      "expected"). */
   1097  1.6  christos   int yycount = 0;
   1098  1.6  christos 
   1099  1.6  christos   /* There are many possibilities here to consider:
   1100  1.6  christos      - If this state is a consistent state with a default action, then
   1101  1.6  christos        the only way this function was invoked is if the default action
   1102  1.6  christos        is an error action.  In that case, don't check for expected
   1103  1.6  christos        tokens because there are none.
   1104  1.6  christos      - The only way there can be no lookahead present (in yychar) is if
   1105  1.6  christos        this state is a consistent state with a default action.  Thus,
   1106  1.6  christos        detecting the absence of a lookahead is sufficient to determine
   1107  1.6  christos        that there is no unexpected or expected token to report.  In that
   1108  1.6  christos        case, just report a simple "syntax error".
   1109  1.6  christos      - Don't assume there isn't a lookahead just because this state is a
   1110  1.6  christos        consistent state with a default action.  There might have been a
   1111  1.6  christos        previous inconsistent state, consistent state with a non-default
   1112  1.6  christos        action, or user semantic action that manipulated yychar.
   1113  1.6  christos      - Of course, the expected token list depends on states to have
   1114  1.6  christos        correct lookahead information, and it depends on the parser not
   1115  1.6  christos        to perform extra reductions after fetching a lookahead from the
   1116  1.6  christos        scanner and before detecting a syntax error.  Thus, state merging
   1117  1.6  christos        (from LALR or IELR) and default reductions corrupt the expected
   1118  1.6  christos        token list.  However, the list is correct for canonical LR with
   1119  1.6  christos        one exception: it will still contain any token that will not be
   1120  1.6  christos        accepted due to an error action in a later state.
   1121  1.6  christos   */
   1122  1.6  christos   if (yytoken != YYEMPTY)
   1123  1.6  christos     {
   1124  1.6  christos       int yyn = yypact[*yyssp];
   1125  1.6  christos       yyarg[yycount++] = yytname[yytoken];
   1126  1.6  christos       if (!yypact_value_is_default (yyn))
   1127  1.6  christos         {
   1128  1.6  christos           /* Start YYX at -YYN if negative to avoid negative indexes in
   1129  1.6  christos              YYCHECK.  In other words, skip the first -YYN actions for
   1130  1.6  christos              this state because they are default actions.  */
   1131  1.6  christos           int yyxbegin = yyn < 0 ? -yyn : 0;
   1132  1.6  christos           /* Stay within bounds of both yycheck and yytname.  */
   1133  1.6  christos           int yychecklim = YYLAST - yyn + 1;
   1134  1.6  christos           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
   1135  1.6  christos           int yyx;
   1136  1.6  christos 
   1137  1.6  christos           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
   1138  1.6  christos             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
   1139  1.6  christos                 && !yytable_value_is_error (yytable[yyx + yyn]))
   1140  1.6  christos               {
   1141  1.6  christos                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
   1142  1.6  christos                   {
   1143  1.6  christos                     yycount = 1;
   1144  1.6  christos                     yysize = yysize0;
   1145  1.6  christos                     break;
   1146  1.6  christos                   }
   1147  1.6  christos                 yyarg[yycount++] = yytname[yyx];
   1148  1.6  christos                 {
   1149  1.6  christos                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
   1150  1.6  christos                   if (! (yysize <= yysize1
   1151  1.6  christos                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
   1152  1.6  christos                     return 2;
   1153  1.6  christos                   yysize = yysize1;
   1154  1.6  christos                 }
   1155  1.6  christos               }
   1156  1.6  christos         }
   1157  1.6  christos     }
   1158  1.1  christos 
   1159  1.6  christos   switch (yycount)
   1160  1.1  christos     {
   1161  1.6  christos # define YYCASE_(N, S)                      \
   1162  1.6  christos       case N:                               \
   1163  1.6  christos         yyformat = S;                       \
   1164  1.6  christos       break
   1165  1.6  christos       YYCASE_(0, YY_("syntax error"));
   1166  1.6  christos       YYCASE_(1, YY_("syntax error, unexpected %s"));
   1167  1.6  christos       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
   1168  1.6  christos       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
   1169  1.6  christos       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
   1170  1.6  christos       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
   1171  1.6  christos # undef YYCASE_
   1172  1.6  christos     }
   1173  1.5  christos 
   1174  1.6  christos   {
   1175  1.6  christos     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
   1176  1.6  christos     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
   1177  1.6  christos       return 2;
   1178  1.6  christos     yysize = yysize1;
   1179  1.6  christos   }
   1180  1.6  christos 
   1181  1.6  christos   if (*yymsg_alloc < yysize)
   1182  1.6  christos     {
   1183  1.6  christos       *yymsg_alloc = 2 * yysize;
   1184  1.6  christos       if (! (yysize <= *yymsg_alloc
   1185  1.6  christos              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
   1186  1.6  christos         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
   1187  1.6  christos       return 1;
   1188  1.6  christos     }
   1189  1.6  christos 
   1190  1.6  christos   /* Avoid sprintf, as that infringes on the user's name space.
   1191  1.6  christos      Don't have undefined behavior even if the translation
   1192  1.6  christos      produced a string with the wrong number of "%s"s.  */
   1193  1.6  christos   {
   1194  1.6  christos     char *yyp = *yymsg;
   1195  1.6  christos     int yyi = 0;
   1196  1.6  christos     while ((*yyp = *yyformat) != '\0')
   1197  1.6  christos       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
   1198  1.6  christos         {
   1199  1.6  christos           yyp += yytnamerr (yyp, yyarg[yyi++]);
   1200  1.6  christos           yyformat += 2;
   1201  1.6  christos         }
   1202  1.6  christos       else
   1203  1.6  christos         {
   1204  1.6  christos           yyp++;
   1205  1.6  christos           yyformat++;
   1206  1.6  christos         }
   1207  1.6  christos   }
   1208  1.6  christos   return 0;
   1209  1.1  christos }
   1210  1.1  christos #endif /* YYERROR_VERBOSE */
   1211  1.1  christos 
   1212  1.1  christos /*-----------------------------------------------.
   1213  1.1  christos | Release the memory associated to this symbol.  |
   1214  1.1  christos `-----------------------------------------------*/
   1215  1.1  christos 
   1216  1.1  christos static void
   1217  1.1  christos yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
   1218  1.1  christos {
   1219  1.1  christos   YYUSE (yyvaluep);
   1220  1.1  christos   if (!yymsg)
   1221  1.1  christos     yymsg = "Deleting";
   1222  1.1  christos   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
   1223  1.1  christos 
   1224  1.6  christos   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   1225  1.6  christos   YYUSE (yytype);
   1226  1.6  christos   YY_IGNORE_MAYBE_UNINITIALIZED_END
   1227  1.1  christos }
   1228  1.1  christos 
   1229  1.1  christos 
   1230  1.1  christos 
   1231  1.1  christos 
   1232  1.6  christos /* The lookahead symbol.  */
   1233  1.1  christos int yychar;
   1234  1.1  christos 
   1235  1.6  christos /* The semantic value of the lookahead symbol.  */
   1236  1.1  christos YYSTYPE yylval;
   1237  1.1  christos /* Number of syntax errors so far.  */
   1238  1.1  christos int yynerrs;
   1239  1.1  christos 
   1240  1.1  christos 
   1241  1.1  christos /*----------.
   1242  1.1  christos | yyparse.  |
   1243  1.1  christos `----------*/
   1244  1.1  christos 
   1245  1.1  christos int
   1246  1.1  christos yyparse (void)
   1247  1.6  christos {
   1248  1.6  christos     int yystate;
   1249  1.6  christos     /* Number of tokens to shift before error messages enabled.  */
   1250  1.6  christos     int yyerrstatus;
   1251  1.6  christos 
   1252  1.6  christos     /* The stacks and their tools:
   1253  1.6  christos        'yyss': related to states.
   1254  1.6  christos        'yyvs': related to semantic values.
   1255  1.6  christos 
   1256  1.6  christos        Refer to the stacks through separate pointers, to allow yyoverflow
   1257  1.6  christos        to reallocate them elsewhere.  */
   1258  1.6  christos 
   1259  1.6  christos     /* The state stack.  */
   1260  1.6  christos     yytype_int16 yyssa[YYINITDEPTH];
   1261  1.6  christos     yytype_int16 *yyss;
   1262  1.6  christos     yytype_int16 *yyssp;
   1263  1.6  christos 
   1264  1.6  christos     /* The semantic value stack.  */
   1265  1.6  christos     YYSTYPE yyvsa[YYINITDEPTH];
   1266  1.6  christos     YYSTYPE *yyvs;
   1267  1.6  christos     YYSTYPE *yyvsp;
   1268  1.6  christos 
   1269  1.6  christos     YYSIZE_T yystacksize;
   1270  1.5  christos 
   1271  1.1  christos   int yyn;
   1272  1.1  christos   int yyresult;
   1273  1.6  christos   /* Lookahead token as an internal (translated) token number.  */
   1274  1.1  christos   int yytoken = 0;
   1275  1.6  christos   /* The variables used to return semantic value and location from the
   1276  1.6  christos      action routines.  */
   1277  1.6  christos   YYSTYPE yyval;
   1278  1.6  christos 
   1279  1.1  christos #if YYERROR_VERBOSE
   1280  1.1  christos   /* Buffer for error messages, and its allocated size.  */
   1281  1.1  christos   char yymsgbuf[128];
   1282  1.1  christos   char *yymsg = yymsgbuf;
   1283  1.1  christos   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
   1284  1.1  christos #endif
   1285  1.1  christos 
   1286  1.1  christos #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
   1287  1.1  christos 
   1288  1.1  christos   /* The number of symbols on the RHS of the reduced rule.
   1289  1.1  christos      Keep to zero when no symbol should be popped.  */
   1290  1.1  christos   int yylen = 0;
   1291  1.1  christos 
   1292  1.6  christos   yyssp = yyss = yyssa;
   1293  1.6  christos   yyvsp = yyvs = yyvsa;
   1294  1.6  christos   yystacksize = YYINITDEPTH;
   1295  1.6  christos 
   1296  1.1  christos   YYDPRINTF ((stderr, "Starting parse\n"));
   1297  1.1  christos 
   1298  1.1  christos   yystate = 0;
   1299  1.1  christos   yyerrstatus = 0;
   1300  1.1  christos   yynerrs = 0;
   1301  1.6  christos   yychar = YYEMPTY; /* Cause a token to be read.  */
   1302  1.1  christos   goto yysetstate;
   1303  1.1  christos 
   1304  1.1  christos /*------------------------------------------------------------.
   1305  1.1  christos | yynewstate -- Push a new state, which is found in yystate.  |
   1306  1.1  christos `------------------------------------------------------------*/
   1307  1.1  christos  yynewstate:
   1308  1.1  christos   /* In all cases, when you get here, the value and location stacks
   1309  1.1  christos      have just been pushed.  So pushing a state here evens the stacks.  */
   1310  1.1  christos   yyssp++;
   1311  1.1  christos 
   1312  1.1  christos  yysetstate:
   1313  1.1  christos   *yyssp = yystate;
   1314  1.1  christos 
   1315  1.1  christos   if (yyss + yystacksize - 1 <= yyssp)
   1316  1.1  christos     {
   1317  1.1  christos       /* Get the current used size of the three stacks, in elements.  */
   1318  1.1  christos       YYSIZE_T yysize = yyssp - yyss + 1;
   1319  1.1  christos 
   1320  1.1  christos #ifdef yyoverflow
   1321  1.1  christos       {
   1322  1.6  christos         /* Give user a chance to reallocate the stack.  Use copies of
   1323  1.6  christos            these so that the &'s don't force the real ones into
   1324  1.6  christos            memory.  */
   1325  1.6  christos         YYSTYPE *yyvs1 = yyvs;
   1326  1.6  christos         yytype_int16 *yyss1 = yyss;
   1327  1.6  christos 
   1328  1.6  christos         /* Each stack pointer address is followed by the size of the
   1329  1.6  christos            data in use in that stack, in bytes.  This used to be a
   1330  1.6  christos            conditional around just the two extra args, but that might
   1331  1.6  christos            be undefined if yyoverflow is a macro.  */
   1332  1.6  christos         yyoverflow (YY_("memory exhausted"),
   1333  1.6  christos                     &yyss1, yysize * sizeof (*yyssp),
   1334  1.6  christos                     &yyvs1, yysize * sizeof (*yyvsp),
   1335  1.6  christos                     &yystacksize);
   1336  1.1  christos 
   1337  1.6  christos         yyss = yyss1;
   1338  1.6  christos         yyvs = yyvs1;
   1339  1.1  christos       }
   1340  1.1  christos #else /* no yyoverflow */
   1341  1.1  christos # ifndef YYSTACK_RELOCATE
   1342  1.1  christos       goto yyexhaustedlab;
   1343  1.1  christos # else
   1344  1.1  christos       /* Extend the stack our own way.  */
   1345  1.1  christos       if (YYMAXDEPTH <= yystacksize)
   1346  1.6  christos         goto yyexhaustedlab;
   1347  1.1  christos       yystacksize *= 2;
   1348  1.1  christos       if (YYMAXDEPTH < yystacksize)
   1349  1.6  christos         yystacksize = YYMAXDEPTH;
   1350  1.1  christos 
   1351  1.1  christos       {
   1352  1.6  christos         yytype_int16 *yyss1 = yyss;
   1353  1.6  christos         union yyalloc *yyptr =
   1354  1.6  christos           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
   1355  1.6  christos         if (! yyptr)
   1356  1.6  christos           goto yyexhaustedlab;
   1357  1.6  christos         YYSTACK_RELOCATE (yyss_alloc, yyss);
   1358  1.6  christos         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
   1359  1.1  christos #  undef YYSTACK_RELOCATE
   1360  1.6  christos         if (yyss1 != yyssa)
   1361  1.6  christos           YYSTACK_FREE (yyss1);
   1362  1.1  christos       }
   1363  1.1  christos # endif
   1364  1.1  christos #endif /* no yyoverflow */
   1365  1.1  christos 
   1366  1.1  christos       yyssp = yyss + yysize - 1;
   1367  1.1  christos       yyvsp = yyvs + yysize - 1;
   1368  1.1  christos 
   1369  1.1  christos       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
   1370  1.6  christos                   (unsigned long int) yystacksize));
   1371  1.1  christos 
   1372  1.1  christos       if (yyss + yystacksize - 1 <= yyssp)
   1373  1.6  christos         YYABORT;
   1374  1.1  christos     }
   1375  1.1  christos 
   1376  1.1  christos   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
   1377  1.1  christos 
   1378  1.6  christos   if (yystate == YYFINAL)
   1379  1.6  christos     YYACCEPT;
   1380  1.6  christos 
   1381  1.1  christos   goto yybackup;
   1382  1.1  christos 
   1383  1.1  christos /*-----------.
   1384  1.1  christos | yybackup.  |
   1385  1.1  christos `-----------*/
   1386  1.1  christos yybackup:
   1387  1.1  christos 
   1388  1.1  christos   /* Do appropriate processing given the current state.  Read a
   1389  1.6  christos      lookahead token if we need one and don't already have one.  */
   1390  1.1  christos 
   1391  1.6  christos   /* First try to decide what to do without reference to lookahead token.  */
   1392  1.1  christos   yyn = yypact[yystate];
   1393  1.6  christos   if (yypact_value_is_default (yyn))
   1394  1.1  christos     goto yydefault;
   1395  1.1  christos 
   1396  1.6  christos   /* Not known => get a lookahead token if don't already have one.  */
   1397  1.1  christos 
   1398  1.6  christos   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   1399  1.1  christos   if (yychar == YYEMPTY)
   1400  1.1  christos     {
   1401  1.1  christos       YYDPRINTF ((stderr, "Reading a token: "));
   1402  1.6  christos       yychar = yylex ();
   1403  1.1  christos     }
   1404  1.1  christos 
   1405  1.1  christos   if (yychar <= YYEOF)
   1406  1.1  christos     {
   1407  1.1  christos       yychar = yytoken = YYEOF;
   1408  1.1  christos       YYDPRINTF ((stderr, "Now at end of input.\n"));
   1409  1.1  christos     }
   1410  1.1  christos   else
   1411  1.1  christos     {
   1412  1.1  christos       yytoken = YYTRANSLATE (yychar);
   1413  1.1  christos       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
   1414  1.1  christos     }
   1415  1.1  christos 
   1416  1.1  christos   /* If the proper action on seeing token YYTOKEN is to reduce or to
   1417  1.1  christos      detect an error, take that action.  */
   1418  1.1  christos   yyn += yytoken;
   1419  1.1  christos   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
   1420  1.1  christos     goto yydefault;
   1421  1.1  christos   yyn = yytable[yyn];
   1422  1.1  christos   if (yyn <= 0)
   1423  1.1  christos     {
   1424  1.6  christos       if (yytable_value_is_error (yyn))
   1425  1.6  christos         goto yyerrlab;
   1426  1.1  christos       yyn = -yyn;
   1427  1.1  christos       goto yyreduce;
   1428  1.1  christos     }
   1429  1.1  christos 
   1430  1.1  christos   /* Count tokens shifted since error; after three, turn off error
   1431  1.1  christos      status.  */
   1432  1.1  christos   if (yyerrstatus)
   1433  1.1  christos     yyerrstatus--;
   1434  1.1  christos 
   1435  1.6  christos   /* Shift the lookahead token.  */
   1436  1.1  christos   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
   1437  1.1  christos 
   1438  1.6  christos   /* Discard the shifted token.  */
   1439  1.6  christos   yychar = YYEMPTY;
   1440  1.1  christos 
   1441  1.1  christos   yystate = yyn;
   1442  1.6  christos   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   1443  1.1  christos   *++yyvsp = yylval;
   1444  1.6  christos   YY_IGNORE_MAYBE_UNINITIALIZED_END
   1445  1.1  christos 
   1446  1.1  christos   goto yynewstate;
   1447  1.1  christos 
   1448  1.1  christos 
   1449  1.1  christos /*-----------------------------------------------------------.
   1450  1.1  christos | yydefault -- do the default action for the current state.  |
   1451  1.1  christos `-----------------------------------------------------------*/
   1452  1.1  christos yydefault:
   1453  1.1  christos   yyn = yydefact[yystate];
   1454  1.1  christos   if (yyn == 0)
   1455  1.1  christos     goto yyerrlab;
   1456  1.1  christos   goto yyreduce;
   1457  1.1  christos 
   1458  1.1  christos 
   1459  1.1  christos /*-----------------------------.
   1460  1.1  christos | yyreduce -- Do a reduction.  |
   1461  1.1  christos `-----------------------------*/
   1462  1.1  christos yyreduce:
   1463  1.1  christos   /* yyn is the number of a rule to reduce with.  */
   1464  1.1  christos   yylen = yyr2[yyn];
   1465  1.1  christos 
   1466  1.1  christos   /* If YYLEN is nonzero, implement the default value of the action:
   1467  1.6  christos      '$$ = $1'.
   1468  1.1  christos 
   1469  1.1  christos      Otherwise, the following line sets YYVAL to garbage.
   1470  1.1  christos      This behavior is undocumented and Bison
   1471  1.1  christos      users should not rely upon it.  Assigning to YYVAL
   1472  1.1  christos      unconditionally makes the parser a bit smaller, and it avoids a
   1473  1.1  christos      GCC warning that YYVAL may be used uninitialized.  */
   1474  1.1  christos   yyval = yyvsp[1-yylen];
   1475  1.1  christos 
   1476  1.1  christos 
   1477  1.1  christos   YY_REDUCE_PRINT (yyn);
   1478  1.1  christos   switch (yyn)
   1479  1.1  christos     {
   1480  1.1  christos         case 4:
   1481  1.6  christos #line 143 "deffilep.y" /* yacc.c:1646  */
   1482  1.6  christos     { def_image_name ((yyvsp[-1].id), (yyvsp[0].vma), 0); }
   1483  1.6  christos #line 1484 "deffilep.c" /* yacc.c:1646  */
   1484  1.1  christos     break;
   1485  1.1  christos 
   1486  1.1  christos   case 5:
   1487  1.6  christos #line 144 "deffilep.y" /* yacc.c:1646  */
   1488  1.6  christos     { def_image_name ((yyvsp[-1].id), (yyvsp[0].vma), 1); }
   1489  1.6  christos #line 1490 "deffilep.c" /* yacc.c:1646  */
   1490  1.1  christos     break;
   1491  1.1  christos 
   1492  1.1  christos   case 6:
   1493  1.6  christos #line 145 "deffilep.y" /* yacc.c:1646  */
   1494  1.6  christos     { def_description ((yyvsp[0].id));}
   1495  1.6  christos #line 1496 "deffilep.c" /* yacc.c:1646  */
   1496  1.1  christos     break;
   1497  1.1  christos 
   1498  1.1  christos   case 7:
   1499  1.6  christos #line 146 "deffilep.y" /* yacc.c:1646  */
   1500  1.6  christos     { def_stacksize ((yyvsp[-1].number), (yyvsp[0].number));}
   1501  1.6  christos #line 1502 "deffilep.c" /* yacc.c:1646  */
   1502  1.1  christos     break;
   1503  1.1  christos 
   1504  1.1  christos   case 8:
   1505  1.6  christos #line 147 "deffilep.y" /* yacc.c:1646  */
   1506  1.6  christos     { def_heapsize ((yyvsp[-1].number), (yyvsp[0].number));}
   1507  1.6  christos #line 1508 "deffilep.c" /* yacc.c:1646  */
   1508  1.1  christos     break;
   1509  1.1  christos 
   1510  1.1  christos   case 9:
   1511  1.6  christos #line 148 "deffilep.y" /* yacc.c:1646  */
   1512  1.6  christos     { def_section ("CODE", (yyvsp[0].number));}
   1513  1.6  christos #line 1514 "deffilep.c" /* yacc.c:1646  */
   1514  1.1  christos     break;
   1515  1.1  christos 
   1516  1.1  christos   case 10:
   1517  1.6  christos #line 149 "deffilep.y" /* yacc.c:1646  */
   1518  1.6  christos     { def_section ("DATA", (yyvsp[0].number));}
   1519  1.6  christos #line 1520 "deffilep.c" /* yacc.c:1646  */
   1520  1.1  christos     break;
   1521  1.1  christos 
   1522  1.1  christos   case 14:
   1523  1.6  christos #line 153 "deffilep.y" /* yacc.c:1646  */
   1524  1.6  christos     { def_version ((yyvsp[0].number), 0);}
   1525  1.6  christos #line 1526 "deffilep.c" /* yacc.c:1646  */
   1526  1.1  christos     break;
   1527  1.1  christos 
   1528  1.1  christos   case 15:
   1529  1.6  christos #line 154 "deffilep.y" /* yacc.c:1646  */
   1530  1.6  christos     { def_version ((yyvsp[-2].number), (yyvsp[0].number));}
   1531  1.6  christos #line 1532 "deffilep.c" /* yacc.c:1646  */
   1532  1.1  christos     break;
   1533  1.1  christos 
   1534  1.1  christos   case 16:
   1535  1.6  christos #line 155 "deffilep.y" /* yacc.c:1646  */
   1536  1.6  christos     { def_directive ((yyvsp[0].id));}
   1537  1.6  christos #line 1538 "deffilep.c" /* yacc.c:1646  */
   1538  1.1  christos     break;
   1539  1.1  christos 
   1540  1.1  christos   case 17:
   1541  1.6  christos #line 156 "deffilep.y" /* yacc.c:1646  */
   1542  1.6  christos     { def_aligncomm ((yyvsp[-2].id), (yyvsp[0].number));}
   1543  1.6  christos #line 1544 "deffilep.c" /* yacc.c:1646  */
   1544  1.1  christos     break;
   1545  1.1  christos 
   1546  1.1  christos   case 21:
   1547  1.6  christos #line 171 "deffilep.y" /* yacc.c:1646  */
   1548  1.6  christos     { def_exports ((yyvsp[-6].id), (yyvsp[-5].id), (yyvsp[-4].number), (yyvsp[-2].number), (yyvsp[0].id)); }
   1549  1.6  christos #line 1550 "deffilep.c" /* yacc.c:1646  */
   1550  1.1  christos     break;
   1551  1.1  christos 
   1552  1.1  christos   case 22:
   1553  1.6  christos #line 177 "deffilep.y" /* yacc.c:1646  */
   1554  1.6  christos     { (yyval.number) = (yyvsp[-2].number) | (yyvsp[0].number); }
   1555  1.6  christos #line 1556 "deffilep.c" /* yacc.c:1646  */
   1556  1.1  christos     break;
   1557  1.1  christos 
   1558  1.1  christos   case 23:
   1559  1.6  christos #line 178 "deffilep.y" /* yacc.c:1646  */
   1560  1.1  christos     { (yyval.number) = 0; }
   1561  1.6  christos #line 1562 "deffilep.c" /* yacc.c:1646  */
   1562  1.1  christos     break;
   1563  1.1  christos 
   1564  1.1  christos   case 24:
   1565  1.6  christos #line 181 "deffilep.y" /* yacc.c:1646  */
   1566  1.1  christos     { (yyval.number) = 1; }
   1567  1.6  christos #line 1568 "deffilep.c" /* yacc.c:1646  */
   1568  1.1  christos     break;
   1569  1.1  christos 
   1570  1.1  christos   case 25:
   1571  1.6  christos #line 182 "deffilep.y" /* yacc.c:1646  */
   1572  1.1  christos     { (yyval.number) = 1; }
   1573  1.6  christos #line 1574 "deffilep.c" /* yacc.c:1646  */
   1574  1.1  christos     break;
   1575  1.1  christos 
   1576  1.1  christos   case 26:
   1577  1.6  christos #line 183 "deffilep.y" /* yacc.c:1646  */
   1578  1.1  christos     { (yyval.number) = 2; }
   1579  1.6  christos #line 1580 "deffilep.c" /* yacc.c:1646  */
   1580  1.1  christos     break;
   1581  1.1  christos 
   1582  1.1  christos   case 27:
   1583  1.6  christos #line 184 "deffilep.y" /* yacc.c:1646  */
   1584  1.1  christos     { (yyval.number) = 2; }
   1585  1.6  christos #line 1586 "deffilep.c" /* yacc.c:1646  */
   1586  1.1  christos     break;
   1587  1.1  christos 
   1588  1.1  christos   case 28:
   1589  1.6  christos #line 185 "deffilep.y" /* yacc.c:1646  */
   1590  1.1  christos     { (yyval.number) = 4; }
   1591  1.6  christos #line 1592 "deffilep.c" /* yacc.c:1646  */
   1592  1.1  christos     break;
   1593  1.1  christos 
   1594  1.1  christos   case 29:
   1595  1.6  christos #line 186 "deffilep.y" /* yacc.c:1646  */
   1596  1.1  christos     { (yyval.number) = 4; }
   1597  1.6  christos #line 1598 "deffilep.c" /* yacc.c:1646  */
   1598  1.1  christos     break;
   1599  1.1  christos 
   1600  1.1  christos   case 30:
   1601  1.6  christos #line 187 "deffilep.y" /* yacc.c:1646  */
   1602  1.1  christos     { (yyval.number) = 8; }
   1603  1.6  christos #line 1604 "deffilep.c" /* yacc.c:1646  */
   1604  1.1  christos     break;
   1605  1.1  christos 
   1606  1.1  christos   case 31:
   1607  1.6  christos #line 188 "deffilep.y" /* yacc.c:1646  */
   1608  1.1  christos     { (yyval.number) = 8; }
   1609  1.6  christos #line 1610 "deffilep.c" /* yacc.c:1646  */
   1610  1.1  christos     break;
   1611  1.1  christos 
   1612  1.1  christos   case 34:
   1613  1.6  christos #line 197 "deffilep.y" /* yacc.c:1646  */
   1614  1.6  christos     { def_import ((yyvsp[-7].id), (yyvsp[-5].id), (yyvsp[-3].id), (yyvsp[-1].id), -1, (yyvsp[0].id)); }
   1615  1.6  christos #line 1616 "deffilep.c" /* yacc.c:1646  */
   1616  1.1  christos     break;
   1617  1.1  christos 
   1618  1.1  christos   case 35:
   1619  1.6  christos #line 199 "deffilep.y" /* yacc.c:1646  */
   1620  1.6  christos     { def_import ((yyvsp[-7].id), (yyvsp[-5].id), (yyvsp[-3].id),  0, (yyvsp[-1].number), (yyvsp[0].id)); }
   1621  1.6  christos #line 1622 "deffilep.c" /* yacc.c:1646  */
   1622  1.1  christos     break;
   1623  1.1  christos 
   1624  1.1  christos   case 36:
   1625  1.6  christos #line 201 "deffilep.y" /* yacc.c:1646  */
   1626  1.6  christos     { def_import ((yyvsp[-5].id), (yyvsp[-3].id),	0, (yyvsp[-1].id), -1, (yyvsp[0].id)); }
   1627  1.6  christos #line 1628 "deffilep.c" /* yacc.c:1646  */
   1628  1.1  christos     break;
   1629  1.1  christos 
   1630  1.1  christos   case 37:
   1631  1.6  christos #line 203 "deffilep.y" /* yacc.c:1646  */
   1632  1.6  christos     { def_import ((yyvsp[-5].id), (yyvsp[-3].id),	0,  0, (yyvsp[-1].number), (yyvsp[0].id)); }
   1633  1.6  christos #line 1634 "deffilep.c" /* yacc.c:1646  */
   1634  1.1  christos     break;
   1635  1.1  christos 
   1636  1.1  christos   case 38:
   1637  1.6  christos #line 205 "deffilep.y" /* yacc.c:1646  */
   1638  1.6  christos     { def_import( 0, (yyvsp[-5].id), (yyvsp[-3].id), (yyvsp[-1].id), -1, (yyvsp[0].id)); }
   1639  1.6  christos #line 1640 "deffilep.c" /* yacc.c:1646  */
   1640  1.1  christos     break;
   1641  1.1  christos 
   1642  1.1  christos   case 39:
   1643  1.6  christos #line 207 "deffilep.y" /* yacc.c:1646  */
   1644  1.6  christos     { def_import ( 0, (yyvsp[-3].id),	0, (yyvsp[-1].id), -1, (yyvsp[0].id)); }
   1645  1.6  christos #line 1646 "deffilep.c" /* yacc.c:1646  */
   1646  1.1  christos     break;
   1647  1.1  christos 
   1648  1.1  christos   case 42:
   1649  1.6  christos #line 216 "deffilep.y" /* yacc.c:1646  */
   1650  1.6  christos     { def_section ((yyvsp[-1].id), (yyvsp[0].number));}
   1651  1.6  christos #line 1652 "deffilep.c" /* yacc.c:1646  */
   1652  1.1  christos     break;
   1653  1.1  christos 
   1654  1.1  christos   case 43:
   1655  1.6  christos #line 217 "deffilep.y" /* yacc.c:1646  */
   1656  1.6  christos     { def_section_alt ((yyvsp[-1].id), (yyvsp[0].id));}
   1657  1.6  christos #line 1658 "deffilep.c" /* yacc.c:1646  */
   1658  1.1  christos     break;
   1659  1.1  christos 
   1660  1.1  christos   case 44:
   1661  1.6  christos #line 221 "deffilep.y" /* yacc.c:1646  */
   1662  1.6  christos     { (yyval.number) = (yyvsp[-2].number) | (yyvsp[0].number); }
   1663  1.6  christos #line 1664 "deffilep.c" /* yacc.c:1646  */
   1664  1.1  christos     break;
   1665  1.1  christos 
   1666  1.1  christos   case 45:
   1667  1.6  christos #line 222 "deffilep.y" /* yacc.c:1646  */
   1668  1.6  christos     { (yyval.number) = (yyvsp[0].number); }
   1669  1.6  christos #line 1670 "deffilep.c" /* yacc.c:1646  */
   1670  1.1  christos     break;
   1671  1.1  christos 
   1672  1.1  christos   case 48:
   1673  1.6  christos #line 229 "deffilep.y" /* yacc.c:1646  */
   1674  1.6  christos     { (yyval.number)=(yyvsp[0].number);}
   1675  1.6  christos #line 1676 "deffilep.c" /* yacc.c:1646  */
   1676  1.1  christos     break;
   1677  1.1  christos 
   1678  1.1  christos   case 49:
   1679  1.6  christos #line 230 "deffilep.y" /* yacc.c:1646  */
   1680  1.1  christos     { (yyval.number)=-1;}
   1681  1.6  christos #line 1682 "deffilep.c" /* yacc.c:1646  */
   1682  1.1  christos     break;
   1683  1.1  christos 
   1684  1.1  christos   case 50:
   1685  1.6  christos #line 234 "deffilep.y" /* yacc.c:1646  */
   1686  1.1  christos     { (yyval.number) = 1;}
   1687  1.6  christos #line 1688 "deffilep.c" /* yacc.c:1646  */
   1688  1.1  christos     break;
   1689  1.1  christos 
   1690  1.1  christos   case 51:
   1691  1.6  christos #line 235 "deffilep.y" /* yacc.c:1646  */
   1692  1.1  christos     { (yyval.number) = 2;}
   1693  1.6  christos #line 1694 "deffilep.c" /* yacc.c:1646  */
   1694  1.1  christos     break;
   1695  1.1  christos 
   1696  1.1  christos   case 52:
   1697  1.6  christos #line 236 "deffilep.y" /* yacc.c:1646  */
   1698  1.1  christos     { (yyval.number)=4;}
   1699  1.6  christos #line 1700 "deffilep.c" /* yacc.c:1646  */
   1700  1.1  christos     break;
   1701  1.1  christos 
   1702  1.1  christos   case 53:
   1703  1.6  christos #line 237 "deffilep.y" /* yacc.c:1646  */
   1704  1.1  christos     { (yyval.number)=8;}
   1705  1.6  christos #line 1706 "deffilep.c" /* yacc.c:1646  */
   1706  1.1  christos     break;
   1707  1.1  christos 
   1708  1.1  christos   case 54:
   1709  1.6  christos #line 241 "deffilep.y" /* yacc.c:1646  */
   1710  1.1  christos     { (yyval.id_const) = "BASE"; }
   1711  1.6  christos #line 1712 "deffilep.c" /* yacc.c:1646  */
   1712  1.1  christos     break;
   1713  1.1  christos 
   1714  1.1  christos   case 55:
   1715  1.6  christos #line 242 "deffilep.y" /* yacc.c:1646  */
   1716  1.1  christos     { (yyval.id_const) = "CODE"; }
   1717  1.6  christos #line 1718 "deffilep.c" /* yacc.c:1646  */
   1718  1.1  christos     break;
   1719  1.1  christos 
   1720  1.1  christos   case 56:
   1721  1.6  christos #line 243 "deffilep.y" /* yacc.c:1646  */
   1722  1.1  christos     { (yyval.id_const) = "CONSTANT"; }
   1723  1.6  christos #line 1724 "deffilep.c" /* yacc.c:1646  */
   1724  1.1  christos     break;
   1725  1.1  christos 
   1726  1.1  christos   case 57:
   1727  1.6  christos #line 244 "deffilep.y" /* yacc.c:1646  */
   1728  1.1  christos     { (yyval.id_const) = "constant"; }
   1729  1.6  christos #line 1730 "deffilep.c" /* yacc.c:1646  */
   1730  1.1  christos     break;
   1731  1.1  christos 
   1732  1.1  christos   case 58:
   1733  1.6  christos #line 245 "deffilep.y" /* yacc.c:1646  */
   1734  1.1  christos     { (yyval.id_const) = "DATA"; }
   1735  1.6  christos #line 1736 "deffilep.c" /* yacc.c:1646  */
   1736  1.1  christos     break;
   1737  1.1  christos 
   1738  1.1  christos   case 59:
   1739  1.6  christos #line 246 "deffilep.y" /* yacc.c:1646  */
   1740  1.1  christos     { (yyval.id_const) = "data"; }
   1741  1.6  christos #line 1742 "deffilep.c" /* yacc.c:1646  */
   1742  1.1  christos     break;
   1743  1.1  christos 
   1744  1.1  christos   case 60:
   1745  1.6  christos #line 247 "deffilep.y" /* yacc.c:1646  */
   1746  1.1  christos     { (yyval.id_const) = "DESCRIPTION"; }
   1747  1.6  christos #line 1748 "deffilep.c" /* yacc.c:1646  */
   1748  1.1  christos     break;
   1749  1.1  christos 
   1750  1.1  christos   case 61:
   1751  1.6  christos #line 248 "deffilep.y" /* yacc.c:1646  */
   1752  1.1  christos     { (yyval.id_const) = "DIRECTIVE"; }
   1753  1.6  christos #line 1754 "deffilep.c" /* yacc.c:1646  */
   1754  1.1  christos     break;
   1755  1.1  christos 
   1756  1.1  christos   case 62:
   1757  1.6  christos #line 249 "deffilep.y" /* yacc.c:1646  */
   1758  1.1  christos     { (yyval.id_const) = "EXECUTE"; }
   1759  1.6  christos #line 1760 "deffilep.c" /* yacc.c:1646  */
   1760  1.1  christos     break;
   1761  1.1  christos 
   1762  1.1  christos   case 63:
   1763  1.6  christos #line 250 "deffilep.y" /* yacc.c:1646  */
   1764  1.1  christos     { (yyval.id_const) = "EXPORTS"; }
   1765  1.6  christos #line 1766 "deffilep.c" /* yacc.c:1646  */
   1766  1.1  christos     break;
   1767  1.1  christos 
   1768  1.1  christos   case 64:
   1769  1.6  christos #line 251 "deffilep.y" /* yacc.c:1646  */
   1770  1.1  christos     { (yyval.id_const) = "HEAPSIZE"; }
   1771  1.6  christos #line 1772 "deffilep.c" /* yacc.c:1646  */
   1772  1.1  christos     break;
   1773  1.1  christos 
   1774  1.1  christos   case 65:
   1775  1.6  christos #line 252 "deffilep.y" /* yacc.c:1646  */
   1776  1.1  christos     { (yyval.id_const) = "IMPORTS"; }
   1777  1.6  christos #line 1778 "deffilep.c" /* yacc.c:1646  */
   1778  1.1  christos     break;
   1779  1.1  christos 
   1780  1.1  christos   case 66:
   1781  1.6  christos #line 259 "deffilep.y" /* yacc.c:1646  */
   1782  1.1  christos     { (yyval.id_const) = "NAME"; }
   1783  1.6  christos #line 1784 "deffilep.c" /* yacc.c:1646  */
   1784  1.1  christos     break;
   1785  1.1  christos 
   1786  1.1  christos   case 67:
   1787  1.6  christos #line 260 "deffilep.y" /* yacc.c:1646  */
   1788  1.1  christos     { (yyval.id_const) = "NONAME"; }
   1789  1.6  christos #line 1790 "deffilep.c" /* yacc.c:1646  */
   1790  1.1  christos     break;
   1791  1.1  christos 
   1792  1.1  christos   case 68:
   1793  1.6  christos #line 261 "deffilep.y" /* yacc.c:1646  */
   1794  1.1  christos     { (yyval.id_const) = "noname"; }
   1795  1.6  christos #line 1796 "deffilep.c" /* yacc.c:1646  */
   1796  1.1  christos     break;
   1797  1.1  christos 
   1798  1.1  christos   case 69:
   1799  1.6  christos #line 262 "deffilep.y" /* yacc.c:1646  */
   1800  1.1  christos     { (yyval.id_const) = "PRIVATE"; }
   1801  1.6  christos #line 1802 "deffilep.c" /* yacc.c:1646  */
   1802  1.1  christos     break;
   1803  1.1  christos 
   1804  1.1  christos   case 70:
   1805  1.6  christos #line 263 "deffilep.y" /* yacc.c:1646  */
   1806  1.1  christos     { (yyval.id_const) = "private"; }
   1807  1.6  christos #line 1808 "deffilep.c" /* yacc.c:1646  */
   1808  1.1  christos     break;
   1809  1.1  christos 
   1810  1.1  christos   case 71:
   1811  1.6  christos #line 264 "deffilep.y" /* yacc.c:1646  */
   1812  1.1  christos     { (yyval.id_const) = "READ"; }
   1813  1.6  christos #line 1814 "deffilep.c" /* yacc.c:1646  */
   1814  1.1  christos     break;
   1815  1.1  christos 
   1816  1.1  christos   case 72:
   1817  1.6  christos #line 265 "deffilep.y" /* yacc.c:1646  */
   1818  1.1  christos     { (yyval.id_const) = "SHARED"; }
   1819  1.6  christos #line 1820 "deffilep.c" /* yacc.c:1646  */
   1820  1.1  christos     break;
   1821  1.1  christos 
   1822  1.1  christos   case 73:
   1823  1.6  christos #line 266 "deffilep.y" /* yacc.c:1646  */
   1824  1.1  christos     { (yyval.id_const) = "STACKSIZE"; }
   1825  1.6  christos #line 1826 "deffilep.c" /* yacc.c:1646  */
   1826  1.1  christos     break;
   1827  1.1  christos 
   1828  1.1  christos   case 74:
   1829  1.6  christos #line 267 "deffilep.y" /* yacc.c:1646  */
   1830  1.1  christos     { (yyval.id_const) = "VERSION"; }
   1831  1.6  christos #line 1832 "deffilep.c" /* yacc.c:1646  */
   1832  1.1  christos     break;
   1833  1.1  christos 
   1834  1.1  christos   case 75:
   1835  1.6  christos #line 268 "deffilep.y" /* yacc.c:1646  */
   1836  1.1  christos     { (yyval.id_const) = "WRITE"; }
   1837  1.6  christos #line 1838 "deffilep.c" /* yacc.c:1646  */
   1838  1.1  christos     break;
   1839  1.1  christos 
   1840  1.1  christos   case 76:
   1841  1.6  christos #line 271 "deffilep.y" /* yacc.c:1646  */
   1842  1.6  christos     { (yyval.id) = (yyvsp[0].id); }
   1843  1.6  christos #line 1844 "deffilep.c" /* yacc.c:1646  */
   1844  1.1  christos     break;
   1845  1.1  christos 
   1846  1.1  christos   case 77:
   1847  1.6  christos #line 273 "deffilep.y" /* yacc.c:1646  */
   1848  1.1  christos     {
   1849  1.6  christos 	    char *name = xmalloc (strlen ((yyvsp[0].id_const)) + 2);
   1850  1.6  christos 	    sprintf (name, ".%s", (yyvsp[0].id_const));
   1851  1.1  christos 	    (yyval.id) = name;
   1852  1.1  christos 	  }
   1853  1.6  christos #line 1854 "deffilep.c" /* yacc.c:1646  */
   1854  1.1  christos     break;
   1855  1.1  christos 
   1856  1.1  christos   case 78:
   1857  1.6  christos #line 279 "deffilep.y" /* yacc.c:1646  */
   1858  1.3  christos     {
   1859  1.6  christos 	    char *name = def_pool_alloc (strlen ((yyvsp[0].id)) + 2);
   1860  1.6  christos 	    sprintf (name, ".%s", (yyvsp[0].id));
   1861  1.1  christos 	    (yyval.id) = name;
   1862  1.1  christos 	  }
   1863  1.6  christos #line 1864 "deffilep.c" /* yacc.c:1646  */
   1864  1.1  christos     break;
   1865  1.1  christos 
   1866  1.1  christos   case 79:
   1867  1.6  christos #line 285 "deffilep.y" /* yacc.c:1646  */
   1868  1.3  christos     {
   1869  1.6  christos 	    char *name = def_pool_alloc (strlen ((yyvsp[-2].id_const)) + 1 + strlen ((yyvsp[0].id)) + 1);
   1870  1.6  christos 	    sprintf (name, "%s.%s", (yyvsp[-2].id_const), (yyvsp[0].id));
   1871  1.1  christos 	    (yyval.id) = name;
   1872  1.1  christos 	  }
   1873  1.6  christos #line 1874 "deffilep.c" /* yacc.c:1646  */
   1874  1.1  christos     break;
   1875  1.1  christos 
   1876  1.1  christos   case 80:
   1877  1.6  christos #line 291 "deffilep.y" /* yacc.c:1646  */
   1878  1.3  christos     {
   1879  1.6  christos 	    char *name = def_pool_alloc (strlen ((yyvsp[-2].id)) + 1 + strlen ((yyvsp[0].id)) + 1);
   1880  1.6  christos 	    sprintf (name, "%s.%s", (yyvsp[-2].id), (yyvsp[0].id));
   1881  1.1  christos 	    (yyval.id) = name;
   1882  1.1  christos 	  }
   1883  1.6  christos #line 1884 "deffilep.c" /* yacc.c:1646  */
   1884  1.1  christos     break;
   1885  1.1  christos 
   1886  1.1  christos   case 81:
   1887  1.6  christos #line 298 "deffilep.y" /* yacc.c:1646  */
   1888  1.6  christos     { (yyval.id) = (yyvsp[0].id); }
   1889  1.6  christos #line 1890 "deffilep.c" /* yacc.c:1646  */
   1890  1.1  christos     break;
   1891  1.1  christos 
   1892  1.1  christos   case 82:
   1893  1.6  christos #line 299 "deffilep.y" /* yacc.c:1646  */
   1894  1.1  christos     { (yyval.id) = ""; }
   1895  1.6  christos #line 1896 "deffilep.c" /* yacc.c:1646  */
   1896  1.1  christos     break;
   1897  1.1  christos 
   1898  1.1  christos   case 83:
   1899  1.6  christos #line 302 "deffilep.y" /* yacc.c:1646  */
   1900  1.6  christos     { (yyval.id) = (yyvsp[0].id); }
   1901  1.6  christos #line 1902 "deffilep.c" /* yacc.c:1646  */
   1902  1.1  christos     break;
   1903  1.1  christos 
   1904  1.1  christos   case 84:
   1905  1.6  christos #line 303 "deffilep.y" /* yacc.c:1646  */
   1906  1.1  christos     { (yyval.id) = 0; }
   1907  1.6  christos #line 1908 "deffilep.c" /* yacc.c:1646  */
   1908  1.1  christos     break;
   1909  1.1  christos 
   1910  1.1  christos   case 85:
   1911  1.6  christos #line 307 "deffilep.y" /* yacc.c:1646  */
   1912  1.6  christos     { (yyval.number) = (yyvsp[0].number);}
   1913  1.6  christos #line 1914 "deffilep.c" /* yacc.c:1646  */
   1914  1.1  christos     break;
   1915  1.1  christos 
   1916  1.1  christos   case 86:
   1917  1.6  christos #line 308 "deffilep.y" /* yacc.c:1646  */
   1918  1.1  christos     { (yyval.number) = -1;}
   1919  1.6  christos #line 1920 "deffilep.c" /* yacc.c:1646  */
   1920  1.1  christos     break;
   1921  1.1  christos 
   1922  1.1  christos   case 87:
   1923  1.6  christos #line 312 "deffilep.y" /* yacc.c:1646  */
   1924  1.6  christos     { (yyval.id) = (yyvsp[0].id); }
   1925  1.6  christos #line 1926 "deffilep.c" /* yacc.c:1646  */
   1926  1.1  christos     break;
   1927  1.1  christos 
   1928  1.1  christos   case 88:
   1929  1.6  christos #line 313 "deffilep.y" /* yacc.c:1646  */
   1930  1.6  christos     { (yyval.id) =	0; }
   1931  1.6  christos #line 1932 "deffilep.c" /* yacc.c:1646  */
   1932  1.1  christos     break;
   1933  1.1  christos 
   1934  1.1  christos   case 89:
   1935  1.6  christos #line 316 "deffilep.y" /* yacc.c:1646  */
   1936  1.6  christos     { (yyval.vma) = (yyvsp[0].vma);}
   1937  1.6  christos #line 1938 "deffilep.c" /* yacc.c:1646  */
   1938  1.1  christos     break;
   1939  1.1  christos 
   1940  1.1  christos   case 90:
   1941  1.6  christos #line 317 "deffilep.y" /* yacc.c:1646  */
   1942  1.3  christos     { (yyval.vma) = (bfd_vma) -1;}
   1943  1.6  christos #line 1944 "deffilep.c" /* yacc.c:1646  */
   1944  1.1  christos     break;
   1945  1.1  christos 
   1946  1.1  christos   case 91:
   1947  1.6  christos #line 320 "deffilep.y" /* yacc.c:1646  */
   1948  1.6  christos     { (yyval.id) = (yyvsp[0].id); }
   1949  1.6  christos #line 1950 "deffilep.c" /* yacc.c:1646  */
   1950  1.1  christos     break;
   1951  1.1  christos 
   1952  1.1  christos   case 92:
   1953  1.6  christos #line 322 "deffilep.y" /* yacc.c:1646  */
   1954  1.1  christos     {
   1955  1.6  christos 	    char *id = def_pool_alloc (strlen ((yyvsp[0].id)) + 2);
   1956  1.6  christos 	    sprintf (id, ".%s", (yyvsp[0].id));
   1957  1.1  christos 	    (yyval.id) = id;
   1958  1.1  christos 	  }
   1959  1.6  christos #line 1960 "deffilep.c" /* yacc.c:1646  */
   1960  1.1  christos     break;
   1961  1.1  christos 
   1962  1.1  christos   case 93:
   1963  1.6  christos #line 328 "deffilep.y" /* yacc.c:1646  */
   1964  1.1  christos     {
   1965  1.6  christos 	    char *id = def_pool_alloc (strlen ((yyvsp[-3].id)) + 1 + strlen ((yyvsp[-1].digits)) + strlen ((yyvsp[0].id)) + 1);
   1966  1.6  christos 	    sprintf (id, "%s.%s%s", (yyvsp[-3].id), (yyvsp[-1].digits), (yyvsp[0].id));
   1967  1.1  christos 	    (yyval.id) = id;
   1968  1.1  christos 	  }
   1969  1.6  christos #line 1970 "deffilep.c" /* yacc.c:1646  */
   1970  1.1  christos     break;
   1971  1.1  christos 
   1972  1.1  christos   case 94:
   1973  1.6  christos #line 335 "deffilep.y" /* yacc.c:1646  */
   1974  1.6  christos     { (yyval.digits) = (yyvsp[0].digits); }
   1975  1.6  christos #line 1976 "deffilep.c" /* yacc.c:1646  */
   1976  1.1  christos     break;
   1977  1.1  christos 
   1978  1.1  christos   case 95:
   1979  1.6  christos #line 336 "deffilep.y" /* yacc.c:1646  */
   1980  1.1  christos     { (yyval.digits) = ""; }
   1981  1.6  christos #line 1982 "deffilep.c" /* yacc.c:1646  */
   1982  1.1  christos     break;
   1983  1.1  christos 
   1984  1.1  christos   case 96:
   1985  1.6  christos #line 339 "deffilep.y" /* yacc.c:1646  */
   1986  1.6  christos     { (yyval.id) = (yyvsp[0].id); }
   1987  1.6  christos #line 1988 "deffilep.c" /* yacc.c:1646  */
   1988  1.1  christos     break;
   1989  1.1  christos 
   1990  1.1  christos   case 97:
   1991  1.6  christos #line 340 "deffilep.y" /* yacc.c:1646  */
   1992  1.1  christos     { (yyval.id) = ""; }
   1993  1.6  christos #line 1994 "deffilep.c" /* yacc.c:1646  */
   1994  1.1  christos     break;
   1995  1.1  christos 
   1996  1.1  christos   case 98:
   1997  1.6  christos #line 343 "deffilep.y" /* yacc.c:1646  */
   1998  1.6  christos     { (yyval.number) = strtoul ((yyvsp[0].digits), 0, 0); }
   1999  1.6  christos #line 2000 "deffilep.c" /* yacc.c:1646  */
   2000  1.3  christos     break;
   2001  1.3  christos 
   2002  1.3  christos   case 99:
   2003  1.6  christos #line 345 "deffilep.y" /* yacc.c:1646  */
   2004  1.6  christos     { (yyval.vma) = (bfd_vma) strtoull ((yyvsp[0].digits), 0, 0); }
   2005  1.6  christos #line 2006 "deffilep.c" /* yacc.c:1646  */
   2006  1.1  christos     break;
   2007  1.1  christos 
   2008  1.1  christos 
   2009  1.6  christos #line 2010 "deffilep.c" /* yacc.c:1646  */
   2010  1.1  christos       default: break;
   2011  1.1  christos     }
   2012  1.6  christos   /* User semantic actions sometimes alter yychar, and that requires
   2013  1.6  christos      that yytoken be updated with the new translation.  We take the
   2014  1.6  christos      approach of translating immediately before every use of yytoken.
   2015  1.6  christos      One alternative is translating here after every semantic action,
   2016  1.6  christos      but that translation would be missed if the semantic action invokes
   2017  1.6  christos      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
   2018  1.6  christos      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
   2019  1.6  christos      incorrect destructor might then be invoked immediately.  In the
   2020  1.6  christos      case of YYERROR or YYBACKUP, subsequent parser actions might lead
   2021  1.6  christos      to an incorrect destructor call or verbose syntax error message
   2022  1.6  christos      before the lookahead is translated.  */
   2023  1.1  christos   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
   2024  1.1  christos 
   2025  1.1  christos   YYPOPSTACK (yylen);
   2026  1.1  christos   yylen = 0;
   2027  1.1  christos   YY_STACK_PRINT (yyss, yyssp);
   2028  1.1  christos 
   2029  1.1  christos   *++yyvsp = yyval;
   2030  1.1  christos 
   2031  1.6  christos   /* Now 'shift' the result of the reduction.  Determine what state
   2032  1.1  christos      that goes to, based on the state we popped back to and the rule
   2033  1.1  christos      number reduced by.  */
   2034  1.1  christos 
   2035  1.1  christos   yyn = yyr1[yyn];
   2036  1.1  christos 
   2037  1.1  christos   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
   2038  1.1  christos   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
   2039  1.1  christos     yystate = yytable[yystate];
   2040  1.1  christos   else
   2041  1.1  christos     yystate = yydefgoto[yyn - YYNTOKENS];
   2042  1.1  christos 
   2043  1.1  christos   goto yynewstate;
   2044  1.1  christos 
   2045  1.1  christos 
   2046  1.6  christos /*--------------------------------------.
   2047  1.6  christos | yyerrlab -- here on detecting error.  |
   2048  1.6  christos `--------------------------------------*/
   2049  1.1  christos yyerrlab:
   2050  1.6  christos   /* Make sure we have latest lookahead translation.  See comments at
   2051  1.6  christos      user semantic actions for why this is necessary.  */
   2052  1.6  christos   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
   2053  1.6  christos 
   2054  1.1  christos   /* If not already recovering from an error, report this error.  */
   2055  1.1  christos   if (!yyerrstatus)
   2056  1.1  christos     {
   2057  1.1  christos       ++yynerrs;
   2058  1.1  christos #if ! YYERROR_VERBOSE
   2059  1.1  christos       yyerror (YY_("syntax error"));
   2060  1.1  christos #else
   2061  1.6  christos # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
   2062  1.6  christos                                         yyssp, yytoken)
   2063  1.1  christos       {
   2064  1.6  christos         char const *yymsgp = YY_("syntax error");
   2065  1.6  christos         int yysyntax_error_status;
   2066  1.6  christos         yysyntax_error_status = YYSYNTAX_ERROR;
   2067  1.6  christos         if (yysyntax_error_status == 0)
   2068  1.6  christos           yymsgp = yymsg;
   2069  1.6  christos         else if (yysyntax_error_status == 1)
   2070  1.6  christos           {
   2071  1.6  christos             if (yymsg != yymsgbuf)
   2072  1.6  christos               YYSTACK_FREE (yymsg);
   2073  1.6  christos             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
   2074  1.6  christos             if (!yymsg)
   2075  1.6  christos               {
   2076  1.6  christos                 yymsg = yymsgbuf;
   2077  1.6  christos                 yymsg_alloc = sizeof yymsgbuf;
   2078  1.6  christos                 yysyntax_error_status = 2;
   2079  1.6  christos               }
   2080  1.6  christos             else
   2081  1.6  christos               {
   2082  1.6  christos                 yysyntax_error_status = YYSYNTAX_ERROR;
   2083  1.6  christos                 yymsgp = yymsg;
   2084  1.6  christos               }
   2085  1.6  christos           }
   2086  1.6  christos         yyerror (yymsgp);
   2087  1.6  christos         if (yysyntax_error_status == 2)
   2088  1.6  christos           goto yyexhaustedlab;
   2089  1.1  christos       }
   2090  1.6  christos # undef YYSYNTAX_ERROR
   2091  1.1  christos #endif
   2092  1.1  christos     }
   2093  1.1  christos 
   2094  1.1  christos 
   2095  1.1  christos 
   2096  1.1  christos   if (yyerrstatus == 3)
   2097  1.1  christos     {
   2098  1.6  christos       /* If just tried and failed to reuse lookahead token after an
   2099  1.6  christos          error, discard it.  */
   2100  1.1  christos 
   2101  1.1  christos       if (yychar <= YYEOF)
   2102  1.6  christos         {
   2103  1.6  christos           /* Return failure if at end of input.  */
   2104  1.6  christos           if (yychar == YYEOF)
   2105  1.6  christos             YYABORT;
   2106  1.6  christos         }
   2107  1.1  christos       else
   2108  1.6  christos         {
   2109  1.6  christos           yydestruct ("Error: discarding",
   2110  1.6  christos                       yytoken, &yylval);
   2111  1.6  christos           yychar = YYEMPTY;
   2112  1.6  christos         }
   2113  1.1  christos     }
   2114  1.1  christos 
   2115  1.6  christos   /* Else will try to reuse lookahead token after shifting the error
   2116  1.1  christos      token.  */
   2117  1.1  christos   goto yyerrlab1;
   2118  1.1  christos 
   2119  1.1  christos 
   2120  1.1  christos /*---------------------------------------------------.
   2121  1.1  christos | yyerrorlab -- error raised explicitly by YYERROR.  |
   2122  1.1  christos `---------------------------------------------------*/
   2123  1.1  christos yyerrorlab:
   2124  1.1  christos 
   2125  1.1  christos   /* Pacify compilers like GCC when the user code never invokes
   2126  1.1  christos      YYERROR and the label yyerrorlab therefore never appears in user
   2127  1.1  christos      code.  */
   2128  1.1  christos   if (/*CONSTCOND*/ 0)
   2129  1.1  christos      goto yyerrorlab;
   2130  1.1  christos 
   2131  1.6  christos   /* Do not reclaim the symbols of the rule whose action triggered
   2132  1.1  christos      this YYERROR.  */
   2133  1.1  christos   YYPOPSTACK (yylen);
   2134  1.1  christos   yylen = 0;
   2135  1.1  christos   YY_STACK_PRINT (yyss, yyssp);
   2136  1.1  christos   yystate = *yyssp;
   2137  1.1  christos   goto yyerrlab1;
   2138  1.1  christos 
   2139  1.1  christos 
   2140  1.1  christos /*-------------------------------------------------------------.
   2141  1.1  christos | yyerrlab1 -- common code for both syntax error and YYERROR.  |
   2142  1.1  christos `-------------------------------------------------------------*/
   2143  1.1  christos yyerrlab1:
   2144  1.6  christos   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
   2145  1.1  christos 
   2146  1.1  christos   for (;;)
   2147  1.1  christos     {
   2148  1.1  christos       yyn = yypact[yystate];
   2149  1.6  christos       if (!yypact_value_is_default (yyn))
   2150  1.6  christos         {
   2151  1.6  christos           yyn += YYTERROR;
   2152  1.6  christos           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
   2153  1.6  christos             {
   2154  1.6  christos               yyn = yytable[yyn];
   2155  1.6  christos               if (0 < yyn)
   2156  1.6  christos                 break;
   2157  1.6  christos             }
   2158  1.6  christos         }
   2159  1.1  christos 
   2160  1.1  christos       /* Pop the current state because it cannot handle the error token.  */
   2161  1.1  christos       if (yyssp == yyss)
   2162  1.6  christos         YYABORT;
   2163  1.1  christos 
   2164  1.1  christos 
   2165  1.1  christos       yydestruct ("Error: popping",
   2166  1.6  christos                   yystos[yystate], yyvsp);
   2167  1.1  christos       YYPOPSTACK (1);
   2168  1.1  christos       yystate = *yyssp;
   2169  1.1  christos       YY_STACK_PRINT (yyss, yyssp);
   2170  1.1  christos     }
   2171  1.1  christos 
   2172  1.6  christos   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   2173  1.1  christos   *++yyvsp = yylval;
   2174  1.6  christos   YY_IGNORE_MAYBE_UNINITIALIZED_END
   2175  1.1  christos 
   2176  1.1  christos 
   2177  1.1  christos   /* Shift the error token.  */
   2178  1.1  christos   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
   2179  1.1  christos 
   2180  1.1  christos   yystate = yyn;
   2181  1.1  christos   goto yynewstate;
   2182  1.1  christos 
   2183  1.1  christos 
   2184  1.1  christos /*-------------------------------------.
   2185  1.1  christos | yyacceptlab -- YYACCEPT comes here.  |
   2186  1.1  christos `-------------------------------------*/
   2187  1.1  christos yyacceptlab:
   2188  1.1  christos   yyresult = 0;
   2189  1.1  christos   goto yyreturn;
   2190  1.1  christos 
   2191  1.1  christos /*-----------------------------------.
   2192  1.1  christos | yyabortlab -- YYABORT comes here.  |
   2193  1.1  christos `-----------------------------------*/
   2194  1.1  christos yyabortlab:
   2195  1.1  christos   yyresult = 1;
   2196  1.1  christos   goto yyreturn;
   2197  1.1  christos 
   2198  1.6  christos #if !defined yyoverflow || YYERROR_VERBOSE
   2199  1.1  christos /*-------------------------------------------------.
   2200  1.1  christos | yyexhaustedlab -- memory exhaustion comes here.  |
   2201  1.1  christos `-------------------------------------------------*/
   2202  1.1  christos yyexhaustedlab:
   2203  1.1  christos   yyerror (YY_("memory exhausted"));
   2204  1.1  christos   yyresult = 2;
   2205  1.1  christos   /* Fall through.  */
   2206  1.1  christos #endif
   2207  1.1  christos 
   2208  1.1  christos yyreturn:
   2209  1.6  christos   if (yychar != YYEMPTY)
   2210  1.6  christos     {
   2211  1.6  christos       /* Make sure we have latest lookahead translation.  See comments at
   2212  1.6  christos          user semantic actions for why this is necessary.  */
   2213  1.6  christos       yytoken = YYTRANSLATE (yychar);
   2214  1.6  christos       yydestruct ("Cleanup: discarding lookahead",
   2215  1.6  christos                   yytoken, &yylval);
   2216  1.6  christos     }
   2217  1.6  christos   /* Do not reclaim the symbols of the rule whose action triggered
   2218  1.1  christos      this YYABORT or YYACCEPT.  */
   2219  1.1  christos   YYPOPSTACK (yylen);
   2220  1.1  christos   YY_STACK_PRINT (yyss, yyssp);
   2221  1.1  christos   while (yyssp != yyss)
   2222  1.1  christos     {
   2223  1.1  christos       yydestruct ("Cleanup: popping",
   2224  1.6  christos                   yystos[*yyssp], yyvsp);
   2225  1.1  christos       YYPOPSTACK (1);
   2226  1.1  christos     }
   2227  1.1  christos #ifndef yyoverflow
   2228  1.1  christos   if (yyss != yyssa)
   2229  1.1  christos     YYSTACK_FREE (yyss);
   2230  1.1  christos #endif
   2231  1.1  christos #if YYERROR_VERBOSE
   2232  1.1  christos   if (yymsg != yymsgbuf)
   2233  1.1  christos     YYSTACK_FREE (yymsg);
   2234  1.1  christos #endif
   2235  1.6  christos   return yyresult;
   2236  1.1  christos }
   2237  1.6  christos #line 347 "deffilep.y" /* yacc.c:1906  */
   2238  1.1  christos 
   2239  1.1  christos 
   2240  1.1  christos /*****************************************************************************
   2241  1.1  christos  API
   2242  1.1  christos  *****************************************************************************/
   2243  1.1  christos 
   2244  1.1  christos static FILE *the_file;
   2245  1.1  christos static const char *def_filename;
   2246  1.1  christos static int linenumber;
   2247  1.1  christos static def_file *def;
   2248  1.1  christos static int saw_newline;
   2249  1.1  christos 
   2250  1.1  christos struct directive
   2251  1.1  christos   {
   2252  1.1  christos     struct directive *next;
   2253  1.1  christos     char *name;
   2254  1.1  christos     int len;
   2255  1.1  christos   };
   2256  1.1  christos 
   2257  1.1  christos static struct directive *directives = 0;
   2258  1.1  christos 
   2259  1.1  christos def_file *
   2260  1.1  christos def_file_empty (void)
   2261  1.1  christos {
   2262  1.1  christos   def_file *rv = xmalloc (sizeof (def_file));
   2263  1.1  christos   memset (rv, 0, sizeof (def_file));
   2264  1.1  christos   rv->is_dll = -1;
   2265  1.1  christos   rv->base_address = (bfd_vma) -1;
   2266  1.1  christos   rv->stack_reserve = rv->stack_commit = -1;
   2267  1.1  christos   rv->heap_reserve = rv->heap_commit = -1;
   2268  1.1  christos   rv->version_major = rv->version_minor = -1;
   2269  1.1  christos   return rv;
   2270  1.1  christos }
   2271  1.1  christos 
   2272  1.1  christos def_file *
   2273  1.1  christos def_file_parse (const char *filename, def_file *add_to)
   2274  1.1  christos {
   2275  1.1  christos   struct directive *d;
   2276  1.1  christos 
   2277  1.1  christos   the_file = fopen (filename, "r");
   2278  1.1  christos   def_filename = filename;
   2279  1.1  christos   linenumber = 1;
   2280  1.1  christos   if (!the_file)
   2281  1.1  christos     {
   2282  1.1  christos       perror (filename);
   2283  1.1  christos       return 0;
   2284  1.1  christos     }
   2285  1.1  christos   if (add_to)
   2286  1.1  christos     {
   2287  1.1  christos       def = add_to;
   2288  1.1  christos     }
   2289  1.1  christos   else
   2290  1.1  christos     {
   2291  1.1  christos       def = def_file_empty ();
   2292  1.1  christos     }
   2293  1.1  christos 
   2294  1.1  christos   saw_newline = 1;
   2295  1.1  christos   if (def_parse ())
   2296  1.1  christos     {
   2297  1.1  christos       def_file_free (def);
   2298  1.1  christos       fclose (the_file);
   2299  1.1  christos       def_pool_free ();
   2300  1.1  christos       return 0;
   2301  1.1  christos     }
   2302  1.1  christos 
   2303  1.1  christos   fclose (the_file);
   2304  1.1  christos 
   2305  1.1  christos   while ((d = directives) != NULL)
   2306  1.1  christos     {
   2307  1.1  christos #if TRACE
   2308  1.1  christos       printf ("Adding directive %08x `%s'\n", d->name, d->name);
   2309  1.1  christos #endif
   2310  1.1  christos       def_file_add_directive (def, d->name, d->len);
   2311  1.1  christos       directives = d->next;
   2312  1.1  christos       free (d->name);
   2313  1.1  christos       free (d);
   2314  1.1  christos     }
   2315  1.1  christos   def_pool_free ();
   2316  1.1  christos 
   2317  1.1  christos   return def;
   2318  1.1  christos }
   2319  1.1  christos 
   2320  1.1  christos void
   2321  1.1  christos def_file_free (def_file *fdef)
   2322  1.1  christos {
   2323  1.1  christos   int i;
   2324  1.1  christos 
   2325  1.1  christos   if (!fdef)
   2326  1.1  christos     return;
   2327  1.1  christos   if (fdef->name)
   2328  1.1  christos     free (fdef->name);
   2329  1.1  christos   if (fdef->description)
   2330  1.1  christos     free (fdef->description);
   2331  1.1  christos 
   2332  1.1  christos   if (fdef->section_defs)
   2333  1.1  christos     {
   2334  1.1  christos       for (i = 0; i < fdef->num_section_defs; i++)
   2335  1.1  christos 	{
   2336  1.1  christos 	  if (fdef->section_defs[i].name)
   2337  1.1  christos 	    free (fdef->section_defs[i].name);
   2338  1.1  christos 	  if (fdef->section_defs[i].class)
   2339  1.1  christos 	    free (fdef->section_defs[i].class);
   2340  1.1  christos 	}
   2341  1.1  christos       free (fdef->section_defs);
   2342  1.1  christos     }
   2343  1.1  christos 
   2344  1.1  christos   if (fdef->exports)
   2345  1.1  christos     {
   2346  1.1  christos       for (i = 0; i < fdef->num_exports; i++)
   2347  1.1  christos 	{
   2348  1.1  christos 	  if (fdef->exports[i].internal_name
   2349  1.1  christos 	      && fdef->exports[i].internal_name != fdef->exports[i].name)
   2350  1.1  christos 	    free (fdef->exports[i].internal_name);
   2351  1.1  christos 	  if (fdef->exports[i].name)
   2352  1.1  christos 	    free (fdef->exports[i].name);
   2353  1.1  christos 	  if (fdef->exports[i].its_name)
   2354  1.1  christos 	    free (fdef->exports[i].its_name);
   2355  1.1  christos 	}
   2356  1.1  christos       free (fdef->exports);
   2357  1.1  christos     }
   2358  1.1  christos 
   2359  1.1  christos   if (fdef->imports)
   2360  1.1  christos     {
   2361  1.1  christos       for (i = 0; i < fdef->num_imports; i++)
   2362  1.1  christos 	{
   2363  1.1  christos 	  if (fdef->imports[i].internal_name
   2364  1.1  christos 	      && fdef->imports[i].internal_name != fdef->imports[i].name)
   2365  1.1  christos 	    free (fdef->imports[i].internal_name);
   2366  1.1  christos 	  if (fdef->imports[i].name)
   2367  1.1  christos 	    free (fdef->imports[i].name);
   2368  1.1  christos 	  if (fdef->imports[i].its_name)
   2369  1.1  christos 	    free (fdef->imports[i].its_name);
   2370  1.1  christos 	}
   2371  1.1  christos       free (fdef->imports);
   2372  1.1  christos     }
   2373  1.1  christos 
   2374  1.1  christos   while (fdef->modules)
   2375  1.1  christos     {
   2376  1.1  christos       def_file_module *m = fdef->modules;
   2377  1.1  christos 
   2378  1.1  christos       fdef->modules = fdef->modules->next;
   2379  1.1  christos       free (m);
   2380  1.1  christos     }
   2381  1.1  christos 
   2382  1.1  christos   while (fdef->aligncomms)
   2383  1.1  christos     {
   2384  1.1  christos       def_file_aligncomm *c = fdef->aligncomms;
   2385  1.1  christos 
   2386  1.1  christos       fdef->aligncomms = fdef->aligncomms->next;
   2387  1.1  christos       free (c->symbol_name);
   2388  1.1  christos       free (c);
   2389  1.1  christos     }
   2390  1.1  christos 
   2391  1.1  christos   free (fdef);
   2392  1.1  christos }
   2393  1.1  christos 
   2394  1.1  christos #ifdef DEF_FILE_PRINT
   2395  1.1  christos void
   2396  1.1  christos def_file_print (FILE *file, def_file *fdef)
   2397  1.1  christos {
   2398  1.1  christos   int i;
   2399  1.1  christos 
   2400  1.1  christos   fprintf (file, ">>>> def_file at 0x%08x\n", fdef);
   2401  1.1  christos   if (fdef->name)
   2402  1.1  christos     fprintf (file, "  name: %s\n", fdef->name ? fdef->name : "(unspecified)");
   2403  1.1  christos   if (fdef->is_dll != -1)
   2404  1.1  christos     fprintf (file, "  is dll: %s\n", fdef->is_dll ? "yes" : "no");
   2405  1.1  christos   if (fdef->base_address != (bfd_vma) -1)
   2406  1.3  christos     {
   2407  1.3  christos       fprintf (file, "  base address: 0x");
   2408  1.3  christos       fprintf_vma (file, fdef->base_address);
   2409  1.3  christos       fprintf (file, "\n");
   2410  1.3  christos     }
   2411  1.1  christos   if (fdef->description)
   2412  1.1  christos     fprintf (file, "  description: `%s'\n", fdef->description);
   2413  1.1  christos   if (fdef->stack_reserve != -1)
   2414  1.1  christos     fprintf (file, "  stack reserve: 0x%08x\n", fdef->stack_reserve);
   2415  1.1  christos   if (fdef->stack_commit != -1)
   2416  1.1  christos     fprintf (file, "  stack commit: 0x%08x\n", fdef->stack_commit);
   2417  1.1  christos   if (fdef->heap_reserve != -1)
   2418  1.1  christos     fprintf (file, "  heap reserve: 0x%08x\n", fdef->heap_reserve);
   2419  1.1  christos   if (fdef->heap_commit != -1)
   2420  1.1  christos     fprintf (file, "  heap commit: 0x%08x\n", fdef->heap_commit);
   2421  1.1  christos 
   2422  1.1  christos   if (fdef->num_section_defs > 0)
   2423  1.1  christos     {
   2424  1.1  christos       fprintf (file, "  section defs:\n");
   2425  1.1  christos 
   2426  1.1  christos       for (i = 0; i < fdef->num_section_defs; i++)
   2427  1.1  christos 	{
   2428  1.1  christos 	  fprintf (file, "    name: `%s', class: `%s', flags:",
   2429  1.1  christos 		   fdef->section_defs[i].name, fdef->section_defs[i].class);
   2430  1.1  christos 	  if (fdef->section_defs[i].flag_read)
   2431  1.1  christos 	    fprintf (file, " R");
   2432  1.1  christos 	  if (fdef->section_defs[i].flag_write)
   2433  1.1  christos 	    fprintf (file, " W");
   2434  1.1  christos 	  if (fdef->section_defs[i].flag_execute)
   2435  1.1  christos 	    fprintf (file, " X");
   2436  1.1  christos 	  if (fdef->section_defs[i].flag_shared)
   2437  1.1  christos 	    fprintf (file, " S");
   2438  1.1  christos 	  fprintf (file, "\n");
   2439  1.1  christos 	}
   2440  1.1  christos     }
   2441  1.1  christos 
   2442  1.1  christos   if (fdef->num_exports > 0)
   2443  1.1  christos     {
   2444  1.1  christos       fprintf (file, "  exports:\n");
   2445  1.1  christos 
   2446  1.1  christos       for (i = 0; i < fdef->num_exports; i++)
   2447  1.1  christos 	{
   2448  1.1  christos 	  fprintf (file, "    name: `%s', int: `%s', ordinal: %d, flags:",
   2449  1.1  christos 		   fdef->exports[i].name, fdef->exports[i].internal_name,
   2450  1.1  christos 		   fdef->exports[i].ordinal);
   2451  1.1  christos 	  if (fdef->exports[i].flag_private)
   2452  1.1  christos 	    fprintf (file, " P");
   2453  1.1  christos 	  if (fdef->exports[i].flag_constant)
   2454  1.1  christos 	    fprintf (file, " C");
   2455  1.1  christos 	  if (fdef->exports[i].flag_noname)
   2456  1.1  christos 	    fprintf (file, " N");
   2457  1.1  christos 	  if (fdef->exports[i].flag_data)
   2458  1.1  christos 	    fprintf (file, " D");
   2459  1.1  christos 	  fprintf (file, "\n");
   2460  1.1  christos 	}
   2461  1.1  christos     }
   2462  1.1  christos 
   2463  1.1  christos   if (fdef->num_imports > 0)
   2464  1.1  christos     {
   2465  1.1  christos       fprintf (file, "  imports:\n");
   2466  1.1  christos 
   2467  1.1  christos       for (i = 0; i < fdef->num_imports; i++)
   2468  1.1  christos 	{
   2469  1.1  christos 	  fprintf (file, "    int: %s, from: `%s', name: `%s', ordinal: %d\n",
   2470  1.1  christos 		   fdef->imports[i].internal_name,
   2471  1.1  christos 		   fdef->imports[i].module,
   2472  1.1  christos 		   fdef->imports[i].name,
   2473  1.1  christos 		   fdef->imports[i].ordinal);
   2474  1.1  christos 	}
   2475  1.1  christos     }
   2476  1.1  christos 
   2477  1.1  christos   if (fdef->version_major != -1)
   2478  1.1  christos     fprintf (file, "  version: %d.%d\n", fdef->version_major, fdef->version_minor);
   2479  1.1  christos 
   2480  1.1  christos   fprintf (file, "<<<< def_file at 0x%08x\n", fdef);
   2481  1.1  christos }
   2482  1.1  christos #endif
   2483  1.1  christos 
   2484  1.1  christos /* Helper routine to check for identity of string pointers,
   2485  1.1  christos    which might be NULL.  */
   2486  1.1  christos 
   2487  1.1  christos static int
   2488  1.1  christos are_names_equal (const char *s1, const char *s2)
   2489  1.1  christos {
   2490  1.1  christos   if (!s1 && !s2)
   2491  1.1  christos     return 0;
   2492  1.1  christos   if (!s1 || !s2)
   2493  1.1  christos     return (!s1 ? -1 : 1);
   2494  1.1  christos   return strcmp (s1, s2);
   2495  1.1  christos }
   2496  1.1  christos 
   2497  1.1  christos static int
   2498  1.1  christos cmp_export_elem (const def_file_export *e, const char *ex_name,
   2499  1.1  christos 		 const char *in_name, const char *its_name,
   2500  1.1  christos 		 int ord)
   2501  1.1  christos {
   2502  1.1  christos   int r;
   2503  1.1  christos 
   2504  1.1  christos   if ((r = are_names_equal (ex_name, e->name)) != 0)
   2505  1.1  christos     return r;
   2506  1.1  christos   if ((r = are_names_equal (in_name, e->internal_name)) != 0)
   2507  1.1  christos     return r;
   2508  1.1  christos   if ((r = are_names_equal (its_name, e->its_name)) != 0)
   2509  1.1  christos     return r;
   2510  1.1  christos   return (ord - e->ordinal);
   2511  1.1  christos }
   2512  1.1  christos 
   2513  1.1  christos /* Search the position of the identical element, or returns the position
   2514  1.1  christos    of the next higher element. If last valid element is smaller, then MAX
   2515  1.1  christos    is returned.  */
   2516  1.1  christos 
   2517  1.1  christos static int
   2518  1.1  christos find_export_in_list (def_file_export *b, int max,
   2519  1.1  christos 		     const char *ex_name, const char *in_name,
   2520  1.1  christos 		     const char *its_name, int ord, int *is_ident)
   2521  1.1  christos {
   2522  1.1  christos   int e, l, r, p;
   2523  1.1  christos 
   2524  1.1  christos   *is_ident = 0;
   2525  1.1  christos   if (!max)
   2526  1.1  christos     return 0;
   2527  1.1  christos   if ((e = cmp_export_elem (b, ex_name, in_name, its_name, ord)) <= 0)
   2528  1.1  christos     {
   2529  1.1  christos       if (!e)
   2530  1.6  christos 	*is_ident = 1;
   2531  1.1  christos       return 0;
   2532  1.1  christos     }
   2533  1.1  christos   if (max == 1)
   2534  1.1  christos     return 1;
   2535  1.1  christos   if ((e = cmp_export_elem (b + (max - 1), ex_name, in_name, its_name, ord)) > 0)
   2536  1.1  christos     return max;
   2537  1.1  christos   else if (!e || max == 2)
   2538  1.1  christos     {
   2539  1.1  christos       if (!e)
   2540  1.1  christos 	*is_ident = 1;
   2541  1.1  christos       return max - 1;
   2542  1.1  christos     }
   2543  1.1  christos   l = 0; r = max - 1;
   2544  1.1  christos   while (l < r)
   2545  1.1  christos     {
   2546  1.1  christos       p = (l + r) / 2;
   2547  1.1  christos       e = cmp_export_elem (b + p, ex_name, in_name, its_name, ord);
   2548  1.1  christos       if (!e)
   2549  1.6  christos 	{
   2550  1.6  christos 	  *is_ident = 1;
   2551  1.6  christos 	  return p;
   2552  1.6  christos 	}
   2553  1.1  christos       else if (e < 0)
   2554  1.6  christos 	r = p - 1;
   2555  1.1  christos       else if (e > 0)
   2556  1.6  christos 	l = p + 1;
   2557  1.1  christos     }
   2558  1.1  christos   if ((e = cmp_export_elem (b + l, ex_name, in_name, its_name, ord)) > 0)
   2559  1.1  christos     ++l;
   2560  1.1  christos   else if (!e)
   2561  1.1  christos     *is_ident = 1;
   2562  1.1  christos   return l;
   2563  1.1  christos }
   2564  1.1  christos 
   2565  1.1  christos def_file_export *
   2566  1.1  christos def_file_add_export (def_file *fdef,
   2567  1.1  christos 		     const char *external_name,
   2568  1.1  christos 		     const char *internal_name,
   2569  1.1  christos 		     int ordinal,
   2570  1.1  christos 		     const char *its_name,
   2571  1.1  christos 		     int *is_dup)
   2572  1.1  christos {
   2573  1.1  christos   def_file_export *e;
   2574  1.1  christos   int pos;
   2575  1.1  christos   int max_exports = ROUND_UP(fdef->num_exports, 32);
   2576  1.1  christos 
   2577  1.1  christos   if (internal_name && !external_name)
   2578  1.1  christos     external_name = internal_name;
   2579  1.1  christos   if (external_name && !internal_name)
   2580  1.1  christos     internal_name = external_name;
   2581  1.1  christos 
   2582  1.1  christos   /* We need to avoid duplicates.  */
   2583  1.1  christos   *is_dup = 0;
   2584  1.1  christos   pos = find_export_in_list (fdef->exports, fdef->num_exports,
   2585  1.1  christos 		     external_name, internal_name,
   2586  1.1  christos 		     its_name, ordinal, is_dup);
   2587  1.1  christos 
   2588  1.1  christos   if (*is_dup != 0)
   2589  1.1  christos     return (fdef->exports + pos);
   2590  1.1  christos 
   2591  1.1  christos   if (fdef->num_exports >= max_exports)
   2592  1.1  christos     {
   2593  1.1  christos       max_exports = ROUND_UP(fdef->num_exports + 1, 32);
   2594  1.1  christos       if (fdef->exports)
   2595  1.1  christos 	fdef->exports = xrealloc (fdef->exports,
   2596  1.1  christos 				 max_exports * sizeof (def_file_export));
   2597  1.1  christos       else
   2598  1.1  christos 	fdef->exports = xmalloc (max_exports * sizeof (def_file_export));
   2599  1.1  christos     }
   2600  1.1  christos 
   2601  1.1  christos   e = fdef->exports + pos;
   2602  1.1  christos   if (pos != fdef->num_exports)
   2603  1.1  christos     memmove (&e[1], e, (sizeof (def_file_export) * (fdef->num_exports - pos)));
   2604  1.1  christos   memset (e, 0, sizeof (def_file_export));
   2605  1.1  christos   e->name = xstrdup (external_name);
   2606  1.1  christos   e->internal_name = xstrdup (internal_name);
   2607  1.1  christos   e->its_name = (its_name ? xstrdup (its_name) : NULL);
   2608  1.1  christos   e->ordinal = ordinal;
   2609  1.1  christos   fdef->num_exports++;
   2610  1.1  christos   return e;
   2611  1.1  christos }
   2612  1.1  christos 
   2613  1.1  christos def_file_module *
   2614  1.1  christos def_get_module (def_file *fdef, const char *name)
   2615  1.1  christos {
   2616  1.1  christos   def_file_module *s;
   2617  1.1  christos 
   2618  1.1  christos   for (s = fdef->modules; s; s = s->next)
   2619  1.1  christos     if (strcmp (s->name, name) == 0)
   2620  1.1  christos       return s;
   2621  1.1  christos 
   2622  1.1  christos   return NULL;
   2623  1.1  christos }
   2624  1.1  christos 
   2625  1.1  christos static def_file_module *
   2626  1.1  christos def_stash_module (def_file *fdef, const char *name)
   2627  1.1  christos {
   2628  1.1  christos   def_file_module *s;
   2629  1.1  christos 
   2630  1.1  christos   if ((s = def_get_module (fdef, name)) != NULL)
   2631  1.1  christos       return s;
   2632  1.1  christos   s = xmalloc (sizeof (def_file_module) + strlen (name));
   2633  1.1  christos   s->next = fdef->modules;
   2634  1.1  christos   fdef->modules = s;
   2635  1.1  christos   s->user_data = 0;
   2636  1.1  christos   strcpy (s->name, name);
   2637  1.1  christos   return s;
   2638  1.1  christos }
   2639  1.1  christos 
   2640  1.1  christos static int
   2641  1.1  christos cmp_import_elem (const def_file_import *e, const char *ex_name,
   2642  1.1  christos 		 const char *in_name, const char *module,
   2643  1.1  christos 		 int ord)
   2644  1.1  christos {
   2645  1.1  christos   int r;
   2646  1.1  christos 
   2647  1.1  christos   if ((r = are_names_equal (module, (e->module ? e->module->name : NULL))))
   2648  1.1  christos     return r;
   2649  1.1  christos   if ((r = are_names_equal (ex_name, e->name)) != 0)
   2650  1.1  christos     return r;
   2651  1.1  christos   if ((r = are_names_equal (in_name, e->internal_name)) != 0)
   2652  1.1  christos     return r;
   2653  1.1  christos   if (ord != e->ordinal)
   2654  1.1  christos     return (ord < e->ordinal ? -1 : 1);
   2655  1.1  christos   return 0;
   2656  1.1  christos }
   2657  1.1  christos 
   2658  1.1  christos /* Search the position of the identical element, or returns the position
   2659  1.1  christos    of the next higher element. If last valid element is smaller, then MAX
   2660  1.1  christos    is returned.  */
   2661  1.1  christos 
   2662  1.1  christos static int
   2663  1.1  christos find_import_in_list (def_file_import *b, int max,
   2664  1.1  christos 		     const char *ex_name, const char *in_name,
   2665  1.1  christos 		     const char *module, int ord, int *is_ident)
   2666  1.1  christos {
   2667  1.1  christos   int e, l, r, p;
   2668  1.1  christos 
   2669  1.1  christos   *is_ident = 0;
   2670  1.1  christos   if (!max)
   2671  1.1  christos     return 0;
   2672  1.1  christos   if ((e = cmp_import_elem (b, ex_name, in_name, module, ord)) <= 0)
   2673  1.1  christos     {
   2674  1.1  christos       if (!e)
   2675  1.6  christos 	*is_ident = 1;
   2676  1.1  christos       return 0;
   2677  1.1  christos     }
   2678  1.1  christos   if (max == 1)
   2679  1.1  christos     return 1;
   2680  1.1  christos   if ((e = cmp_import_elem (b + (max - 1), ex_name, in_name, module, ord)) > 0)
   2681  1.1  christos     return max;
   2682  1.1  christos   else if (!e || max == 2)
   2683  1.1  christos     {
   2684  1.1  christos       if (!e)
   2685  1.6  christos 	*is_ident = 1;
   2686  1.1  christos       return max - 1;
   2687  1.1  christos     }
   2688  1.1  christos   l = 0; r = max - 1;
   2689  1.1  christos   while (l < r)
   2690  1.1  christos     {
   2691  1.1  christos       p = (l + r) / 2;
   2692  1.1  christos       e = cmp_import_elem (b + p, ex_name, in_name, module, ord);
   2693  1.1  christos       if (!e)
   2694  1.6  christos 	{
   2695  1.6  christos 	  *is_ident = 1;
   2696  1.6  christos 	  return p;
   2697  1.6  christos 	}
   2698  1.1  christos       else if (e < 0)
   2699  1.6  christos 	r = p - 1;
   2700  1.1  christos       else if (e > 0)
   2701  1.6  christos 	l = p + 1;
   2702  1.1  christos     }
   2703  1.1  christos   if ((e = cmp_import_elem (b + l, ex_name, in_name, module, ord)) > 0)
   2704  1.1  christos     ++l;
   2705  1.1  christos   else if (!e)
   2706  1.1  christos     *is_ident = 1;
   2707  1.1  christos   return l;
   2708  1.1  christos }
   2709  1.1  christos 
   2710  1.6  christos static void
   2711  1.6  christos fill_in_import (def_file_import *i,
   2712  1.6  christos 		const char *name,
   2713  1.6  christos 		def_file_module *module,
   2714  1.6  christos 		int ordinal,
   2715  1.6  christos 		const char *internal_name,
   2716  1.6  christos 		const char *its_name)
   2717  1.6  christos {
   2718  1.6  christos   memset (i, 0, sizeof (def_file_import));
   2719  1.6  christos   if (name)
   2720  1.6  christos     i->name = xstrdup (name);
   2721  1.6  christos   i->module = module;
   2722  1.6  christos   i->ordinal = ordinal;
   2723  1.6  christos   if (internal_name)
   2724  1.6  christos     i->internal_name = xstrdup (internal_name);
   2725  1.6  christos   else
   2726  1.6  christos     i->internal_name = i->name;
   2727  1.6  christos   i->its_name = (its_name ? xstrdup (its_name) : NULL);
   2728  1.6  christos }
   2729  1.6  christos 
   2730  1.1  christos def_file_import *
   2731  1.1  christos def_file_add_import (def_file *fdef,
   2732  1.1  christos 		     const char *name,
   2733  1.1  christos 		     const char *module,
   2734  1.1  christos 		     int ordinal,
   2735  1.1  christos 		     const char *internal_name,
   2736  1.1  christos 		     const char *its_name,
   2737  1.1  christos 		     int *is_dup)
   2738  1.1  christos {
   2739  1.1  christos   def_file_import *i;
   2740  1.1  christos   int pos;
   2741  1.1  christos   int max_imports = ROUND_UP (fdef->num_imports, 16);
   2742  1.1  christos 
   2743  1.1  christos   /* We need to avoid here duplicates.  */
   2744  1.1  christos   *is_dup = 0;
   2745  1.1  christos   pos = find_import_in_list (fdef->imports, fdef->num_imports,
   2746  1.1  christos 			     name,
   2747  1.1  christos 			     (!internal_name ? name : internal_name),
   2748  1.1  christos 			     module, ordinal, is_dup);
   2749  1.1  christos   if (*is_dup != 0)
   2750  1.1  christos     return fdef->imports + pos;
   2751  1.1  christos 
   2752  1.1  christos   if (fdef->num_imports >= max_imports)
   2753  1.1  christos     {
   2754  1.1  christos       max_imports = ROUND_UP (fdef->num_imports+1, 16);
   2755  1.1  christos 
   2756  1.1  christos       if (fdef->imports)
   2757  1.1  christos 	fdef->imports = xrealloc (fdef->imports,
   2758  1.1  christos 				 max_imports * sizeof (def_file_import));
   2759  1.1  christos       else
   2760  1.1  christos 	fdef->imports = xmalloc (max_imports * sizeof (def_file_import));
   2761  1.1  christos     }
   2762  1.1  christos   i = fdef->imports + pos;
   2763  1.1  christos   if (pos != fdef->num_imports)
   2764  1.6  christos     memmove (i + 1, i, sizeof (def_file_import) * (fdef->num_imports - pos));
   2765  1.6  christos 
   2766  1.6  christos   fill_in_import (i, name, def_stash_module (fdef, module), ordinal,
   2767  1.6  christos 		  internal_name, its_name);
   2768  1.6  christos   fdef->num_imports++;
   2769  1.6  christos 
   2770  1.6  christos   return i;
   2771  1.6  christos }
   2772  1.6  christos 
   2773  1.6  christos int
   2774  1.6  christos def_file_add_import_from (def_file *fdef,
   2775  1.6  christos 			  int num_imports,
   2776  1.6  christos 			  const char *name,
   2777  1.6  christos 			  const char *module,
   2778  1.6  christos 			  int ordinal,
   2779  1.6  christos 			  const char *internal_name,
   2780  1.6  christos 			  const char *its_name ATTRIBUTE_UNUSED)
   2781  1.6  christos {
   2782  1.6  christos   def_file_import *i;
   2783  1.6  christos   int is_dup;
   2784  1.6  christos   int pos;
   2785  1.6  christos   int max_imports = ROUND_UP (fdef->num_imports, 16);
   2786  1.6  christos 
   2787  1.6  christos   /* We need to avoid here duplicates.  */
   2788  1.6  christos   is_dup = 0;
   2789  1.6  christos   pos = find_import_in_list (fdef->imports, fdef->num_imports,
   2790  1.6  christos 			     name, internal_name ? internal_name : name,
   2791  1.6  christos 			     module, ordinal, &is_dup);
   2792  1.6  christos   if (is_dup != 0)
   2793  1.6  christos     return -1;
   2794  1.6  christos   if (fdef->imports && pos != fdef->num_imports)
   2795  1.6  christos     {
   2796  1.6  christos       i = fdef->imports + pos;
   2797  1.6  christos       if (i->module && strcmp (i->module->name, module) == 0)
   2798  1.6  christos 	return -1;
   2799  1.6  christos     }
   2800  1.6  christos 
   2801  1.6  christos   if (fdef->num_imports + num_imports - 1 >= max_imports)
   2802  1.6  christos     {
   2803  1.6  christos       max_imports = ROUND_UP (fdef->num_imports + num_imports, 16);
   2804  1.6  christos 
   2805  1.6  christos       if (fdef->imports)
   2806  1.6  christos 	fdef->imports = xrealloc (fdef->imports,
   2807  1.6  christos 				 max_imports * sizeof (def_file_import));
   2808  1.6  christos       else
   2809  1.6  christos 	fdef->imports = xmalloc (max_imports * sizeof (def_file_import));
   2810  1.6  christos     }
   2811  1.6  christos   i = fdef->imports + pos;
   2812  1.6  christos   if (pos != fdef->num_imports)
   2813  1.6  christos     memmove (i + num_imports, i,
   2814  1.6  christos 	     sizeof (def_file_import) * (fdef->num_imports - pos));
   2815  1.6  christos 
   2816  1.6  christos   return pos;
   2817  1.6  christos }
   2818  1.6  christos 
   2819  1.6  christos def_file_import *
   2820  1.6  christos def_file_add_import_at (def_file *fdef,
   2821  1.6  christos 			int pos,
   2822  1.6  christos 			const char *name,
   2823  1.6  christos 			const char *module,
   2824  1.6  christos 			int ordinal,
   2825  1.6  christos 			const char *internal_name,
   2826  1.6  christos 			const char *its_name)
   2827  1.6  christos {
   2828  1.6  christos   def_file_import *i = fdef->imports + pos;
   2829  1.6  christos 
   2830  1.6  christos   fill_in_import (i, name, def_stash_module (fdef, module), ordinal,
   2831  1.6  christos 		  internal_name, its_name);
   2832  1.1  christos   fdef->num_imports++;
   2833  1.1  christos 
   2834  1.1  christos   return i;
   2835  1.1  christos }
   2836  1.1  christos 
   2837  1.1  christos struct
   2838  1.1  christos {
   2839  1.1  christos   char *param;
   2840  1.1  christos   int token;
   2841  1.1  christos }
   2842  1.1  christos diropts[] =
   2843  1.1  christos {
   2844  1.1  christos   { "-heap", HEAPSIZE },
   2845  1.1  christos   { "-stack", STACKSIZE_K },
   2846  1.1  christos   { "-attr", SECTIONS },
   2847  1.1  christos   { "-export", EXPORTS },
   2848  1.1  christos   { "-aligncomm", ALIGNCOMM },
   2849  1.1  christos   { 0, 0 }
   2850  1.1  christos };
   2851  1.1  christos 
   2852  1.1  christos void
   2853  1.1  christos def_file_add_directive (def_file *my_def, const char *param, int len)
   2854  1.1  christos {
   2855  1.1  christos   def_file *save_def = def;
   2856  1.1  christos   const char *pend = param + len;
   2857  1.1  christos   char * tend = (char *) param;
   2858  1.1  christos   int i;
   2859  1.1  christos 
   2860  1.1  christos   def = my_def;
   2861  1.1  christos 
   2862  1.1  christos   while (param < pend)
   2863  1.1  christos     {
   2864  1.1  christos       while (param < pend
   2865  1.1  christos 	     && (ISSPACE (*param) || *param == '\n' || *param == 0))
   2866  1.1  christos 	param++;
   2867  1.1  christos 
   2868  1.1  christos       if (param == pend)
   2869  1.1  christos 	break;
   2870  1.1  christos 
   2871  1.1  christos       /* Scan forward until we encounter any of:
   2872  1.6  christos 	  - the end of the buffer
   2873  1.1  christos 	  - the start of a new option
   2874  1.6  christos 	  - a newline separating options
   2875  1.6  christos 	  - a NUL separating options.  */
   2876  1.1  christos       for (tend = (char *) (param + 1);
   2877  1.1  christos 	   (tend < pend
   2878  1.1  christos 	    && !(ISSPACE (tend[-1]) && *tend == '-')
   2879  1.1  christos 	    && *tend != '\n' && *tend != 0);
   2880  1.1  christos 	   tend++)
   2881  1.1  christos 	;
   2882  1.1  christos 
   2883  1.1  christos       for (i = 0; diropts[i].param; i++)
   2884  1.1  christos 	{
   2885  1.1  christos 	  len = strlen (diropts[i].param);
   2886  1.1  christos 
   2887  1.1  christos 	  if (tend - param >= len
   2888  1.1  christos 	      && strncmp (param, diropts[i].param, len) == 0
   2889  1.1  christos 	      && (param[len] == ':' || param[len] == ' '))
   2890  1.1  christos 	    {
   2891  1.1  christos 	      lex_parse_string_end = tend;
   2892  1.1  christos 	      lex_parse_string = param + len + 1;
   2893  1.1  christos 	      lex_forced_token = diropts[i].token;
   2894  1.1  christos 	      saw_newline = 0;
   2895  1.1  christos 	      if (def_parse ())
   2896  1.1  christos 		continue;
   2897  1.1  christos 	      break;
   2898  1.1  christos 	    }
   2899  1.1  christos 	}
   2900  1.1  christos 
   2901  1.1  christos       if (!diropts[i].param)
   2902  1.1  christos 	{
   2903  1.3  christos 	  if (tend < pend)
   2904  1.3  christos 	    {
   2905  1.3  christos 	      char saved;
   2906  1.1  christos 
   2907  1.3  christos 	      saved = * tend;
   2908  1.3  christos 	      * tend = 0;
   2909  1.3  christos 	      /* xgettext:c-format */
   2910  1.3  christos 	      einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
   2911  1.3  christos 	      * tend = saved;
   2912  1.3  christos 	    }
   2913  1.3  christos 	  else
   2914  1.3  christos 	    {
   2915  1.3  christos 	      einfo (_("Warning: corrupt .drectve at end of def file\n"));
   2916  1.3  christos 	    }
   2917  1.1  christos 	}
   2918  1.1  christos 
   2919  1.1  christos       lex_parse_string = 0;
   2920  1.1  christos       param = tend;
   2921  1.1  christos     }
   2922  1.1  christos 
   2923  1.1  christos   def = save_def;
   2924  1.1  christos   def_pool_free ();
   2925  1.1  christos }
   2926  1.1  christos 
   2927  1.1  christos /* Parser Callbacks.  */
   2928  1.1  christos 
   2929  1.1  christos static void
   2930  1.3  christos def_image_name (const char *name, bfd_vma base, int is_dll)
   2931  1.1  christos {
   2932  1.1  christos   /* If a LIBRARY or NAME statement is specified without a name, there is nothing
   2933  1.1  christos      to do here.  We retain the output filename specified on command line.  */
   2934  1.1  christos   if (*name)
   2935  1.1  christos     {
   2936  1.1  christos       const char* image_name = lbasename (name);
   2937  1.1  christos 
   2938  1.1  christos       if (image_name != name)
   2939  1.1  christos 	einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n",
   2940  1.1  christos 	       def_filename, linenumber, is_dll ? "LIBRARY" : "NAME",
   2941  1.1  christos 	       name);
   2942  1.1  christos       if (def->name)
   2943  1.1  christos 	free (def->name);
   2944  1.3  christos       /* Append the default suffix, if none specified.  */
   2945  1.1  christos       if (strchr (image_name, '.') == 0)
   2946  1.1  christos 	{
   2947  1.1  christos 	  const char * suffix = is_dll ? ".dll" : ".exe";
   2948  1.1  christos 
   2949  1.1  christos 	  def->name = xmalloc (strlen (image_name) + strlen (suffix) + 1);
   2950  1.1  christos 	  sprintf (def->name, "%s%s", image_name, suffix);
   2951  1.6  christos 	}
   2952  1.1  christos       else
   2953  1.1  christos 	def->name = xstrdup (image_name);
   2954  1.1  christos     }
   2955  1.1  christos 
   2956  1.1  christos   /* Honor a BASE address statement, even if LIBRARY string is empty.  */
   2957  1.1  christos   def->base_address = base;
   2958  1.1  christos   def->is_dll = is_dll;
   2959  1.1  christos }
   2960  1.1  christos 
   2961  1.1  christos static void
   2962  1.1  christos def_description (const char *text)
   2963  1.1  christos {
   2964  1.1  christos   int len = def->description ? strlen (def->description) : 0;
   2965  1.1  christos 
   2966  1.1  christos   len += strlen (text) + 1;
   2967  1.1  christos   if (def->description)
   2968  1.1  christos     {
   2969  1.1  christos       def->description = xrealloc (def->description, len);
   2970  1.1  christos       strcat (def->description, text);
   2971  1.1  christos     }
   2972  1.1  christos   else
   2973  1.1  christos     {
   2974  1.1  christos       def->description = xmalloc (len);
   2975  1.1  christos       strcpy (def->description, text);
   2976  1.1  christos     }
   2977  1.1  christos }
   2978  1.1  christos 
   2979  1.1  christos static void
   2980  1.1  christos def_stacksize (int reserve, int commit)
   2981  1.1  christos {
   2982  1.1  christos   def->stack_reserve = reserve;
   2983  1.1  christos   def->stack_commit = commit;
   2984  1.1  christos }
   2985  1.1  christos 
   2986  1.1  christos static void
   2987  1.1  christos def_heapsize (int reserve, int commit)
   2988  1.1  christos {
   2989  1.1  christos   def->heap_reserve = reserve;
   2990  1.1  christos   def->heap_commit = commit;
   2991  1.1  christos }
   2992  1.1  christos 
   2993  1.1  christos static void
   2994  1.1  christos def_section (const char *name, int attr)
   2995  1.1  christos {
   2996  1.1  christos   def_file_section *s;
   2997  1.1  christos   int max_sections = ROUND_UP (def->num_section_defs, 4);
   2998  1.1  christos 
   2999  1.1  christos   if (def->num_section_defs >= max_sections)
   3000  1.1  christos     {
   3001  1.1  christos       max_sections = ROUND_UP (def->num_section_defs+1, 4);
   3002  1.1  christos 
   3003  1.1  christos       if (def->section_defs)
   3004  1.1  christos 	def->section_defs = xrealloc (def->section_defs,
   3005  1.1  christos 				      max_sections * sizeof (def_file_import));
   3006  1.1  christos       else
   3007  1.1  christos 	def->section_defs = xmalloc (max_sections * sizeof (def_file_import));
   3008  1.1  christos     }
   3009  1.1  christos   s = def->section_defs + def->num_section_defs;
   3010  1.1  christos   memset (s, 0, sizeof (def_file_section));
   3011  1.1  christos   s->name = xstrdup (name);
   3012  1.1  christos   if (attr & 1)
   3013  1.1  christos     s->flag_read = 1;
   3014  1.1  christos   if (attr & 2)
   3015  1.1  christos     s->flag_write = 1;
   3016  1.1  christos   if (attr & 4)
   3017  1.1  christos     s->flag_execute = 1;
   3018  1.1  christos   if (attr & 8)
   3019  1.1  christos     s->flag_shared = 1;
   3020  1.1  christos 
   3021  1.1  christos   def->num_section_defs++;
   3022  1.1  christos }
   3023  1.1  christos 
   3024  1.1  christos static void
   3025  1.1  christos def_section_alt (const char *name, const char *attr)
   3026  1.1  christos {
   3027  1.1  christos   int aval = 0;
   3028  1.1  christos 
   3029  1.1  christos   for (; *attr; attr++)
   3030  1.1  christos     {
   3031  1.1  christos       switch (*attr)
   3032  1.1  christos 	{
   3033  1.1  christos 	case 'R':
   3034  1.1  christos 	case 'r':
   3035  1.1  christos 	  aval |= 1;
   3036  1.1  christos 	  break;
   3037  1.1  christos 	case 'W':
   3038  1.1  christos 	case 'w':
   3039  1.1  christos 	  aval |= 2;
   3040  1.1  christos 	  break;
   3041  1.1  christos 	case 'X':
   3042  1.1  christos 	case 'x':
   3043  1.1  christos 	  aval |= 4;
   3044  1.1  christos 	  break;
   3045  1.1  christos 	case 'S':
   3046  1.1  christos 	case 's':
   3047  1.1  christos 	  aval |= 8;
   3048  1.1  christos 	  break;
   3049  1.1  christos 	}
   3050  1.1  christos     }
   3051  1.1  christos   def_section (name, aval);
   3052  1.1  christos }
   3053  1.1  christos 
   3054  1.1  christos static void
   3055  1.1  christos def_exports (const char *external_name,
   3056  1.1  christos 	     const char *internal_name,
   3057  1.1  christos 	     int ordinal,
   3058  1.1  christos 	     int flags,
   3059  1.1  christos 	     const char *its_name)
   3060  1.1  christos {
   3061  1.1  christos   def_file_export *dfe;
   3062  1.1  christos   int is_dup = 0;
   3063  1.1  christos 
   3064  1.1  christos   if (!internal_name && external_name)
   3065  1.1  christos     internal_name = external_name;
   3066  1.1  christos #if TRACE
   3067  1.1  christos   printf ("def_exports, ext=%s int=%s\n", external_name, internal_name);
   3068  1.1  christos #endif
   3069  1.1  christos 
   3070  1.1  christos   dfe = def_file_add_export (def, external_name, internal_name, ordinal,
   3071  1.1  christos 			     its_name, &is_dup);
   3072  1.1  christos 
   3073  1.1  christos   /* We might check here for flag redefinition and warn.  For now we
   3074  1.1  christos      ignore duplicates silently.  */
   3075  1.1  christos   if (is_dup)
   3076  1.1  christos     return;
   3077  1.1  christos 
   3078  1.1  christos   if (flags & 1)
   3079  1.1  christos     dfe->flag_noname = 1;
   3080  1.1  christos   if (flags & 2)
   3081  1.1  christos     dfe->flag_constant = 1;
   3082  1.1  christos   if (flags & 4)
   3083  1.1  christos     dfe->flag_data = 1;
   3084  1.1  christos   if (flags & 8)
   3085  1.1  christos     dfe->flag_private = 1;
   3086  1.1  christos }
   3087  1.1  christos 
   3088  1.1  christos static void
   3089  1.1  christos def_import (const char *internal_name,
   3090  1.1  christos 	    const char *module,
   3091  1.1  christos 	    const char *dllext,
   3092  1.1  christos 	    const char *name,
   3093  1.1  christos 	    int ordinal,
   3094  1.1  christos 	    const char *its_name)
   3095  1.1  christos {
   3096  1.1  christos   char *buf = 0;
   3097  1.1  christos   const char *ext = dllext ? dllext : "dll";
   3098  1.1  christos   int is_dup = 0;
   3099  1.3  christos 
   3100  1.1  christos   buf = xmalloc (strlen (module) + strlen (ext) + 2);
   3101  1.1  christos   sprintf (buf, "%s.%s", module, ext);
   3102  1.1  christos   module = buf;
   3103  1.1  christos 
   3104  1.1  christos   def_file_add_import (def, name, module, ordinal, internal_name, its_name,
   3105  1.1  christos 		       &is_dup);
   3106  1.1  christos   free (buf);
   3107  1.1  christos }
   3108  1.1  christos 
   3109  1.1  christos static void
   3110  1.1  christos def_version (int major, int minor)
   3111  1.1  christos {
   3112  1.1  christos   def->version_major = major;
   3113  1.1  christos   def->version_minor = minor;
   3114  1.1  christos }
   3115  1.1  christos 
   3116  1.1  christos static void
   3117  1.1  christos def_directive (char *str)
   3118  1.1  christos {
   3119  1.1  christos   struct directive *d = xmalloc (sizeof (struct directive));
   3120  1.1  christos 
   3121  1.1  christos   d->next = directives;
   3122  1.1  christos   directives = d;
   3123  1.1  christos   d->name = xstrdup (str);
   3124  1.1  christos   d->len = strlen (str);
   3125  1.1  christos }
   3126  1.1  christos 
   3127  1.1  christos static void
   3128  1.1  christos def_aligncomm (char *str, int align)
   3129  1.1  christos {
   3130  1.1  christos   def_file_aligncomm *c, *p;
   3131  1.3  christos 
   3132  1.1  christos   p = NULL;
   3133  1.1  christos   c = def->aligncomms;
   3134  1.1  christos   while (c != NULL)
   3135  1.1  christos     {
   3136  1.1  christos       int e = strcmp (c->symbol_name, str);
   3137  1.1  christos       if (!e)
   3138  1.1  christos 	{
   3139  1.1  christos 	  /* Not sure if we want to allow here duplicates with
   3140  1.1  christos 	     different alignments, but for now we keep them.  */
   3141  1.1  christos 	  e = (int) c->alignment - align;
   3142  1.1  christos 	  if (!e)
   3143  1.1  christos 	    return;
   3144  1.1  christos 	}
   3145  1.1  christos       if (e > 0)
   3146  1.6  christos 	break;
   3147  1.1  christos       c = (p = c)->next;
   3148  1.1  christos     }
   3149  1.1  christos 
   3150  1.1  christos   c = xmalloc (sizeof (def_file_aligncomm));
   3151  1.1  christos   c->symbol_name = xstrdup (str);
   3152  1.1  christos   c->alignment = (unsigned int) align;
   3153  1.1  christos   if (!p)
   3154  1.1  christos     {
   3155  1.1  christos       c->next = def->aligncomms;
   3156  1.1  christos       def->aligncomms = c;
   3157  1.1  christos     }
   3158  1.1  christos   else
   3159  1.1  christos     {
   3160  1.1  christos       c->next = p->next;
   3161  1.1  christos       p->next = c;
   3162  1.1  christos     }
   3163  1.1  christos }
   3164  1.1  christos 
   3165  1.1  christos static int
   3166  1.1  christos def_error (const char *err)
   3167  1.1  christos {
   3168  1.1  christos   einfo ("%P: %s:%d: %s\n",
   3169  1.1  christos 	 def_filename ? def_filename : "<unknown-file>", linenumber, err);
   3170  1.1  christos   return 0;
   3171  1.1  christos }
   3172  1.1  christos 
   3173  1.1  christos 
   3174  1.1  christos /* Lexical Scanner.  */
   3175  1.1  christos 
   3176  1.1  christos #undef TRACE
   3177  1.1  christos #define TRACE 0
   3178  1.1  christos 
   3179  1.1  christos /* Never freed, but always reused as needed, so no real leak.  */
   3180  1.1  christos static char *buffer = 0;
   3181  1.1  christos static int buflen = 0;
   3182  1.1  christos static int bufptr = 0;
   3183  1.1  christos 
   3184  1.1  christos static void
   3185  1.1  christos put_buf (char c)
   3186  1.1  christos {
   3187  1.1  christos   if (bufptr == buflen)
   3188  1.1  christos     {
   3189  1.1  christos       buflen += 50;		/* overly reasonable, eh?  */
   3190  1.1  christos       if (buffer)
   3191  1.1  christos 	buffer = xrealloc (buffer, buflen + 1);
   3192  1.1  christos       else
   3193  1.1  christos 	buffer = xmalloc (buflen + 1);
   3194  1.1  christos     }
   3195  1.1  christos   buffer[bufptr++] = c;
   3196  1.1  christos   buffer[bufptr] = 0;		/* not optimal, but very convenient.  */
   3197  1.1  christos }
   3198  1.1  christos 
   3199  1.1  christos static struct
   3200  1.1  christos {
   3201  1.1  christos   char *name;
   3202  1.1  christos   int token;
   3203  1.1  christos }
   3204  1.1  christos tokens[] =
   3205  1.1  christos {
   3206  1.1  christos   { "BASE", BASE },
   3207  1.1  christos   { "CODE", CODE },
   3208  1.1  christos   { "CONSTANT", CONSTANTU },
   3209  1.1  christos   { "constant", CONSTANTL },
   3210  1.1  christos   { "DATA", DATAU },
   3211  1.1  christos   { "data", DATAL },
   3212  1.1  christos   { "DESCRIPTION", DESCRIPTION },
   3213  1.1  christos   { "DIRECTIVE", DIRECTIVE },
   3214  1.1  christos   { "EXECUTE", EXECUTE },
   3215  1.1  christos   { "EXPORTS", EXPORTS },
   3216  1.1  christos   { "HEAPSIZE", HEAPSIZE },
   3217  1.1  christos   { "IMPORTS", IMPORTS },
   3218  1.1  christos   { "LIBRARY", LIBRARY },
   3219  1.1  christos   { "NAME", NAME },
   3220  1.1  christos   { "NONAME", NONAMEU },
   3221  1.1  christos   { "noname", NONAMEL },
   3222  1.1  christos   { "PRIVATE", PRIVATEU },
   3223  1.1  christos   { "private", PRIVATEL },
   3224  1.1  christos   { "READ", READ },
   3225  1.1  christos   { "SECTIONS", SECTIONS },
   3226  1.1  christos   { "SEGMENTS", SECTIONS },
   3227  1.1  christos   { "SHARED", SHARED },
   3228  1.1  christos   { "STACKSIZE", STACKSIZE_K },
   3229  1.1  christos   { "VERSION", VERSIONK },
   3230  1.1  christos   { "WRITE", WRITE },
   3231  1.1  christos   { 0, 0 }
   3232  1.1  christos };
   3233  1.1  christos 
   3234  1.1  christos static int
   3235  1.1  christos def_getc (void)
   3236  1.1  christos {
   3237  1.1  christos   int rv;
   3238  1.1  christos 
   3239  1.1  christos   if (lex_parse_string)
   3240  1.1  christos     {
   3241  1.1  christos       if (lex_parse_string >= lex_parse_string_end)
   3242  1.1  christos 	rv = EOF;
   3243  1.1  christos       else
   3244  1.1  christos 	rv = *lex_parse_string++;
   3245  1.1  christos     }
   3246  1.1  christos   else
   3247  1.1  christos     {
   3248  1.1  christos       rv = fgetc (the_file);
   3249  1.1  christos     }
   3250  1.1  christos   if (rv == '\n')
   3251  1.1  christos     saw_newline = 1;
   3252  1.1  christos   return rv;
   3253  1.1  christos }
   3254  1.1  christos 
   3255  1.1  christos static int
   3256  1.1  christos def_ungetc (int c)
   3257  1.1  christos {
   3258  1.1  christos   if (lex_parse_string)
   3259  1.1  christos     {
   3260  1.1  christos       lex_parse_string--;
   3261  1.1  christos       return c;
   3262  1.1  christos     }
   3263  1.1  christos   else
   3264  1.1  christos     return ungetc (c, the_file);
   3265  1.1  christos }
   3266  1.1  christos 
   3267  1.1  christos static int
   3268  1.1  christos def_lex (void)
   3269  1.1  christos {
   3270  1.1  christos   int c, i, q;
   3271  1.1  christos 
   3272  1.1  christos   if (lex_forced_token)
   3273  1.1  christos     {
   3274  1.1  christos       i = lex_forced_token;
   3275  1.1  christos       lex_forced_token = 0;
   3276  1.1  christos #if TRACE
   3277  1.1  christos       printf ("lex: forcing token %d\n", i);
   3278  1.1  christos #endif
   3279  1.1  christos       return i;
   3280  1.1  christos     }
   3281  1.1  christos 
   3282  1.1  christos   c = def_getc ();
   3283  1.1  christos 
   3284  1.1  christos   /* Trim leading whitespace.  */
   3285  1.1  christos   while (c != EOF && (c == ' ' || c == '\t') && saw_newline)
   3286  1.1  christos     c = def_getc ();
   3287  1.1  christos 
   3288  1.1  christos   if (c == EOF)
   3289  1.1  christos     {
   3290  1.1  christos #if TRACE
   3291  1.1  christos       printf ("lex: EOF\n");
   3292  1.1  christos #endif
   3293  1.1  christos       return 0;
   3294  1.1  christos     }
   3295  1.1  christos 
   3296  1.1  christos   if (saw_newline && c == ';')
   3297  1.1  christos     {
   3298  1.1  christos       do
   3299  1.1  christos 	{
   3300  1.1  christos 	  c = def_getc ();
   3301  1.1  christos 	}
   3302  1.1  christos       while (c != EOF && c != '\n');
   3303  1.1  christos       if (c == '\n')
   3304  1.1  christos 	return def_lex ();
   3305  1.1  christos       return 0;
   3306  1.1  christos     }
   3307  1.1  christos 
   3308  1.1  christos   /* Must be something else.  */
   3309  1.1  christos   saw_newline = 0;
   3310  1.1  christos 
   3311  1.1  christos   if (ISDIGIT (c))
   3312  1.1  christos     {
   3313  1.1  christos       bufptr = 0;
   3314  1.1  christos       while (c != EOF && (ISXDIGIT (c) || (c == 'x')))
   3315  1.1  christos 	{
   3316  1.1  christos 	  put_buf (c);
   3317  1.1  christos 	  c = def_getc ();
   3318  1.1  christos 	}
   3319  1.1  christos       if (c != EOF)
   3320  1.1  christos 	def_ungetc (c);
   3321  1.1  christos       yylval.digits = def_pool_strdup (buffer);
   3322  1.1  christos #if TRACE
   3323  1.1  christos       printf ("lex: `%s' returns DIGITS\n", buffer);
   3324  1.1  christos #endif
   3325  1.1  christos       return DIGITS;
   3326  1.1  christos     }
   3327  1.1  christos 
   3328  1.1  christos   if (ISALPHA (c) || strchr ("$:-_?@", c))
   3329  1.1  christos     {
   3330  1.1  christos       bufptr = 0;
   3331  1.1  christos       q = c;
   3332  1.1  christos       put_buf (c);
   3333  1.1  christos       c = def_getc ();
   3334  1.1  christos 
   3335  1.1  christos       if (q == '@')
   3336  1.1  christos 	{
   3337  1.6  christos 	  if (ISBLANK (c) ) /* '@' followed by whitespace.  */
   3338  1.1  christos 	    return (q);
   3339  1.6  christos 	  else if (ISDIGIT (c)) /* '@' followed by digit.  */
   3340  1.6  christos 	    {
   3341  1.1  christos 	      def_ungetc (c);
   3342  1.6  christos 	      return (q);
   3343  1.1  christos 	    }
   3344  1.1  christos #if TRACE
   3345  1.1  christos 	  printf ("lex: @ returns itself\n");
   3346  1.1  christos #endif
   3347  1.1  christos 	}
   3348  1.1  christos 
   3349  1.1  christos       while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@<>", c)))
   3350  1.1  christos 	{
   3351  1.1  christos 	  put_buf (c);
   3352  1.1  christos 	  c = def_getc ();
   3353  1.1  christos 	}
   3354  1.1  christos       if (c != EOF)
   3355  1.1  christos 	def_ungetc (c);
   3356  1.1  christos       if (ISALPHA (q)) /* Check for tokens.  */
   3357  1.1  christos 	{
   3358  1.6  christos 	  for (i = 0; tokens[i].name; i++)
   3359  1.1  christos 	    if (strcmp (tokens[i].name, buffer) == 0)
   3360  1.1  christos 	      {
   3361  1.1  christos #if TRACE
   3362  1.1  christos 	        printf ("lex: `%s' is a string token\n", buffer);
   3363  1.1  christos #endif
   3364  1.1  christos 	        return tokens[i].token;
   3365  1.1  christos 	      }
   3366  1.1  christos 	}
   3367  1.1  christos #if TRACE
   3368  1.1  christos       printf ("lex: `%s' returns ID\n", buffer);
   3369  1.1  christos #endif
   3370  1.1  christos       yylval.id = def_pool_strdup (buffer);
   3371  1.1  christos       return ID;
   3372  1.1  christos     }
   3373  1.1  christos 
   3374  1.1  christos   if (c == '\'' || c == '"')
   3375  1.1  christos     {
   3376  1.1  christos       q = c;
   3377  1.1  christos       c = def_getc ();
   3378  1.1  christos       bufptr = 0;
   3379  1.1  christos 
   3380  1.1  christos       while (c != EOF && c != q)
   3381  1.1  christos 	{
   3382  1.1  christos 	  put_buf (c);
   3383  1.1  christos 	  c = def_getc ();
   3384  1.1  christos 	}
   3385  1.1  christos       yylval.id = def_pool_strdup (buffer);
   3386  1.1  christos #if TRACE
   3387  1.1  christos       printf ("lex: `%s' returns ID\n", buffer);
   3388  1.1  christos #endif
   3389  1.1  christos       return ID;
   3390  1.1  christos     }
   3391  1.1  christos 
   3392  1.1  christos   if ( c == '=')
   3393  1.1  christos     {
   3394  1.1  christos       c = def_getc ();
   3395  1.1  christos       if (c == '=')
   3396  1.6  christos 	{
   3397  1.1  christos #if TRACE
   3398  1.6  christos 	  printf ("lex: `==' returns EQUAL\n");
   3399  1.1  christos #endif
   3400  1.6  christos 	  return EQUAL;
   3401  1.6  christos 	}
   3402  1.1  christos       def_ungetc (c);
   3403  1.1  christos #if TRACE
   3404  1.1  christos       printf ("lex: `=' returns itself\n");
   3405  1.1  christos #endif
   3406  1.1  christos       return '=';
   3407  1.1  christos     }
   3408  1.1  christos   if (c == '.' || c == ',')
   3409  1.1  christos     {
   3410  1.1  christos #if TRACE
   3411  1.1  christos       printf ("lex: `%c' returns itself\n", c);
   3412  1.1  christos #endif
   3413  1.1  christos       return c;
   3414  1.1  christos     }
   3415  1.1  christos 
   3416  1.1  christos   if (c == '\n')
   3417  1.1  christos     {
   3418  1.1  christos       linenumber++;
   3419  1.1  christos       saw_newline = 1;
   3420  1.1  christos     }
   3421  1.1  christos 
   3422  1.1  christos   /*printf ("lex: 0x%02x ignored\n", c); */
   3423  1.1  christos   return def_lex ();
   3424  1.1  christos }
   3425  1.1  christos 
   3426  1.1  christos static char *
   3427  1.1  christos def_pool_alloc (size_t sz)
   3428  1.1  christos {
   3429  1.1  christos   def_pool_str *e;
   3430  1.1  christos 
   3431  1.1  christos   e = (def_pool_str *) xmalloc (sizeof (def_pool_str) + sz);
   3432  1.1  christos   e->next = pool_strs;
   3433  1.1  christos   pool_strs = e;
   3434  1.1  christos   return e->data;
   3435  1.1  christos }
   3436  1.1  christos 
   3437  1.1  christos static char *
   3438  1.1  christos def_pool_strdup (const char *str)
   3439  1.1  christos {
   3440  1.1  christos   char *s;
   3441  1.1  christos   size_t len;
   3442  1.1  christos   if (!str)
   3443  1.1  christos     return NULL;
   3444  1.1  christos   len = strlen (str) + 1;
   3445  1.1  christos   s = def_pool_alloc (len);
   3446  1.1  christos   memcpy (s, str, len);
   3447  1.1  christos   return s;
   3448  1.1  christos }
   3449  1.1  christos 
   3450  1.1  christos static void
   3451  1.1  christos def_pool_free (void)
   3452  1.1  christos {
   3453  1.1  christos   def_pool_str *p;
   3454  1.1  christos   while ((p = pool_strs) != NULL)
   3455  1.1  christos     {
   3456  1.1  christos       pool_strs = p->next;
   3457  1.1  christos       free (p);
   3458  1.1  christos     }
   3459  1.1  christos }
   3460