From 35a723b5bf0865f1e8c10dde03b0e5660bf75421 Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Wed, 20 Jun 2001 22:53:21 +0000 Subject: [PATCH] Several bug fixes and additions. --- tools/winapi/config.pm | 60 +++-- tools/winapi/winapi_fixup | 274 +++++++++++++++------ tools/winapi_check/modules.pm | 2 +- tools/winapi_check/win16/setupx.api | 1 + tools/winapi_check/win32/winmm.api | 4 + tools/winapi_check/winapi.pm | 47 ++-- tools/winapi_check/winapi_check | 56 +++-- tools/winapi_check/winapi_documentation.pm | 42 ++-- 8 files changed, 322 insertions(+), 164 deletions(-) diff --git a/tools/winapi/config.pm b/tools/winapi/config.pm index 086f442ed2d..dc30a2c07f1 100644 --- a/tools/winapi/config.pm +++ b/tools/winapi/config.pm @@ -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($_); + + 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\///; - - 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 @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 { (); diff --git a/tools/winapi/winapi_fixup b/tools/winapi/winapi_fixup index 047da6fcab0..bef5c24f592 100755 --- a/tools/winapi/winapi_fixup +++ b/tools/winapi/winapi_fixup @@ -10,7 +10,9 @@ BEGIN { } use config qw( - &file_type &file_skip &files_skip &file_normalize + &file_type &files_filter + &file_skip &files_skip + &file_normalize &get_spec_files &translate_calling_convention16 &translate_calling_convention32 $current_dir $wine_dir $winapi_dir $winapi_check_dir @@ -35,12 +37,15 @@ my %options_long = ( "win32" => { default => 1, description => "Win32 fixup" }, "local" => { default => 1, description => "local fixup" }, - "documentation" => { default => 0, parent => "local", description => "documentation fixup" }, - "ordinal" => { default => 0, parent => "local", description => "ordinal fixup" }, + "documentation" => { default => 1, parent => "local", description => "documentation 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" }, + "global" => { default => 1, description => "global fixup" }, - "modify" => { default => 0, description => "global fixup" }, + "modify" => { default => 0, description => "actually perform the fixups" }, ); my %options_short = ( @@ -66,54 +71,65 @@ if($wine_dir eq ".") { 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 $external_name = shift; my @entries = (); foreach my $winapi (@winapis) { - my @module2 = (); { - my $module2 = $winapi->function_internal_module($internal_name); - if(defined($module2)) { - @module2 = split(/ & /, $module2); + my @module = (); { + my $module = $winapi->function_internal_module($internal_name); + if(defined($module)) { + @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 $external_module = $winapi->function_external_module($external_name); - if(defined($external_module)) { - @external_module = split(/ & /, $external_module); - } - } - 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]; + my $module; + my $ordinal; + while(defined($module = shift @module) && defined($ordinal = shift @ordinal)) { + push @entries, [$module, $ordinal]; } } 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_current = 0; @@ -129,7 +145,7 @@ foreach my $file (@c_files) { if(options->progress) { output->progress("$file: file $progress_current of $progress_max"); } - + my $found_function = sub { my $line = shift; my $refdebug_channels = shift; @@ -173,48 +189,92 @@ foreach my $file (@c_files) { my $calling_convention16 = translate_calling_convention16($calling_convention); my $calling_convention32 = translate_calling_convention32($calling_convention); - - if(options->ordinal && $documentation) { + if(options->documentation_ordinal && $documentation) { local $_; foreach (split(/\n/, $documentation)) { - if(/^(\s*\*\s*\w+\s*)([\(\[]\s*\w+\.\s*(?:\@|\d+)\s*[\)\]])\s*([\(\[]\s*\w+\.\s*(?:\@|\d+)\s*[\)\]])/m) { - $substitute_line{$_}{search} = $_; - $substitute_line{$_}{replace} = "$1$2\n$1$3"; - } elsif(/^\s*\*\s*(\w+)\s*$/m) { - my $external_name = $1; + 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 @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) { - 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; - $substitute_line{$_}{search} = "$external_name"; - $substitute_line{$_}{replace} = "$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"; + $substitute_line{$_}{search} = "^\Q$_\E\$"; + $substitute_line{$_}{replace} = "$part1$external_name (\U$module\E.$ordinal)"; } } } } } - 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 $module; my $ordinal; @@ -234,11 +294,21 @@ foreach my $file (@c_files) { } if(options->stub) { + # FIXME: Not correct foreach my $winapi (@winapis) { if($winapi->function_stub($internal_name)) { my $module = $winapi->function_internal_module($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 @argument_kinds = map { my $type = $_; @@ -252,26 +322,32 @@ foreach my $file (@c_files) { if(defined($kind) && $kind eq "longlong") { $n += 2; ("long", "long"); - } else { + } elsif(defined($kind)) { $n++; $kind; + } else { + $abort = 1; + $n++; + "undef"; } } @argument_types; 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") { - $substitute->{replace} = "$ordinal $calling_convention16 $internal_name(@argument_kinds) $internal_name"; + $substitute->{replace} = "$ordinal $calling_convention16 $external_name(@argument_kinds) $internal_name"; } 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})) { $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}; if(defined($search) && defined($replace)) { + my $modified2 = 0; if(options->modify) { - if(s/\Q$search\E/$replace/) { + if(s/$search/$replace/) { $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"; @@ -347,6 +445,7 @@ foreach my $file (@c_files) { while() { chomp; + my @substitutes2 = (); foreach my $substitute (@substitutes) { my $search = $substitute->{search}; my $replace = $substitute->{replace}; @@ -358,8 +457,12 @@ foreach my $file (@c_files) { output->write("$file: search : '$search'\n"); output->write("$file: replace: '$replace'\n"); } + next; + } else { + push @substitutes2, $substitute; } } + @substitutes = @substitutes2; print OUT "$_\n"; } @@ -372,6 +475,17 @@ foreach my $file (@c_files) { } else { 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"); + } + } + } } diff --git a/tools/winapi_check/modules.pm b/tools/winapi_check/modules.pm index b2130e440af..c4ae86f54e9 100644 --- a/tools/winapi_check/modules.pm +++ b/tools/winapi_check/modules.pm @@ -24,7 +24,7 @@ sub new { my @all_spec_files = map { s/^.\/(.*)$/$1/; - if(&$file_type($_) eq "library") { + if(&$file_type($_) eq "winelib") { $_; } else { (); diff --git a/tools/winapi_check/win16/setupx.api b/tools/winapi_check/win16/setupx.api index d41655f6748..104ca49998a 100644 --- a/tools/winapi_check/win16/setupx.api +++ b/tools/winapi_check/win16/setupx.api @@ -13,6 +13,7 @@ LPEXPANDVTBL LPHKEY LPLOGDISKDESC LPLPDEVICE_INFO16 +LPVIRTNODE LPVOID VIFPROC diff --git a/tools/winapi_check/win32/winmm.api b/tools/winapi_check/win32/winmm.api index 9619125f00e..57bfc18ed13 100644 --- a/tools/winapi_check/win32/winmm.api +++ b/tools/winapi_check/win32/winmm.api @@ -79,6 +79,10 @@ UINT * WORD * YIELDPROC +%ptr --forbidden + +LPMMIOPROC16 + %str LPCSTR diff --git a/tools/winapi_check/winapi.pm b/tools/winapi_check/winapi.pm index c7302e920ed..f462941389b 100644 --- a/tools/winapi_check/winapi.pm +++ b/tools/winapi_check/winapi.pm @@ -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; - $$function_internal_ordinal{$internal_name} = $ordinal; - $$function_external_ordinal{$external_name} = $ordinal; + 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; - $$function_internal_ordinal{$internal_name} = $ordinal; - $$function_external_ordinal{$external_name} = $ordinal; + 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+)$/) { diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check index e7bebc4c8fb..0a936540883 100755 --- a/tools/winapi_check/winapi_check +++ b/tools/winapi_check/winapi_check @@ -92,32 +92,48 @@ if(!defined($options)) { 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 { - my $file = shift; + local $_ = shift; - my $file_dir = $file; - if(!($file_dir =~ s/^(.*?)\/[^\/]*$/$1/)) { - $file_dir = "."; - } - - $file_dir =~ s/^$wine_dir\///; + $_ = file_absolutize($_); - 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"; - } + 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; @@ -344,8 +360,8 @@ foreach my $file (@c_files) { $win16api->found_internal_function($internal_name) if $options->win16; $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); diff --git a/tools/winapi_check/winapi_documentation.pm b/tools/winapi_check/winapi_documentation.pm index 26f7222076a..a413a00a8eb 100644 --- a/tools/winapi_check/winapi_documentation.pm +++ b/tools/winapi_check/winapi_documentation.pm @@ -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/) { - $output->write("documentation: wrong or missing ordinal " . - "expected ($uc_module16.$ordinal16) \\\n$documentation\n"); - } + 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 (\U$module16\E.$ordinal16) \\\n$documentation\n"); } } } - if(defined($module32)) { - my $ordinal32 = $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/) { - $output->write("documentation: wrong or missing ordinal " . - "expected ($uc_module32.$ordinal32) \\\n$documentation\n"); - } + if(defined($module32)) { + my @modules32 = split(/\s*\&\s*/, $module32); + my @ordinals32 = split(/\s*\&\s*/, $win32api->function_internal_ordinal($internal_name)); + + 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 (\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"); }