winapi: Add support for APIENTRY

Francois Gouget fgouget at free.fr
Thu May 11 17:19:54 CDT 2006


Changelog:

  * tools/winapi/c_parser.pm
    tools/winapi/winapi_local.pm
    tools/winapi/winapi_parser.pm

    Francois Gouget <fgouget at free.fr>
    Add support for APIENTRY
    Factorize a couple of call convention matching regular expressions.

-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
      Linux, WinNT, MS-DOS - also known as the Good, the Bad and the Ugly.
-------------- next part --------------
Index: tools/winapi/c_parser.pm
===================================================================
RCS file: /home/wine/wine/tools/winapi/c_parser.pm,v
retrieving revision 1.20
diff -u -p -r1.20 c_parser.pm
--- tools/winapi/c_parser.pm	2 Dec 2005 10:31:11 -0000	1.20
+++ tools/winapi/c_parser.pm	11 May 2006 20:57:57 -0000
@@ -37,7 +37,7 @@ use c_type;
 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($$$$$);
Index: tools/winapi/winapi_local.pm
===================================================================
RCS file: /home/wine/wine/tools/winapi/winapi_local.pm,v
retrieving revision 1.5
diff -u -p -r1.5 winapi_local.pm
--- tools/winapi/winapi_local.pm	30 Nov 2005 12:01:04 -0000	1.5
+++ tools/winapi/winapi_local.pm	11 May 2006 20:57:57 -0000
@@ -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 {
Index: tools/winapi/winapi_parser.pm
===================================================================
RCS file: /home/wine/wine/tools/winapi/winapi_parser.pm,v
retrieving revision 1.11
diff -u -p -r1.11 winapi_parser.pm
--- tools/winapi/winapi_parser.pm	10 May 2006 17:58:50 -0000	1.11
+++ tools/winapi/winapi_parser.pm	11 May 2006 20:57:58 -0000
@@ -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;


More information about the wine-patches mailing list