Commit 35a723b5 authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

Several bug fixes and additions.

parent a9d0209c
...@@ -9,9 +9,9 @@ require Exporter; ...@@ -9,9 +9,9 @@ require Exporter;
@ISA = qw(Exporter); @ISA = qw(Exporter);
@EXPORT = qw( @EXPORT = qw(
&file_type &file_type &files_filter
&file_skip &files_skip &file_skip &files_skip
&file_normalize &file_absolutize &file_normalize
&get_spec_files &get_spec_files
&translate_calling_convention16 &translate_calling_convention32 &translate_calling_convention16 &translate_calling_convention32
); );
...@@ -22,32 +22,35 @@ require Exporter; ...@@ -22,32 +22,35 @@ require Exporter;
use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir); use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
sub file_type { sub file_type {
my $file = shift; local $_ = shift;
my $file_dir = $file; $_ = file_absolutize($_);
if(!($file_dir =~ s/^(.*?)\/[^\/]*$/$1/)) {
$file_dir = ".";
}
$file_dir =~ s/^$wine_dir\///; m%^(?:libtest|rc|server|tests|tools)/% && return "";
m%^(?:programs|debugger|miscemu)/% && return "wineapp";
m%^(?:library|tsx11|unicode)/% && return "library";
m%^windows/x11drv/wineclipsrv.c% && return "application";
if($file_dir =~ /^(libtest|programs|rc|server|tests|tools)/ || return "winelib";
$file =~ /dbgmain\.c$/ || }
$file =~ /wineclipsrv\.c$/) # FIXME: Kludge
{ sub files_filter {
return "application"; my $type = shift;
} elsif($file_dir =~ /^(debugger|miscemu)/) {
return "emulator"; my @files;
} else { foreach my $file (@_) {
return "library"; if(file_type($file) eq $type) {
push @files, $file;
}
} }
return @files;
} }
sub file_skip { sub file_skip {
local $_ = shift; local $_ = shift;
$_ = "$current_dir/$_"; $_ = file_absolutize($_);
s%^\./%%;
m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1; m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1;
m%^(?:debugger|miscemu|tsx11|server|unicode)/% && return 1; m%^(?:debugger|miscemu|tsx11|server|unicode)/% && return 1;
...@@ -69,6 +72,18 @@ sub files_skip { ...@@ -69,6 +72,18 @@ sub files_skip {
return @files; return @files;
} }
sub file_absolutize {
local $_ = shift;
$_ = file_normalize($_);
if(!s%^$wine_dir/%%) {
$_ = "$current_dir/$_";
}
s%^\./%%;
return $_;
}
sub file_normalize { sub file_normalize {
local $_ = shift; local $_ = shift;
...@@ -86,8 +101,9 @@ sub get_spec_files { ...@@ -86,8 +101,9 @@ sub get_spec_files {
output->progress("$wine_dir: searching for *.spec"); output->progress("$wine_dir: searching for *.spec");
my @spec_files = map { my @spec_files = map {
s/^$wine_dir\/(.*)$/$1/; s%^\./%%;
if(file_type($_) eq "library") { s%^$wine_dir/%%;
if(file_type($_) eq "winelib") {
$_; $_;
} else { } else {
(); ();
......
...@@ -24,7 +24,7 @@ sub new { ...@@ -24,7 +24,7 @@ sub new {
my @all_spec_files = map { my @all_spec_files = map {
s/^.\/(.*)$/$1/; s/^.\/(.*)$/$1/;
if(&$file_type($_) eq "library") { if(&$file_type($_) eq "winelib") {
$_; $_;
} else { } else {
(); ();
......
...@@ -13,6 +13,7 @@ LPEXPANDVTBL ...@@ -13,6 +13,7 @@ LPEXPANDVTBL
LPHKEY LPHKEY
LPLOGDISKDESC LPLOGDISKDESC
LPLPDEVICE_INFO16 LPLPDEVICE_INFO16
LPVIRTNODE
LPVOID LPVOID
VIFPROC VIFPROC
......
...@@ -79,6 +79,10 @@ UINT * ...@@ -79,6 +79,10 @@ UINT *
WORD * WORD *
YIELDPROC YIELDPROC
%ptr --forbidden
LPMMIOPROC16
%str %str
LPCSTR LPCSTR
......
...@@ -18,7 +18,7 @@ sub new { ...@@ -18,7 +18,7 @@ sub new {
my $path = shift; my $path = shift;
my @files = map { my @files = map {
s/^.\/(.*)$/$1/; s%^\./%%;
$_; $_;
} split(/\n/, `find $path -name \\*.api`); } split(/\n/, `find $path -name \\*.api`);
...@@ -212,8 +212,8 @@ sub read_all_spec_files { ...@@ -212,8 +212,8 @@ sub read_all_spec_files {
my $win32api = shift; my $win32api = shift;
my @files = map { my @files = map {
s/^$wine_dir\/(.*)$/$1/; s%^\./%%;
if(&$file_type($_) eq "library") { if(&$file_type($_) eq "winelib") {
$_; $_;
} else { } else {
(); ();
...@@ -244,6 +244,7 @@ sub parse_spec_file { ...@@ -244,6 +244,7 @@ sub parse_spec_file {
my $module_files = \%{$self->{MODULE_FILES}}; my $module_files = \%{$self->{MODULE_FILES}};
my $file = shift; my $file = shift;
$file =~ s%^\./%%;
my %ordinals; my %ordinals;
my $type; my $type;
...@@ -289,26 +290,26 @@ sub parse_spec_file { ...@@ -289,26 +290,26 @@ sub parse_spec_file {
$$function_external_name{$internal_name} = $external_name; $$function_external_name{$internal_name} = $external_name;
$$function_internal_arguments{$internal_name} = $arguments; $$function_internal_arguments{$internal_name} = $arguments;
$$function_external_arguments{$external_name} = $arguments; $$function_external_arguments{$external_name} = $arguments;
$$function_internal_ordinal{$internal_name} = $ordinal; if(!$$function_internal_ordinal{$internal_name}) {
$$function_external_ordinal{$external_name} = $ordinal; $$function_internal_ordinal{$internal_name} = $ordinal;
} else {
$$function_internal_ordinal{$internal_name} .= " & $ordinal";
}
if(!$$function_external_ordinal{$external_name}) {
$$function_external_ordinal{$external_name} = $ordinal;
} else {
$$function_external_ordinal{$external_name} .= " & $ordinal";
}
$$function_internal_calling_convention{$internal_name} = $calling_convention; $$function_internal_calling_convention{$internal_name} = $calling_convention;
$$function_external_calling_convention{$external_name} = $calling_convention; $$function_external_calling_convention{$external_name} = $calling_convention;
if(!$$function_internal_module{$internal_name}) { if(!$$function_internal_module{$internal_name}) {
$$function_internal_module{$internal_name} = "$module"; $$function_internal_module{$internal_name} = "$module";
} elsif($$function_internal_module{$internal_name} !~ /$module/) { } else { # if($$function_internal_module{$internal_name} !~ /$module/) {
if(0) {
$$output->write("$file: $external_name: the internal function ($internal_name) " .
"already belongs to a module ($$function_internal_module{$internal_name})\n");
}
$$function_internal_module{$internal_name} .= " & $module"; $$function_internal_module{$internal_name} .= " & $module";
} }
if(!$$function_external_module{$external_name}) { if(!$$function_external_module{$external_name}) {
$$function_external_module{$external_name} = "$module"; $$function_external_module{$external_name} = "$module";
} elsif($$function_external_module{$external_name} !~ /$module/) { } else { # if($$function_external_module{$external_name} !~ /$module/) {
if(0) {
$$output->write("$file: $internal_name: the external function ($external_name) " .
"already belongs to a module ($$function_external_module{$external_name})\n");
}
$$function_external_module{$external_name} .= " & $module"; $$function_external_module{$external_name} .= " & $module";
} }
...@@ -361,16 +362,24 @@ sub parse_spec_file { ...@@ -361,16 +362,24 @@ sub parse_spec_file {
# FIXME: Internal name existing more than once not handled properly # FIXME: Internal name existing more than once not handled properly
$$function_stub{$internal_name} = 1; $$function_stub{$internal_name} = 1;
$$function_internal_ordinal{$internal_name} = $ordinal; if(!$$function_internal_ordinal{$internal_name}) {
$$function_external_ordinal{$external_name} = $ordinal; $$function_internal_ordinal{$internal_name} = $ordinal;
} else {
$$function_internal_ordinal{$internal_name} .= " & $ordinal";
}
if(!$$function_external_ordinal{$external_name}) {
$$function_external_ordinal{$external_name} = $ordinal;
} else {
$$function_external_ordinal{$external_name} .= " & $ordinal";
}
if(!$$function_internal_module{$internal_name}) { if(!$$function_internal_module{$internal_name}) {
$$function_internal_module{$internal_name} = "$module"; $$function_internal_module{$internal_name} = "$module";
} elsif($$function_internal_module{$internal_name} !~ /$module/) { } else { # if($$function_internal_module{$internal_name} !~ /$module/) {
$$function_internal_module{$internal_name} .= " & $module"; $$function_internal_module{$internal_name} .= " & $module";
} }
if(!$$function_external_module{$external_name}) { if(!$$function_external_module{$external_name}) {
$$function_external_module{$external_name} = "$module"; $$function_external_module{$external_name} = "$module";
} elsif($$function_external_module{$external_name} !~ /$module/) { } else { # if($$function_external_module{$external_name} !~ /$module/) {
$$function_external_module{$external_name} .= " & $module"; $$function_external_module{$external_name} .= " & $module";
} }
} elsif(/^(\d+|@)\s+forward(?:\s+(?:-noimport|-norelay|-i386|-ret64))?\s+(\S+)\s+(\S+)\.(\S+)$/) { } elsif(/^(\d+|@)\s+forward(?:\s+(?:-noimport|-norelay|-i386|-ret64))?\s+(\S+)\s+(\S+)\.(\S+)$/) {
......
...@@ -92,32 +92,48 @@ if(!defined($options)) { ...@@ -92,32 +92,48 @@ if(!defined($options)) {
exit; exit;
} }
sub file_type { sub file_absolutize {
my $file = shift; local $_ = shift;
my $file_dir = $file; $_ = file_normalize($_);
if(!($file_dir =~ s/^(.*?)\/[^\/]*$/$1/)) { if(!s%^$wine_dir/%%) {
$file_dir = "."; $_ = "$current_dir/$_";
} }
s%^\./%%;
$file_dir =~ s/^$wine_dir\///;
if($file_dir =~ /^(libtest|programs|rc|server|tests|tools)/ || return $_;
$file =~ /dbgmain\.c$/ || }
$file =~ /wineclipsrv\.c$/) # FIXME: Kludge
{ sub file_normalize {
return "application"; local $_ = shift;
} elsif($file_dir =~ /^(debugger|miscemu)/) {
return "emulator"; foreach my $dir (split(m%/%, $current_dir)) {
} else { s%^(\.\./)*\.\./$dir/%%;
return "library"; if(defined($1)) {
$_ = "$1$_";
}
} }
return $_;
}
sub file_type {
local $_ = shift;
$_ = file_absolutize($_);
m%^(?:libtest|rc|server|tests|tools)/% && return "";
m%^(?:programs|debugger|miscemu)/% && return "wineapp";
m%^(?:library|tsx11|unicode)/% && return "library";
m%^windows/x11drv/wineclipsrv.c% && return "application";
return "winelib";
} }
sub file_skip { sub file_skip {
local $_ = shift; local $_ = shift;
s%^\./%%; $_ = file_absolutize($_);
m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1; m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1;
m%^(?:debugger|miscemu|tsx11|unicode)/% && return 1; m%^(?:debugger|miscemu|tsx11|unicode)/% && return 1;
...@@ -344,8 +360,8 @@ foreach my $file (@c_files) { ...@@ -344,8 +360,8 @@ foreach my $file (@c_files) {
$win16api->found_internal_function($internal_name) if $options->win16; $win16api->found_internal_function($internal_name) if $options->win16;
$win32api->found_internal_function($internal_name) if $options->win32; $win32api->found_internal_function($internal_name) if $options->win32;
} }
if($file_type ne "application") { if($file_type eq "winelib") {
my $module16 = $win16api->function_internal_module($internal_name); my $module16 = $win16api->function_internal_module($internal_name);
my $module32 = $win32api->function_internal_module($internal_name); my $module32 = $win32api->function_internal_module($internal_name);
......
...@@ -95,39 +95,37 @@ sub check_documentation { ...@@ -95,39 +95,37 @@ sub check_documentation {
if($options->documentation_ordinal) { if($options->documentation_ordinal) {
if(defined($module16)) { if(defined($module16)) {
my $ordinal16 = $win16api->function_internal_ordinal($internal_name); my @modules16 = split(/\s*\&\s*/, $module16);
my @ordinals16 = split(/\s*\&\s*/, $win16api->function_internal_ordinal($internal_name));
if(!defined($ordinal16)) {
$output->write("function have no ordinal\n"); my $module16;
} else { my $ordinal16;
my @uc_modules16 = split(/\s*\&\s*/, uc($module16)); while(defined($module16 = shift @modules16) && defined($ordinal16 = shift @ordinals16)) {
foreach my $uc_module16 (@uc_modules16) { if($documentation !~ /\b\U$module16\E\.\Q$ordinal16\E/) {
if($documentation !~ /\b$uc_module16\.\Q$ordinal16\E/) { $output->write("documentation: wrong or missing ordinal " .
$output->write("documentation: wrong or missing ordinal " . "expected (\U$module16\E.$ordinal16) \\\n$documentation\n");
"expected ($uc_module16.$ordinal16) \\\n$documentation\n");
}
} }
} }
} }
if(defined($module32)) { if(defined($module32)) {
my $ordinal32 = $win32api->function_internal_ordinal($internal_name); my @modules32 = split(/\s*\&\s*/, $module32);
my @ordinals32 = split(/\s*\&\s*/, $win32api->function_internal_ordinal($internal_name));
if(!defined($ordinal32)) {
$output->write("function have no ordinal\n"); my $module32;
} else { my $ordinal32;
my @uc_modules32 = split(/\s*\&\s*/, uc($module32)); while(defined($module32 = shift @modules32) && defined($ordinal32 = shift @ordinals32)) {
foreach my $uc_module32 (@uc_modules32) { if($documentation !~ /\b\U$module32\E\.\Q$ordinal32\E/) {
if($documentation !~ /\b$uc_module32\.\Q$ordinal32\E/) { $output->write("documentation: wrong or missing ordinal " .
$output->write("documentation: wrong or missing ordinal " . "expected (\U$module32\E.$ordinal32) \\\n$documentation\n");
"expected ($uc_module32.$ordinal32) \\\n$documentation\n");
}
} }
} }
} }
} }
# FIXME: Not correct
if($options->documentation_pedantic) { if($options->documentation_pedantic) {
my $ordinal = $win16api->function_internal_ordinal($internal_name); my $ordinal = (split(/\s*\&\s*/, $win16api->function_internal_ordinal($internal_name)))[0];
if(defined($ordinal) && $documentation !~ /^ \*\s+(?:\@|\w+)(?:\s+[\(\[]\w+\.(?:\@|\d+)[\)\]])+/m) { if(defined($ordinal) && $documentation !~ /^ \*\s+(?:\@|\w+)(?:\s+[\(\[]\w+\.(?:\@|\d+)[\)\]])+/m) {
$output->write("documentation: pedantic check failed \\\n$documentation\n"); $output->write("documentation: pedantic check failed \\\n$documentation\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment