Add support for fastcall functions in .spec files

svn path=/trunk/; revision=34837
This commit is contained in:
Hervé Poussineau 2008-07-27 09:12:37 +00:00
parent 0bd0421c3b
commit 615f0216fa
3 changed files with 26 additions and 4 deletions

View file

@ -40,6 +40,7 @@ typedef enum
TYPE_STDCALL, /* stdcall function (Win32) */
TYPE_CDECL, /* cdecl function (Win32) */
TYPE_VARARGS, /* varargs function (Win32) */
TYPE_FASTCALL, /* fastcall function (Win32) */
TYPE_EXTERN, /* external symbol (Win32) */
TYPE_NBTYPES
} ORD_TYPE;

View file

@ -57,6 +57,7 @@ static const char * const TypeNames[TYPE_NBTYPES] =
"stdcall", /* TYPE_STDCALL */
"cdecl", /* TYPE_CDECL */
"varargs", /* TYPE_VARARGS */
"fastcall", /* TYPE_FASTCALL */
"extern" /* TYPE_EXTERN */
};
@ -490,6 +491,7 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec )
case TYPE_STDCALL:
case TYPE_VARARGS:
case TYPE_CDECL:
case TYPE_FASTCALL:
if (!parse_spec_export( odp, spec )) goto error;
break;
case TYPE_ABS:

View file

@ -577,23 +577,25 @@ void BuildDef32File( DLLSPEC *spec )
if (!(odp->flags & FLAG_PRIVATE)) total++;
output( " %s", name );
switch(odp->type)
{
case TYPE_EXTERN:
output( " %s", name );
is_data = 1;
/* fall through */
if(strcmp(name, odp->link_name) || (odp->flags & FLAG_FORWARD))
output( "=%s", odp->link_name );
break;
case TYPE_VARARGS:
case TYPE_CDECL:
/* try to reduce output */
output( " %s", name );
if(strcmp(name, odp->link_name) || (odp->flags & FLAG_FORWARD))
output( "=%s", odp->link_name );
break;
case TYPE_STDCALL:
{
int at_param = strlen(odp->u.func.arg_types) * get_ptr_size();
output( " %s", name );
if (!kill_at) output( "@%d", at_param );
if (odp->flags & FLAG_FORWARD)
{
@ -606,8 +608,25 @@ void BuildDef32File( DLLSPEC *spec )
}
break;
}
case TYPE_FASTCALL:
{
int at_param = strlen(odp->u.func.arg_types) * get_ptr_size();
output( " @%s", name );
if (!kill_at) output( "@%d", at_param );
if (odp->flags & FLAG_FORWARD)
{
output( "=@%s", odp->link_name );
}
else if (strcmp(name, odp->link_name)) /* try to reduce output */
{
output( "=@%s", odp->link_name );
if (!kill_at) output( "@%d", at_param );
}
break;
}
case TYPE_STUB:
{
output( " %s", name );
if (!kill_at)
{
const char *check = name + strlen(name);