Module: wine Branch: refs/heads/master Commit: 9139fd140c436e07f7d331cbf6dc91dc14e34a95 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9139fd140c436e07f7d331cb...
Author: Francois Gouget fgouget@free.fr Date: Fri May 12 00:19:54 2006 +0200
winapi: Add support for APIENTRY.
Factorize a couple of call convention matching regular expressions.
---
tools/winapi/c_parser.pm | 2 +- tools/winapi/winapi_local.pm | 2 +- tools/winapi/winapi_parser.pm | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/tools/winapi/c_parser.pm b/tools/winapi/c_parser.pm index f29b1a1..975d7fe 100644 --- a/tools/winapi/c_parser.pm +++ b/tools/winapi/c_parser.pm @@ -37,7 +37,7 @@ # Defined a couple common regexp tidbits my $CALL_CONVENTION="__cdecl|__stdcall|" . "__RPC_API|__RPC_STUB|__RPC_USER|" . "CALLBACK|CDECL|NTAPI|PASCAL|RPC_ENTRY|RPC_VAR_ENTRY|" . - "VFWAPI|VFWAPIV|WINAPI|WINAPIV|"; + "VFWAPI|VFWAPIV|WINAPI|WINAPIV|APIENTRY|";
sub parse_c_function($$$$$); diff --git a/tools/winapi/winapi_local.pm b/tools/winapi/winapi_local.pm index 20d7f71..55b5138 100644 --- a/tools/winapi/winapi_local.pm +++ b/tools/winapi/winapi_local.pm @@ -101,7 +101,7 @@ sub _check_function($$$$$$) { $implemented_calling_convention = "cdecl"; } elsif($calling_convention =~ /^(?:VFWAPIV|WINAPIV)$/) { $implemented_calling_convention = "varargs"; - } elsif($calling_convention =~ /^(?:__stdcall|__RPC_STUB|__RPC_USER|NET_API_FUNCTION|RPC_ENTRY|VFWAPI|WINAPI|CALLBACK)$/) { + } elsif($calling_convention =~ /^(?:__stdcall|__RPC_STUB|__RPC_USER|APIENTRY|NET_API_FUNCTION|RPC_ENTRY|VFWAPI|WINAPI|CALLBACK)$/) { if(defined($implemented_return_kind) && $implemented_return_kind eq "longlong") { $implemented_calling_convention = "stdcall"; # FIXME: Check entry flags } else { diff --git a/tools/winapi/winapi_parser.pm b/tools/winapi/winapi_parser.pm index 2260c4f..4a5e44b 100644 --- a/tools/winapi/winapi_parser.pm +++ b/tools/winapi/winapi_parser.pm @@ -23,6 +23,13 @@ use strict; use output qw($output); use options qw($options);
+# Defined a couple common regexp tidbits +my $CALL_CONVENTION="__cdecl|__stdcall|" . + "__RPC_API|__RPC_STUB|__RPC_USER|RPC_ENTRY|" . + "RPC_VAR_ENTRY|STDMETHODCALLTYPE|NET_API_FUNCTION|" . + "CALLBACK|CDECL|NTAPI|PASCAL|APIENTRY|" . + "VFWAPI|VFWAPIV|WINAPI|WINAPIV|"; + sub parse_c_file($$) { my $file = shift; my $callbacks = shift; @@ -373,7 +380,7 @@ sub parse_c_file($$) { } next; } elsif(/(extern\s+|static\s+)?((interface\s+|struct\s+|union\s+|enum\s+|signed\s+|unsigned\s+)?\w+((\s**)+\s*|\s+)) - ((__cdecl|__stdcall|__RPC_STUB|__RPC_USER|CDECL|NET_API_FUNCTION|RPC_ENTRY|VFWAPIV|VFWAPI|WINAPIV|WINAPI|CALLBACK)\s+)? + (($CALL_CONVENTION)\s+)? (\w+((\w+))?)\s*((.*?))\s*({|;)/sx) { my @lines = split(/\n/, $&); @@ -449,8 +456,8 @@ sub parse_c_file($$) { ((?:interface\s+|struct\s+|union\s+|enum\s+|register\s+|(?:signed\s+|unsigned\s+)? (?:short\s+(?=int)|long\s+(?=int))?)?\w+)\s* ((?:const|volatile)?\s*(?:*\s*(?:const|volatile)?\s*?)*)\s* - (?:__cdecl\s+|__stdcall\s+|__RPC_STUB\s+|__RPC_USER\s+|CALLBACK\s+|CDECL\s+|NET_API_FUNCTION\s+|RPC_ENTRY\s+|STDMETHODCALLTYPE\s+|VFWAPIV\s+|VFWAPI\s+|WINAPIV\s+|WINAPI\s+)? - (\s*(?:__cdecl|__stdcall|__RPC_STUB|__RPC_USER|CALLBACK|CDECL|NET_API_FUNCTION|RPC_ENTRY|STDMETHODCALLTYPE|VFWAPIV|VFWAPI|WINAPIV|WINAPI)?\s**\s*((?:\w+)?)\s*)\s* + (?:(?:$CALL_CONVENTION)\s+)? + (\s*(?:$CALL_CONVENTION)?\s**\s*((?:\w+)?)\s*)\s* (\s*(.*?)\s*)$/x) { my $return_type = $1;