diff --git a/tools/winapi_check/win16/ddeml.api b/tools/winapi_check/win16/ddeml.api index 9728949879e..7635935206f 100644 --- a/tools/winapi_check/win16/ddeml.api +++ b/tools/winapi_check/win16/ddeml.api @@ -6,7 +6,7 @@ HCONVLIST HDDEDATA HSZ -%long # --forbidden +%long --forbidden int diff --git a/tools/winapi_check/win32/gdi32.api b/tools/winapi_check/win32/gdi32.api index 1092db4e2a0..5a85af49c5d 100644 --- a/tools/winapi_check/win32/gdi32.api +++ b/tools/winapi_check/win32/gdi32.api @@ -24,7 +24,7 @@ LPARAM UINT WORD -%long # --forbidden +%long --forbidden int diff --git a/tools/winapi_check/win32/kernel32.api b/tools/winapi_check/win32/kernel32.api index 708b87ab95f..3de5e455b91 100644 --- a/tools/winapi_check/win32/kernel32.api +++ b/tools/winapi_check/win32/kernel32.api @@ -87,7 +87,6 @@ LPDEBUG_EVENT LPDWORD LPFILETIME LPINPUT_RECORD -LPLONG LPLDT_ENTRY LPMEMORYSTATUS LPMEMORY_BASIC_INFORMATION diff --git a/tools/winapi_check/win32/ole32.api b/tools/winapi_check/win32/ole32.api index 4a2e3bb50c5..2a6795a211b 100644 --- a/tools/winapi_check/win32/ole32.api +++ b/tools/winapi_check/win32/ole32.api @@ -69,7 +69,6 @@ LPOLEINPLACEFRAMEINFO LPOLEMENUGROUPWIDTHS LPOLEOBJECT LPOLESTREAM -LPOLESTR LPOLESTR * LPPERSISTSTORAGE LPRUNNINGOBJECTTABLE * @@ -91,13 +90,10 @@ WORD * void * void ** -%str +%str # ??? LPCOLESTR - -%str # --forbidden - -LPOLESTR16 +LPOLESTR %void diff --git a/tools/winapi_check/win32/oleaut32.api b/tools/winapi_check/win32/oleaut32.api index 9d23b093be0..c40efc3a436 100644 --- a/tools/winapi_check/win32/oleaut32.api +++ b/tools/winapi_check/win32/oleaut32.api @@ -56,7 +56,6 @@ LPCLSID LPDWORD LPFONTDESC LPOCPFIPARAMS -LPOLESTR LPPICTDESC LPSTREAM LPUNKNOWN @@ -84,6 +83,7 @@ void ** %str # ??? LPCOLESTR +LPOLESTR %void diff --git a/tools/winapi_check/win32/user32.api b/tools/winapi_check/win32/user32.api index 5778aeec9b9..549c52fbe8e 100644 --- a/tools/winapi_check/win32/user32.api +++ b/tools/winapi_check/win32/user32.api @@ -27,6 +27,7 @@ HMONITOR HRESULT HRGN HSZ +HTASK HWINSTA HWND INT @@ -39,10 +40,9 @@ WCHAR WORD WPARAM -%long # --forbidden +%long --forbidden HMODULE16 -HTASK int %longlong diff --git a/tools/winapi_check/win32/winmm.api b/tools/winapi_check/win32/winmm.api index 3c7881dba2a..9619125f00e 100644 --- a/tools/winapi_check/win32/winmm.api +++ b/tools/winapi_check/win32/winmm.api @@ -12,6 +12,7 @@ HMIXER HMIXEROBJ HMMIO HMODULE +HTASK HWAVEIN HWAVEOUT HWND @@ -22,10 +23,9 @@ LPARAM LRESULT UINT -%long # --forbidden +%long --forbidden HMMIO16 -HTASK UINT16 %ptr diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check index 92b54ce8f27..37d1ad82b47 100755 --- a/tools/winapi_check/winapi_check +++ b/tools/winapi_check/winapi_check @@ -91,10 +91,10 @@ my %includes; my $header = $1; if(-e "$file_dir/$header") { $includes{$file}{includes}{"$file_dir/$header"}++; - } elsif(-e "include/$header") { + } elsif(-e "$wine_dir/include/$header") { $includes{$file}{includes}{"include/$header"}++; - } else { - $output->write("$file: #include \"$header\" is not a local include\n"); + } else { + $output->write("$file: #include \"$header\" is not a local include ($file_dir)\n"); } } } @@ -138,6 +138,7 @@ foreach my $file ($options->files) { my $found_function = sub { my $documentation = shift; + my $linkage = shift; my $return_type = shift; my $calling_convention = shift; my $name = shift; @@ -165,6 +166,7 @@ foreach my $file ($options->files) { $functions{$name} = $function; $function->documentation($documentation); + $function->linkage($linkage); $function->file($file); $function->return_type($return_type); $function->calling_convention($calling_convention); @@ -234,25 +236,72 @@ foreach my $file ($options->files) { } } - if($options->documentation && (defined($module16) || defined($module32))) { - my $name2 = $name; - my $name3 = $name; - my $name4 = $name; - my $name5 = $name; + if($options->documentation && (defined($module16) || defined($module32)) && + $linkage ne "extern" && $statements ne "") + { + my $name1; + my $name2; + my $name3; + my $name4; + my $name5; if(defined($module16) && !defined($module32)) { + my @uc_modules16 = split(/\s*\&\s*/, uc($module16)); + push @uc_modules16, "WIN16"; + + $name1 = $name; + foreach my $uc_module16 (@uc_modules16) { + if($name1 =~ s/^$uc_module16\_//) { last; } + } + + $name2 = $name1; $name2 =~ s/([AW])$/16$1/; - $name3 =~ s/16(([AW])?)$/$1/; - $name4 =~ s/^\U$module16\E\_//; - $name5 =~ s/^WIN16_//; + + $name3 = $name1; + $name3 =~ s/16(([AW])?)$/$1/; + + $name4 = $name1; + $name4 =~ s/^(.*?)(?:16)?$/\U$1\E/; + + $name5 = $name1; + $name5 = s/^(.*?)16_fn(.*?)$/$116_$2/; } elsif(!defined($module16) && defined($module32)) { + my @uc_modules32 = split(/\s*\&\s*/, uc($module32)); + + $name1 = $name; + foreach my $uc_module32 (@uc_modules32) { + if($name1 =~ s/^$uc_module32\_//) { last; } + } + + $name2 = $name1; $name2 =~ s/([AW])$/32$1/; + + $name3 = $name1; $name3 =~ s/32(([AW])?)$/$1/; - $name4 =~ s/^\U$module32\E\_//; - $name5 =~ s/^WIN16_//; + + $name4 = $name1; + $name4 =~ s/AW$//; + + $name5 = $name1; + } else { + my @uc_modules = split(/\s*\&\s*/, uc($module16)); + push @uc_modules, split(/\s*\&\s*/, uc($module32)); + + $name1 = $name; + foreach my $uc_module (@uc_modules) { + if($name1 =~ s/^$uc_module\_//) { last; } + } + + $name2 = $name1; + + $name3 = $name1; + + $name4 = $name1; + + $name5 = $name1; } - if($name !~ /^SMapLS|SUnMapLS/ && $documentation !~ /($name|$name2|$name3|$name4|$name5)/) { + if($name !~ /^SMapLS|SUnMapLS/ && $documentation !~ /($name|$name1|$name2|$name3|$name4|$name5)/) { $output->write("$file: $name: \\\n"); $output->write("$documentation\n"); } @@ -313,7 +362,9 @@ foreach my $file ($options->files) { if($check_protection) { if((-e "$wine_dir/include/$header" || -e "$file_dir/$header")) { - $output->write("$file: #include \<$header\> is a local include\n"); + if($header !~ /^ctype.h$/) { + $output->write("$file: #include \<$header\> is a local include\n"); + } } my $macro = uc($header); diff --git a/tools/winapi_check/winapi_function.pm b/tools/winapi_check/winapi_function.pm index a43c50feb4e..ceb1b598c02 100644 --- a/tools/winapi_check/winapi_function.pm +++ b/tools/winapi_check/winapi_function.pm @@ -33,6 +33,17 @@ sub documentation { return $$documentation; } +sub linkage { + my $self = shift; + my $linkage = \${$self->{LINKAGE}}; + + local $_ = shift; + + if(defined($_)) { $$linkage = $_; } + + return $$linkage; +} + sub return_type { my $self = shift; my $return_type = \${$self->{RETURN_TYPE}}; diff --git a/tools/winapi_check/winapi_options.pm b/tools/winapi_check/winapi_options.pm index b11c67e1dcb..87f98dcb56a 100644 --- a/tools/winapi_check/winapi_options.pm +++ b/tools/winapi_check/winapi_options.pm @@ -175,7 +175,11 @@ sub new { @$files = map { s/^.\/(.*)$/$1/; - $_; + if(!/spec\.c$/) { + $_; + } else { + (); + } } split(/\n/, `find $paths -name \\*.c`); return $self; diff --git a/tools/winapi_check/winapi_parser.pm b/tools/winapi_check/winapi_parser.pm index bb8d198cd02..e8b263c87d2 100644 --- a/tools/winapi_check/winapi_parser.pm +++ b/tools/winapi_check/winapi_parser.pm @@ -10,6 +10,7 @@ sub parse_c_file { my $preprocessor_found_callback = shift; my $documentation; + my $linkage; my $return_type; my $calling_convention; my $function = ""; @@ -18,6 +19,7 @@ sub parse_c_file { my $function_begin = sub { $documentation = shift; + $linkage = shift; $return_type= shift; $calling_convention = shift; $function = shift; @@ -26,7 +28,7 @@ sub parse_c_file { $statements = ""; }; my $function_end = sub { - &$function_found_callback($documentation,$return_type,$calling_convention,$function,$arguments,$statements); + &$function_found_callback($documentation,$linkage,$return_type,$calling_convention,$function,$arguments,$statements); $function = ""; }; @@ -53,7 +55,7 @@ sub parse_c_file { $lookahead_count = 0; } $lookahead_count++; - print "$level: $line\n" if $options->debug >= 2; + print " $level: $line\n" if $options->debug >= 2; } else { $lookahead_count = 0; $again = 0; @@ -94,7 +96,7 @@ sub parse_c_file { my $documentation; { my $n = $#comments; - while($n >= 0 && $comments[$n] !~ /\/\*\*/) { $n-- } + while($n >= 0 && ($comments[$n] !~ /^\/\*\*/ || $comments[$n] =~ /^\/\*\*+\//)) { $n-- } if(defined($comments[$n]) && $n >= 0) { $documentation = $comments[$n]; } else { @@ -104,45 +106,90 @@ sub parse_c_file { if($level > 0) { - my $line; - s/^([^\{\}]*)//s; - $line = $1; - if(/^(\{)/) { - $_ = $'; $again = 1; + my $line = ""; + while(/^[^\{\}]/) { + s/^([^\{\}\'\"]*)//s; $line .= $1; - print "+1: $_\n" if $options->debug >= 2; - $level++; - } elsif(/^(\})/) { + if(s/^\'//) { + $line .= "\'"; + while(/^./ && !s/^\'//) { + s/^([^\'\\]*)//s; + $line .= $1; + if(s/^\\//) { + $line .= "\\"; + if(s/^(.)//s) { + $line .= $1; + if($1 eq "0") { + s/^(\d{0,3})//s; + $line .= $1; + } + } + } + } + $line .= "\'"; + } elsif(s/^\"//) { + $line .= "\""; + while(/^./ && !s/^\"//) { + s/^([^\"\\]*)//s; + $line .= $1; + if(s/^\\//) { + $line .= "\\"; + if(s/^(.)//s) { + $line .= $1; + if($1 eq "0") { + s/^(\d{0,3})//s; + $line .= $1; + } + } + } + } + $line .= "\""; + } + } + + if(s/^\{//) { $_ = $'; $again = 1; - $line .= $1 if $level > 1; - print "-1: $_\n" if $options->debug >= 2; + $line .= "{"; + print "+1: \{$_\n" if $options->debug >= 2; + $level++; + } elsif(s/^\}//) { + $_ = $'; $again = 1; + $line .= "}" if $level > 1; + print "-1: \}$_\n" if $options->debug >= 2; $level--; } + if($line !~ /^\s*$/) { $statements .= "$line\n"; - } + } + if($function && $level == 0) { &$function_end; } next; - } elsif(/((struct\s+|union\s+|enum\s+)?\w+((\s*\*)+\s*|\s+))((__cdecl|__stdcall|VFWAPIV|VFWAPI|WINAPIV|WINAPI)\s+)?(\w+(\(\w+\))?)\s*\(([^\)]*)\)\s*(\{|\;)/s) { + } elsif(/(extern\s+|static\s+)?((struct\s+|union\s+|enum\s+)?\w+((\s*\*)+\s*|\s+))((__cdecl|__stdcall|VFWAPIV|VFWAPI|WINAPIV|WINAPI)\s+)?(\w+(\(\w+\))?)\s*\(([^\)]*)\)\s*(\{|\;)/s) { $_ = $'; $again = 1; - - if($10 eq ";") { - next; - } elsif($10 eq "{") { - $level++; - } - my $return_type = $1; - my $calling_convention = $6; - my $name = $7; - my $arguments = $9; + if($11 eq "{") { + $level++; + } + + my $linkage = $1; + my $return_type = $2; + my $calling_convention = $7; + my $name = $8; + my $arguments = $10; + + if(!defined($linkage)) { + $linkage = ""; + } if(!defined($calling_convention)) { $calling_convention = ""; } + $linkage =~ s/\s*$//; + $return_type =~ s/\s*$//; $return_type =~ s/\s*\*\s*/*/g; $return_type =~ s/(\*+)/ $1/g; @@ -180,76 +227,83 @@ sub parse_c_file { if($options->debug) { print "$file: $return_type $calling_convention $name(" . join(",", @arguments) . ")\n"; } - &$function_begin($documentation,$return_type,$calling_convention,$name,\@arguments); + &$function_begin($documentation,$linkage,$return_type,$calling_convention,$name,\@arguments); + if($level == 0) { + &$function_end; + } } elsif(/DC_(GET_X_Y|GET_VAL_16)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { $_ = $'; $again = 1; my @arguments = ("HDC16"); - &$function_begin($documentation,$2, "WINAPI", $3, \@arguments); + &$function_begin($documentation, "", $2, "WINAPI", $3, \@arguments); &$function_end; } elsif(/DC_(GET_VAL_32)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,.*?\)/s) { $_ = $'; $again = 1; my @arguments = ("HDC"); - &$function_begin($documentation,$2, "WINAPI", $3, \@arguments); + &$function_begin($documentation, "", $2, "WINAPI", $3, \@arguments); &$function_end; } elsif(/DC_(GET_VAL_EX)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { $_ = $'; $again = 1; my @arguments16 = ("HDC16", "LP" . $5 . "16"); my @arguments32 = ("HDC", "LP" . $5); - &$function_begin($documentation,"BOOL16", "WINAPI", $2 . "16", \@arguments16); + &$function_begin($documentation, "", "BOOL16", "WINAPI", $2 . "16", \@arguments16); &$function_end; - &$function_begin($documentation,"BOOL", "WINAPI", $2, \@arguments32); + &$function_begin($documentation, "", "BOOL", "WINAPI", $2, \@arguments32); &$function_end; } elsif(/DC_(SET_MODE)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { $_ = $'; $again = 1; my @arguments16 = ("HDC16", "INT16"); my @arguments32 = ("HDC", "INT"); - &$function_begin($documentation,"INT16", "WINAPI", $2 . "16", \@arguments16); + &$function_begin($documentation, "", "INT16", "WINAPI", $2 . "16", \@arguments16); &$function_end; - &$function_begin($documentation,"INT", "WINAPI", $2, \@arguments32); + &$function_begin($documentation, "", "INT", "WINAPI", $2, \@arguments32); &$function_end; } elsif(/WAVEIN_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) { $_ = $'; $again = 1; my @arguments16 = ("HWAVEIN16"); my @arguments32 = ("HWAVEIN"); - &$function_begin($documentation,"UINT16", "WINAPI", "waveIn" . $1 . "16", \@arguments16); + &$function_begin($documentation, "", "UINT16", "WINAPI", "waveIn" . $1 . "16", \@arguments16); &$function_end; - &$function_begin($documentation,"UINT", "WINAPI", "waveIn" . $1, \@arguments32); + &$function_begin($documentation, "", "UINT", "WINAPI", "waveIn" . $1, \@arguments32); &$function_end; } elsif(/WAVEOUT_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) { $_ = $'; $again = 1; my @arguments16 = ("HWAVEOUT16"); my @arguments32 = ("HWAVEOUT"); - &$function_begin($documentation,"UINT16", "WINAPI", "waveOut" . $1 . "16", \@arguments16); + &$function_begin($documentation, "", "UINT16", "WINAPI", "waveOut" . $1 . "16", \@arguments16); &$function_end; - &$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $1, \@arguments32); + &$function_begin($documentation, "", "UINT", "WINAPI", "waveOut" . $1, \@arguments32); &$function_end; } elsif(/WAVEOUT_SHORTCUT_(1|2)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { $_ = $'; $again = 1; if($1 eq "1") { my @arguments16 = ("HWAVEOUT16", $4); my @arguments32 = ("HWAVEOUT", $4); - &$function_begin($documentation,"UINT16", "WINAPI", "waveOut" . $2 . "16", \@arguments16); + &$function_begin($documentation, "", "UINT16", "WINAPI", "waveOut" . $2 . "16", \@arguments16); &$function_end; - &$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $2, \@arguments32); + &$function_begin($documentation, "", "UINT", "WINAPI", "waveOut" . $2, \@arguments32); &$function_end; } elsif($1 eq 2) { my @arguments16 = ("UINT16", $4); my @arguments32 = ("UINT", $4); - &$function_begin($documentation,"UINT16", "WINAPI", "waveOut". $2 . "16", \@arguments16); + &$function_begin($documentation, "", "UINT16", "WINAPI", "waveOut". $2 . "16", \@arguments16); &$function_end; - &$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $2, \@arguments32); + &$function_begin($documentation, "", "UINT", "WINAPI", "waveOut" . $2, \@arguments32); &$function_end; } } elsif(/DEFINE_REGS_ENTRYPOINT_\d+\(\s*(\S*)\s*,\s*([^\s,\)]*).*?\)/s) { $_ = $'; $again = 1; $regs_entrypoints{$2} = $1; + } elsif(/\'[^\']*\'/s) { + $_ = $'; $again = 1; + } elsif(/\"[^\"]*\"/s) { + $_ = $'; $again = 1; } elsif(/;/s) { $_ = $'; $again = 1; - } elsif(/\{/s) { - $_ = $'; $again = 1; - print "+1: $_\n" if $options->debug >= 2; - $level++; + } elsif(/\{/s) { + $_ = $'; $again = 1; + print "+1: $_\n" if $options->debug >= 2; + $level++; } else { $lookahead = 1; }