Make winapi_check understand the interface keyword.

This commit is contained in:
Vincent Béron 2005-12-02 11:27:13 +01:00 committed by Alexandre Julliard
parent 9ba4e09828
commit 2f8f459516
2 changed files with 20 additions and 20 deletions

View File

@ -1110,7 +1110,7 @@ sub parse_c_file($$$$) {
$declaration .= $&; $declaration .= $&;
if($declaration =~ /^typedef/s || if($declaration =~ /^typedef/s ||
$declaration =~ /^(?:const\s+|extern\s+|static\s+|volatile\s+)*(?:struct|union)(?:\s+\w+)?\s*\{/s) $declaration =~ /^(?:const\s+|extern\s+|static\s+|volatile\s+)*(?:interface|struct|union)(?:\s+\w+)?\s*\{/s)
{ {
# Nothing # Nothing
} elsif($plevel == 1 && $blevel == 1) { } elsif($plevel == 1 && $blevel == 1) {
@ -1128,7 +1128,7 @@ sub parse_c_file($$$$) {
$declaration .= $&; $declaration .= $&;
if(0 && $blevel == 1 && if(0 && $blevel == 1 &&
$declaration !~ /^typedef/ && $declaration !~ /^typedef/ &&
$declaration !~ /^(?:const\s+|extern\s+|static\s+|volatile\s+)?(?:struct|union)(?:\s+\w+)?\s*\{/s && $declaration !~ /^(?:const\s+|extern\s+|static\s+|volatile\s+)?(?:interface|struct|union)(?:\s+\w+)?\s*\{/s &&
$declaration =~ /^(?:\w+(?:\s*\*)*\s+)*(\w+)\s*\(\s*(?:(?:\w+\s*,\s*)*(\w+))?\s*\)\s*(.*?);$/s && $declaration =~ /^(?:\w+(?:\s*\*)*\s+)*(\w+)\s*\(\s*(?:(?:\w+\s*,\s*)*(\w+))?\s*\)\s*(.*?);$/s &&
$1 ne "ICOM_VTABLE" && defined($2) && $2 ne "void" && $3) # K&R $1 ne "ICOM_VTABLE" && defined($2) && $2 ne "void" && $3) # K&R
{ {
@ -1617,7 +1617,7 @@ sub parse_c_struct_union($$$$$$$$$) {
$self->_parse_c_until_one_of("\\S", \$_, \$line, \$column); $self->_parse_c_until_one_of("\\S", \$_, \$line, \$column);
if (!s/^(struct\s+|union\s+)((?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)?\s*\{\s*//s) { if (!s/^(interface\s+|struct\s+|union\s+)((?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)?\s*\{\s*//s) {
return 0; return 0;
} }
$kind = $1; $kind = $1;
@ -1787,7 +1787,7 @@ sub parse_c_type($$$$$) {
# Nothing # Nothing
} elsif($self->_parse_c('ICOM_VTABLE\(.*?\)', \$_, \$line, \$column, \$type)) { } elsif($self->_parse_c('ICOM_VTABLE\(.*?\)', \$_, \$line, \$column, \$type)) {
# Nothing # Nothing
} elsif($self->_parse_c('(?:enum\s+|struct\s+|union\s+)?(?:(?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)\s*(\*\s*)*', } elsif($self->_parse_c('(?:enum\s+|interface\s+|struct\s+|union\s+)?(?:(?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)\s*(\*\s*)*',
\$_, \$line, \$column, \$type)) \$_, \$line, \$column, \$type))
{ {
# Nothing # Nothing
@ -1986,7 +1986,7 @@ sub parse_c_variable($$$$$$$) {
# Nothing # Nothing
} elsif(/^$/) { } elsif(/^$/) {
return 0; return 0;
} elsif (s/^(enum\s+|struct\s+|union\s+)((?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)?\s*\{\s*//s) { } elsif (s/^(enum\s+|interface\s+|struct\s+|union\s+)((?:MSVCRT|WS)\(\s*\w+\s*\)|\w+)?\s*\{\s*//s) {
my $kind = $1; my $kind = $1;
my $_name = $2; my $_name = $2;
$self->_update_c_position($&, \$line, \$column); $self->_update_c_position($&, \$line, \$column);
@ -1998,7 +1998,7 @@ sub parse_c_variable($$$$$$$) {
} }
$finished = 1; $finished = 1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s+DECLSPEC_ALIGN\(.*?\)|\s*(?:const\s*|volatile\s*)?\*)*)\s*(\w+)\s*(\[.*?\]$|:\s*(\d+)$|\{)?//s) { } elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+\b(?:\s+DECLSPEC_ALIGN\(.*?\)|\s*(?:const\s*|volatile\s*)?\*)*)\s*(\w+)\s*(\[.*?\]$|:\s*(\d+)$|\{)?//s) {
$type = "$sign$1"; $type = "$sign$1";
$name = $2; $name = $2;
@ -2017,13 +2017,13 @@ sub parse_c_variable($$$$$$$) {
$type = $self->_format_c_type($type); $type = $self->_format_c_type($type);
$finished = 1; $finished = 1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*)\s*:\s*(\d+)$//s) { } elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*)\s*:\s*(\d+)$//s) {
$type = "$sign$1:$2"; $type = "$sign$1:$2";
$name = ""; $name = "";
$type = $self->_format_c_type($type); $type = $self->_format_c_type($type);
$finished = 1; $finished = 1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*\s*\(\s*(?:$CALL_CONVENTION)?(?:\s*\*)*)\s*(\w+)\s*(\)\s*\(.*?\))$//s) { } elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*\s*\(\s*(?:$CALL_CONVENTION)?(?:\s*\*)*)\s*(\w+)\s*(\)\s*\(.*?\))$//s) {
$type = $self->_format_c_type("$sign$1$3"); $type = $self->_format_c_type("$sign$1$3");
$name = $2; $name = $2;
@ -2049,7 +2049,7 @@ sub parse_c_variable($$$$$$$) {
} elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*\(\w+\)', \$_, \$line, \$column, \$match)) { } elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*\(\w+\)', \$_, \$line, \$column, \$match)) {
$type = $match; $type = $match;
$finished = 1; $finished = 1;
} elsif(s/^(enum|struct|union)(?:\s+(\w+))?\s*\{.*?\}\s*//s) { } elsif(s/^(enum|interface|struct|union)(?:\s+(\w+))?\s*\{.*?\}\s*//s) {
my $kind = $1; my $kind = $1;
my $_name = $2; my $_name = $2;
$self->_update_c_position($&, \$line, \$column); $self->_update_c_position($&, \$line, \$column);
@ -2059,7 +2059,7 @@ sub parse_c_variable($$$$$$$) {
} else { } else {
$type = "struct { }"; $type = "struct { }";
} }
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+)\s*(?:\*\s*)*//s) { } elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+)\s*(?:\*\s*)*//s) {
$type = $&; $type = $&;
$type =~ s/\s//g; $type =~ s/\s//g;
} else { } else {
@ -2109,7 +2109,7 @@ sub parse_c_variable($$$$$$$) {
} elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*\(.*?\)', \$_, \$line, \$column, \$match)) { } elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*\(.*?\)', \$_, \$line, \$column, \$match)) {
$type = "<type>"; $type = "<type>";
$name = "<name>"; $name = "<name>";
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+)\s* } elsif(s/^((?:enum\s+|interface\s+|struct\s+|union\s+)?\w+)\s*
(?:\*\s*)*(\w+|\s*\*?\s*\w+\s*\))\s*(?:\[[^\]]*\]|\([^\)]*\))? (?:\*\s*)*(\w+|\s*\*?\s*\w+\s*\))\s*(?:\[[^\]]*\]|\([^\)]*\))?
(?:,\s*(?:\*\s*)*(\w+)\s*(?:\[[^\]]*\])?)* (?:,\s*(?:\*\s*)*(\w+)\s*(?:\[[^\]]*\])?)*
\s*(?:=|$)//sx) \s*(?:=|$)//sx)
@ -2121,7 +2121,7 @@ sub parse_c_variable($$$$$$$) {
$type =~ s/\s//g; $type =~ s/\s//g;
$type =~ s/^struct/struct /; $type =~ s/^struct/struct /;
} elsif(/^(enum|struct|union)(?:\s+(\w+))?\s*\{.*?\}\s*((?:\*\s*)*)(\w+)\s*(?:=|$)/s) { } elsif(/^(enum|interface|struct|union)(?:\s+(\w+))?\s*\{.*?\}\s*((?:\*\s*)*)(\w+)\s*(?:=|$)/s) {
$self->_update_c_position($&, \$line, \$column); $self->_update_c_position($&, \$line, \$column);
my $kind = $1; my $kind = $1;

View File

@ -140,7 +140,7 @@ sub parse_c_file($$) {
my $names = shift; my $names = shift;
foreach my $name (@$names) { foreach my $name (@$names) {
if($type =~ /^(?:struct|enum)/) { if($type =~ /^(?:enum|interface|struct|union)/) {
# $output->write("typedef $type {\n"); # $output->write("typedef $type {\n");
# $output->write("} $name;\n"); # $output->write("} $name;\n");
} else { } else {
@ -372,7 +372,7 @@ sub parse_c_file($$) {
} }
} }
next; next;
} elsif(/(extern\s+|static\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+)? ((__cdecl|__stdcall|__RPC_STUB|__RPC_USER|CDECL|NET_API_FUNCTION|RPC_ENTRY|VFWAPIV|VFWAPI|WINAPIV|WINAPI|CALLBACK)\s+)?
(\w+(\(\w+\))?)\s*\((.*?)\)\s*(\{|\;)/sx) (\w+(\(\w+\))?)\s*\((.*?)\)\s*(\{|\;)/sx)
{ {
@ -432,7 +432,7 @@ sub parse_c_file($$) {
$argument_type = "..."; $argument_type = "...";
$argument_name = "..."; $argument_name = "...";
} elsif($argument =~ /^ } elsif($argument =~ /^
((?: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+|ElfW\(\w+\)|WS\(\w+\)))\s* (?:short\s+(?=int)|long\s+(?=int))?)?(?:\w+|ElfW\(\w+\)|WS\(\w+\)))\s*
((?:__RPC_FAR|const|CONST|volatile)?\s*(?:\*\s*(?:__RPC_FAR|const|CONST|volatile)?\s*?)*)\s* ((?:__RPC_FAR|const|CONST|volatile)?\s*(?:\*\s*(?:__RPC_FAR|const|CONST|volatile)?\s*?)*)\s*
(\w*)\s*(\[\])?(?:\s+OPTIONAL)?$/x) (\w*)\s*(\[\])?(?:\s+OPTIONAL)?$/x)
@ -446,7 +446,7 @@ sub parse_c_file($$) {
} }
$argument_name = $3; $argument_name = $3;
} elsif ($argument =~ /^ } elsif ($argument =~ /^
((?: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+)? (?:__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+)?
@ -465,7 +465,7 @@ sub parse_c_file($$) {
$argument_type = "$return_type (*)($arguments)"; $argument_type = "$return_type (*)($arguments)";
} elsif ($argument =~ /^ } elsif ($argument =~ /^
((?: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*
(\w+)\s*\[\s*(.*?)\s*\](?:\[\s*(.*?)\s*\])?$/x) (\w+)\s*\[\s*(.*?)\s*\](?:\[\s*(.*?)\s*\])?$/x)
@ -548,7 +548,7 @@ sub parse_c_file($$) {
} elsif(/(DEFAULT|DECLARE)_DEBUG_CHANNEL\s*\((\S+)\)/s) { } elsif(/(DEFAULT|DECLARE)_DEBUG_CHANNEL\s*\((\S+)\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
push @$debug_channels, $1; push @$debug_channels, $1;
} elsif(/typedef\s+(enum|struct|union)(?:\s+(\w+))?\s*\{/s) { } elsif(/typedef\s+(enum|interface|struct|union)(?:\s+(\w+))?\s*\{/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
$level++; $level++;
my $type = $1; my $type = $1;
@ -557,7 +557,7 @@ sub parse_c_file($$) {
} }
&$type_begin($type); &$type_begin($type);
} elsif(/typedef\s+ } elsif(/typedef\s+
((?:const\s+|CONST\s+|enum\s+|long\s+|signed\s+|short\s+|struct\s+|union\s+|unsigned\s+|volatile\s+)*?) ((?:const\s+|CONST\s+|enum\s+|interface\s+|long\s+|signed\s+|short\s+|struct\s+|union\s+|unsigned\s+|volatile\s+)*?)
(\w+) (\w+)
(?:\s+const|\s+volatile)? (?:\s+const|\s+volatile)?
((?:\s*(?:(?:FAR|__RPC_FAR|TW_HUGE)?\s*)?\*+\s*|\s+)(?:volatile\s+|DECLSPEC_ALIGN\(\d+\)\s+)?\w+\s*(?:\[[^\]]*\])* ((?:\s*(?:(?:FAR|__RPC_FAR|TW_HUGE)?\s*)?\*+\s*|\s+)(?:volatile\s+|DECLSPEC_ALIGN\(\d+\)\s+)?\w+\s*(?:\[[^\]]*\])*
@ -585,7 +585,7 @@ sub parse_c_file($$) {
&$type_begin($type); &$type_begin($type);
&$type_end([@names]); &$type_end([@names]);
} elsif(/typedef\s+ } elsif(/typedef\s+
(?:(?:const\s+|enum\s+|long\s+|signed\s+|short\s+|struct\s+|union\s+|unsigned\s+|volatile\s+)*?) (?:(?:const\s+|enum\s+|interface\s+|long\s+|signed\s+|short\s+|struct\s+|union\s+|unsigned\s+|volatile\s+)*?)
(\w+(?:\s*\*+\s*)?)\s* (\w+(?:\s*\*+\s*)?)\s*
(?:(\w+)\s*)? (?:(\w+)\s*)?
\((?:(\w+)\s*)?\s*(?:\*\s*(\w+)|_ATL_CATMAPFUNC)\s*\)\s* \((?:(\w+)\s*)?\s*(?:\*\s*(\w+)|_ATL_CATMAPFUNC)\s*\)\s*