- Added a new tool winapi_test for generating tests.
- Added a data structure packing test to winapi_test.
- Reorganized and optimized a few things.
diff --git a/tools/winapi_check/modules.pm b/tools/winapi_check/modules.pm
index 1904ff3..82ac2e4 100644
--- a/tools/winapi_check/modules.pm
+++ b/tools/winapi_check/modules.pm
@@ -39,7 +39,13 @@
use options qw($options);
use output qw($output);
-$modules = 'modules'->new;
+sub import {
+ $Exporter::ExportLevel++;
+ &Exporter::import(@_);
+ $Exporter::ExportLevel--;
+
+ $modules = 'modules'->new;
+}
sub get_spec_file_type {
my $file = shift;
@@ -85,18 +91,23 @@
my $self = {};
bless ($self, $class);
- my $spec_files16 = \@{$self->{SPEC_FILES16}};
- my $spec_files32 = \@{$self->{SPEC_FILES32}};
+ my $spec_file_found = $self->read_module_file();
+ $self->read_spec_files($spec_file_found);
+
+ return $self;
+}
+
+sub read_module_file {
+ my $self = shift;
+
my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};
my $spec_file2dir = \%{$self->{SPEC_FILE2DIR}};
- my $spec_file2module = \%{$self->{SPEC_FILE2MODULE}};
- my $module2spec_file = \%{$self->{MODULE2SPEC_FILE}};
my $module_file = "$winapi_check_dir/modules.dat";
$output->progress("modules.dat");
- my %spec_file_found;
+ my $spec_file_found = {};
my $allowed_dir;
my $spec_file;
@@ -114,7 +125,7 @@
$output->write("modules.dat: $spec_file: file ($spec_file) doesn't exist or is no file\n");
}
- $spec_file_found{$spec_file}++;
+ $$spec_file_found{$spec_file}++;
$$spec_file2dir{$spec_file} = {};
next;
} else {
@@ -129,6 +140,20 @@
}
close(IN);
+ return $spec_file_found;
+}
+
+sub read_spec_files {
+ my $self = shift;
+
+ my $spec_file_found = shift;
+
+ my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};
+ my $spec_files16 = \@{$self->{SPEC_FILES16}};
+ my $spec_files32 = \@{$self->{SPEC_FILES32}};
+ my $spec_file2module = \%{$self->{SPEC_FILE2MODULE}};
+ my $module2spec_file = \%{$self->{MODULE2SPEC_FILE}};
+
my @spec_files;
if($wine_dir eq ".") {
@spec_files = get_spec_files("winelib");
@@ -162,14 +187,10 @@
}
foreach my $spec_file (@spec_files) {
- if(!$spec_file_found{$spec_file} && $spec_file !~ m%tests/[^/]+$%) {
+ if(!$$spec_file_found{$spec_file} && $spec_file !~ m%tests/[^/]+$%) {
$output->write("modules.dat: $spec_file: exists but is not specified\n");
}
}
-
- $modules = $self;
-
- return $self;
}
sub all_modules {