From 615f0216fa8cee3a2fc7279d2fe34959fe7a8a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 27 Jul 2008 09:12:37 +0000 Subject: [PATCH] Add support for fastcall functions in .spec files svn path=/trunk/; revision=34837 --- reactos/tools/winebuild/build.h | 1 + reactos/tools/winebuild/parser.c | 2 ++ reactos/tools/winebuild/spec32.c | 27 +++++++++++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/reactos/tools/winebuild/build.h b/reactos/tools/winebuild/build.h index e876755395e..1aff91b9841 100644 --- a/reactos/tools/winebuild/build.h +++ b/reactos/tools/winebuild/build.h @@ -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; diff --git a/reactos/tools/winebuild/parser.c b/reactos/tools/winebuild/parser.c index 5e876a262c2..304899dfa22 100644 --- a/reactos/tools/winebuild/parser.c +++ b/reactos/tools/winebuild/parser.c @@ -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: diff --git a/reactos/tools/winebuild/spec32.c b/reactos/tools/winebuild/spec32.c index 1277f858bc7..ca959dab6ef 100644 --- a/reactos/tools/winebuild/spec32.c +++ b/reactos/tools/winebuild/spec32.c @@ -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);