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;
@ISA = qw(Exporter);
@EXPORT = qw(
&file_type
&file_type &files_filter
&file_skip &files_skip
&file_normalize
&file_absolutize &file_normalize
&get_spec_files
&translate_calling_convention16 &translate_calling_convention32
);
......@@ -22,32 +22,35 @@ require Exporter;
use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
sub file_type {
my $file = shift;
local $_ = shift;
my $file_dir = $file;
if(!($file_dir =~ s/^(.*?)\/[^\/]*$/$1/)) {
$file_dir = ".";
}
$_ = file_absolutize($_);
$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)/ ||
$file =~ /dbgmain\.c$/ ||
$file =~ /wineclipsrv\.c$/) # FIXME: Kludge
{
return "application";
} elsif($file_dir =~ /^(debugger|miscemu)/) {
return "emulator";
} else {
return "library";
return "winelib";
}
sub files_filter {
my $type = shift;
my @files;
foreach my $file (@_) {
if(file_type($file) eq $type) {
push @files, $file;
}
}
return @files;
}
sub file_skip {
local $_ = shift;
$_ = "$current_dir/$_";
s%^\./%%;
$_ = file_absolutize($_);
m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1;
m%^(?:debugger|miscemu|tsx11|server|unicode)/% && return 1;
......@@ -69,6 +72,18 @@ sub files_skip {
return @files;
}
sub file_absolutize {
local $_ = shift;
$_ = file_normalize($_);
if(!s%^$wine_dir/%%) {
$_ = "$current_dir/$_";
}
s%^\./%%;
return $_;
}
sub file_normalize {
local $_ = shift;
......@@ -86,8 +101,9 @@ sub get_spec_files {
output->progress("$wine_dir: searching for *.spec");
my @spec_files = map {
s/^$wine_dir\/(.*)$/$1/;
if(file_type($_) eq "library") {
s%^\./%%;
s%^$wine_dir/%%;
if(file_type($_) eq "winelib") {
$_;
} else {
();
......
......@@ -24,7 +24,7 @@ sub new {
my @all_spec_files = map {
s/^.\/(.*)$/$1/;
if(&$file_type($_) eq "library") {
if(&$file_type($_) eq "winelib") {
$_;
} else {
();
......
......@@ -13,6 +13,7 @@ LPEXPANDVTBL
LPHKEY
LPLOGDISKDESC
LPLPDEVICE_INFO16
LPVIRTNODE
LPVOID
VIFPROC
......
......@@ -79,6 +79,10 @@ UINT *
WORD *
YIELDPROC
%ptr --forbidden
LPMMIOPROC16
%str
LPCSTR
......
......@@ -18,7 +18,7 @@ sub new {
my $path = shift;
my @files = map {
s/^.\/(.*)$/$1/;
s%^\./%%;
$_;
} split(/\n/, `find $path -name \\*.api`);
......@@ -212,8 +212,8 @@ sub read_all_spec_files {
my $win32api = shift;
my @files = map {
s/^$wine_dir\/(.*)$/$1/;
if(&$file_type($_) eq "library") {
s%^\./%%;
if(&$file_type($_) eq "winelib") {
$_;
} else {
();
......@@ -244,6 +244,7 @@ sub parse_spec_file {
my $module_files = \%{$self->{MODULE_FILES}};
my $file = shift;
$file =~ s%^\./%%;
my %ordinals;
my $type;
......@@ -289,26 +290,26 @@ sub parse_spec_file {
$$function_external_name{$internal_name} = $external_name;
$$function_internal_arguments{$internal_name} = $arguments;
$$function_external_arguments{$external_name} = $arguments;
if(!$$function_internal_ordinal{$internal_name}) {
$$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_external_calling_convention{$external_name} = $calling_convention;
if(!$$function_internal_module{$internal_name}) {
$$function_internal_module{$internal_name} = "$module";
} elsif($$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");
}
} else { # if($$function_internal_module{$internal_name} !~ /$module/) {
$$function_internal_module{$internal_name} .= " & $module";
}
if(!$$function_external_module{$external_name}) {
$$function_external_module{$external_name} = "$module";
} elsif($$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");
}
} else { # if($$function_external_module{$external_name} !~ /$module/) {
$$function_external_module{$external_name} .= " & $module";
}
......@@ -361,16 +362,24 @@ sub parse_spec_file {
# FIXME: Internal name existing more than once not handled properly
$$function_stub{$internal_name} = 1;
if(!$$function_internal_ordinal{$internal_name}) {
$$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}) {
$$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";
}
if(!$$function_external_module{$external_name}) {
$$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";
}
} elsif(/^(\d+|@)\s+forward(?:\s+(?:-noimport|-norelay|-i386|-ret64))?\s+(\S+)\s+(\S+)\.(\S+)$/) {
......
......@@ -92,32 +92,48 @@ if(!defined($options)) {
exit;
}
sub file_type {
my $file = shift;
sub file_absolutize {
local $_ = shift;
my $file_dir = $file;
if(!($file_dir =~ s/^(.*?)\/[^\/]*$/$1/)) {
$file_dir = ".";
$_ = file_normalize($_);
if(!s%^$wine_dir/%%) {
$_ = "$current_dir/$_";
}
s%^\./%%;
$file_dir =~ s/^$wine_dir\///;
return $_;
}
if($file_dir =~ /^(libtest|programs|rc|server|tests|tools)/ ||
$file =~ /dbgmain\.c$/ ||
$file =~ /wineclipsrv\.c$/) # FIXME: Kludge
{
return "application";
} elsif($file_dir =~ /^(debugger|miscemu)/) {
return "emulator";
} else {
return "library";
sub file_normalize {
local $_ = shift;
foreach my $dir (split(m%/%, $current_dir)) {
s%^(\.\./)*\.\./$dir/%%;
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 {
local $_ = shift;
s%^\./%%;
$_ = file_absolutize($_);
m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1;
m%^(?:debugger|miscemu|tsx11|unicode)/% && return 1;
......@@ -345,7 +361,7 @@ foreach my $file (@c_files) {
$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 $module32 = $win32api->function_internal_module($internal_name);
......
......@@ -95,39 +95,37 @@ sub check_documentation {
if($options->documentation_ordinal) {
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");
} else {
my @uc_modules16 = split(/\s*\&\s*/, uc($module16));
foreach my $uc_module16 (@uc_modules16) {
if($documentation !~ /\b$uc_module16\.\Q$ordinal16\E/) {
my $module16;
my $ordinal16;
while(defined($module16 = shift @modules16) && defined($ordinal16 = shift @ordinals16)) {
if($documentation !~ /\b\U$module16\E\.\Q$ordinal16\E/) {
$output->write("documentation: wrong or missing ordinal " .
"expected ($uc_module16.$ordinal16) \\\n$documentation\n");
}
"expected (\U$module16\E.$ordinal16) \\\n$documentation\n");
}
}
}
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");
} else {
my @uc_modules32 = split(/\s*\&\s*/, uc($module32));
foreach my $uc_module32 (@uc_modules32) {
if($documentation !~ /\b$uc_module32\.\Q$ordinal32\E/) {
my $module32;
my $ordinal32;
while(defined($module32 = shift @modules32) && defined($ordinal32 = shift @ordinals32)) {
if($documentation !~ /\b\U$module32\E\.\Q$ordinal32\E/) {
$output->write("documentation: wrong or missing ordinal " .
"expected ($uc_module32.$ordinal32) \\\n$documentation\n");
}
"expected (\U$module32\E.$ordinal32) \\\n$documentation\n");
}
}
}
}
# FIXME: Not correct
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) {
$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