Commit 39b3195c authored by Alexandre Julliard's avatar Alexandre Julliard

Added entry point flags -noimport, -norelay, -ret64 and -i386.

Replaced 'byte', 'word' and 'long' by 'variable' and made it work for Win32 too. Made parser more robust against truncated files.
parent 5298812b
......@@ -365,7 +365,7 @@ debug_channels (crtdll)
@ cdecl cosh(double) cosh
@ cdecl ctime(ptr) ctime
@ cdecl difftime(long long) CRTDLL_difftime
@ cdecl div(long long) CRTDLL_div
@ cdecl -noimport div(long long) CRTDLL_div
@ cdecl exit(long) CRTDLL_exit
@ cdecl exp(double) exp
@ cdecl fabs(double) fabs
......@@ -428,7 +428,7 @@ debug_channels (crtdll)
@ cdecl isxdigit(long) CRTDLL_isxdigit
@ cdecl labs(long) labs
@ cdecl ldexp(double long) CRTDLL_ldexp
@ cdecl ldiv(long long) CRTDLL_ldiv
@ cdecl -noimport ldiv(long long) CRTDLL_ldiv
@ stub localeconv
@ cdecl localtime(ptr) localtime
@ cdecl log(double) log
......
......@@ -276,7 +276,7 @@ owner kernel32
327 register K327() HandleParamError
328 pascal16 _DebugOutput() _DebugOutput
329 pascal16 K329(str word) DebugFillBuffer
332 long THHOOK(0 0 0 0 0 0 0 0)
332 variable THHOOK(0 0 0 0 0 0 0 0)
334 pascal16 IsBadReadPtr(segptr word) IsBadReadPtr16
335 pascal16 IsBadWritePtr(segptr word) IsBadWritePtr16
336 pascal16 IsBadCodePtr(segptr) IsBadCodePtr16
......@@ -285,7 +285,7 @@ owner kernel32
339 pascal16 DiagQuery() DiagQuery16
340 pascal16 DiagOutput(str) DiagOutput16
341 pascal ToolHelpHook(ptr) ToolHelpHook16
342 word __GP(0 0 0 0)
342 variable __GP(0 0)
343 stub RegisterWinOldApHook
344 stub GetWinOldApHooks
345 pascal16 IsSharedSelector(word) IsSharedSelector16
......
......@@ -304,11 +304,11 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ stub RtlCompressBuffer
@ stub RtlConsoleMultiByteToUnicodeN
@ stub RtlConvertExclusiveToShared
@ stdcall64 RtlConvertLongToLargeInteger(long) RtlConvertLongToLargeInteger
@ stdcall -ret64 RtlConvertLongToLargeInteger(long) RtlConvertLongToLargeInteger
@ stub RtlConvertSharedToExclusive
@ stdcall RtlConvertSidToUnicodeString(ptr ptr)RtlConvertSidToUnicodeString
@ stub RtlConvertUiListToApiList
@ stdcall64 RtlConvertUlongToLargeInteger(long) RtlConvertUlongToLargeInteger
@ stdcall -ret64 RtlConvertUlongToLargeInteger(long) RtlConvertUlongToLargeInteger
@ stub RtlCopyLuid
@ stub RtlCopyLuidAndAttributesArray
@ stub RtlCopySecurityDescriptor
......@@ -351,9 +351,9 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ stdcall RtlDosPathNameToNtPathName_U(ptr ptr long long) RtlDosPathNameToNtPathName_U
@ stub RtlDosSearchPath_U
@ stdcall RtlDumpResource(ptr) RtlDumpResource
@ stdcall64 RtlEnlargedIntegerMultiply(long long) RtlEnlargedIntegerMultiply
@ stdcall -ret64 RtlEnlargedIntegerMultiply(long long) RtlEnlargedIntegerMultiply
@ stdcall RtlEnlargedUnsignedDivide(long long long ptr) RtlEnlargedUnsignedDivide
@ stdcall64 RtlEnlargedUnsignedMultiply(long long) RtlEnlargedUnsignedMultiply
@ stdcall -ret64 RtlEnlargedUnsignedMultiply(long long) RtlEnlargedUnsignedMultiply
@ stdcall RtlEnterCriticalSection(ptr) RtlEnterCriticalSection
@ stub RtlEnumProcessHeaps
@ stub RtlEnumerateGenericTable
......@@ -368,8 +368,8 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ stdcall RtlEraseUnicodeString(ptr) RtlEraseUnicodeString
@ stub RtlExpandEnvironmentStrings_U
@ stub RtlExtendHeap
@ stdcall64 RtlExtendedIntegerMultiply(long long long) RtlExtendedIntegerMultiply
@ stdcall64 RtlExtendedLargeIntegerDivide(long long long ptr) RtlExtendedLargeIntegerDivide
@ stdcall -ret64 RtlExtendedIntegerMultiply(long long long) RtlExtendedIntegerMultiply
@ stdcall -ret64 RtlExtendedLargeIntegerDivide(long long long ptr) RtlExtendedLargeIntegerDivide
@ stub RtlExtendedMagicDivide
@ stdcall RtlFillMemory(ptr long long) RtlFillMemory
@ stub RtlFillMemoryUlong
......@@ -429,13 +429,13 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ stub RtlIsGenericTableEmpty
@ stub RtlIsNameLegalDOS8Dot3
@ stdcall RtlIsTextUnicode(ptr long ptr) RtlIsTextUnicode
@ stdcall64 RtlLargeIntegerAdd(long long long long) RtlLargeIntegerAdd
@ stdcall64 RtlLargeIntegerArithmeticShift(long long long) RtlLargeIntegerArithmeticShift
@ stdcall64 RtlLargeIntegerDivide(long long long long ptr) RtlLargeIntegerDivide
@ stdcall64 RtlLargeIntegerNegate(long long) RtlLargeIntegerNegate
@ stdcall64 RtlLargeIntegerShiftLeft(long long long) RtlLargeIntegerShiftLeft
@ stdcall64 RtlLargeIntegerShiftRight(long long long) RtlLargeIntegerShiftRight
@ stdcall64 RtlLargeIntegerSubtract(long long long long) RtlLargeIntegerSubtract
@ stdcall -ret64 RtlLargeIntegerAdd(long long long long) RtlLargeIntegerAdd
@ stdcall -ret64 RtlLargeIntegerArithmeticShift(long long long) RtlLargeIntegerArithmeticShift
@ stdcall -ret64 RtlLargeIntegerDivide(long long long long ptr) RtlLargeIntegerDivide
@ stdcall -ret64 RtlLargeIntegerNegate(long long) RtlLargeIntegerNegate
@ stdcall -ret64 RtlLargeIntegerShiftLeft(long long long) RtlLargeIntegerShiftLeft
@ stdcall -ret64 RtlLargeIntegerShiftRight(long long long) RtlLargeIntegerShiftRight
@ stdcall -ret64 RtlLargeIntegerSubtract(long long long long) RtlLargeIntegerSubtract
@ stub RtlLargeIntegerToChar
@ stdcall RtlLeaveCriticalSection(ptr) RtlLeaveCriticalSection
@ stdcall RtlLengthRequiredSid(long) RtlLengthRequiredSid
......@@ -872,13 +872,13 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ stub __eFYL2X
@ stub __eFYL2XP1
@ stub __eGetStatusWord
@ stdcall64 _alldiv(long long long long) _alldiv
@ stdcall64 _allmul(long long long long) _allmul
@ register _alloca_probe() NTDLL_alloca_probe
@ stdcall64 _allrem(long long long long) _allrem
@ stdcall64 _aulldiv(long long long long) _aulldiv
@ stdcall64 _aullrem(long long long long) _aullrem
@ register _chkstk() NTDLL_chkstk
@ stdcall -ret64 _alldiv(long long long long) _alldiv
@ stdcall -ret64 _allmul(long long long long) _allmul
@ register -i386 _alloca_probe() NTDLL_alloca_probe
@ stdcall -ret64 _allrem(long long long long) _allrem
@ stdcall -ret64 _aulldiv(long long long long) _aulldiv
@ stdcall -ret64 _aullrem(long long long long) _aullrem
@ register -i386 _chkstk() NTDLL_chkstk
@ stub _fltused
@ cdecl _ftol() NTDLL__ftol
@ cdecl _itoa(long ptr long) _itoa
......@@ -902,8 +902,8 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl _wcsupr(wstr) NTDLL__wcsupr
@ stub abs
@ stub atan
@ cdecl atoi(str) atoi
@ cdecl atol(str) atol
@ cdecl -noimport atoi(str) atoi
@ cdecl -noimport atol(str) atol
@ stub ceil
@ stub cos
@ stub fabs
......@@ -920,31 +920,31 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ stub labs
@ stub log
@ cdecl mbstowcs(ptr str long) NTDLL_mbstowcs
@ cdecl memchr(ptr long long) memchr
@ cdecl memcmp(ptr ptr long) memcmp
@ cdecl memcpy(ptr ptr long) memcpy
@ cdecl memmove(ptr ptr long) memmove
@ cdecl memset(ptr long long) memset
@ cdecl -noimport memchr(ptr long long) memchr
@ cdecl -noimport memcmp(ptr ptr long) memcmp
@ cdecl -noimport memcpy(ptr ptr long) memcpy
@ cdecl -noimport memmove(ptr ptr long) memmove
@ cdecl -noimport memset(ptr long long) memset
@ cdecl pow(double double) pow
@ stub qsort
@ stub sin
@ varargs sprintf(str str) sprintf
@ stub sqrt
@ varargs sscanf() sscanf
@ cdecl strcat(str str) strcat
@ cdecl strchr(str long) strchr
@ cdecl strcmp(str str) strcmp
@ cdecl strcpy(ptr str) strcpy
@ cdecl strcspn(str str) strcspn
@ cdecl strlen(str) strlen
@ cdecl strncat(str str long) strncat
@ cdecl strncmp(str str long) strncmp
@ cdecl strncpy(ptr str long) strncpy
@ cdecl strpbrk(str str long) strpbrk
@ cdecl strrchr(str long) strrchr
@ cdecl strspn(str str) strspn
@ cdecl strstr(str str) strstr
@ cdecl strtol(str ptr long) strtol
@ cdecl -noimport strcat(str str) strcat
@ cdecl -noimport strchr(str long) strchr
@ cdecl -noimport strcmp(str str) strcmp
@ cdecl -noimport strcpy(ptr str) strcpy
@ cdecl -noimport strcspn(str str) strcspn
@ cdecl -noimport strlen(str) strlen
@ cdecl -noimport strncat(str str long) strncat
@ cdecl -noimport strncmp(str str long) strncmp
@ cdecl -noimport strncpy(ptr str long) strncpy
@ cdecl -noimport strpbrk(str str long) strpbrk
@ cdecl -noimport strrchr(str long) strrchr
@ cdecl -noimport strspn(str str) strspn
@ cdecl -noimport strstr(str str) strstr
@ cdecl -noimport strtol(str ptr long) strtol
@ varargs swprintf(wstr wstr) wsprintfW
@ stub tan
@ cdecl tolower(long) tolower
......@@ -1013,14 +1013,14 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
# Exception handling
@ cdecl __wine_exception_handler(ptr ptr ptr ptr) __wine_exception_handler
@ cdecl __wine_finally_handler(ptr ptr ptr ptr) __wine_finally_handler
@ cdecl -norelay __wine_exception_handler(ptr ptr ptr ptr) __wine_exception_handler
@ cdecl -norelay __wine_finally_handler(ptr ptr ptr ptr) __wine_finally_handler
# Debugging interface
@ cdecl wine_dbgstr_an(str long) wine_dbgstr_an
@ cdecl wine_dbgstr_wn(str long) wine_dbgstr_wn
@ cdecl wine_dbgstr_guid(ptr) wine_dbgstr_guid
@ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf
@ cdecl -norelay wine_dbgstr_an(str long) wine_dbgstr_an
@ cdecl -norelay wine_dbgstr_wn(str long) wine_dbgstr_wn
@ cdecl -norelay wine_dbgstr_guid(ptr) wine_dbgstr_guid
@ cdecl -norelay wine_dbg_vprintf(str ptr) wine_dbg_vprintf
@ varargs wine_dbg_printf(str) wine_dbg_printf
@ varargs wine_dbg_log(long str str str) wine_dbg_log
......
......@@ -8,19 +8,19 @@ type win16|win32
[heap SIZE]
[init FUNCTION]
[import DLL]
[rsrc PREFIX]
[rsrc RESFILE]
ORDINAL VARTYPE EXPORTNAME (DATA [DATA [DATA [...]]])
ORDINAL FUNCTYPE [FLAGS] EXPORTNAME([ARGTYPE [ARGTYPE [...]]]) HANDLERNAME
ORDINAL FUNCTYPE EXPORTNAME([ARGTYPE [ARGTYPE [...]]]) HANDLERNAME
ORDINAL variable [FLAGS] EXPORTNAME (DATA [DATA [DATA [...]]])
ORDINAL stub EXPORTNAME
ORDINAL stub [FLAGS] EXPORTNAME
ORDINAL equate EXPORTNAME DATA
ORDINAL equate [FLAGS] EXPORTNAME DATA
ORDINAL extern EXPORTNAME SYMBOLNAME
ORDINAL extern [FLAGS] EXPORTNAME SYMBOLNAME
ORDINAL forward EXPORTNAME SYMBOLNAME
ORDINAL forward [FLAGS] EXPORTNAME SYMBOLNAME
# COMMENT_TEXT
......@@ -49,7 +49,19 @@ is loaded. This is only valid for Win32 modules.
modules at the present). The import declaration can be present several
times.
"rsrc" specifies the prefix for the resource directory name.
"rsrc" specifies the path of the compiled resource file.
"ORDINAL" specified the ordinal number corresponding to the entry
point, or "@" for automatic ordinal allocation (Win32 only).
"FLAGS" is a series of optional flags, preceded by a '-' character.
The supported flags are:
"-noimport": the entry point is not made available for importing
from winelib applications (Win32 only).
"-norelay": the entry point is not displayed in relay debugging
traces (Win32 only).
"-ret64": the function returns a 64-bit value (Win32 only).
"-i386": the entry point is only available on i386 platforms.
Lines whose first character is a '#' will be ignored as comments.
......@@ -57,25 +69,21 @@ Lines whose first character is a '#' will be ignored as comments.
Variable ordinals:
==================
This type defines data storage at the ordinal specified. You may
store items as bytes, 16-bit words, or 32-bit words.
"ORDINAL" is replaced by the ordinal number corresponding to the
variable. "VARTYPE" should be "byte", "word" or "long" for 8, 16, or
32 bits respectively. "EXPORTNAME" will be the name available for
dynamic linking. "DATA" can be a decimal number or a hex number preceeded
by "0x". The following example defines the variable "VariableA" at
ordinal 2 and containing 4 bytes:
This type defines data storage as 32-bit words at the ordinal specified.
"EXPORTNAME" will be the name available for dynamic linking. "DATA"
can be a decimal number or a hex number preceeded by "0x". The
following example defines the variable "VariableA" at ordinal 2 and
containing 4 ints:
2 byte VariableA(-1 0xff 0 0)
2 variable VariableA(-1 0xff 0 0)
Function ordinals:
==================
This type defines a function entry point. The prototype defined by
"EXPORTNAME ([ARGTYPE [ARGTYPE [...]]])" specifies the name available for
dynamic linking and the format of the arguments. "ORDINAL" is replaced
by the ordinal number corresponding to the function, or "@" for
automatic ordinal allocation (Win32 only).
dynamic linking and the format of the arguments. "@" can be used
instead of "EXPORTNAME" for ordinal-only exports.
"FUNCTYPE" should be one of:
- "pascal16" for a Win16 function returning a 16-bit value
......@@ -87,15 +95,17 @@ automatic ordinal allocation (Win32 only).
- "varargs" for a Win32 function taking a variable number of arguments
"ARGTYPE" should be one of:
- "word"
- "long"
- "ptr" (linear pointer)
- "str" (linear pointer to a null-terminated string)
- "s_word" (signed word)
- "segptr" (segmented pointer).
- "segstr" (segmented pointer to a null-terminated string)
Only "ptr", "str" and "long" are valid for Win32 functions.
- "word" (16-bit unsigned value)
- "s_word" (16-bit signed word)
- "long" (32-bit value)
- "double" (64-bit value)
- "ptr" (linear pointer)
- "str" (linear pointer to a null-terminated ASCII string)
- "wstr" (linear pointer to a null-terminated Unicode string)
- "segptr" (segmented pointer)
- "segstr" (segmented pointer to a null-terminated ASCII string)
Only "ptr", "str", "wstr", "long" and "double" are valid for Win32 functions.
"HANDLERNAME" is the name of the actual Wine function that will
process the request in 32-bit mode.
......@@ -129,8 +139,7 @@ Equate ordinals:
================
This type defines an ordinal as an absolute value.
"ORDINAL" is replaced by the ordinal number corresponding to the
variable. "EXPORTNAME" will be the name available for dynamic linking.
"EXPORTNAME" will be the name available for dynamic linking.
"DATA" can be a decimal number or a hex number preceeded by "0x".
Extern ordinals:
......
......@@ -33,9 +33,7 @@
typedef enum
{
TYPE_BYTE, /* byte variable (Win16) */
TYPE_WORD, /* word variable (Win16) */
TYPE_LONG, /* long variable (Win16) */
TYPE_VARIABLE, /* variable */
TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
TYPE_ABS, /* absolute value (Win16) */
......@@ -43,7 +41,6 @@ typedef enum
TYPE_INTERRUPT, /* interrupt handler function (Win16) */
TYPE_STUB, /* unimplemented stub */
TYPE_STDCALL, /* stdcall function (Win32) */
TYPE_STDCALL64, /* stdcall function with 64-bit return (Win32) */
TYPE_CDECL, /* cdecl function (Win32) */
TYPE_VARARGS, /* varargs function (Win32) */
TYPE_EXTERN, /* external symbol (Win32) */
......@@ -100,7 +97,8 @@ typedef struct
ORD_TYPE type;
int ordinal;
int offset;
int lineno;
int lineno;
int flags;
char name[80];
union
{
......@@ -112,6 +110,12 @@ typedef struct
} u;
} ORDDEF;
/* entry point flags */
#define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
#define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
#define FLAG_RET64 0x04 /* function returns a 64-bit value */
#define FLAG_I386 0x08 /* function is i386 only */
/* Offset of a structure field relative to the start of the struct */
#define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
......
......@@ -204,9 +204,7 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
selector = 1; /* Code selector */
break;
case TYPE_BYTE:
case TYPE_WORD:
case TYPE_LONG:
case TYPE_VARIABLE:
selector = 2; /* Data selector */
break;
......@@ -714,17 +712,7 @@ void BuildSpec16File( FILE *outfile )
odp->offset = LOWORD(odp->u.abs.value);
break;
case TYPE_BYTE:
odp->offset = data_offset;
data_offset += StoreVariableCode( data + data_offset, 1, odp);
break;
case TYPE_WORD:
odp->offset = data_offset;
data_offset += StoreVariableCode( data + data_offset, 2, odp);
break;
case TYPE_LONG:
case TYPE_VARIABLE:
odp->offset = data_offset;
data_offset += StoreVariableCode( data + data_offset, 4, odp);
break;
......
......@@ -12,6 +12,7 @@
#include <ctype.h>
#include <unistd.h>
#include "config.h"
#include "winbase.h"
#include "wine/exception.h"
#include "build.h"
......@@ -24,6 +25,20 @@ static int string_compare( const void *ptr1, const void *ptr2 )
return strcmp( *str1, *str2 );
}
/*******************************************************************
* make_internal_name
*
* Generate an internal name for an entry point. Used for stubs etc.
*/
static const char *make_internal_name( const ORDDEF *odp, const char *prefix )
{
static char buffer[256];
if (odp->name[0]) sprintf( buffer, "__wine_%s_%s", prefix, odp->name );
else sprintf( buffer, "__wine_%s_%d", prefix, odp->ordinal );
return buffer;
}
/*******************************************************************
* AssignOrdinals
*
......@@ -166,17 +181,18 @@ static void output_exports( FILE *outfile, int nr_exports, int fwd_size )
fprintf( outfile, "%s", odp->u.ext.link_name );
break;
case TYPE_STDCALL:
case TYPE_STDCALL64:
case TYPE_VARARGS:
case TYPE_CDECL:
fprintf( outfile, "%s", odp->u.func.link_name);
break;
case TYPE_STUB:
if (odp->name[0]) fprintf( outfile, "__stub_%s", odp->name );
else fprintf( outfile, "__stub_%d", i );
fprintf( outfile, "%s", make_internal_name( odp, "stub" ) );
break;
case TYPE_REGISTER:
fprintf( outfile, "__regs_%d", i );
fprintf( outfile, "%s", make_internal_name( odp, "regs" ) );
break;
case TYPE_VARIABLE:
fprintf( outfile, "(func_ptr)%s", make_internal_name( odp, "var" ) );
break;
case TYPE_FORWARD:
fprintf( outfile, "(func_ptr)&exports.exp.forwards[%d] /* %s */",
......@@ -242,22 +258,21 @@ static void output_exports( FILE *outfile, int nr_exports, int fwd_size )
/* skip non-existent entry points */
if (!odp) goto ignore;
/* skip non-functions */
if ((odp->type != TYPE_STDCALL) && (odp->type != TYPE_STDCALL64) &&
(odp->type != TYPE_CDECL) && (odp->type != TYPE_REGISTER)) goto ignore;
/* skip wine internal functions */
if (!strncmp( odp->name, "wine_", 5 ) || !strncmp( odp->name, "__wine_", 7 )) goto ignore;
if ((odp->type != TYPE_STDCALL) &&
(odp->type != TYPE_CDECL) &&
(odp->type != TYPE_REGISTER)) goto ignore;
/* skip norelay entry points */
if (odp->flags & FLAG_NORELAY) goto ignore;
for (j = 0; odp->u.func.arg_types[j]; j++)
{
if (odp->u.func.arg_types[j] == 't') mask |= 1<< (j*2);
if (odp->u.func.arg_types[j] == 'W') mask |= 2<< (j*2);
}
if ((odp->flags & FLAG_RET64) && (j < 16)) mask |= 0x80000000;
switch(odp->type)
{
case TYPE_STDCALL64:
if (j < 16) mask |= 0x80000000;
/* fall through */
case TYPE_STDCALL:
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc2, 0x%04x, %s, 0x%08x }",
strlen(odp->u.func.arg_types) * sizeof(int),
......@@ -269,8 +284,9 @@ static void output_exports( FILE *outfile, int nr_exports, int fwd_size )
odp->u.func.link_name, mask );
break;
case TYPE_REGISTER:
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc3, 0x%04x, __regs_%d, 0x%08x }",
0x8000 | (strlen(odp->u.func.arg_types) * sizeof(int)), i, mask );
fprintf( outfile, " { 0xe9, { 0,0,0,0 }, 0xc3, 0x%04x, %s, 0x%08x }",
0x8000 | (strlen(odp->u.func.arg_types) * sizeof(int)),
make_internal_name( odp, "regs" ), mask );
break;
default:
assert(0);
......@@ -291,8 +307,7 @@ static void output_exports( FILE *outfile, int nr_exports, int fwd_size )
for (i = 0; i < nb_names; i++)
{
char *p;
/* 'extern' definitions are not available for implicit import */
if (Names[i]->type == TYPE_EXTERN) continue;
if (Names[i]->flags & FLAG_NOIMPORT) continue;
/* check for invalid characters in the name */
for (p = Names[i]->name; *p; p++) if (!isalnum(*p) && *p != '_') break;
if (!*p) fprintf( outfile, "const char __wine_dllexport_%s_%s = 0;\n",
......@@ -343,13 +358,46 @@ static void output_stub_funcs( FILE *outfile )
for (i = 0, odp = EntryPoints; i < nb_entry_points; i++, odp++)
{
if (odp->type != TYPE_STUB) continue;
fprintf( outfile, "static void %s(void) ", make_internal_name( odp, "stub" ) );
if (odp->name[0])
fprintf( outfile, "static void __stub_%s(void) { __wine_unimplemented(\"%s\"); }\n",
odp->name, odp->name );
fprintf( outfile, "{ __wine_unimplemented(\"%s\"); }\n", odp->name );
else
fprintf( outfile, "static void __stub_%d(void) { __wine_unimplemented(\"%d\"); }\n",
odp->ordinal, odp->ordinal );
fprintf( outfile, "{ __wine_unimplemented(\"%d\"); }\n", odp->ordinal );
}
}
/*******************************************************************
* output_register_funcs
*
* Output the functions for register entry points
*/
static void output_register_funcs( FILE *outfile )
{
ORDDEF *odp;
const char *name;
int i;
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "static void __asm__dummy(void) {\n" );
fprintf( outfile, "#endif /* !defined(__GNUC__) */\n" );
for (i = 0, odp = EntryPoints; i < nb_entry_points; i++, odp++)
{
if (odp->type != TYPE_REGISTER) continue;
name = make_internal_name( odp, "regs" );
fprintf( outfile,
"asm(\".align 4\\n\\t\"\n"
" \".type " PREFIX "%s,@function\\n\\t\"\n"
" \"" PREFIX "%s:\\n\\t\"\n"
" \"call " PREFIX "CALL32_Regs\\n\\t\"\n"
" \".long " PREFIX "%s\\n\\t\"\n"
" \".byte %d,%d\");\n",
name, name, odp->u.func.link_name,
4 * strlen(odp->u.func.arg_types), 4 * strlen(odp->u.func.arg_types) );
}
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif /* !defined(__GNUC__) */\n" );
}
......@@ -361,7 +409,7 @@ static void output_stub_funcs( FILE *outfile )
void BuildSpec32File( FILE *outfile )
{
ORDDEF *odp;
int i, fwd_size = 0, have_regs = FALSE;
int i, j, fwd_size = 0, have_regs = FALSE;
int nr_exports, nr_imports, nr_resources, nr_debug;
int characteristics, subsystem, has_imports;
const char *init_func;
......@@ -408,7 +456,6 @@ void BuildSpec32File( FILE *outfile )
fprintf( outfile, "extern void %s();\n", odp->u.ext.link_name );
break;
case TYPE_STDCALL:
case TYPE_STDCALL64:
case TYPE_VARARGS:
case TYPE_CDECL:
fprintf( outfile, "extern void %s();\n", odp->u.func.link_name );
......@@ -417,43 +464,29 @@ void BuildSpec32File( FILE *outfile )
fwd_size += strlen(odp->u.fwd.link_name) + 1;
break;
case TYPE_REGISTER:
fprintf( outfile, "extern void __regs_%d();\n", odp->ordinal );
fprintf( outfile, "extern void %s();\n", make_internal_name( odp, "regs" ) );
have_regs = TRUE;
break;
case TYPE_STUB:
break;
case TYPE_VARIABLE:
fprintf( outfile, "unsigned int %s[%d] = {",
make_internal_name( odp, "var" ), odp->u.var.n_values );
for (j = 0; j < odp->u.var.n_values; j++)
{
fprintf( outfile, " 0x%08x", odp->u.var.values[j] );
if (j < odp->u.var.n_values-1) fputc( ',', outfile );
}
fprintf( outfile, " };\n" );
break;
default:
fprintf(stderr,"build: function type %d not available for Win32\n",
odp->type);
exit(1);
fatal_error("function type %d not available for Win32\n", odp->type);
}
}
/* Output code for all register functions */
if ( have_regs )
{
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "static void __asm__dummy(void) {\n" );
fprintf( outfile, "#endif /* !defined(__GNUC__) */\n" );
for (i = 0, odp = EntryPoints; i < nb_entry_points; i++, odp++)
{
if (odp->type != TYPE_REGISTER) continue;
fprintf( outfile,
"asm(\".align 4\\n\\t\"\n"
" \".type " PREFIX "__regs_%d,@function\\n\\t\"\n"
" \"" PREFIX "__regs_%d:\\n\\t\"\n"
" \"call " PREFIX "CALL32_Regs\\n\\t\"\n"
" \".long " PREFIX "%s\\n\\t\"\n"
" \".byte %d,%d\");\n",
odp->ordinal, odp->ordinal, odp->u.func.link_name,
4 * strlen(odp->u.func.arg_types),
4 * strlen(odp->u.func.arg_types) );
}
fprintf( outfile, "#ifndef __GNUC__\n" );
fprintf( outfile, "}\n" );
fprintf( outfile, "#endif /* !defined(__GNUC__) */\n" );
}
if (have_regs) output_register_funcs( outfile );
/* Output the exports and relay entry points */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment