Commit 098883be authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

Fixed winapi_extract.

parent 65578c03
...@@ -224,7 +224,6 @@ sub parse_spec_file { ...@@ -224,7 +224,6 @@ sub parse_spec_file {
my %ordinals; my %ordinals;
my $module; my $module;
my $module_file;
$output->lazy_progress("$file"); $output->lazy_progress("$file");
...@@ -242,8 +241,6 @@ sub parse_spec_file { ...@@ -242,8 +241,6 @@ sub parse_spec_file {
/^$/ && next; /^$/ && next;
if($header) { if($header) {
if(/^name\s*(\S*)/) { $module = $1; }
if(/^file\s*(\S*)/) { $module_file = $1; }
if(/^\d+|@/) { $header = 0; $lookahead = 1; } if(/^\d+|@/) { $header = 0; $lookahead = 1; }
next; next;
} }
......
...@@ -41,20 +41,20 @@ use function; ...@@ -41,20 +41,20 @@ use function;
use type; use type;
use winapi_function; use winapi_function;
use winapi_parser; use winapi_parser;
use winapi qw(@winapis); use winapi qw($win16api $win32api @winapis);
my %module2entries; my %module2entries;
my %module2spec_file; my %module2spec_file;
my %module2type;
my %module2filename;
if($options->spec_files || $options->winetest) { if($options->spec_files || $options->winetest) {
local $_; local $_;
foreach my $spec_file (get_spec_files("winelib")) { foreach my $spec_file (get_spec_files("winelib")) {
my $entries = []; my $entries = [];
my $module; my $module = $spec_file;
my $type; $module =~ s/^.*?([^\/]*)\.spec$/$1/;
my $type = "win32";
open(IN, "< $wine_dir/$spec_file"); open(IN, "< $wine_dir/$spec_file");
...@@ -68,16 +68,7 @@ if($options->spec_files || $options->winetest) { ...@@ -68,16 +68,7 @@ if($options->spec_files || $options->winetest) {
/^$/ && next; # skip empty lines /^$/ && next; # skip empty lines
if($header) { if($header) {
if(/^name\s+(.*?)$/) { if(/^\d+|@/) {
$module = $1;
$module2spec_file{$module} = $spec_file;
} elsif(/^file\s+(.*?)$/) {
my $filename = $1;
$module2filename{$module} = $filename;
} elsif(/^type\s+(.*?)$/) {
$type = $1;
$module2type{$module} = $type;
} elsif(/^\d+|@/) {
$header = 0; $header = 0;
$lookahead = 1; $lookahead = 1;
} }
...@@ -94,6 +85,7 @@ if($options->spec_files || $options->winetest) { ...@@ -94,6 +85,7 @@ if($options->spec_files || $options->winetest) {
} }
close(IN); close(IN);
$module2spec_file{$module} = $spec_file;
$module2entries{$module} = $entries; $module2entries{$module} = $entries;
} }
} }
...@@ -244,7 +236,15 @@ foreach my $file (@c_files) { ...@@ -244,7 +236,15 @@ foreach my $file (@c_files) {
my $argument = shift; my $argument = shift;
}; };
&winapi_parser::parse_c_file($file, $create_function, $found_function, $create_type, $found_type, $found_preprocessor); &winapi_parser::parse_c_file($file, {
# c_comment_found => $found_c_comment,
# cplusplus_comment_found => $found_cplusplus_comment,
function_create => $create_function,
function_found => $found_function,
type_create => $create_type,
type_found => $found_type,
preprocessor_found => $found_preprocessor
});
my @internal_names = keys(%functions); my @internal_names = keys(%functions);
if($#internal_names < 0) { if($#internal_names < 0) {
...@@ -283,9 +283,14 @@ sub output_function { ...@@ -283,9 +283,14 @@ sub output_function {
} }
if($options->spec_files) { if($options->spec_files) {
foreach my $module (keys(%specifications)) { foreach my $winapi (@winapis) {
my $type = $winapi->name;
if($type eq "win16" && !$options->win16) { next; }
if($type eq "win32" && !$options->win32) { next; }
foreach my $module ($winapi->all_modules) {
my $spec_file = $module2spec_file{$module}; my $spec_file = $module2spec_file{$module};
my $type = $module2type{$module};
if(!defined($spec_file) || !defined($type)) { if(!defined($spec_file) || !defined($type)) {
$output->write("$module: doesn't exist\n"); $output->write("$module: doesn't exist\n");
...@@ -297,8 +302,6 @@ if($options->spec_files) { ...@@ -297,8 +302,6 @@ if($options->spec_files) {
$output->progress("$spec_file"); $output->progress("$spec_file");
open(OUT, "> $wine_dir/$spec_file"); open(OUT, "> $wine_dir/$spec_file");
print OUT "name $module\n";
print OUT "type $type\n";
if(exists($specifications{$module}{init})) { if(exists($specifications{$module}{init})) {
my $function = $specifications{$module}{init}{function}; my $function = $specifications{$module}{init}{function};
print OUT "init " . $function->internal_name . "\n"; print OUT "init " . $function->internal_name . "\n";
...@@ -378,12 +381,15 @@ if($options->spec_files) { ...@@ -378,12 +381,15 @@ if($options->spec_files) {
close(OUT); close(OUT);
} }
}
} }
if($options->stub_statistics) { if($options->stub_statistics) {
foreach my $winapi (@winapis) { foreach my $winapi (@winapis) {
if($winapi->name eq "win16" && !$options->win16) { next; } my $type = $winapi->name;
if($winapi->name eq "win32" && !$options->win32) { next; }
if($type eq "win16" && !$options->win16) { next; }
if($type eq "win32" && !$options->win32) { next; }
my %module_stub_count; my %module_stub_count;
my %module_total_count; my %module_total_count;
...@@ -421,13 +427,12 @@ if($options->stub_statistics) { ...@@ -421,13 +427,12 @@ if($options->stub_statistics) {
} }
if($options->winetest) { if($options->winetest) {
foreach my $module (sort(keys(%specifications))) { foreach my $module ($win32api->all_modules) {
my $type = $module2type{$module}; my $type = "win32";
my $filename = $module2filename{$module} || $module;
my $modulename = $filename;
$modulename =~ s/\./_/g;
next unless $type eq "win32"; my $package = $module;
$package =~ s/\.dll$//;
$package =~ s/\./_/g;
my @entries; my @entries;
...@@ -452,18 +457,9 @@ if($options->winetest) { ...@@ -452,18 +457,9 @@ if($options->winetest) {
my $ordinal = $entry->{ordinal}; my $ordinal = $entry->{ordinal};
my $function = $entry->{function}; my $function = $entry->{function};
my $return_kind; my $return_kind = $function->return_kind32 || "undef";
my $calling_convention; my $calling_convention = $function->calling_convention32 || "undef";
my $refargument_kinds; my $refargument_kinds = $function->argument_kinds32;
if($type eq "win16") {
$return_kind = $function->return_kind16 || "undef";
$calling_convention = $function->calling_convention16 || "undef";
$refargument_kinds = $function->argument_kinds16;
} elsif($type eq "win32") {
$return_kind = $function->return_kind32 || "undef";
$calling_convention = $function->calling_convention32 || "undef";
$refargument_kinds = $function->argument_kinds32;
}
my @argument_kinds; my @argument_kinds;
if(defined($refargument_kinds)) { if(defined($refargument_kinds)) {
...@@ -474,9 +470,9 @@ if($options->winetest) { ...@@ -474,9 +470,9 @@ if($options->winetest) {
next if $external_name eq "\@"; next if $external_name eq "\@";
if($n == 0) { if($n == 0) {
open(OUT, "> $wine_dir/programs/winetest/include/${modulename}.pm"); open(OUT, "> $wine_dir/programs/winetest/include/${package}.pm");
print OUT "package ${modulename};\n"; print OUT "package ${package};\n";
print OUT "\n"; print OUT "\n";
print OUT "use strict;\n"; print OUT "use strict;\n";
...@@ -516,7 +512,7 @@ if($options->winetest) { ...@@ -516,7 +512,7 @@ if($options->winetest) {
print OUT "\n"; print OUT "\n";
print OUT "};\n"; print OUT "};\n";
print OUT "\n"; print OUT "\n";
print OUT "&wine::declare(\"$filename\",\%\$module_declarations);\n"; print OUT "&wine::declare(\"$module\",\%\$module_declarations);\n";
print OUT "push \@EXPORT, map { \"&\" . \$_; } sort(keys(\%\$module_declarations));\n"; print OUT "push \@EXPORT, map { \"&\" . \$_; } sort(keys(\%\$module_declarations));\n";
print OUT "1;\n"; print OUT "1;\n";
close(OUT); close(OUT);
......
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