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

- Fixed broken winapi_extract options --{pseudo-,}stub-statistics.

- Added new winapi_extract options --{pseudo-,}implemented.
parent 0bc4b565
#!/usr/bin/perl -w
# Copyright 2001 Patrik Stridvall
# Copyright 2002 Patrik Stridvall
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
......@@ -45,7 +45,7 @@ use winapi_c_parser;
use winapi_function;
use vars qw($win16api $win32api @winapis);
if ($options->spec_files || $options->winetest) {
if ($options->spec_files || $options->implemented || $options->stub_statistics || $options->winetest) {
require winapi;
import winapi qw($win16api $win32api @winapis);
}
......@@ -161,24 +161,29 @@ sub documentation_specifications {
my %module_pseudo_stub;
sub statements_stub {
sub statements_pseudo_stub {
my $function = shift;
my $pseudo_stub = 0;
my $statements = $function->statements;
if(defined($statements) && $statements =~ /FIXME[^;]*stub/s) {
if($options->win16) {
my $external_name16 = $function->external_name16;
foreach my $module16 ($function->modules16) {
$module_pseudo_stub{$module16}{$external_name16}++;
$pseudo_stub = 1;
}
}
if($options->win32) {
my $external_name32 = $function->external_name32;
foreach my $module32 ($function->modules32) {
$module_pseudo_stub{$module32}{$external_name32}++;
$pseudo_stub = 1;
}
}
}
return $pseudo_stub;
}
my @h_files = ();
......@@ -189,7 +194,7 @@ if($options->headers) {
}
my @c_files = ();
if(1 || $options->spec_files || $options->pseudo_stub_statistics) {
if($options->spec_files || $options->pseudo_implemented || $options->pseudo_stub_statistics) {
@c_files = $options->c_files;
@c_files = files_skip(@c_files);
@c_files = files_filter("winelib", @c_files);
......@@ -267,13 +272,13 @@ foreach my $file (@h_files, @c_files) {
}
my $old_function;
if($options->stub_statistics) {
if($options->implemented || $options->stub_statistics) {
$old_function = 'winapi_function'->new;
} else {
$old_function = 'function'->new;
}
$function->file($file);
$old_function->file($function->file);
$old_function->debug_channels([]); # FIXME: Not complete
$old_function->documentation_line(0); # FIXME: Not complete
......@@ -298,16 +303,36 @@ foreach my $file (@h_files, @c_files) {
documentation_specifications($old_function);
}
if($options->stub_statistics) {
statements_stub($old_function);
}
if ($function->statements) {
$function = undef;
&$update_output();
} else {
$function = undef;
}
my $pseudo_stub = 0;
if ($options->pseudo_implemented || $options->pseudo_stub_statistics) {
$pseudo_stub = statements_pseudo_stub($old_function);
}
my $module = $old_function->module;
my $external_name = $old_function->external_name;
my $statements = $old_function->statements;
if ($options->pseudo_implemented && $module && $external_name && $statements) {
my @external_names = split(/\s*&\s*/, $external_name);
my @modules = split(/\s*&\s*/, $module);
my @external_names2;
while(defined(my $external_name = shift @external_names) &&
defined(my $module = shift @modules))
{
if ($pseudo_stub) {
$output->write("$module.$external_name: pseudo implemented\n");
} else {
$output->write("$module.$external_name: implemented\n");
}
}
}
};
$parser->set_found_function_callback($found_function);
......@@ -355,6 +380,41 @@ foreach my $file (@h_files, @c_files) {
$output->prefix("");
}
if($options->implemented && !$options->pseudo_implemented) {
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) {
foreach my $external_name ($winapi->all_functions_in_module($module)) {
my $external_calling_convention =
$winapi->function_external_calling_convention_in_module($module, $external_name);
if($external_calling_convention eq "forward") {
(my $forward_module, my $forward_external_name) =
$winapi->function_forward_final_destination($module, $external_name);
my $forward_external_calling_convention =
$winapi->function_external_calling_convention_in_module($forward_module, $forward_external_name);
if(!defined($forward_external_calling_convention)) {
next;
}
$external_calling_convention = $forward_external_calling_convention;
}
if ($external_calling_convention ne "stub") {
$output->write("*.spec: $module.$external_name: implemented\n");
}
}
}
}
}
sub output_function {
local *OUT = shift;
my $type = shift;
......
......@@ -43,6 +43,8 @@ my %options_long = (
"old" => { default => 0, description => "use the old parser" },
"headers" => { default => 0, description => "parse the .h files as well" },
"implemented" => { default => 0, parent => "old", description => "implemented functions extraction" },
"pseudo-implemented" => { default => 0, parent => "implemented", description => "pseudo implemented functions extraction" },
"struct" => { default => 0, parent => "headers", description => "struct extraction" },
"spec-files" => { default => 0, parent => "old", description => "spec files extraction" },
"stub-statistics" => { default => 0, parent => "old", description => "stub statistics" },
......
......@@ -159,9 +159,9 @@ dlls/msimg32
dlls/msisys
% dlls/msrle32/msrle32.spec
% dlls/msvideo/msrle32/msrle32.spec
dlls/msrle32
dlls/msvideo/msrle32
% dlls/msvcrt/msvcrt.spec
......
......@@ -209,6 +209,8 @@ sub parse_c_file {
my $function = new c_function;
$function->file($old_function->file);
$function->begin_line($old_function->function_line);
$function->begin_column(0);
$function->end_line($old_function->function_line);
......@@ -219,6 +221,17 @@ sub parse_c_file {
$function->calling_convention($old_function->calling_convention);
$function->name($old_function->internal_name);
if(defined($old_function->argument_types)) {
$function->argument_types([@{$old_function->argument_types}]);
}
if(defined($old_function->argument_names)) {
$function->argument_names([@{$old_function->argument_names}]);
}
$function->statements_line($old_function->statements_line);
$function->statements_column(0);
$function->statements($old_function->statements);
&$$found_function($function);
};
......
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