Several bug fixes and additions.
This commit is contained in:
parent
a9d0209c75
commit
35a723b5bf
|
@ -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;
|
||||||
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 = ".";
|
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 files_filter {
|
||||||
|
my $type = shift;
|
||||||
|
|
||||||
|
my @files;
|
||||||
|
foreach my $file (@_) {
|
||||||
|
if(file_type($file) eq $type) {
|
||||||
|
push @files, $file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_dir =~ s/^$wine_dir\///;
|
return @files;
|
||||||
|
|
||||||
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_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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
();
|
();
|
||||||
|
|
|
@ -10,7 +10,9 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
use config qw(
|
use config qw(
|
||||||
&file_type &file_skip &files_skip &file_normalize
|
&file_type &files_filter
|
||||||
|
&file_skip &files_skip
|
||||||
|
&file_normalize
|
||||||
&get_spec_files
|
&get_spec_files
|
||||||
&translate_calling_convention16 &translate_calling_convention32
|
&translate_calling_convention16 &translate_calling_convention32
|
||||||
$current_dir $wine_dir $winapi_dir $winapi_check_dir
|
$current_dir $wine_dir $winapi_dir $winapi_check_dir
|
||||||
|
@ -35,12 +37,15 @@ my %options_long = (
|
||||||
"win32" => { default => 1, description => "Win32 fixup" },
|
"win32" => { default => 1, description => "Win32 fixup" },
|
||||||
|
|
||||||
"local" => { default => 1, description => "local fixup" },
|
"local" => { default => 1, description => "local fixup" },
|
||||||
"documentation" => { default => 0, parent => "local", description => "documentation fixup" },
|
"documentation" => { default => 1, parent => "local", description => "documentation fixup" },
|
||||||
"ordinal" => { default => 0, parent => "local", description => "ordinal fixup" },
|
"documentation-ordinal" => { default => 1, parent => "documentation", description => "documentation ordinal fixup" },
|
||||||
|
"documentation-missing" => { default => 0, parent => "documentation", description => "documentation missing fixup" },
|
||||||
|
"documentation-name" => { default => 0, parent => "documentation", description => "documentation name fixup" },
|
||||||
"stub" => { default => 0, parent => "local", description => "stub fixup" },
|
"stub" => { default => 0, parent => "local", description => "stub fixup" },
|
||||||
|
|
||||||
"global" => { default => 1, description => "global fixup" },
|
"global" => { default => 1, description => "global fixup" },
|
||||||
|
|
||||||
"modify" => { default => 0, description => "global fixup" },
|
"modify" => { default => 0, description => "actually perform the fixups" },
|
||||||
);
|
);
|
||||||
|
|
||||||
my %options_short = (
|
my %options_short = (
|
||||||
|
@ -66,54 +71,65 @@ if($wine_dir eq ".") {
|
||||||
winapi->read_spec_files($modules, $wine_dir, $current_dir, \@spec_files, $win16api, $win32api);
|
winapi->read_spec_files($modules, $wine_dir, $current_dir, \@spec_files, $win16api, $win32api);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_all_module_ordinal {
|
sub get_all_module_internal_ordinal {
|
||||||
my $internal_name = shift;
|
my $internal_name = shift;
|
||||||
my $external_name = shift;
|
|
||||||
|
|
||||||
my @entries = ();
|
my @entries = ();
|
||||||
foreach my $winapi (@winapis) {
|
foreach my $winapi (@winapis) {
|
||||||
my @module2 = (); {
|
my @module = (); {
|
||||||
my $module2 = $winapi->function_internal_module($internal_name);
|
my $module = $winapi->function_internal_module($internal_name);
|
||||||
if(defined($module2)) {
|
if(defined($module)) {
|
||||||
@module2 = split(/ & /, $module2);
|
@module = split(/ & /, $module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my @ordinal = (); {
|
||||||
|
my $ordinal = $winapi->function_internal_ordinal($internal_name);
|
||||||
|
if(defined($ordinal)) {
|
||||||
|
@ordinal = split(/ & /, $ordinal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $module2 (@module2) {
|
|
||||||
my $ordinal2;
|
|
||||||
|
|
||||||
my @external_module = (); {
|
my $module;
|
||||||
my $external_module = $winapi->function_external_module($external_name);
|
my $ordinal;
|
||||||
if(defined($external_module)) {
|
while(defined($module = shift @module) && defined($ordinal = shift @ordinal)) {
|
||||||
@external_module = split(/ & /, $external_module);
|
push @entries, [$module, $ordinal];
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach my $external_module (@external_module) {
|
|
||||||
if(!defined($ordinal2) && $module2 eq $external_module) {
|
|
||||||
$ordinal2 = $winapi->function_external_ordinal($external_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my @internal_module = (); {
|
|
||||||
my $internal_module = $winapi->function_internal_module($internal_name);
|
|
||||||
if(defined($internal_module)) {
|
|
||||||
@internal_module = split(/ & /, $internal_module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach my $internal_module (@internal_module) {
|
|
||||||
if(!defined($ordinal2) && $module2 eq $internal_module) {
|
|
||||||
$ordinal2 = $winapi->function_internal_ordinal($internal_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
push @entries, [$module2, $ordinal2];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return @entries;
|
return @entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @c_files = files_skip(options->c_files);
|
sub get_all_module_external_ordinal {
|
||||||
|
my $external_name = shift;
|
||||||
|
|
||||||
|
my @entries = ();
|
||||||
|
foreach my $winapi (@winapis) {
|
||||||
|
my @module = (); {
|
||||||
|
my $module = $winapi->function_external_module($external_name);
|
||||||
|
if(defined($module)) {
|
||||||
|
@module = split(/ & /, $module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my @ordinal = (); {
|
||||||
|
my $ordinal = $winapi->function_external_ordinal($external_name);
|
||||||
|
if(defined($ordinal)) {
|
||||||
|
@ordinal = split(/ & /, $ordinal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $module;
|
||||||
|
my $ordinal;
|
||||||
|
while(defined($module = shift @module) && defined($ordinal = shift @ordinal)) {
|
||||||
|
push @entries, [$module, $ordinal];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return @entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @c_files = options->c_files;
|
||||||
|
@c_files = files_skip(@c_files);
|
||||||
|
@c_files = files_filter("winelib", @c_files);
|
||||||
|
|
||||||
my $progress_output;
|
my $progress_output;
|
||||||
my $progress_current = 0;
|
my $progress_current = 0;
|
||||||
|
@ -129,7 +145,7 @@ foreach my $file (@c_files) {
|
||||||
if(options->progress) {
|
if(options->progress) {
|
||||||
output->progress("$file: file $progress_current of $progress_max");
|
output->progress("$file: file $progress_current of $progress_max");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $found_function = sub {
|
my $found_function = sub {
|
||||||
my $line = shift;
|
my $line = shift;
|
||||||
my $refdebug_channels = shift;
|
my $refdebug_channels = shift;
|
||||||
|
@ -173,48 +189,92 @@ foreach my $file (@c_files) {
|
||||||
my $calling_convention16 = translate_calling_convention16($calling_convention);
|
my $calling_convention16 = translate_calling_convention16($calling_convention);
|
||||||
my $calling_convention32 = translate_calling_convention32($calling_convention);
|
my $calling_convention32 = translate_calling_convention32($calling_convention);
|
||||||
|
|
||||||
|
if(options->documentation_ordinal && $documentation) {
|
||||||
if(options->ordinal && $documentation) {
|
|
||||||
local $_;
|
local $_;
|
||||||
foreach (split(/\n/, $documentation)) {
|
foreach (split(/\n/, $documentation)) {
|
||||||
if(/^(\s*\*\s*\w+\s*)([\(\[]\s*\w+\.\s*(?:\@|\d+)\s*[\)\]])\s*([\(\[]\s*\w+\.\s*(?:\@|\d+)\s*[\)\]])/m) {
|
if(/^(\s*\*\s*(\w+)\s*)(\s*(?:[\(\[]\s*\w+(?:\s*\.\s*\S+\s*)?[\)\]])+)(.*?)$/m) {
|
||||||
$substitute_line{$_}{search} = $_;
|
my $part1 = $1;
|
||||||
$substitute_line{$_}{replace} = "$1$2\n$1$3";
|
my $external_name = $2;
|
||||||
} elsif(/^\s*\*\s*(\w+)\s*$/m) {
|
my $part3 = $3;
|
||||||
my $external_name = $1;
|
my $part4 = $4;
|
||||||
|
|
||||||
|
$part4 =~ s/\s*$//;
|
||||||
|
|
||||||
|
my @entries = ();
|
||||||
|
while($part3 =~ s/^\s*([\(\[]\s*(\w+)(?:\s*\.\s*(\S+)\s*)?[\)\]])//) {
|
||||||
|
push @entries, [$1, lc($2), $3];
|
||||||
|
}
|
||||||
|
|
||||||
|
my $replaced = 0;
|
||||||
|
my $replace = "";
|
||||||
|
foreach my $entry (@entries) {
|
||||||
|
(my $part, my $module, my $ordinal) = @$entry;
|
||||||
|
foreach my $entry2 (get_all_module_external_ordinal($external_name)) {
|
||||||
|
(my $module2, my $ordinal2) = @$entry2;
|
||||||
|
|
||||||
|
if(defined($module2) && $module eq $module2 &&
|
||||||
|
(!defined($ordinal) || (defined($ordinal2) && $ordinal ne $ordinal2)))
|
||||||
|
{
|
||||||
|
if(defined($ordinal)) {
|
||||||
|
if($part =~ s/\U$module\E\s*.\s*\Q$ordinal\E/\U$module2\E.$ordinal2/) {
|
||||||
|
$replaced++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($part =~ s/\U$module\E/\U$module2\E.$ordinal2/) {
|
||||||
|
$replaced++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($replace) { $replace .= "\n"; }
|
||||||
|
$replace .= "$part1$part$part4";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($replaced > 0) {
|
||||||
|
$substitute_line{$_}{search} = "^\Q$_\E\$";
|
||||||
|
$substitute_line{$_}{replace} = "$replace";
|
||||||
|
}
|
||||||
|
} elsif(/^(\s*\*\s*)(\w+)\s*$/m) {
|
||||||
|
my $part1 = $1;
|
||||||
|
my $external_name = $2;
|
||||||
if($internal_name eq $external_name) {
|
if($internal_name eq $external_name) {
|
||||||
foreach my $entry (get_all_module_ordinal($internal_name, $external_name)) {
|
foreach my $entry (get_all_module_external_ordinal($external_name)) {
|
||||||
(my $module, my $ordinal) = @$entry;
|
(my $module, my $ordinal) = @$entry;
|
||||||
|
|
||||||
$substitute_line{$_}{search} = "$external_name";
|
$substitute_line{$_}{search} = "^\Q$_\E\$";
|
||||||
$substitute_line{$_}{replace} = "$external_name (\U$module\E.$ordinal)";
|
$substitute_line{$_}{replace} = "$part1$external_name (\U$module\E.$ordinal)";
|
||||||
}
|
|
||||||
}
|
|
||||||
} elsif(/^\s*\*\s*(\w+)\s*[\(\[]\s*(\w+)\.\s*(\@|\d+)\s*[\)\]]/m) {
|
|
||||||
my $external_name = $1;
|
|
||||||
my $module = lc($2);
|
|
||||||
my $ordinal = $3;
|
|
||||||
|
|
||||||
foreach my $entry (get_all_module_ordinal($internal_name, $external_name)) {
|
|
||||||
(my $module2, my $ordinal2) = @$entry;
|
|
||||||
if(!defined($module2) || !defined($ordinal2)) {
|
|
||||||
if(defined($module2)) {
|
|
||||||
output->write("$file: $internal_name: unknown error (\U$module2\E.?)\n");
|
|
||||||
} elsif(defined($module2)) {
|
|
||||||
output->write("$file: $internal_name: unknown error (?.$ordinal2)\n");
|
|
||||||
} else {
|
|
||||||
output->write("$file: $internal_name: unknown error\n");
|
|
||||||
}
|
|
||||||
} elsif($module eq $module2 && $ordinal ne $ordinal2) {
|
|
||||||
$substitute_line{$_}{search} = "\U$module\E.$ordinal";
|
|
||||||
$substitute_line{$_}{replace} = "\U$module2\E.$ordinal2";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options->documentation && !$documentation) {
|
if(options->documentation_name && $documentation) {
|
||||||
|
local $_;
|
||||||
|
foreach (split(/\n/, $documentation)) {
|
||||||
|
if(/^(\s*\*\s*(\w+)\s*)(\s*(?:[\(\[]\s*\w+(?:\s*\.\s*\S+\s*)?[\)\]])+)(.*?)$/m) {
|
||||||
|
my $part1 = $1;
|
||||||
|
my $external_name = $2;
|
||||||
|
my $part3 = $3;
|
||||||
|
my $part4 = $4;
|
||||||
|
|
||||||
|
$part4 =~ s/\s*$//;
|
||||||
|
|
||||||
|
my $external_name2;
|
||||||
|
foreach my $winapi (@winapis) {
|
||||||
|
$external_name2 = ($winapi->function_external_name($internal_name) || $external_name2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(defined($external_name2) && $external_name ne $external_name2) {
|
||||||
|
output->write("$external_name != $external_name2\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options->documentation_missing && !$documentation) {
|
||||||
|
# FIXME: Not correct
|
||||||
|
|
||||||
my $external_name;
|
my $external_name;
|
||||||
my $module;
|
my $module;
|
||||||
my $ordinal;
|
my $ordinal;
|
||||||
|
@ -234,11 +294,21 @@ foreach my $file (@c_files) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options->stub) {
|
if(options->stub) {
|
||||||
|
# FIXME: Not correct
|
||||||
foreach my $winapi (@winapis) {
|
foreach my $winapi (@winapis) {
|
||||||
if($winapi->function_stub($internal_name)) {
|
if($winapi->function_stub($internal_name)) {
|
||||||
my $module = $winapi->function_internal_module($internal_name);
|
my $module = $winapi->function_internal_module($internal_name);
|
||||||
my $ordinal = $winapi->function_internal_ordinal($internal_name);
|
my $ordinal = $winapi->function_internal_ordinal($internal_name);
|
||||||
|
|
||||||
|
my $external_name = $internal_name;
|
||||||
|
if($winapi->name eq "win16") {
|
||||||
|
$external_name =~ s/(?:_)?16([AW]?)$//;
|
||||||
|
if(defined($1)) {
|
||||||
|
$external_name .= $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $abort = 0;
|
||||||
my $n;
|
my $n;
|
||||||
my @argument_kinds = map {
|
my @argument_kinds = map {
|
||||||
my $type = $_;
|
my $type = $_;
|
||||||
|
@ -252,26 +322,32 @@ foreach my $file (@c_files) {
|
||||||
if(defined($kind) && $kind eq "longlong") {
|
if(defined($kind) && $kind eq "longlong") {
|
||||||
$n += 2;
|
$n += 2;
|
||||||
("long", "long");
|
("long", "long");
|
||||||
} else {
|
} elsif(defined($kind)) {
|
||||||
$n++;
|
$n++;
|
||||||
$kind;
|
$kind;
|
||||||
|
} else {
|
||||||
|
$abort = 1;
|
||||||
|
$n++;
|
||||||
|
"undef";
|
||||||
}
|
}
|
||||||
} @argument_types;
|
} @argument_types;
|
||||||
|
|
||||||
my $substitute = {};
|
my $substitute = {};
|
||||||
$substitute->{search} = "^$ordinal\\s+stub\\s+$internal_name\\s*(?:#.*?)?\$";
|
$substitute->{search} = "^\\s*$ordinal\\s+stub\\s+$external_name\\s*(?:#.*?)?\$";
|
||||||
|
|
||||||
if($winapi->name eq "win16") {
|
if($winapi->name eq "win16") {
|
||||||
$substitute->{replace} = "$ordinal $calling_convention16 $internal_name(@argument_kinds) $internal_name";
|
$substitute->{replace} = "$ordinal $calling_convention16 $external_name(@argument_kinds) $internal_name";
|
||||||
} else {
|
} else {
|
||||||
$substitute->{replace} = "$ordinal $calling_convention32 $internal_name(@argument_kinds) $internal_name";
|
$substitute->{replace} = "$ordinal $calling_convention32 $external_name(@argument_kinds) $internal_name";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!defined($spec_file{$module})) {
|
if(!defined($spec_file{$module})) {
|
||||||
$spec_file{$module} = [];
|
$spec_file{$module} = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
push @{$spec_file{$module}}, $substitute;
|
if(!$abort) {
|
||||||
|
push @{$spec_file{$module}}, $substitute;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,13 +383,35 @@ foreach my $file (@c_files) {
|
||||||
my $replace = $substitute_line{$_}{replace};
|
my $replace = $substitute_line{$_}{replace};
|
||||||
|
|
||||||
if(defined($search) && defined($replace)) {
|
if(defined($search) && defined($replace)) {
|
||||||
|
my $modified2 = 0;
|
||||||
if(options->modify) {
|
if(options->modify) {
|
||||||
if(s/\Q$search\E/$replace/) {
|
if(s/$search/$replace/) {
|
||||||
$modified = 1;
|
$modified = 1;
|
||||||
|
$modified2 = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!options->modify || !$modified2) {
|
||||||
|
my $search2;
|
||||||
|
my $replace2;
|
||||||
|
if(options->modify && !$modified2) {
|
||||||
|
$search2 = "unmatched search";
|
||||||
|
$replace2 = "unmatched replace";
|
||||||
|
} else {
|
||||||
|
$search2 = "search";
|
||||||
|
$replace2 = "replace";
|
||||||
|
}
|
||||||
|
output->write("$file: $.: $search2 : '$search'\n");
|
||||||
|
|
||||||
|
my @replace2 = split(/\n/, $replace);
|
||||||
|
if($#replace2 > 0) {
|
||||||
|
output->write("$file: $.: $replace2: \\\n");
|
||||||
|
foreach my $replace2 (@replace2) {
|
||||||
|
output->write("'$replace2'\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
output->write("$file: $.: $replace2: '$replace'\n");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
output->write("$file: $.: search : '$search'\n");
|
|
||||||
output->write("$file: $.: replace: '$replace'\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print OUT "$_\n";
|
print OUT "$_\n";
|
||||||
|
@ -347,6 +445,7 @@ foreach my $file (@c_files) {
|
||||||
while(<IN>) {
|
while(<IN>) {
|
||||||
chomp;
|
chomp;
|
||||||
|
|
||||||
|
my @substitutes2 = ();
|
||||||
foreach my $substitute (@substitutes) {
|
foreach my $substitute (@substitutes) {
|
||||||
my $search = $substitute->{search};
|
my $search = $substitute->{search};
|
||||||
my $replace = $substitute->{replace};
|
my $replace = $substitute->{replace};
|
||||||
|
@ -358,8 +457,12 @@ foreach my $file (@c_files) {
|
||||||
output->write("$file: search : '$search'\n");
|
output->write("$file: search : '$search'\n");
|
||||||
output->write("$file: replace: '$replace'\n");
|
output->write("$file: replace: '$replace'\n");
|
||||||
}
|
}
|
||||||
|
next;
|
||||||
|
} else {
|
||||||
|
push @substitutes2, $substitute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@substitutes = @substitutes2;
|
||||||
|
|
||||||
print OUT "$_\n";
|
print OUT "$_\n";
|
||||||
}
|
}
|
||||||
|
@ -372,6 +475,17 @@ foreach my $file (@c_files) {
|
||||||
} else {
|
} else {
|
||||||
output->write("$module: doesn't have any spec file\n");
|
output->write("$module: doesn't have any spec file\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($#substitutes >= 0) {
|
||||||
|
foreach my $substitute (@substitutes) {
|
||||||
|
my $search = $substitute->{search};
|
||||||
|
my $replace = $substitute->{replace};
|
||||||
|
|
||||||
|
output->write("$file: unmatched search : '$search'\n");
|
||||||
|
output->write("$file: unmatched replace: '$replace'\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
LPHKEY
|
LPHKEY
|
||||||
LPLOGDISKDESC
|
LPLOGDISKDESC
|
||||||
LPLPDEVICE_INFO16
|
LPLPDEVICE_INFO16
|
||||||
|
LPVIRTNODE
|
||||||
LPVOID
|
LPVOID
|
||||||
VIFPROC
|
VIFPROC
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,10 @@ UINT *
|
||||||
WORD *
|
WORD *
|
||||||
YIELDPROC
|
YIELDPROC
|
||||||
|
|
||||||
|
%ptr --forbidden
|
||||||
|
|
||||||
|
LPMMIOPROC16
|
||||||
|
|
||||||
%str
|
%str
|
||||||
|
|
||||||
LPCSTR
|
LPCSTR
|
||||||
|
|
|
@ -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 {
|
||||||
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 {
|
||||||
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 {
|
||||||
$$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 {
|
||||||
|
|
||||||
# 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)) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub file_absolutize {
|
||||||
|
local $_ = shift;
|
||||||
|
|
||||||
|
$_ = file_normalize($_);
|
||||||
|
if(!s%^$wine_dir/%%) {
|
||||||
|
$_ = "$current_dir/$_";
|
||||||
|
}
|
||||||
|
s%^\./%%;
|
||||||
|
|
||||||
|
return $_;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub file_normalize {
|
||||||
|
local $_ = shift;
|
||||||
|
|
||||||
|
foreach my $dir (split(m%/%, $current_dir)) {
|
||||||
|
s%^(\.\./)*\.\./$dir/%%;
|
||||||
|
if(defined($1)) {
|
||||||
|
$_ = "$1$_";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $_;
|
||||||
|
}
|
||||||
|
|
||||||
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\///;
|
|
||||||
|
|
||||||
if($file_dir =~ /^(libtest|programs|rc|server|tests|tools)/ ||
|
m%^(?:libtest|rc|server|tests|tools)/% && return "";
|
||||||
$file =~ /dbgmain\.c$/ ||
|
m%^(?:programs|debugger|miscemu)/% && return "wineapp";
|
||||||
$file =~ /wineclipsrv\.c$/) # FIXME: Kludge
|
m%^(?:library|tsx11|unicode)/% && return "library";
|
||||||
{
|
m%^windows/x11drv/wineclipsrv.c% && return "application";
|
||||||
return "application";
|
|
||||||
} elsif($file_dir =~ /^(debugger|miscemu)/) {
|
return "winelib";
|
||||||
return "emulator";
|
|
||||||
} else {
|
|
||||||
return "library";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
$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 {
|
||||||
|
|
||||||
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)) {
|
my $module16;
|
||||||
$output->write("function have no ordinal\n");
|
my $ordinal16;
|
||||||
} else {
|
while(defined($module16 = shift @modules16) && defined($ordinal16 = shift @ordinals16)) {
|
||||||
my @uc_modules16 = split(/\s*\&\s*/, uc($module16));
|
if($documentation !~ /\b\U$module16\E\.\Q$ordinal16\E/) {
|
||||||
foreach my $uc_module16 (@uc_modules16) {
|
$output->write("documentation: wrong or missing ordinal " .
|
||||||
if($documentation !~ /\b$uc_module16\.\Q$ordinal16\E/) {
|
"expected (\U$module16\E.$ordinal16) \\\n$documentation\n");
|
||||||
$output->write("documentation: wrong or missing ordinal " .
|
|
||||||
"expected ($uc_module16.$ordinal16) \\\n$documentation\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(defined($module32)) {
|
|
||||||
my $ordinal32 = $win32api->function_internal_ordinal($internal_name);
|
|
||||||
|
|
||||||
if(!defined($ordinal32)) {
|
if(defined($module32)) {
|
||||||
$output->write("function have no ordinal\n");
|
my @modules32 = split(/\s*\&\s*/, $module32);
|
||||||
} else {
|
my @ordinals32 = split(/\s*\&\s*/, $win32api->function_internal_ordinal($internal_name));
|
||||||
my @uc_modules32 = split(/\s*\&\s*/, uc($module32));
|
|
||||||
foreach my $uc_module32 (@uc_modules32) {
|
my $module32;
|
||||||
if($documentation !~ /\b$uc_module32\.\Q$ordinal32\E/) {
|
my $ordinal32;
|
||||||
$output->write("documentation: wrong or missing ordinal " .
|
while(defined($module32 = shift @modules32) && defined($ordinal32 = shift @ordinals32)) {
|
||||||
"expected ($uc_module32.$ordinal32) \\\n$documentation\n");
|
if($documentation !~ /\b\U$module32\E\.\Q$ordinal32\E/) {
|
||||||
}
|
$output->write("documentation: wrong or missing ordinal " .
|
||||||
|
"expected (\U$module32\E.$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");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue