* dlltool.h: New file.

* deflex.l: Include dlltool.h and libiberty.h.  Don't declare
	strdup.  Use xstrdup rather than strdup.
	* defparse.y: Include bfd.h, bucomm.h, and dlltool.h.
	* dlltool.c: Include dlltool.h and time.h.  Make a lot of
	variables and functions static.  Make a lot of char * variables
	and parameters const.  Add declarations for static functions.  Do
	some reindenting.  Hide more PowerPC stuff inside DLLTOOL_PPC.
This commit is contained in:
Ian Lance Taylor 1997-06-11 21:18:10 +00:00
parent f14c4109f8
commit a33f735924
6 changed files with 351 additions and 253 deletions

View File

@ -51,6 +51,7 @@ configure.com
configure.in
cxxfilt.man
dlltool.c
dlltool.h
debug.c
debug.h
dep-in.sed

View File

@ -1,3 +1,14 @@
Wed Jun 11 17:15:47 1997 Ian Lance Taylor <ian@cygnus.com>
* dlltool.h: New file.
* deflex.l: Include dlltool.h and libiberty.h. Don't declare
strdup. Use xstrdup rather than strdup.
* defparse.y: Include bfd.h, bucomm.h, and dlltool.h.
* dlltool.c: Include dlltool.h and time.h. Make a lot of
variables and functions static. Make a lot of char * variables
and parameters const. Add declarations for static functions. Do
some reindenting. Hide more PowerPC stuff inside DLLTOOL_PPC.
Wed Jun 11 12:05:52 1997 H.J. Lu <hjl@gnu.ai.mit.edu>
* ar.c (bfd_special_undocumented_glue): Add const.

View File

@ -1,7 +1,6 @@
%{
/* deflex.l - Lexer for .def files */
%{/* deflex.l - Lexer for .def files */
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@ -17,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Contributed by Steve Chamberlain
@ -25,29 +24,30 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
#define DONTDECLARE_MALLOC
#include "libiberty.h"
#include "defparse.h"
extern char *strdup();
#include "dlltool.h"
int linenumber;
%}
%%
"NAME" { return NAME;}
"LIBRARY" { return LIBRARY;}
"DESCRIPTION" { return DESCRIPTION;}
"STACKSIZE" { return STACKSIZE;}
"HEAPSIZE" { return HEAPSIZE;}
"CODE" { return CODE;}
"DATA" { return DATA;}
"SECTIONS" { return SECTIONS;}
"EXPORTS" { return EXPORTS;}
"IMPORTS" { return IMPORTS;}
"VERSION" { return VERSION;}
"BASE" { return BASE;}
"NAME" { return NAME;}
"LIBRARY" { return LIBRARY;}
"DESCRIPTION" { return DESCRIPTION;}
"STACKSIZE" { return STACKSIZE;}
"HEAPSIZE" { return HEAPSIZE;}
"CODE" { return CODE;}
"DATA" { return DATA;}
"SECTIONS" { return SECTIONS;}
"EXPORTS" { return EXPORTS;}
"IMPORTS" { return IMPORTS;}
"VERSION" { return VERSION;}
"BASE" { return BASE;}
"CONSTANT" { return CONSTANT; }
"NONAME" { return NONAME; }
"READ" { return READ;}
"WRITE" { return WRITE;}
"READ" { return READ;}
"WRITE" { return WRITE;}
"EXECUTE" { return EXECUTE;}
"SHARED" { return SHARED;}
@ -55,29 +55,30 @@ int linenumber;
return NUMBER; }
[A-Za-z$:\-\_][A-Za-z0-9/$:\-\_@]+ {
yylval.id = strdup(yytext);
yylval.id = xstrdup (yytext);
return ID;
}
"\""[^\"]*"\"" {
yylval.string = strdup (yytext+1);
yylval.string[yyleng-2] = 0;
return STRING;
yylval.id = xstrdup (yytext+1);
yylval.id[yyleng-2] = 0;
return ID;
}
"\'"[^\']*"\'" {
yylval.string = strdup (yytext+1);
yylval.string[yyleng-2] = 0;
return STRING;
yylval.id = xstrdup (yytext+1);
yylval.id[yyleng-2] = 0;
return ID;
}
"*".* { }
";".* { }
" " { }
"\t" { }
"\n" { linenumber ++ ;}
"=" { return '=';}
"." { return '.';}
"@" { return '@';}
"," { return ',';}
"\n" { linenumber ++ ;}
"=" { return '=';}
"." { return '.';}
"@" { return '@';}
"," { return ',';}
%%
#ifndef yywrap
/* Needed for lex, though not flex. */

View File

@ -1,7 +1,6 @@
{
/* defparse.y - parser for .def files */
%{ /* defparse.y - parser for .def files */
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@ -17,20 +16,22 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "bucomm.h"
#include "dlltool.h"
%}
%union {
char *id;
int number;
char *string;
};
%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
%token SECTIONS, EXPORTS, IMPORTS, VERSION, BASE, CONSTANT
%token READ WRITE EXECUTE SHARED NONAME
%token <id> ID
%token <string> STRING
%token <number> NUMBER
%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT attr attr_list opt_number
%type <id> opt_name opt_equal_name
@ -45,7 +46,7 @@ command:
NAME opt_name opt_base { def_name ($2, $3); }
| LIBRARY opt_name opt_base { def_library ($2, $3); }
| EXPORTS explist
| DESCRIPTION STRING { def_description ($2);}
| DESCRIPTION ID { def_description ($2);}
| STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
| HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);}
| CODE attr_list { def_code ($2);}

File diff suppressed because it is too large Load Diff

40
binutils/dlltool.h Normal file
View File

@ -0,0 +1,40 @@
/* dlltool.h -- header file for dlltool
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of GNU Binutils.
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 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 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. */
#include "ansidecl.h"
#include <stdio.h>
extern void def_code PARAMS ((int));
extern void def_data PARAMS ((int));
extern void def_description PARAMS ((const char *));
extern void def_exports PARAMS ((const char *, const char *, int, int, int));
extern void def_heapsize PARAMS ((int, int));
extern void def_import PARAMS ((const char *, const char *, const char *));
extern void def_library PARAMS ((const char *, int));
extern void def_name PARAMS ((const char *, int));
extern void def_section PARAMS ((const char *, int));
extern void def_stacksize PARAMS ((int, int));
extern void def_version PARAMS ((int, int));
extern int yyparse PARAMS ((void));
extern int yyerror PARAMS ((const char *));
extern int yydebug;
extern int yylex PARAMS ((void));
extern FILE *yyin;
extern int linenumber;