ChangeSet ID: 21620 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/12/02 04:31:11
Modified files: tools/winapi : c_parser.pm winapi_parser.pm
Log message: Vincent BĂ©ron vberon@mecano.gme.usherb.ca Make winapi_check understand the interface keyword.
Patch: http://cvs.winehq.org/patch.py?id=21620
Old revision New revision Changes Path 1.19 1.20 +12 -12 wine/tools/winapi/c_parser.pm 1.8 1.9 +8 -8 wine/tools/winapi/winapi_parser.pm
Index: wine/tools/winapi/c_parser.pm diff -u -p wine/tools/winapi/c_parser.pm:1.19 wine/tools/winapi/c_parser.pm:1.20 --- wine/tools/winapi/c_parser.pm:1.19 2 Dec 2005 10:31:11 -0000 +++ wine/tools/winapi/c_parser.pm 2 Dec 2005 10:31:11 -0000 @@ -1110,7 +1110,7 @@ sub parse_c_file($$$$) { $declaration .= $&;
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 } elsif($plevel == 1 && $blevel == 1) { @@ -1128,7 +1128,7 @@ sub parse_c_file($$$$) { $declaration .= $&; if(0 && $blevel == 1 && $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 && $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);
- 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; } $kind = $1; @@ -1787,7 +1787,7 @@ sub parse_c_type($$$$$) { # Nothing } elsif($self->_parse_c('ICOM_VTABLE(.*?)', $_, $line, $column, $type)) { # 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)) { # Nothing @@ -1986,7 +1986,7 @@ sub parse_c_variable($$$$$$$) { # Nothing } elsif(/^$/) { 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 $_name = $2; $self->_update_c_position($&, $line, $column); @@ -1998,7 +1998,7 @@ sub parse_c_variable($$$$$$$) { }
$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"; $name = $2;
@@ -2017,13 +2017,13 @@ sub parse_c_variable($$$$$$$) { $type = $self->_format_c_type($type);
$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"; $name = ""; $type = $self->_format_c_type($type);
$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"); $name = $2;
@@ -2049,7 +2049,7 @@ sub parse_c_variable($$$$$$$) { } elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*(\w+)', $_, $line, $column, $match)) { $type = $match; $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 $_name = $2; $self->_update_c_position($&, $line, $column); @@ -2059,7 +2059,7 @@ sub parse_c_variable($$$$$$$) { } else { $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 =~ s/\s//g; } else { @@ -2109,7 +2109,7 @@ sub parse_c_variable($$$$$$$) { } elsif($self->_parse_c('(?:struct\s+)?ICOM_VTABLE\s*(.*?)', $_, $line, $column, $match)) { $type = "<type>"; $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*(?:*\s*)*(\w+)\s*(?:[[^]]*])?)* \s*(?:=|$)//sx) @@ -2121,7 +2121,7 @@ sub parse_c_variable($$$$$$$) {
$type =~ s/\s//g; $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);
my $kind = $1; Index: wine/tools/winapi/winapi_parser.pm diff -u -p wine/tools/winapi/winapi_parser.pm:1.8 wine/tools/winapi/winapi_parser.pm:1.9 --- wine/tools/winapi/winapi_parser.pm:1.8 2 Dec 2005 10:31:11 -0000 +++ wine/tools/winapi/winapi_parser.pm 2 Dec 2005 10:31:11 -0000 @@ -140,7 +140,7 @@ sub parse_c_file($$) { my $names = shift;
foreach my $name (@$names) { - if($type =~ /^(?:struct|enum)/) { + if($type =~ /^(?:enum|interface|struct|union)/) { # $output->write("typedef $type {\n"); # $output->write("} $name;\n"); } else { @@ -372,7 +372,7 @@ sub parse_c_file($$) { } } 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+)? (\w+((\w+))?)\s*((.*?))\s*({|;)/sx) { @@ -432,7 +432,7 @@ sub parse_c_file($$) { $argument_type = "..."; $argument_name = "..."; } 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* ((?:__RPC_FAR|const|CONST|volatile)?\s*(?:*\s*(?:__RPC_FAR|const|CONST|volatile)?\s*?)*)\s* (\w*)\s*([])?(?:\s+OPTIONAL)?$/x) @@ -446,7 +446,7 @@ sub parse_c_file($$) { } $argument_name = $3; } 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* ((?: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+)? @@ -465,7 +465,7 @@ sub parse_c_file($$) { $argument_type = "$return_type (*)($arguments)"; } 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* ((?:const|volatile)?\s*(?:*\s*(?:const|volatile)?\s*?)*)\s* (\w+)\s*[\s*(.*?)\s*](?:[\s*(.*?)\s*])?$/x) @@ -548,7 +548,7 @@ sub parse_c_file($$) { } elsif(/(DEFAULT|DECLARE)_DEBUG_CHANNEL\s*((\S+))/s) { $_ = $'; $again = 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; $level++; my $type = $1; @@ -557,7 +557,7 @@ sub parse_c_file($$) { } &$type_begin($type); } 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+) (?:\s+const|\s+volatile)? ((?:\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_end([@names]); } 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*)? ((?:(\w+)\s*)?\s*(?:*\s*(\w+)|_ATL_CATMAPFUNC)\s*)\s*