[PATCH 1/2] winebuild: Move the global string spec_file_name to DLLSPEC
Detlef Riekenberg
wine.dev at web.de
Wed Dec 23 03:27:32 CST 2009
---
tools/winebuild/build.h | 4 ++--
tools/winebuild/main.c | 13 ++++++-------
tools/winebuild/spec16.c | 4 ++--
tools/winebuild/spec32.c | 6 +++---
tools/winebuild/utils.c | 8 +++++---
5 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index e47278a..202c6f5 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -97,6 +97,7 @@ typedef struct
char *dll_name; /* internal name of the dll */
char *init_func; /* initialization routine */
char *main_module; /* main Win32 module for Win16 specs */
+ char *spec_file_name; /* specfile to use for export */
SPEC_TYPE type; /* type of dll (Win16/Win32) */
int base; /* ordinal base */
int limit; /* ordinal limit */
@@ -213,7 +214,7 @@ extern const char *get_ld_command(void);
extern const char *get_nm_command(void);
extern const char *get_windres_command(void);
extern char *get_temp_file_name( const char *prefix, const char *suffix );
-extern void output_standard_file_header(void);
+extern void output_standard_file_header(DLLSPEC * );
extern FILE *open_input_file( const char *srcdir, const char *name );
extern void close_input_file( FILE *file );
extern void dump_bytes( const void *buffer, unsigned int size );
@@ -313,7 +314,6 @@ extern int link_ext_symbols;
extern int force_pointer_size;
extern char *input_file_name;
-extern char *spec_file_name;
extern FILE *output_file;
extern const char *output_file_name;
extern char **lib_path;
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 14c1689..88639c5 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -80,7 +80,6 @@ char *target_alias = NULL;
char **lib_path = NULL;
char *input_file_name = NULL;
-char *spec_file_name = NULL;
FILE *output_file = NULL;
const char *output_file_name = NULL;
static const char *output_file_source_name;
@@ -343,7 +342,7 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
/* ignored */
break;
case 'E':
- spec_file_name = xstrdup( optarg );
+ spec->spec_file_name = xstrdup( optarg );
set_dll_file_name( optarg, spec );
break;
case 'F':
@@ -571,8 +570,8 @@ static void load_import_libs( char *argv[] )
static int parse_input_file( DLLSPEC *spec )
{
- FILE *input_file = open_input_file( NULL, spec_file_name );
- char *extension = strrchr( spec_file_name, '.' );
+ FILE *input_file = open_input_file( NULL, spec->spec_file_name );
+ char *extension = strrchr( spec->spec_file_name, '.' );
int result;
spec->src_name = xstrdup( input_file_name );
@@ -606,7 +605,7 @@ int main(int argc, char **argv)
case MODE_DLL:
if (spec->subsystem != IMAGE_SUBSYSTEM_NATIVE)
spec->characteristics |= IMAGE_FILE_DLL;
- if (!spec_file_name) fatal_error( "missing .spec file\n" );
+ if (!spec->spec_file_name) fatal_error( "missing .spec file\n" );
if (spec->type == SPEC_WIN32 && spec->main_module) /* embedded 16-bit module */
{
spec->type = SPEC_WIN16;
@@ -618,7 +617,7 @@ int main(int argc, char **argv)
case MODE_EXE:
load_resources( argv, spec );
load_import_libs( argv );
- if (spec_file_name && !parse_input_file( spec )) break;
+ if (spec->spec_file_name && !parse_input_file( spec )) break;
if (fake_module)
{
if (spec->type == SPEC_WIN16) output_fake_module16( spec );
@@ -640,7 +639,7 @@ int main(int argc, char **argv)
case MODE_DEF:
if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
if (spec->type == SPEC_WIN16) fatal_error( "Cannot yet build .def file for 16-bit dlls\n" );
- if (!spec_file_name) fatal_error( "missing .spec file\n" );
+ if (!spec->spec_file_name) fatal_error( "missing .spec file\n" );
if (!parse_input_file( spec )) break;
BuildDef32File( spec );
break;
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
index a0a962f..eb25b73 100644
--- a/tools/winebuild/spec16.c
+++ b/tools/winebuild/spec16.c
@@ -851,7 +851,7 @@ static void output_module16( DLLSPEC *spec )
void BuildSpec16File( DLLSPEC *spec )
{
init_dll_name( spec );
- output_standard_file_header();
+ output_standard_file_header(spec);
output_module16( spec );
output_init_code( spec );
@@ -886,7 +886,7 @@ void output_spec16_file( DLLSPEC *spec16 )
resolve_imports( spec16 );
add_16bit_exports( spec32, spec16 );
- output_standard_file_header();
+ output_standard_file_header( spec16 );
output_module( spec32 );
output_module16( spec16 );
output_stubs( spec16 );
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index c2b11af..46e1beb 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -549,7 +549,7 @@ void output_module( DLLSPEC *spec )
void BuildSpec32File( DLLSPEC *spec )
{
resolve_imports( spec );
- output_standard_file_header();
+ output_standard_file_header(spec);
output_module( spec );
output_stubs( spec );
output_exports( spec );
@@ -771,9 +771,9 @@ void BuildDef32File( DLLSPEC *spec )
const char *name;
int i, total;
- if (spec_file_name)
+ if (spec->spec_file_name)
output( "; File generated automatically from %s; do not edit!\n\n",
- spec_file_name );
+ spec->spec_file_name );
else
output( "; File generated automatically; do not edit!\n\n" );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index c0b9371..7533cac 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -540,10 +540,10 @@ void align_output( unsigned int align )
}
/* output a standard header for generated files */
-void output_standard_file_header(void)
+void output_standard_file_header(DLLSPEC * spec)
{
- if (spec_file_name)
- output( "/* File generated automatically from %s; do not edit! */\n", spec_file_name );
+ if (spec->spec_file_name)
+ output( "/* File generated automatically from %s; do not edit! */\n", spec->spec_file_name );
else
output( "/* File generated automatically; do not edit! */\n" );
output( "/* This file can be copied, modified and distributed without restriction. */\n\n" );
@@ -658,6 +658,7 @@ DLLSPEC *alloc_dll_spec(void)
spec->dll_name = NULL;
spec->init_func = NULL;
spec->main_module = NULL;
+ spec->spec_file_name = NULL;
spec->type = SPEC_WIN32;
spec->base = MAX_ORDINALS;
spec->limit = 0;
@@ -700,6 +701,7 @@ void free_dll_spec( DLLSPEC *spec )
free( odp->export_name );
free( odp->link_name );
}
+ free( spec->spec_file_name );
free( spec->file_name );
free( spec->dll_name );
free( spec->init_func );
--
1.6.5
--=-------------12615674909256535012--
More information about the wine-patches
mailing list