From e44eb4bcc4e4b4a8e77e267681aeeb597de24d0e Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Sat, 8 Jan 2000 22:20:32 +0000 Subject: [PATCH] - Added support for auto allocated ordinals - Fixed varargs (16 bit) bug - Minor fixes --- tools/winapi_check/win32/shell32.api | 3 ++ tools/winapi_check/winapi.pm | 12 ++--- tools/winapi_check/winapi_check | 67 ++++++++++++++++++---------- tools/winapi_check/winapi_local.pm | 5 ++- 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/tools/winapi_check/win32/shell32.api b/tools/winapi_check/win32/shell32.api index 367c116a745..f072099f802 100644 --- a/tools/winapi_check/win32/shell32.api +++ b/tools/winapi_check/win32/shell32.api @@ -6,3 +6,6 @@ HMENU HICON HWND +%ptr + +PNOTIFYICONDATAW diff --git a/tools/winapi_check/winapi.pm b/tools/winapi_check/winapi.pm index 7e588c15ec6..f7a6a88f765 100644 --- a/tools/winapi_check/winapi.pm +++ b/tools/winapi_check/winapi.pm @@ -175,12 +175,12 @@ sub parse_spec_file { if($header) { if(/^name\s*(\S*)/) { $module = $1; } if(/^type\s*(\w+)/) { $type = $1; } - if(/^\d+/) { $header = 0 }; + if(/^\d+|@/) { $header = 0 }; next; } my $ordinal; - if(/^(\d+)\s+(pascal|pascal16|stdcall|cdecl|register|interrupt|varargs)\s+(\S+)\s*\(\s*(.*?)\s*\)\s*(\S+)$/) { + if(/^(\d+|@)\s+(pascal|pascal16|stdcall|cdecl|register|interrupt|varargs)\s+(\S+)\s*\(\s*(.*?)\s*\)\s*(\S+)$/) { my $calling_convention = $2; my $external_name = $3; my $arguments = $4; @@ -196,7 +196,7 @@ sub parse_spec_file { } elsif($$function_module{$internal_name} !~ /$module/) { $$function_module{$internal_name} .= " & $module"; } - } elsif(/^(\d+)\s+stub\s+(\S+)$/) { + } elsif(/^(\d+|@)\s+stub\s+(\S+)$/) { my $external_name = $2; $ordinal = $1; @@ -215,11 +215,11 @@ sub parse_spec_file { } elsif($$function_module{$internal_name} !~ /$module/) { $$function_module{$internal_name} .= " & $module"; } - } elsif(/^\d+\s+(equate|long|word|extern|forward)/) { + } elsif(/^(\d+|@)\s+(equate|long|word|extern|forward)/) { # ignore } else { my $next_line = ; - if($next_line =~ /^\d/) { + if($next_line =~ /^\d|@/) { die "$file: $.: syntax error: '$_'\n"; } else { $_ .= $next_line; @@ -228,7 +228,7 @@ sub parse_spec_file { } if(defined($ordinal)) { - if($ordinals{$ordinal}) { + if($ordinal ne "@" && $ordinals{$ordinal}) { $$output->write("$file: ordinal redefined: $_\n"); } $ordinals{$ordinal}++; diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check index a8d3cd5515f..171d1de0bf5 100755 --- a/tools/winapi_check/winapi_check +++ b/tools/winapi_check/winapi_check @@ -125,12 +125,13 @@ foreach my $file ($options->files) { } my $file_type; - if($file_dir =~ /^(libtest|program|rc)/) { + if($file_dir =~ /^(libtest|program|rc|tools)/ || + $file =~ /dbgmain\.c$/ || + $file =~ /wineclipsrv\.c$/) # FIXME: Kludge + { $file_type = "application"; } elsif($file_dir =~ /^(debug|miscemu)/) { $file_type = "emulator"; - } elsif($file_dir =~ /^(tools)/) { - $file_type = "tool"; } else { $file_type = "library"; } @@ -156,7 +157,7 @@ foreach my $file ($options->files) { $win32api->found_function($name) if $options->win32; } - if($options->local) { + if($options->local && $file_type ne "application") { my $module16 = $win16api->function_module($name); my $module32 = $win32api->function_module($name); @@ -269,18 +270,20 @@ foreach my $file ($options->files) { } }; my $found_conditional = sub { - local $_ = shift; - if(!$nativeapi->is_conditional($_)) { - if(/^HAVE_/ && !/^HAVE_(IPX|MESAGL|BUGGY_MESAGL|WINE_CONSTRUCTOR)$/) - { - $output->write("$file: $_ is not a declared as a conditional\n"); - } - } else { - $conditional++; - if(!$config) { - $output->write("$file: conditional $_ used but config.h is not included\n"); - } - } + if($file_type ne "application") { + local $_ = shift; + if(!$nativeapi->is_conditional($_)) { + if(/^HAVE_/ && !/^HAVE_(IPX|MESAGL|BUGGY_MESAGL|WINE_CONSTRUCTOR)$/) + { + $output->write("$file: $_ is not a declared as a conditional\n"); + } + } else { + $conditional++; + if(!$config) { + $output->write("$file: conditional $_ used but config.h is not included\n"); + } + } + } }; my $preprocessor = 'preprocessor'->new($found_include, $found_conditional); my $found_preprocessor = sub { @@ -291,10 +294,25 @@ foreach my $file ($options->files) { if($options->config) { if($directive eq "include") { + my $header; + my $check_protection; + my $check_local; if($argument =~ /^<(.*?)>$/) { - my $header = $1; + $header = $1; + if($file_type ne "application") { + $check_protection = 1; + } else { + $check_protection = 0; + } + $check_local = 0; + } elsif($argument =~ /^"(.*?)"$/) { + $header = $1; + $check_protection = 0; + $check_local = 1; + } - if((-e "$wine_dir/include/$header" || -e "$file_dir/$header") && $file_type ne "application") { + if($check_protection) { + if((-e "$wine_dir/include/$header" || -e "$file_dir/$header")) { $output->write("$file: #include \<$header\> is a local include\n"); } @@ -306,20 +324,23 @@ foreach my $file ($options->files) { if(!$preprocessor->is_def($macro)) { if($macro =~ /^HAVE_X11/) { if(!$preprocessor->is_undef("X_DISPLAY_MISSING")) { - $output->write("$file: #$directive $argument: is a conditional include, but is not protected\n"); + $output->write("$file: #$directive $argument: is a conditional include, " . + "but is not protected\n"); } } elsif($macro =~ /^HAVE_(.*?)_H$/) { if($header ne "alloca.h" && !$preprocessor->is_def("STATFS_DEFINED_BY_$1")) { - $output->write("$file: #$directive $argument: is a conditional include, but is not protected\n"); + $output->write("$file: #$directive $argument: is a conditional include, " . + "but is not protected\n"); } } } } elsif($preprocessor->is_def($macro)) { - $output->write("$file: #$directive $argument: is protected, but is not a conditional include\n"); + $output->write("$file: #$directive $argument: is protected, " . + "but is not a conditional include\n"); } - } elsif($argument =~ /^"(.*?)"$/) { - my $header = $1; + } + if($check_local) { if(-e "$file_dir/$header") { $includes{"$file_dir/$header"}{used}++; foreach my $name (keys(%{$includes{"$file_dir/$header"}{includes}})) { diff --git a/tools/winapi_check/winapi_local.pm b/tools/winapi_check/winapi_local.pm index f73b23163ac..e5f5489d833 100644 --- a/tools/winapi_check/winapi_local.pm +++ b/tools/winapi_check/winapi_local.pm @@ -58,6 +58,8 @@ sub check_function { if($winapi->name eq "win16") { if($calling_convention =~ /^__cdecl$/) { $implemented_calling_convention = "cdecl"; + } elsif($calling_convention =~ /^VFWAPIV|WINAPIV$/) { + $implemented_calling_convention = "varargs"; } elsif($calling_convention = ~ /^__stdcall|VFWAPI|WINAPI$/) { if($implemented_return_kind =~ /^s_word|word|void$/) { $implemented_calling_convention = "pascal16"; @@ -90,7 +92,8 @@ sub check_function { { # correct } elsif($implemented_calling_convention ne $declared_calling_convention && - !($declared_calling_convention =~ /^pascal/ && $forbidden_return_type)) + !($declared_calling_convention =~ /^pascal/ && $forbidden_return_type) && + !($implemented_calling_convention =~ /^cdecl|varargs$/ && $declared_calling_convention =~ /^cdecl|varargs$/)) { if($options->calling_convention) { &$output("calling convention mismatch: $implemented_calling_convention != $declared_calling_convention");