winapi: Add support for APIENTRY.
Factorize a couple of call convention matching regular expressions.
This commit is contained in:
parent
3b102b39f4
commit
9139fd140c
|
@ -37,7 +37,7 @@ use c_type;
|
||||||
my $CALL_CONVENTION="__cdecl|__stdcall|" .
|
my $CALL_CONVENTION="__cdecl|__stdcall|" .
|
||||||
"__RPC_API|__RPC_STUB|__RPC_USER|" .
|
"__RPC_API|__RPC_STUB|__RPC_USER|" .
|
||||||
"CALLBACK|CDECL|NTAPI|PASCAL|RPC_ENTRY|RPC_VAR_ENTRY|" .
|
"CALLBACK|CDECL|NTAPI|PASCAL|RPC_ENTRY|RPC_VAR_ENTRY|" .
|
||||||
"VFWAPI|VFWAPIV|WINAPI|WINAPIV|";
|
"VFWAPI|VFWAPIV|WINAPI|WINAPIV|APIENTRY|";
|
||||||
|
|
||||||
|
|
||||||
sub parse_c_function($$$$$);
|
sub parse_c_function($$$$$);
|
||||||
|
|
|
@ -101,7 +101,7 @@ sub _check_function($$$$$$) {
|
||||||
$implemented_calling_convention = "cdecl";
|
$implemented_calling_convention = "cdecl";
|
||||||
} elsif($calling_convention =~ /^(?:VFWAPIV|WINAPIV)$/) {
|
} elsif($calling_convention =~ /^(?:VFWAPIV|WINAPIV)$/) {
|
||||||
$implemented_calling_convention = "varargs";
|
$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") {
|
if(defined($implemented_return_kind) && $implemented_return_kind eq "longlong") {
|
||||||
$implemented_calling_convention = "stdcall"; # FIXME: Check entry flags
|
$implemented_calling_convention = "stdcall"; # FIXME: Check entry flags
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,6 +23,13 @@ use strict;
|
||||||
use output qw($output);
|
use output qw($output);
|
||||||
use options qw($options);
|
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($$) {
|
sub parse_c_file($$) {
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
my $callbacks = shift;
|
my $callbacks = shift;
|
||||||
|
@ -373,7 +380,7 @@ sub parse_c_file($$) {
|
||||||
}
|
}
|
||||||
next;
|
next;
|
||||||
} elsif(/(extern\s+|static\s+)?((interface\s+|struct\s+|union\s+|enum\s+|signed\s+|unsigned\s+)?\w+((\s*\*)+\s*|\s+))
|
} 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)
|
(\w+(\(\w+\))?)\s*\((.*?)\)\s*(\{|\;)/sx)
|
||||||
{
|
{
|
||||||
my @lines = split(/\n/, $&);
|
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+)?
|
((?:interface\s+|struct\s+|union\s+|enum\s+|register\s+|(?:signed\s+|unsigned\s+)?
|
||||||
(?:short\s+(?=int)|long\s+(?=int))?)?\w+)\s*
|
(?:short\s+(?=int)|long\s+(?=int))?)?\w+)\s*
|
||||||
((?:const|volatile)?\s*(?:\*\s*(?:const|volatile)?\s*?)*)\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+)?
|
(?:(?:$CALL_CONVENTION)\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*
|
\(\s*(?:$CALL_CONVENTION)?\s*\*\s*((?:\w+)?)\s*\)\s*
|
||||||
\(\s*(.*?)\s*\)$/x)
|
\(\s*(.*?)\s*\)$/x)
|
||||||
{
|
{
|
||||||
my $return_type = $1;
|
my $return_type = $1;
|
||||||
|
|
Loading…
Reference in New Issue