- Updated API files

- Don't check the *.spec.c files
- Better parsing of strings
- Better documentation checking
- Minor bug fixes
This commit is contained in:
Patrik Stridvall 2000-03-24 20:39:51 +00:00 committed by Alexandre Julliard
parent c287e9fe37
commit 4bb532e72d
11 changed files with 189 additions and 74 deletions

View File

@ -6,7 +6,7 @@ HCONVLIST
HDDEDATA HDDEDATA
HSZ HSZ
%long # --forbidden %long --forbidden
int int

View File

@ -24,7 +24,7 @@ LPARAM
UINT UINT
WORD WORD
%long # --forbidden %long --forbidden
int int

View File

@ -87,7 +87,6 @@ LPDEBUG_EVENT
LPDWORD LPDWORD
LPFILETIME LPFILETIME
LPINPUT_RECORD LPINPUT_RECORD
LPLONG
LPLDT_ENTRY LPLDT_ENTRY
LPMEMORYSTATUS LPMEMORYSTATUS
LPMEMORY_BASIC_INFORMATION LPMEMORY_BASIC_INFORMATION

View File

@ -69,7 +69,6 @@ LPOLEINPLACEFRAMEINFO
LPOLEMENUGROUPWIDTHS LPOLEMENUGROUPWIDTHS
LPOLEOBJECT LPOLEOBJECT
LPOLESTREAM LPOLESTREAM
LPOLESTR
LPOLESTR * LPOLESTR *
LPPERSISTSTORAGE LPPERSISTSTORAGE
LPRUNNINGOBJECTTABLE * LPRUNNINGOBJECTTABLE *
@ -91,13 +90,10 @@ WORD *
void * void *
void ** void **
%str %str # ???
LPCOLESTR LPCOLESTR
LPOLESTR
%str # --forbidden
LPOLESTR16
%void %void

View File

@ -56,7 +56,6 @@ LPCLSID
LPDWORD LPDWORD
LPFONTDESC LPFONTDESC
LPOCPFIPARAMS LPOCPFIPARAMS
LPOLESTR
LPPICTDESC LPPICTDESC
LPSTREAM LPSTREAM
LPUNKNOWN LPUNKNOWN
@ -84,6 +83,7 @@ void **
%str # ??? %str # ???
LPCOLESTR LPCOLESTR
LPOLESTR
%void %void

View File

@ -27,6 +27,7 @@ HMONITOR
HRESULT HRESULT
HRGN HRGN
HSZ HSZ
HTASK
HWINSTA HWINSTA
HWND HWND
INT INT
@ -39,10 +40,9 @@ WCHAR
WORD WORD
WPARAM WPARAM
%long # --forbidden %long --forbidden
HMODULE16 HMODULE16
HTASK
int int
%longlong %longlong

View File

@ -12,6 +12,7 @@ HMIXER
HMIXEROBJ HMIXEROBJ
HMMIO HMMIO
HMODULE HMODULE
HTASK
HWAVEIN HWAVEIN
HWAVEOUT HWAVEOUT
HWND HWND
@ -22,10 +23,9 @@ LPARAM
LRESULT LRESULT
UINT UINT
%long # --forbidden %long --forbidden
HMMIO16 HMMIO16
HTASK
UINT16 UINT16
%ptr %ptr

View File

