nlmheader.c

来自「基于4个mips核的noc设计」· C语言 代码 · 共 1,992 行 · 第 1/4 页

C
1,992
字号
/*  A Bison parser, made from nlmheader.y    by GNU Bison version 1.28  */#define YYBISON 1  /* Identify Bison output.  */#define	CHECK	257#define	CODESTART	258#define	COPYRIGHT	259#define	CUSTOM	260#define	DATE	261#define	DEBUG	262#define	DESCRIPTION	263#define	EXIT	264#define	EXPORT	265#define	FLAG_ON	266#define	FLAG_OFF	267#define	FULLMAP	268#define	HELP	269#define	IMPORT	270#define	INPUT	271#define	MAP	272#define	MESSAGES	273#define	MODULE	274#define	MULTIPLE	275#define	OS_DOMAIN	276#define	OUTPUT	277#define	PSEUDOPREEMPTION	278#define	REENTRANT	279#define	SCREENNAME	280#define	SHARELIB	281#define	STACK	282#define	START	283#define	SYNCHRONIZE	284#define	THREADNAME	285#define	TYPE	286#define	VERBOSE	287#define	VERSIONK	288#define	XDCDATA	289#define	STRING	290#define	QUOTED_STRING	291#line 1 "nlmheader.y"/* nlmheader.y - parse NLM header specification keywords.     Copyright 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.This file is part of GNU Binutils.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  *//* Written by Ian Lance Taylor <ian@cygnus.com>.   This bison file parses the commands recognized by the NetWare NLM   linker, except for lists of object files.  It stores the   information in global variables.   This implementation is based on the description in the NetWare Tool   Maker Specification manual, edition 1.0.  */#include <ansidecl.h>#include <stdio.h>#include <ctype.h>#include "bfd.h"#include "bucomm.h"#include "nlm/common.h"#include "nlm/internal.h"#include "nlmconv.h"/* Information is stored in the structures pointed to by these   variables.  */Nlm_Internal_Fixed_Header *fixed_hdr;Nlm_Internal_Variable_Header *var_hdr;Nlm_Internal_Version_Header *version_hdr;Nlm_Internal_Copyright_Header *copyright_hdr;Nlm_Internal_Extended_Header *extended_hdr;/* Procedure named by CHECK.  */char *check_procedure;/* File named by CUSTOM.  */char *custom_file;/* Whether to generate debugging information (DEBUG).  */boolean debug_info;/* Procedure named by EXIT.  */char *exit_procedure;/* Exported symbols (EXPORT).  */struct string_list *export_symbols;/* List of files from INPUT.  */struct string_list *input_files;/* Map file name (MAP, FULLMAP).  */char *map_file;/* Whether a full map has been requested (FULLMAP).  */boolean full_map;/* File named by HELP.  */char *help_file;/* Imported symbols (IMPORT).  */struct string_list *import_symbols;/* File named by MESSAGES.  */char *message_file;/* Autoload module list (MODULE).  */struct string_list *modules;/* File named by OUTPUT.  */char *output_file;/* File named by SHARELIB.  */char *sharelib_file;/* Start procedure name (START).  */char *start_procedure;/* VERBOSE.  */boolean verbose;/* RPC description file (XDCDATA).  */char *rpc_file;/* The number of serious errors that have occurred.  */int parse_errors;/* The current symbol prefix when reading a list of import or export   symbols.  */static char *symbol_prefix;/* Parser error message handler.  */#define yyerror(msg) nlmheader_error (msg);/* Local functions.  */static int yylex PARAMS ((void));static void nlmlex_file_push PARAMS ((const char *));static boolean nlmlex_file_open PARAMS ((const char *));static int nlmlex_buf_init PARAMS ((void));static char nlmlex_buf_add PARAMS ((int));static long nlmlex_get_number PARAMS ((const char *));static void nlmheader_identify PARAMS ((void));static void nlmheader_warn PARAMS ((const char *, int));static void nlmheader_error PARAMS ((const char *));static struct string_list * string_list_cons PARAMS ((char *,						      struct string_list *));static struct string_list * string_list_append PARAMS ((struct string_list *,							struct string_list *));static struct string_list * string_list_append1 PARAMS ((struct string_list *,							 char *));static char *xstrdup PARAMS ((const char *));#line 112 "nlmheader.y"typedef union{  char *string;  struct string_list *list;} YYSTYPE;#include <stdio.h>#ifndef __cplusplus#ifndef __STDC__#define const#endif#endif#define	YYFINAL		82#define	YYFLAG		-32768#define	YYNTBASE	40#define YYTRANSLATE(x) ((unsigned)(x) <= 291 ? yytranslate[x] : 50)static const char yytranslate[] = {     0,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,    38,    39,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,    37};#if YYDEBUG != 0static const short yyprhs[] = {     0,     0,     2,     3,     6,     9,    12,    15,    18,    23,    25,    28,    31,    32,    36,    39,    42,    44,    47,    50,    51,    55,    58,    60,    63,    66,    69,    71,    73,    76,    78,    80,    83,    86,    89,    92,    94,    97,   100,   102,   107,   111,   114,   115,   117,   119,   121,   124,   127,   131,   133,   134};static const short yyrhs[] = {    41,     0,     0,    42,    41,     0,     3,    36,     0,     4,    36,     0,     5,    37,     0,     6,    36,     0,     7,    36,    36,    36,     0,     8,     0,     9,    37,     0,    10,    36,     0,     0,    11,    43,    45,     0,    12,    36,     0,    13,    36,     0,    14,     0,    14,    36,     0,    15,    36,     0,     0,    16,    44,    45,     0,    17,    49,     0,    18,     0,    18,    36,     0,    19,    36,     0,    20,    49,     0,    21,     0,    22,     0,    23,    36,     0,    24,     0,    25,     0,    26,    37,     0,    27,    36,     0,    28,    36,     0,    29,    36,     0,    30,     0,    31,    37,     0,    32,    36,     0,    33,     0,    34,    36,    36,    36,     0,    34,    36,    36,     0,    35,    36,     0,     0,    46,     0,    48,     0,    47,     0,    46,    48,     0,    46,    47,     0,    38,    36,    39,     0,    36,     0,     0,    36,    49,     0};#endif#if YYDEBUG != 0static const short yyrline[] = { 0,   143,   149,   151,   156,   161,   166,   183,   187,   205,   209,   225,   229,   234,   237,   242,   247,   252,   257,   261,   266,   269,   273,   277,   281,   285,   289,   293,   297,   304,   308,   312,   328,   332,   337,   341,   345,   361,   366,   370,   394,   410,   418,   423,   433,   438,   442,   446,   454,   465,   481,   486};#endif#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)static const char * const yytname[] = {   "$","error","$undefined.","CHECK","CODESTART","COPYRIGHT","CUSTOM","DATE","DEBUG","DESCRIPTION","EXIT","EXPORT","FLAG_ON","FLAG_OFF","FULLMAP","HELP","IMPORT","INPUT","MAP","MESSAGES","MODULE","MULTIPLE","OS_DOMAIN","OUTPUT","PSEUDOPREEMPTION","REENTRANT","SCREENNAME","SHARELIB","STACK","START","SYNCHRONIZE","THREADNAME","TYPE","VERBOSE","VERSIONK","XDCDATA","STRING","QUOTED_STRING","'('","')'","file","commands","command","@1","@2","symbol_list_opt","symbol_list","symbol_prefix","symbol","string_list", NULL};#endifstatic const short yyr1[] = {     0,    40,    41,    41,    42,    42,    42,    42,    42,    42,    42,    42,    43,    42,    42,    42,    42,    42,    42,    44,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    42,    45,    45,    46,    46,    46,    46,    47,    48,    49,    49};static const short yyr2[] = {     0,     1,     0,     2,     2,     2,     2,     2,     4,     1,     2,     2,     0,     3,     2,     2,     1,     2,     2,     0,     3,     2,     1,     2,     2,     2,     1,     1,     2,     1,     1,     2,     2,     2,     2,     1,     2,     2,     1,     4,     3,     2,     0,     1,     1,     1,     2,     2,     3,     1,     0,     2};static const short yydefact[] = {     2,     0,     0,     0,     0,     0,     9,     0,     0,    12,     0,     0,    16,     0,    19,    50,    22,     0,    50,    26,    27,     0,    29,    30,     0,     0,     0,     0,    35,     0,     0,    38,     0,     0,     1,     2,     4,     5,     6,     7,     0,    10,    11,    42,    14,    15,    17,    18,    42,    50,    21,    23,    24,    25,    28,    31,    32,    33,    34,    36,    37,     0,    41,     3,     0,    49,     0,    13,    43,    45,    44,    20,    51,    40,     8,     0,    47,    46,    39,    48,     0,     0,     0};static const short yydefgoto[] = {    80,    34,    35,    43,    48,    67,    68,    69,    70,    50};static const short yypact[] = {    -3,    -1,     1,     2,     4,     5,-32768,     6,     8,-32768,     9,    10,    11,    12,-32768,    13,    14,    16,    13,-32768,-32768,    17,-32768,-32768,    18,    20,    21,    22,-32768,    23,    25,-32768,    26,    27,-32768,    -3,-32768,-32768,-32768,-32768,    29,-32768,-32768,    -2,-32768,-32768,-32768,-32768,    -2,    13,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    30,-32768,-32768,    31,-32768,    32,-32768,    -2,-32768,-32768,-32768,-32768,    33,-32768,     3,-32768,-32768,-32768,-32768,    38,    51,-32768};static const short yypgoto[] = {-32768,    19,-32768,-32768,-32768,    24,-32768,    -9,     7,    15};#define	YYLAST		75static const short yytable[] = {     1,     2,     3,     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,    30,    31,    32,    33,    53,    65,    36,    66,    37,    81,    38,    39,    40,    79,    41,    42,    44,    45,    46,    47,    49,    51,    82,    52,    54,    63,    55,    56,    57,    58,    76,    59,    60,    61,    62,    72,    64,    73,    74,    75,    78,     0,     0,    71,     0,     0,    77};static const short yycheck[] = {     3,     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,    18,    36,    36,    38,    36,     0,    37,    36,    36,    39,    37,    36,    36,    36,    36,    36,    36,    36,     0,    36,    36,    35,    37,    36,    36,    36,    68,    37,    36,    36,    36,    49,    36,    36,    36,    36,    36,    -1,    -1,    48,    -1,    -1,    68};/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */#line 3 "/usr/share/bison/bison.simple"/* This file comes from bison-1.28.  *//* Skeleton output parser for bison,   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2, or (at your option)   any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 59 Temple Place - Suite 330,   Boston, MA 02111-1307, USA.  *//* As a special exception, when this file is copied by Bison into a   Bison output file, you may use that output file without restriction.   This special exception was added by the Free Software Foundation   in version 1.24 of Bison.  *//* This is the parser code that is written into each bison parser  when the %semantic_parser declaration is not specified in the grammar.  It was written by Richard Stallman by simplifying the hairy parser  used when %semantic_parser is specified.  */#ifndef YYSTACK_USE_ALLOCA#ifdef alloca#define YYSTACK_USE_ALLOCA#else /* alloca not defined */#ifdef __GNUC__#define YYSTACK_USE_ALLOCA#define alloca __builtin_alloca#else /* not GNU C.  */#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))#define YYSTACK_USE_ALLOCA#include <alloca.h>#else /* not sparc *//* We think this test detects Watcom and Microsoft C.  *//* This used to test MSDOS, but that is a bad idea   since that symbol is in the user namespace.  */#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)#if 0 /* No need for malloc.h, which pollutes the namespace;	 instead, just don't use alloca.  */#include <malloc.h>#endif#else /* not MSDOS, or __TURBOC__ */#if defined(_AIX)/* I don't know what this was needed for, but it pollutes the namespace.   So I turned it off.   rms, 2 May 1997.  *//* #include <malloc.h>  */ #pragma alloca#define YYSTACK_USE_ALLOCA#else /* not MSDOS, or __TURBOC__, or _AIX */#if 0#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,		 and on HPUX 10.  Eventually we can turn this on.  */#define YYSTACK_USE_ALLOCA#define alloca __builtin_alloca#endif /* __hpux */#endif#endif /* not _AIX */#endif /* not MSDOS, or __TURBOC__ */#endif /* not sparc */#endif /* not GNU C */#endif /* alloca not defined */#endif /* YYSTACK_USE_ALLOCA not defined */#ifdef YYSTACK_USE_ALLOCA#define YYSTACK_ALLOC alloca#else#define YYSTACK_ALLOC malloc#endif/* Note: there must be only one dollar sign in this file.   It is replaced by the list of actions, each action   as one case of the switch.  */#define yyerrok		(yyerrstatus = 0)#define yyclearin	(yychar = YYEMPTY)#define YYEMPTY		-2#define YYEOF		0#define YYACCEPT	goto yyacceptlab#define YYABORT 	goto yyabortlab#define YYERROR		goto yyerrlab1/* Like YYERROR except do call yyerror.   This remains here temporarily to ease the   transition to the new meaning of YYERROR, for GCC.   Once GCC version 2 has supplanted version 1, this can go.  */#define YYFAIL		goto yyerrlab#define YYRECOVERING()  (!!yyerrstatus)#define YYBACKUP(token, value) \do								\  if (yychar == YYEMPTY && yylen == 1)				\    { yychar = (token), yylval = (value);			\      yychar1 = YYTRANSLATE (yychar);				\      YYPOPSTACK;						\      goto yybackup;						\    }								\  else								\    { yyerror ("syntax error: cannot back up"); YYERROR; }	\while (0)#define YYTERROR	1#define YYERRCODE	256#ifndef YYPURE#define YYLEX		yylex()#endif#ifdef YYPURE#ifdef YYLSP_NEEDED#ifdef YYLEX_PARAM#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)#else#define YYLEX		yylex(&yylval, &yylloc)#endif#else /* not YYLSP_NEEDED */#ifdef YYLEX_PARAM#define YYLEX		yylex(&yylval, YYLEX_PARAM)#else#define YYLEX		yylex(&yylval)#endif#endif /* not YYLSP_NEEDED */#endif/* If nonreentrant, generate the variables here */#ifndef YYPUREint	yychar;			/*  the lookahead symbol		*/YYSTYPE	yylval;			/*  the semantic value of the		*/				/*  lookahead symbol			*/#ifdef YYLSP_NEEDEDYYLTYPE yylloc;			/*  location data for the lookahead	*/				/*  symbol				*/#endifint yynerrs;			/*  number of parse errors so far       */#endif  /* not YYPURE */#if YYDEBUG != 0int yydebug;			/*  nonzero means print parse trace	*//* Since this is uninitialized, it does not stop multiple parsers   from coexisting.  */#endif/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/#ifndef	YYINITDEPTH#define YYINITDEPTH 200#endif/*  YYMAXDEPTH is the maximum size the stacks can grow to    (effective only if the built-in stack extension method is used).  */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?