Commit a896531f authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

- Added new option --documentation-arguments

- Minor API files update
parent 1ed55775
......@@ -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
......
......@@ -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
......
......@@ -31,6 +31,10 @@ FARPROC16
LPCSTR
%void
void
%word
BOOL16
......
......@@ -27,7 +27,6 @@ unsigned long
%longlong
LONGLONG
ULONGLONG
%ptr
......
......@@ -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 = <IN>;
......
......@@ -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("");
}
......
......@@ -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";
}
......
......@@ -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" },
......
......@@ -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;
}
......
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