Alter the functions declaration order or predeclare them so perl can

check the prototypes.
This commit is contained in:
Francois Gouget 2004-10-30 02:11:19 +00:00 committed by Alexandre Julliard
parent f7478816d4
commit bebac0a400
4 changed files with 131 additions and 114 deletions

View File

@ -66,6 +66,23 @@ my $year = $datetime[5] + 1900;
my $date = "$months[$datetime[4]] $year"; my $date = "$months[$datetime[4]] $year";
sub output_api_comment($);
sub output_api_footer($);
sub output_api_header($);
sub output_api_name($);
sub output_api_synopsis($);
sub output_close_api_file();
sub output_comment($);
sub output_html_index_files();
sub output_html_stylesheet();
sub output_open_api_file($);
sub output_sgml_dll_file($);
sub output_sgml_master_file($);
sub output_spec($);
sub process_comment($);
sub process_extra_comment($);
# Generate the list of exported entries for the dll # Generate the list of exported entries for the dll
sub process_spec_file($) sub process_spec_file($)
{ {

View File

@ -186,44 +186,6 @@ sub all_modules($) {
return sort(keys(%$module2spec_file)); return sort(keys(%$module2spec_file));
} }
sub complete_modules($$) {
my $self = shift;
my $c_files = shift;
my %dirs;
foreach my $file (@$c_files) {
my $dir = file_directory("$current_dir/$file");
$dirs{$dir}++;
}
my @c_files = get_c_files("winelib");
@c_files = files_skip(@c_files);
foreach my $file (@c_files) {
my $dir = file_directory($file);
if(exists($dirs{$dir})) {
$dirs{$dir}--;
}
}
my @complete_modules = ();
foreach my $module ($self->all_modules) {
my $index = -1;
my @dirs = $self->allowed_dirs_for_module($module);
foreach my $dir (@dirs) {
if(exists($dirs{$dir}) && $dirs{$dir} == 0) {
$index++;
}
}
if($index == $#dirs) {
push @complete_modules, $module;
}
}
return @complete_modules;
}
sub is_allowed_module($$) { sub is_allowed_module($$) {
my $self = shift; my $self = shift;
@ -326,6 +288,44 @@ sub found_module_in_dir($$$) {
$$used_module_dirs{$module}{$dir}++; $$used_module_dirs{$module}{$dir}++;
} }
sub complete_modules($$) {
my $self = shift;
my $c_files = shift;
my %dirs;
foreach my $file (@$c_files) {
my $dir = file_directory("$current_dir/$file");
$dirs{$dir}++;
}
my @c_files = get_c_files("winelib");
@c_files = files_skip(@c_files);
foreach my $file (@c_files) {
my $dir = file_directory($file);
if(exists($dirs{$dir})) {
$dirs{$dir}--;
}
}
my @complete_modules = ();
foreach my $module ($self->all_modules) {
my $index = -1;
my @dirs = $self->allowed_dirs_for_module($module);
foreach my $dir (@dirs) {
if(exists($dirs{$dir}) && $dirs{$dir} == 0) {
$index++;
}
}
if($index == $#dirs) {
push @complete_modules, $module;
}
}
return @complete_modules;
}
sub global_report($) { sub global_report($) {
my $self = shift; my $self = shift;

View File

@ -25,39 +25,6 @@ use options qw($options);
use output qw($output); use output qw($output);
use winapi qw($win16api $win32api @winapis); use winapi qw($win16api $win32api @winapis);
sub check_function($) {
my $function = shift;
my $return_type = $function->return_type;
my $calling_convention = $function->calling_convention;
my $calling_convention16 = $function->calling_convention16;
my $calling_convention32 = $function->calling_convention32;
my $internal_name = $function->internal_name;
my $external_name16 = $function->external_name16;
my $external_name32 = $function->external_name32;
my $module16 = $function->module16;
my $module32 = $function->module32;
my $refargument_types = $function->argument_types;
if(!defined($refargument_types)) {
return;
}
if($options->win16 && $options->report_module($module16)) {
_check_function($return_type,
$calling_convention, $external_name16,
$internal_name, $refargument_types,
$win16api);
}
if($options->win32 && $options->report_module($module32)) {
_check_function($return_type,
$calling_convention, $external_name32,
$internal_name, $refargument_types,
$win32api);
}
}
sub _check_function($$$$$$) { sub _check_function($$$$$$) {
my $return_type = shift; my $return_type = shift;
my $calling_convention = shift; my $calling_convention = shift;
@ -303,19 +270,36 @@ sub _check_function($$$$$$) {
} }
} }
sub check_statements($$) { sub check_function($) {
my $functions = shift;
my $function = shift; my $function = shift;
my $return_type = $function->return_type;
my $calling_convention = $function->calling_convention;
my $calling_convention16 = $function->calling_convention16;
my $calling_convention32 = $function->calling_convention32;
my $internal_name = $function->internal_name;
my $external_name16 = $function->external_name16;
my $external_name32 = $function->external_name32;
my $module16 = $function->module16; my $module16 = $function->module16;
my $module32 = $function->module32; my $module32 = $function->module32;
my $refargument_types = $function->argument_types;
if(!defined($refargument_types)) {
return;
}
if($options->win16 && $options->report_module($module16)) { if($options->win16 && $options->report_module($module16)) {
_check_statements($win16api, $functions, $function); _check_function($return_type,
$calling_convention, $external_name16,
$internal_name, $refargument_types,
$win16api);
} }
if($options->win32 && $options->report_module($module32)) { if($options->win32 && $options->report_module($module32)) {
_check_statements($win16api, $functions, $function); _check_function($return_type,
$calling_convention, $external_name32,
$internal_name, $refargument_types,
$win32api);
} }
} }
@ -398,6 +382,22 @@ sub _check_statements($$$) {
} }
} }
sub check_statements($$) {
my $functions = shift;
my $function = shift;
my $module16 = $function->module16;
my $module32 = $function->module32;
if($options->win16 && $options->report_module($module16)) {
_check_statements($win16api, $functions, $function);
}
if($options->win32 && $options->report_module($module32)) {
_check_statements($win16api, $functions, $function);
}
}
sub check_file($$) { sub check_file($$) {
my $file = shift; my $file = shift;
my $functions = shift; my $functions = shift;

View File

@ -403,6 +403,45 @@ sub bsearch($$)
} }
} }
##
# Retrieves the contents of the specified directory.
# We either get it from the directories hashtable which acts as a
# cache, or use opendir, readdir, closedir and store the result
# in the hashtable.
sub get_directory_contents($)
{
my $dirname=$_[0];
my $directory;
#print "getting the contents of $dirname\n";
# check for a cached version
$dirname =~ s+/$++;
if ($dirname eq "") {
$dirname=cwd;
}
$directory=$directories{$dirname};
if (defined $directory) {
#print "->@$directory\n";
return $directory;
}
# Read this directory
if (opendir(DIRECTORY, "$dirname")) {
my @files=readdir DIRECTORY;
closedir(DIRECTORY);
$directory=\@files;
} else {
# Return an empty list
#print "error: cannot open $dirname\n";
my @files;
$directory=\@files;
}
#print "->@$directory\n";
$directories{$dirname}=$directory;
return $directory;
}
##### #####
@ -1023,45 +1062,6 @@ sub fix_file_and_directory_names($)
# its contents (files and directories) # its contents (files and directories)
my %directories; my %directories;
##
# Retrieves the contents of the specified directory.
# We either get it from the directories hashtable which acts as a
# cache, or use opendir, readdir, closedir and store the result
# in the hashtable.
sub get_directory_contents($)
{
my $dirname=$_[0];
my $directory;
#print "getting the contents of $dirname\n";
# check for a cached version
$dirname =~ s+/$++;
if ($dirname eq "") {
$dirname=cwd;
}
$directory=$directories{$dirname};
if (defined $directory) {
#print "->@$directory\n";
return $directory;
}
# Read this directory
if (opendir(DIRECTORY, "$dirname")) {
my @files=readdir DIRECTORY;
closedir(DIRECTORY);
$directory=\@files;
} else {
# Return an empty list
#print "error: cannot open $dirname\n";
my @files;
$directory=\@files;
}
#print "->@$directory\n";
$directories{$dirname}=$directory;
return $directory;
}
## ##
# Try to find a file for the specified filename. The attempt is # Try to find a file for the specified filename. The attempt is
# case-insensitive which is why it's not trivial. If a match is # case-insensitive which is why it's not trivial. If a match is