@ -91,10 +91,10 @@ my %includes;
my $header = $1; my $header = $1;
if(-e "$file_dir/$header") { if(-e "$file_dir/$header") {
$includes{$file}{includes}{"$file_dir/$header"}++; $includes{$file}{includes}{"$file_dir/$header"}++;
} elsif(-e "include/$header") { } elsif(-e "$wine_dir/include/$header") {
$includes{$file}{includes}{"include/$header"}++; $includes{$file}{includes}{"include/$header"}++;
} else { } else {
$output->write("$file: #include \"$header\" is not a local include\n"); $output->write("$file: #include \"$header\" is not a local include ($file_dir)\n");
} }
} }
} }
@ -138,6 +138,7 @@ foreach my $file ($options->files) {
my $found_function = sub { my $found_function = sub {
my $documentation = shift; my $documentation = shift;
my $linkage = shift;
my $return_type = shift; my $return_type = shift;
my $calling_convention = shift; my $calling_convention = shift;
my $name = shift; my $name = shift;
@ -165,6 +166,7 @@ foreach my $file ($options->files) {
$functions{$name} = $function; $functions{$name} = $function;
$function->documentation($documentation); $function->documentation($documentation);
$function->linkage($linkage);
$function->file($file); $function->file($file);
$function->return_type($return_type); $function->return_type($return_type);
$function->calling_convention($calling_convention); $function->calling_convention($calling_convention);
@ -234,25 +236,72 @@ foreach my $file ($options->files) {
} }
} }
if($options->documentation && (defined($module16) || defined($module32))) { if($options->documentation && (defined($module16) || defined($module32)) &&
my $name2 = $name; $linkage ne "extern" && $statements ne "")
my $name3 = $name; {
my $name4 = $name; my $name1;
my $name5 = $name; my $name2;
my $name3;
my $name4;
my $name5;
if(defined($module16) && !defined($module32)) { if(defined($module16) && !defined($module32)) {
$name2 =~ s/([AW])$/16$1/; my @uc_modules16 = split(/\s*\&\s*/, uc($module16));
$name3 =~ s/16(([AW])?)$/$1/; push @uc_modules16, "WIN16";
$name4 =~ s/^\U$module16\E\_//;
$name5 =~ s/^WIN16_//; $name1 = $name;
} elsif(!defined($module16) && defined($module32)) { foreach my $uc_module16 (@uc_modules16) {
$name2 =~ s/([AW])$/32$1/; if($name1 =~ s/^$uc_module16\_//) { last; }
$name3 =~ s/32(([AW])?)$/$1/;
$name4 =~ s/^\U$module32\E\_//;
$name5 =~ s/^WIN16_//;
} }
if($name !~ /^SMapLS|SUnMapLS/ && $documentation !~ /($name|$name2|$name3|$name4|$name5)/) { $name2 = $name1;
$name2 =~ s/([AW])$/16$1/;
$name3 = $name1;
$name3 =~ s/16(([AW])?)$/$1/;
$name4 = $name1;
$name4 =~ s/^(.*?)(?:16)?$/\U$1\E/;
$name5 = $name1;
$name5 = s/^(.*?)16_fn(.*?)$/$116_$2/;
} elsif(!defined($module16) && defined($module32)) {
my @uc_modules32 = split(/\s*\&\s*/, uc($module32));
$name1 = $name;
foreach my $uc_module32 (@uc_modules32) {
if($name1 =~ s/^$uc_module32\_//) { last; }
}
$name2 = $name1;
$name2 =~ s/([AW])$/32$1/;
$name3 = $name1;
$name3 =~ s/32(([AW])?)$/$1/;
$name4 = $name1;
$name4 =~ s/AW$//;
$name5 = $name1;
} else {
my @uc_modules = split(/\s*\&\s*/, uc($module16));
push @uc_modules, split(/\s*\&\s*/, uc($module32));
$name1 = $name;
foreach my $uc_module (@uc_modules) {
if($name1 =~ s/^$uc_module\_//) { last; }
}
$name2 = $name1;
$name3 = $name1;
$name4 = $name1;
$name5 = $name1;
}
if($name !~ /^SMapLS|SUnMapLS/ && $documentation !~ /($name|$name1|$name2|$name3|$name4|$name5)/) {
$output->write("$file: $name: \\\n"); $output->write("$file: $name: \\\n");
$output->write("$documentation\n"); $output->write("$documentation\n");
} }
@ -313,8 +362,10 @@ foreach my $file ($options->files) {
if($check_protection) { if($check_protection) {
if((-e "$wine_dir/include/$header" || -e "$file_dir/$header")) { if((-e "$wine_dir/include/$header" || -e "$file_dir/$header")) {
if($header !~ /^ctype.h$/) {
$output->write("$file: #include \<$header\> is a local include\n"); $output->write("$file: #include \<$header\> is a local include\n");
} }
}
my $macro = uc($header); my $macro = uc($header);
$macro =~ y/\.\//__/; $macro =~ y/\.\//__/;

View File

@ -33,6 +33,17 @@ sub documentation {
return $$documentation; return $$documentation;
} }
sub linkage {
my $self = shift;
my $linkage = \${$self->{LINKAGE}};
local $_ = shift;
if(defined($_)) { $$linkage = $_; }
return $$linkage;
}
sub return_type { sub return_type {
my $self = shift; my $self = shift;
my $return_type = \${$self->{RETURN_TYPE}}; my $return_type = \${$self->{RETURN_TYPE}};

View File

@ -175,7 +175,11 @@ sub new {
@$files = map { @$files = map {
s/^.\/(.*)$/$1/; s/^.\/(.*)$/$1/;
if(!/spec\.c$/) {
$_; $_;
} else {
();
}
} split(/\n/, `find $paths -name \\*.c`); } split(/\n/, `find $paths -name \\*.c`);
return $self; return $self;

View File

@ -10,6 +10,7 @@ sub parse_c_file {
my $preprocessor_found_callback = shift; my $preprocessor_found_callback = shift;
my $documentation; my $documentation;
my $linkage;
my $return_type; my $return_type;
my $calling_convention; my $calling_convention;
my $function = ""; my $function = "";
@ -18,6 +19,7 @@ sub parse_c_file {
my $function_begin = sub { my $function_begin = sub {
$documentation = shift; $documentation = shift;
$linkage = shift;
$return_type= shift; $return_type= shift;
$calling_convention = shift; $calling_convention = shift;
$function = shift; $function = shift;
@ -26,7 +28,7 @@ sub parse_c_file {
$statements = ""; $statements = "";
}; };
my $function_end = sub { my $function_end = sub {
&$function_found_callback($documentation,$return_type,$calling_convention,$function,$arguments,$statements); &$function_found_callback($documentation,$linkage,$return_type,$calling_convention,$function,$arguments,$statements);
$function = ""; $function = "";
}; };
@ -94,7 +96,7 @@ sub parse_c_file {
my $documentation; my $documentation;
{ {
my $n = $#comments; my $n = $#comments;
while($n >= 0 && $comments[$n] !~ /\/\*\*/) { $n-- } while($n >= 0 && ($comments[$n] !~ /^\/\*\*/ || $comments[$n] =~ /^\/\*\*+\//)) { $n-- }
if(defined($comments[$n]) && $n >= 0) { if(defined($comments[$n]) && $n >= 0) {
$documentation = $comments[$n]; $documentation = $comments[$n];
} else { } else {
@ -104,45 +106,90 @@ sub parse_c_file {
if($level > 0) if($level > 0)
{ {
my $line; my $line = "";
s/^([^\{\}]*)//s; while(/^[^\{\}]/) {
$line = $1; s/^([^\{\}\'\"]*)//s;
if(/^(\{)/) {
$_ = $'; $again = 1;
$line .= $1; $line .= $1;
print "+1: $_\n" if $options->debug >= 2; if(s/^\'//) {
$level++; $line .= "\'";
} elsif(/^(\})/) { while(/^./ && !s/^\'//) {
s/^([^\'\\]*)//s;
$line .= $1;
if(s/^\\//) {
$line .= "\\";
if(s/^(.)//s) {
$line .= $1;
if($1 eq "0") {
s/^(\d{0,3})//s;
$line .= $1;
}
}
}
}
$line .= "\'";
} elsif(s/^\"//) {
$line .= "\"";
while(/^./ && !s/^\"//) {
s/^([^\"\\]*)//s;
$line .= $1;
if(s/^\\//) {
$line .= "\\";
if(s/^(.)//s) {
$line .= $1;
if($1 eq "0") {
s/^(\d{0,3})//s;
$line .= $1;
}
}
}
}
$line .= "\"";
}
}
if(s/^\{//) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
$line .= $1 if $level > 1; $line .= "{";
print "-1: $_\n" if $options->debug >= 2; print "+1: \{$_\n" if $options->debug >= 2;
$level++;
} elsif(s/^\}//) {
$_ = $'; $again = 1;
$line .= "}" if $level > 1;
print "-1: \}$_\n" if $options->debug >= 2;
$level--; $level--;
} }
if($line !~ /^\s*$/) { if($line !~ /^\s*$/) {
$statements .= "$line\n"; $statements .= "$line\n";
} }
if($function && $level == 0) { if($function && $level == 0) {
&$function_end; &$function_end;
} }
next; next;
} elsif(/((struct\s+|union\s+|enum\s+)?\w+((\s*\*)+\s*|\s+))((__cdecl|__stdcall|VFWAPIV|VFWAPI|WINAPIV|WINAPI)\s+)?(\w+(\(\w+\))?)\s*\(([^\)]*)\)\s*(\{|\;)/s) { } elsif(/(extern\s+|static\s+)?((struct\s+|union\s+|enum\s+)?\w+((\s*\*)+\s*|\s+))((__cdecl|__stdcall|VFWAPIV|VFWAPI|WINAPIV|WINAPI)\s+)?(\w+(\(\w+\))?)\s*\(([^\)]*)\)\s*(\{|\;)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
if($10 eq ";") { if($11 eq "{") {
next;
} elsif($10 eq "{") {
$level++; $level++;
} }
my $return_type = $1; my $linkage = $1;
my $calling_convention = $6; my $return_type = $2;
my $name = $7; my $calling_convention = $7;
my $arguments = $9; my $name = $8;
my $arguments = $10;
if(!defined($linkage)) {
$linkage = "";
}
if(!defined($calling_convention)) { if(!defined($calling_convention)) {
$calling_convention = ""; $calling_convention = "";
} }
$linkage =~ s/\s*$//;
$return_type =~ s/\s*$//; $return_type =~ s/\s*$//;
$return_type =~ s/\s*\*\s*/*/g; $return_type =~ s/\s*\*\s*/*/g;
$return_type =~ s/(\*+)/ $1/g; $return_type =~ s/(\*+)/ $1/g;
@ -180,70 +227,77 @@ sub parse_c_file {
if($options->debug) { if($options->debug) {
print "$file: $return_type $calling_convention $name(" . join(",", @arguments) . ")\n"; print "$file: $return_type $calling_convention $name(" . join(",", @arguments) . ")\n";
} }
&$function_begin($documentation,$return_type,$calling_convention,$name,\@arguments);
&$function_begin($documentation,$linkage,$return_type,$calling_convention,$name,\@arguments);
if($level == 0) {
&$function_end;
}
} elsif(/DC_(GET_X_Y|GET_VAL_16)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/DC_(GET_X_Y|GET_VAL_16)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
my @arguments = ("HDC16"); my @arguments = ("HDC16");
&$function_begin($documentation,$2, "WINAPI", $3, \@arguments); &$function_begin($documentation, "", $2, "WINAPI", $3, \@arguments);
&$function_end; &$function_end;
} elsif(/DC_(GET_VAL_32)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,.*?\)/s) { } elsif(/DC_(GET_VAL_32)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,.*?\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
my @arguments = ("HDC"); my @arguments = ("HDC");
&$function_begin($documentation,$2, "WINAPI", $3, \@arguments); &$function_begin($documentation, "", $2, "WINAPI", $3, \@arguments);
&$function_end; &$function_end;
} elsif(/DC_(GET_VAL_EX)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/DC_(GET_VAL_EX)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
my @arguments16 = ("HDC16", "LP" . $5 . "16"); my @arguments16 = ("HDC16", "LP" . $5 . "16");
my @arguments32 = ("HDC", "LP" . $5); my @arguments32 = ("HDC", "LP" . $5);
&$function_begin($documentation,"BOOL16", "WINAPI", $2 . "16", \@arguments16); &$function_begin($documentation, "", "BOOL16", "WINAPI", $2 . "16", \@arguments16);
&$function_end; &$function_end;
&$function_begin($documentation,"BOOL", "WINAPI", $2, \@arguments32); &$function_begin($documentation, "", "BOOL", "WINAPI", $2, \@arguments32);
&$function_end; &$function_end;
} elsif(/DC_(SET_MODE)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/DC_(SET_MODE)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
my @arguments16 = ("HDC16", "INT16"); my @arguments16 = ("HDC16", "INT16");
my @arguments32 = ("HDC", "INT"); my @arguments32 = ("HDC", "INT");
&$function_begin($documentation,"INT16", "WINAPI", $2 . "16", \@arguments16); &$function_begin($documentation, "", "INT16", "WINAPI", $2 . "16", \@arguments16);
&$function_end; &$function_end;
&$function_begin($documentation,"INT", "WINAPI", $2, \@arguments32); &$function_begin($documentation, "", "INT", "WINAPI", $2, \@arguments32);
&$function_end; &$function_end;
} elsif(/WAVEIN_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/WAVEIN_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
my @arguments16 = ("HWAVEIN16"); my @arguments16 = ("HWAVEIN16");
my @arguments32 = ("HWAVEIN"); my @arguments32 = ("HWAVEIN");
&$function_begin($documentation,"UINT16", "WINAPI", "waveIn" . $1 . "16", \@arguments16); &$function_begin($documentation, "", "UINT16", "WINAPI", "waveIn" . $1 . "16", \@arguments16);
&$function_end; &$function_end;
&$function_begin($documentation,"UINT", "WINAPI", "waveIn" . $1, \@arguments32); &$function_begin($documentation, "", "UINT", "WINAPI", "waveIn" . $1, \@arguments32);
&$function_end; &$function_end;
} elsif(/WAVEOUT_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/WAVEOUT_SHORTCUT_0\s*\(\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
my @arguments16 = ("HWAVEOUT16"); my @arguments16 = ("HWAVEOUT16");
my @arguments32 = ("HWAVEOUT"); my @arguments32 = ("HWAVEOUT");
&$function_begin($documentation,"UINT16", "WINAPI", "waveOut" . $1 . "16", \@arguments16); &$function_begin($documentation, "", "UINT16", "WINAPI", "waveOut" . $1 . "16", \@arguments16);
&$function_end; &$function_end;
&$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $1, \@arguments32); &$function_begin($documentation, "", "UINT", "WINAPI", "waveOut" . $1, \@arguments32);
&$function_end; &$function_end;
} elsif(/WAVEOUT_SHORTCUT_(1|2)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) { } elsif(/WAVEOUT_SHORTCUT_(1|2)\s*\(\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
if($1 eq "1") { if($1 eq "1") {
my @arguments16 = ("HWAVEOUT16", $4); my @arguments16 = ("HWAVEOUT16", $4);
my @arguments32 = ("HWAVEOUT", $4); my @arguments32 = ("HWAVEOUT", $4);
&$function_begin($documentation,"UINT16", "WINAPI", "waveOut" . $2 . "16", \@arguments16); &$function_begin($documentation, "", "UINT16", "WINAPI", "waveOut" . $2 . "16", \@arguments16);
&$function_end; &$function_end;
&$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $2, \@arguments32); &$function_begin($documentation, "", "UINT", "WINAPI", "waveOut" . $2, \@arguments32);
&$function_end; &$function_end;
} elsif($1 eq 2) { } elsif($1 eq 2) {
my @arguments16 = ("UINT16", $4); my @arguments16 = ("UINT16", $4);
my @arguments32 = ("UINT", $4); my @arguments32 = ("UINT", $4);
&$function_begin($documentation,"UINT16", "WINAPI", "waveOut". $2 . "16", \@arguments16); &$function_begin($documentation, "", "UINT16", "WINAPI", "waveOut". $2 . "16", \@arguments16);
&$function_end; &$function_end;
&$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $2, \@arguments32); &$function_begin($documentation, "", "UINT", "WINAPI", "waveOut" . $2, \@arguments32);
&$function_end; &$function_end;
} }
} elsif(/DEFINE_REGS_ENTRYPOINT_\d+\(\s*(\S*)\s*,\s*([^\s,\)]*).*?\)/s) { } elsif(/DEFINE_REGS_ENTRYPOINT_\d+\(\s*(\S*)\s*,\s*([^\s,\)]*).*?\)/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
$regs_entrypoints{$2} = $1; $regs_entrypoints{$2} = $1;
} elsif(/\'[^\']*\'/s) {
$_ = $'; $again = 1;
} elsif(/\"[^\"]*\"/s) {
$_ = $'; $again = 1;
} elsif(/;/s) { } elsif(/;/s) {
$_ = $'; $again = 1; $_ = $'; $again = 1;
} elsif(/\{/s) { } elsif(/\{/s) {