Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
66fed8cb
Commit
66fed8cb
authored
Dec 15, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocate entry points dynamically to allow for a larger number of
ordinals.
parent
473fd0b0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
58 deletions
+46
-58
build.h
tools/winebuild/build.h
+5
-17
import.c
tools/winebuild/import.c
+2
-2
main.c
tools/winebuild/main.c
+2
-2
parser.c
tools/winebuild/parser.c
+13
-13
spec16.c
tools/winebuild/spec16.c
+7
-6
spec32.c
tools/winebuild/spec32.c
+17
-18
No files found.
tools/winebuild/build.h
View file @
66fed8cb
...
...
@@ -74,7 +74,6 @@ typedef struct
{
int
n_args
;
char
arg_types
[
17
];
char
link_name
[
80
];
}
ORD_FUNCTION
;
typedef
struct
...
...
@@ -84,29 +83,18 @@ typedef struct
typedef
struct
{
char
link_name
[
80
];
}
ORD_EXTERN
;
typedef
struct
{
char
link_name
[
80
];
}
ORD_FORWARD
;
typedef
struct
{
ORD_TYPE
type
;
int
ordinal
;
int
offset
;
int
lineno
;
int
flags
;
char
name
[
80
];
char
*
name
;
char
*
link_name
;
union
{
ORD_VARIABLE
var
;
ORD_FUNCTION
func
;
ORD_ABS
abs
;
ORD_EXTERN
ext
;
ORD_FORWARD
fwd
;
}
u
;
}
ORDDEF
;
...
...
@@ -132,7 +120,7 @@ typedef struct
#define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
#define MAX_ORDINALS
2048
#define MAX_ORDINALS
65535
/* global functions */
...
...
@@ -176,14 +164,14 @@ extern int nb_lib_paths;
extern
char
DLLName
[
80
];
extern
char
DLLFileName
[
80
];
extern
char
DLLInitFunc
[
80
];
extern
char
owner_name
[
80
];
extern
char
*
init_func
;
extern
const
char
*
input_file_name
;
extern
const
char
*
output_file_name
;
extern
char
**
debug_channels
;
extern
char
**
lib_path
;
extern
ORDDEF
EntryPoints
[
MAX_ORDINALS
];
extern
ORDDEF
*
EntryPoints
[
MAX_ORDINALS
];
extern
ORDDEF
*
Ordinals
[
MAX_ORDINALS
];
extern
ORDDEF
*
Names
[
MAX_ORDINALS
];
extern
SPEC_MODE
SpecMode
;
...
...
tools/winebuild/import.c
View file @
66fed8cb
...
...
@@ -247,8 +247,8 @@ static void warn_unused( const struct import* imp )
{
ORDDEF
*
odp
=
Ordinals
[
i
];
if
(
!
odp
||
odp
->
type
!=
TYPE_FORWARD
)
continue
;
if
(
!
strncasecmp
(
odp
->
u
.
fwd
.
link_name
,
imp
->
dll
,
len
)
&&
odp
->
u
.
fwd
.
link_name
[
len
]
==
'.'
)
if
(
!
strncasecmp
(
odp
->
link_name
,
imp
->
dll
,
len
)
&&
odp
->
link_name
[
len
]
==
'.'
)
return
;
/* found an import, do not warn */
}
/* switch current_line temporarily to the line of the import declaration */
...
...
tools/winebuild/main.c
View file @
66fed8cb
...
...
@@ -17,7 +17,7 @@
#include "winnt.h"
#include "build.h"
ORDDEF
EntryPoints
[
MAX_ORDINALS
];
ORDDEF
*
EntryPoints
[
MAX_ORDINALS
];
ORDDEF
*
Ordinals
[
MAX_ORDINALS
];
ORDDEF
*
Names
[
MAX_ORDINALS
];
...
...
@@ -40,8 +40,8 @@ int debugging = 0;
char
DLLName
[
80
];
char
DLLFileName
[
80
];
char
DLLInitFunc
[
80
];
char
owner_name
[
80
];
char
*
init_func
=
NULL
;
char
**
debug_channels
=
NULL
;
char
**
lib_path
=
NULL
;
...
...
tools/winebuild/parser.c
View file @
66fed8cb
...
...
@@ -279,7 +279,7 @@ static void ParseExportFunction( ORDDEF *odp )
odp
->
type
=
TYPE_CDECL
;
/* stdcall is the same as cdecl for 0 args */
if
(
odp
->
type
==
TYPE_VARARGS
)
odp
->
flags
|=
FLAG_NORELAY
;
/* no relay debug possible for varags entry point */
strcpy
(
odp
->
u
.
func
.
link_name
,
GetToken
(
0
)
);
odp
->
link_name
=
xstrdup
(
GetToken
(
0
)
);
}
...
...
@@ -310,7 +310,7 @@ static void ParseEquate( ORDDEF *odp )
static
void
ParseStub
(
ORDDEF
*
odp
)
{
odp
->
u
.
func
.
arg_types
[
0
]
=
'\0'
;
odp
->
u
.
func
.
link_name
[
0
]
=
'\0'
;
odp
->
link_name
=
xstrdup
(
""
)
;
}
...
...
@@ -333,7 +333,7 @@ static void ParseInterrupt( ORDDEF *odp )
if
(
*
token
!=
')'
)
fatal_error
(
"Expected ')' got '%s'
\n
"
,
token
);
odp
->
u
.
func
.
arg_types
[
0
]
=
'\0'
;
strcpy
(
odp
->
u
.
func
.
link_name
,
GetToken
(
0
)
);
odp
->
link_name
=
xstrdup
(
GetToken
(
0
)
);
}
...
...
@@ -345,7 +345,7 @@ static void ParseInterrupt( ORDDEF *odp )
static
void
ParseExtern
(
ORDDEF
*
odp
)
{
if
(
SpecType
==
SPEC_WIN16
)
fatal_error
(
"'extern' not supported for Win16
\n
"
);
strcpy
(
odp
->
u
.
ext
.
link_name
,
GetToken
(
0
)
);
odp
->
link_name
=
xstrdup
(
GetToken
(
0
)
);
/* 'extern' definitions are not available for implicit import */
odp
->
flags
|=
FLAG_NOIMPORT
;
}
...
...
@@ -359,7 +359,7 @@ static void ParseExtern( ORDDEF *odp )
static
void
ParseForward
(
ORDDEF
*
odp
)
{
if
(
SpecType
==
SPEC_WIN16
)
fatal_error
(
"'forward' not supported for Win16
\n
"
);
strcpy
(
odp
->
u
.
fwd
.
link_name
,
GetToken
(
0
)
);
odp
->
link_name
=
xstrdup
(
GetToken
(
0
)
);
}
...
...
@@ -409,7 +409,9 @@ static void ParseOrdinal(int ordinal)
{
char
*
token
;
ORDDEF
*
odp
=
&
EntryPoints
[
nb_entry_points
++
];
ORDDEF
*
odp
=
xmalloc
(
sizeof
(
*
odp
)
);
memset
(
odp
,
0
,
sizeof
(
*
odp
)
);
EntryPoints
[
nb_entry_points
++
]
=
odp
;
token
=
GetToken
(
0
);
...
...
@@ -423,7 +425,7 @@ static void ParseOrdinal(int ordinal)
token
=
GetToken
(
0
);
if
(
*
token
==
'-'
)
token
=
ParseFlags
(
odp
);
strcpy
(
odp
->
name
,
token
);
odp
->
name
=
xstrdup
(
token
);
fix_export_name
(
odp
->
name
);
odp
->
lineno
=
current_line
;
odp
->
ordinal
=
ordinal
;
...
...
@@ -464,8 +466,8 @@ static void ParseOrdinal(int ordinal)
if
(
odp
->
flags
&
FLAG_I386
)
{
/* ignore this entry point on non-Intel archs */
nb_entry_points
--
;
memset
(
odp
,
0
,
sizeof
(
*
odp
)
);
EntryPoints
[
--
nb_entry_points
]
=
NULL
;
free
(
odp
);
return
;
}
#endif
...
...
@@ -572,11 +574,9 @@ SPEC_TYPE ParseTopLevel( FILE *file )
}
else
if
(
strcmp
(
token
,
"init"
)
==
0
)
{
strcpy
(
DLLInitFunc
,
GetToken
(
0
));
if
(
SpecType
==
SPEC_WIN16
)
if
(
SpecType
==
SPEC_WIN16
)
fatal_error
(
"init cannot be used for Win16 spec files
\n
"
);
if
(
!
DLLInitFunc
[
0
])
fatal_error
(
"Expected function name after init
\n
"
);
init_func
=
xstrdup
(
GetToken
(
0
)
);
}
else
if
(
strcmp
(
token
,
"import"
)
==
0
)
{
...
...
tools/winebuild/spec16.c
View file @
66fed8cb
...
...
@@ -536,11 +536,12 @@ static void output_stub_funcs( FILE *outfile )
{
ORDDEF
*
odp
=
Ordinals
[
i
];
if
(
!
odp
||
odp
->
type
!=
TYPE_STUB
)
continue
;
strcpy
(
odp
->
u
.
func
.
link_name
,
"__stub_"
);
strcat
(
odp
->
u
.
func
.
link_name
,
odp
->
name
);
for
(
p
=
odp
->
u
.
func
.
link_name
;
*
p
;
p
++
)
if
(
!
isalnum
(
*
p
))
*
p
=
'_'
;
odp
->
link_name
=
xrealloc
(
odp
->
link_name
,
strlen
(
odp
->
name
)
+
13
);
strcpy
(
odp
->
link_name
,
"__wine_stub_"
);
strcat
(
odp
->
link_name
,
odp
->
name
);
for
(
p
=
odp
->
link_name
;
*
p
;
p
++
)
if
(
!
isalnum
(
*
p
))
*
p
=
'_'
;
fprintf
(
outfile
,
"static void %s(void) { __wine_unimplemented(
\"
%s
\"
); }
\n
"
,
odp
->
u
.
func
.
link_name
,
odp
->
name
);
odp
->
link_name
,
odp
->
name
);
}
}
...
...
@@ -640,7 +641,7 @@ void BuildSpec16File( FILE *outfile )
case
TYPE_CDECL
:
case
TYPE_PASCAL
:
case
TYPE_PASCAL_16
:
fprintf
(
outfile
,
"extern void %s();
\n
"
,
odp
->
u
.
func
.
link_name
);
fprintf
(
outfile
,
"extern void %s();
\n
"
,
odp
->
link_name
);
break
;
default:
break
;
...
...
@@ -727,7 +728,7 @@ void BuildSpec16File( FILE *outfile )
fprintf
(
outfile
,
" /* %s.%d */ "
,
DLLName
,
i
);
fprintf
(
outfile
,
"{ 0x5566, 0x68, %s, 0xe866, %d /* %s_%s_%s */ },
\n
"
,
odp
->
u
.
func
.
link_name
,
odp
->
link_name
,
(
type
-
typelist
)
*
sizeof
(
CALLFROM16
)
-
(
code_offset
+
sizeof
(
ENTRYPOINT16
)),
(
odp
->
type
==
TYPE_CDECL
)
?
"c"
:
"p"
,
...
...
tools/winebuild/spec32.c
View file @
66fed8cb
...
...
@@ -106,7 +106,6 @@ static int output_exports( FILE *outfile, int nr_exports )
{
int
i
,
fwd_size
=
0
,
total_size
=
0
;
char
*
p
;
ORDDEF
*
odp
;
if
(
!
nr_exports
)
return
0
;
...
...
@@ -146,12 +145,12 @@ static int output_exports( FILE *outfile, int nr_exports )
else
switch
(
odp
->
type
)
{
case
TYPE_EXTERN
:
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
u
.
ext
.
link_name
);
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
link_name
);
break
;
case
TYPE_STDCALL
:
case
TYPE_VARARGS
:
case
TYPE_CDECL
:
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
u
.
func
.
link_name
);
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
link_name
);
break
;
case
TYPE_STUB
:
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s
\\
n
\"\n
"
,
make_internal_name
(
odp
,
"stub"
)
);
...
...
@@ -164,7 +163,7 @@ static int output_exports( FILE *outfile, int nr_exports )
break
;
case
TYPE_FORWARD
:
fprintf
(
outfile
,
"
\"\\
t.long __wine_spec_forwards+%d
\\
n
\"\n
"
,
fwd_size
);
fwd_size
+=
strlen
(
odp
->
u
.
fwd
.
link_name
)
+
1
;
fwd_size
+=
strlen
(
odp
->
link_name
)
+
1
;
break
;
default:
assert
(
0
);
...
...
@@ -218,7 +217,7 @@ static int output_exports( FILE *outfile, int nr_exports )
{
ORDDEF
*
odp
=
Ordinals
[
i
];
if
(
odp
&&
odp
->
type
==
TYPE_FORWARD
)
fprintf
(
outfile
,
"
\"\\
t"
STRING
"
\\\"
%s
\\\"\\
n
\"\n
"
,
odp
->
u
.
fwd
.
link_name
);
fprintf
(
outfile
,
"
\"\\
t"
STRING
"
\\\"
%s
\\\"\\
n
\"\n
"
,
odp
->
link_name
);
}
fprintf
(
outfile
,
"
\"\\
t.align 4
\\
n
\"\n
"
);
total_size
+=
(
fwd_size
+
3
)
&
~
3
;
...
...
@@ -252,19 +251,19 @@ static int output_exports( FILE *outfile, int nr_exports )
switch
(
odp
->
type
)
{
case
TYPE_STDCALL
:
fprintf
(
outfile
,
"
\"\\
tjmp "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
u
.
func
.
link_name
);
fprintf
(
outfile
,
"
\"\\
tjmp "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
link_name
);
fprintf
(
outfile
,
"
\"\\
tret $%d
\\
n
\"\n
"
,
strlen
(
odp
->
u
.
func
.
arg_types
)
*
sizeof
(
int
)
);
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s,0x%08x
\\
n
\"\n
"
,
odp
->
u
.
func
.
link_name
,
mask
);
odp
->
link_name
,
mask
);
break
;
case
TYPE_CDECL
:
fprintf
(
outfile
,
"
\"\\
tjmp "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
u
.
func
.
link_name
);
fprintf
(
outfile
,
"
\"\\
tjmp "
PREFIX
"%s
\\
n
\"\n
"
,
odp
->
link_name
);
fprintf
(
outfile
,
"
\"\\
tret
\\
n
\"\n
"
);
fprintf
(
outfile
,
"
\"\\
t.short %d
\\
n
\"\n
"
,
strlen
(
odp
->
u
.
func
.
arg_types
)
*
sizeof
(
int
)
);
fprintf
(
outfile
,
"
\"\\
t.long "
PREFIX
"%s,0x%08x
\\
n
\"\n
"
,
odp
->
u
.
func
.
link_name
,
mask
);
odp
->
link_name
,
mask
);
break
;
case
TYPE_REGISTER
:
fprintf
(
outfile
,
"
\"\\
tjmp "
PREFIX
"%s
\\
n
\"\n
"
,
...
...
@@ -304,8 +303,9 @@ static int output_exports( FILE *outfile, int nr_exports )
/* output variables */
for
(
i
=
0
,
odp
=
EntryPoints
;
i
<
nb_entry_points
;
i
++
,
odp
++
)
for
(
i
=
0
;
i
<
nb_entry_points
;
i
++
)
{
ORDDEF
*
odp
=
EntryPoints
[
i
];
if
(
odp
->
type
==
TYPE_VARIABLE
)
{
int
j
;
...
...
@@ -334,10 +334,10 @@ static int output_exports( FILE *outfile, int nr_exports )
static
void
output_stub_funcs
(
FILE
*
outfile
)
{
int
i
;
ORDDEF
*
odp
;
for
(
i
=
0
,
odp
=
EntryPoints
;
i
<
nb_entry_points
;
i
++
,
odp
++
)
for
(
i
=
0
;
i
<
nb_entry_points
;
i
++
)
{
ORDDEF
*
odp
=
EntryPoints
[
i
];
if
(
odp
->
type
!=
TYPE_STUB
)
continue
;
fprintf
(
outfile
,
"#ifdef __GNUC__
\n
"
);
fprintf
(
outfile
,
"static void __wine_unimplemented( const char *func ) __attribute__((noreturn));
\n
"
);
...
...
@@ -366,8 +366,9 @@ static void output_stub_funcs( FILE *outfile )
break
;
}
for
(
i
=
0
,
odp
=
EntryPoints
;
i
<
nb_entry_points
;
i
++
,
odp
++
)
for
(
i
=
0
;
i
<
nb_entry_points
;
i
++
)
{
ORDDEF
*
odp
=
EntryPoints
[
i
];
if
(
odp
->
type
!=
TYPE_STUB
)
continue
;
fprintf
(
outfile
,
"void %s(void) "
,
make_internal_name
(
odp
,
"stub"
)
);
if
(
odp
->
name
[
0
])
...
...
@@ -385,12 +386,12 @@ static void output_stub_funcs( FILE *outfile )
*/
static
void
output_register_funcs
(
FILE
*
outfile
)
{
ORDDEF
*
odp
;
const
char
*
name
;
int
i
;
for
(
i
=
0
,
odp
=
EntryPoints
;
i
<
nb_entry_points
;
i
++
,
odp
++
)
for
(
i
=
0
;
i
<
nb_entry_points
;
i
++
)
{
ORDDEF
*
odp
=
EntryPoints
[
i
];
if
(
odp
->
type
!=
TYPE_REGISTER
)
continue
;
name
=
make_internal_name
(
odp
,
"regs"
);
fprintf
(
outfile
,
...
...
@@ -400,7 +401,7 @@ static void output_register_funcs( FILE *outfile )
"
\"
call "
PREFIX
"CALL32_Regs
\\
n
\\
t
\"\n
"
"
\"
.long "
PREFIX
"%s
\\
n
\\
t
\"\n
"
"
\"
.byte %d,%d
\"
);
\n
"
,
name
,
name
,
odp
->
u
.
func
.
link_name
,
name
,
name
,
odp
->
link_name
,
4
*
strlen
(
odp
->
u
.
func
.
arg_types
),
4
*
strlen
(
odp
->
u
.
func
.
arg_types
)
);
}
}
...
...
@@ -416,7 +417,6 @@ void BuildSpec32File( FILE *outfile )
int
exports_size
=
0
;
int
nr_exports
,
nr_imports
,
nr_resources
,
nr_debug
;
int
characteristics
,
subsystem
;
const
char
*
init_func
;
DWORD
page_size
;
#ifdef HAVE_GETPAGESIZE
...
...
@@ -490,7 +490,6 @@ void BuildSpec32File( FILE *outfile )
/* Output LibMain function */
init_func
=
DLLInitFunc
[
0
]
?
DLLInitFunc
:
NULL
;
characteristics
=
subsystem
=
0
;
switch
(
SpecMode
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment