From a896531f38a33e163679148aed81231549ef2c6b Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Thu, 30 Nov 2000 01:31:44 +0000 Subject: [PATCH] - Added new option --documentation-arguments - Minor API files update --- tools/winapi_check/modules.dat | 2 -- tools/winapi_check/nativeapi.dat | 4 ++- tools/winapi_check/win16/toolhelp.api | 4 +++ tools/winapi_check/win32/crtdll.api | 1 - tools/winapi_check/winapi.pm | 7 +++-- tools/winapi_check/winapi_check | 18 +++++++++++- tools/winapi_check/winapi_local.pm | 2 +- tools/winapi_check/winapi_options.pm | 1 + tools/winapi_check/winapi_parser.pm | 41 +++++++++++++++++++++------ 9 files changed, 63 insertions(+), 17 deletions(-) diff --git a/tools/winapi_check/modules.dat b/tools/winapi_check/modules.dat index bc2033de5ee..aae92d3f3b1 100644 --- a/tools/winapi_check/modules.dat +++ b/tools/winapi_check/modules.dat @@ -354,7 +354,6 @@ dlls/version % dlls/win32s/w32skrnl.spec dlls/win32s -loader % dlls/win32s/w32sys.spec @@ -450,7 +449,6 @@ dlls/wsock32 % dlls/winspool/winspool.drv.spec dlls/winspool -win32 % dlls/wow32/wow32.spec diff --git a/tools/winapi_check/nativeapi.dat b/tools/winapi_check/nativeapi.dat index 321286ae1d1..07a840ec3bc 100644 --- a/tools/winapi_check/nativeapi.dat +++ b/tools/winapi_check/nativeapi.dat @@ -45,7 +45,7 @@ ctime div dup dup2 -environ +ecvt errno execlp execvp @@ -54,6 +54,7 @@ exp fabs fclose fcntl +fcvt fdopen feof fflush @@ -79,6 +80,7 @@ fsync ftell ftruncate fwrite +gcvt getc getcwd getenv diff --git a/tools/winapi_check/win16/toolhelp.api b/tools/winapi_check/win16/toolhelp.api index 8100ff25ce7..b2d5cbf9328 100644 --- a/tools/winapi_check/win16/toolhelp.api +++ b/tools/winapi_check/win16/toolhelp.api @@ -31,6 +31,10 @@ FARPROC16 LPCSTR +%void + +void + %word BOOL16 diff --git a/tools/winapi_check/win32/crtdll.api b/tools/winapi_check/win32/crtdll.api index 0e3012134a0..8a87159132f 100644 --- a/tools/winapi_check/win32/crtdll.api +++ b/tools/winapi_check/win32/crtdll.api @@ -27,7 +27,6 @@ unsigned long %longlong LONGLONG -ULONGLONG %ptr diff --git a/tools/winapi_check/winapi.pm b/tools/winapi_check/winapi.pm index 32df6074a59..eadca22b053 100644 --- a/tools/winapi_check/winapi.pm +++ b/tools/winapi_check/winapi.pm @@ -268,7 +268,10 @@ sub parse_spec_file { } my $ordinal; - if(/^(\d+|@)\s+(pascal|pascal16|stdcall|stdcall64|cdecl|register|interrupt|varargs)\s+(\S+)\s*\(\s*(.*?)\s*\)\s*(\S+)$/) { + if(/^(\d+|@)\s+ + (pascal|pascal16|stdcall|cdecl|register|interrupt|varargs) + (?:\s+(?:-noimport|-norelay|-i386|-ret64))*\s+(\S+)\s*\(\s*(.*?)\s*\)\s*(\S+)$/x) + { my $calling_convention = $2; my $external_name = $3; my $arguments = $4; @@ -350,7 +353,7 @@ sub parse_spec_file { my $forward_name = $4; $$function_forward{$external_name} = "$module:$forward_module.$forward_name"; - } elsif(/^(\d+|@)\s+(equate|long|word|extern|forward)/) { + } elsif(/^(\d+|@)\s+(equate|extern|variable)/) { # ignore } else { my $next_line = ; diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check index 5e6c2fea758..bd6f9e57176 100755 --- a/tools/winapi_check/winapi_check +++ b/tools/winapi_check/winapi_check @@ -192,6 +192,8 @@ if($options->headers) { my @argument_types = @$refargument_types; my $refargument_names = shift; my @argument_names = @$refargument_names; + my $refargument_documentations = shift; + my @argument_documentations = @$refargument_documentations; my $statements = shift; foreach my $winapi (@winapis) { @@ -273,6 +275,8 @@ foreach my $file ($options->c_files) { my @argument_types = @$refargument_types; my $refargument_names = shift; my @argument_names = @$refargument_names; + my $refargument_documentations = shift; + my @argument_documentations = @$refargument_documentations; my $statements = shift; my $external_name16 = $win16api->function_external_name($internal_name); @@ -480,7 +484,7 @@ foreach my $file ($options->c_files) { } if($documentation !~ /\b($internal_name|$name1|$name2)\b/) { - $output->write("\\\n$documentation\n"); + $output->write("documentation: \\\n$documentation\n"); } if($options->documentation_width) { @@ -493,6 +497,18 @@ foreach my $file ($options->c_files) { } } } + + if($options->documentation_arguments) { + my $n = 0; + for my $argument_documentation (@argument_documentations) { + $n++; + if($argument_documentation ne "") { + if($argument_documentation !~ /^\/\*\s+\[(?:in|out|in\/out)\].*?\*\/$/) { + $output->write("argument $n documentation: \\\n$argument_documentation\n"); + } + } + } + } } $output->prefix(""); } diff --git a/tools/winapi_check/winapi_local.pm b/tools/winapi_check/winapi_local.pm index 678aac47c24..315ce41516d 100644 --- a/tools/winapi_check/winapi_local.pm +++ b/tools/winapi_check/winapi_local.pm @@ -76,7 +76,7 @@ sub check_function { $implemented_calling_convention = "varargs"; } elsif($calling_convention =~ /^__stdcall|VFWAPI|WINAPI|CALLBACK$/) { if($implemented_return_kind =~ /^longlong$/) { - $implemented_calling_convention = "stdcall64"; + $implemented_calling_convention = "stdcall"; # FIXME: Check entry flags } else { $implemented_calling_convention = "stdcall"; } diff --git a/tools/winapi_check/winapi_options.pm b/tools/winapi_check/winapi_options.pm index 2c374b56b4d..0536dcd21da 100644 --- a/tools/winapi_check/winapi_options.pm +++ b/tools/winapi_check/winapi_options.pm @@ -73,6 +73,7 @@ my %options = ( "debug-messages" => { default => 0, parent => "statements", description => "check for debug messages inconsistances" }, "documentation" => { default => 1, parent => "local", description => "check for documentation inconsistances\n" }, "documentation-width" => { default => 0, parent => "documentation", description => "check for documentation width inconsistances\n" }, + "documentation-arguments" => { default => 0, parent => "documentation", description => "check for arguments documentation inconsistances\n" }, "prototype" => { default => 0, parent => ["local", "headers"], description => "prototype checking" }, "global" => { default => 1, description => "global checking" }, diff --git a/tools/winapi_check/winapi_parser.pm b/tools/winapi_check/winapi_parser.pm index 630ec8f4a66..18c8f7136f4 100644 --- a/tools/winapi_check/winapi_parser.pm +++ b/tools/winapi_check/winapi_parser.pm @@ -16,6 +16,7 @@ sub parse_c_file { my $function = ""; my $argument_types; my $argument_names; + my $argument_documentations; my $statements; my $function_begin = sub { @@ -26,18 +27,26 @@ sub parse_c_file { $function = shift; $argument_types = shift; $argument_names = shift; - + $argument_documentations = shift; + if($#$argument_names == -1) { foreach my $n (0..$#$argument_types) { push @$argument_names, ""; } } + if($#$argument_documentations == -1) { + foreach my $n (0..$#$argument_documentations) { + push @$argument_documentations, ""; + } + } + $statements = ""; }; my $function_end = sub { - &$function_found_callback($documentation,$linkage,$return_type,$calling_convention, - $function,$argument_types,$argument_names,$statements); + &$function_found_callback($documentation,$linkage,$return_type, + $calling_convention,$function,$argument_types, + $argument_names,$argument_documentations,$statements); $function = ""; }; @@ -113,12 +122,21 @@ sub parse_c_file { next; } - my $documentation; + my $documentation; + my @argument_documentations; { my $n = $#comments; - while($n >= 0 && ($comments[$n] !~ /^\/\*\*/ || $comments[$n] =~ /^\/\*\*+\//)) { $n-- } + while($n >= 0 && ($comments[$n] !~ /^\/\*\*/ || + $comments[$n] =~ /^\/\*\*+\//)) + { + $n--; + } + if(defined($comments[$n]) && $n >= 0) { $documentation = $comments[$n]; + for(my $m=$n+1; $m <= $#comments; $m++) { + push @argument_documentations, $comments[$m]; + } } else { $documentation = ""; } @@ -228,7 +246,7 @@ sub parse_c_file { $arguments =~ y/\t\n/ /; $arguments =~ s/^\s*(.*?)\s*$/$1/; if($arguments eq "") { $arguments = "void" } - + my @argument_types; my @argument_names; my @arguments = split(/,/, $arguments); @@ -243,7 +261,12 @@ sub parse_c_file { if($argument =~ /^\.\.\.$/) { $argument_type = "..."; $argument_name = "..."; - } elsif($argument =~ /^((?:struct\s+|union\s+|enum\s+|(?:signed\s+|unsigned\s+)(?:short\s+(?=int)|long\s+(?=int))?)?\w+)\s*((?:const)?\s*(?:\*\s*?)*)\s*(?:WINE_UNUSED\s+)?(\w*)\s*(?:\[\]|\s+OPTIONAL)?/) { + } elsif($argument =~ /^ + ((?:struct\s+|union\s+|enum\s+|(?:signed\s+|unsigned\s+) + (?:short\s+(?=int)|long\s+(?=int))?)?\w+)\s* + ((?:const)?\s*(?:\*\s*?)*)\s* + (?:WINE_UNUSED\s+)?(\w*)\s*(?:\[\]|\s+OPTIONAL)?/x) + { $argument_type = "$1"; if($2 ne "") { $argument_type .= " $2"; @@ -269,8 +292,8 @@ sub parse_c_file { if($options->debug) { print "$file: $return_type $calling_convention $name(" . join(",", @arguments) . ")\n"; } - - &$function_begin($documentation,$linkage,$return_type,$calling_convention,$name,\@argument_types,\@argument_names); + + &$function_begin($documentation,$linkage,$return_type,$calling_convention,$name,\@argument_types,\@argument_names,\@argument_documentations); if($level == 0) { &$function_end; }