Errors running winapi_extract --stub-statistics
Francois Gouget
fgouget at free.fr
Sun Jul 21 05:58:59 CDT 2002
On Fri, 19 Jul 2002, Patrik Stridvall wrote:
[...]
> Correct. Patch for this and other problem with
> winapi_extract coming soon.
Thanks a lot of the patch, it works much better now.
I noticed another 'problem' of sorts: winapi_extract does not count
forward functions. For instance for msvcrt20 it says:
*.c: msvcrt20: 427 of 429 functions are stubs (427 real, 0 pseudo)
But in fact there are also 697 forward functions. So I began checking in
more details and found other inconsistencies. For instance for comctl32
it says:
*.c: comctl32: 107 of 244 functions are stubs (88 real, 19 pseudo)
But comctl32.spec has only 197 lines so it cannot declare 244 functions.
Also, a grep stub comctl32.spec | wc -l says there are only 24 matches
(one is commented out). So I tweaked things a bit and arrived at the
attached patch. I'm not sure I did things right. Does it make sense?
With the patch, I get the following statistics:
*.c: comctl32: 42 of 179 functions are stubs (23 real, 19 pseudo) and 0 are forwards
And for msvcrt20:
*.c: msvcrt20: 427 of 1126 functions are stubs (427 real, 0 pseudo) and 697 are forwards
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
I haven't lost my mind, it's backed up on tape around here somewhere...
-------------- next part --------------
Index: tools/winapi/winapi.pm
===================================================================
RCS file: /home/wine/wine/tools/winapi/winapi.pm,v
retrieving revision 1.1
diff -u -r1.1 winapi.pm
--- tools/winapi/winapi.pm 19 Jul 2002 00:31:05 -0000 1.1
+++ tools/winapi/winapi.pm 21 Jul 2002 10:33:35 -0000
@@ -212,12 +213,12 @@
my $function_external_calling_convention = \%{$self->{FUNCTION_EXTERNAL_CALLING_CONVENTION}};
my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
- my $function_stub = \%{$self->{FUNCTION_STUB}};
my $function_forward = \%{$self->{FUNCTION_FORWARD}};
my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
my $modules = \%{$self->{MODULES}};
my $module_files = \%{$self->{MODULE_FILES}};
+ my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
my $file = shift;
$file =~ s%^\./%%;
@@ -268,6 +266,11 @@
$arguments .= "ptr";
}
+ if ($external_name ne "@") {
+ $$module_external_calling_convention{$module}{$external_name}=$calling_convention;
+ } else {
+ $$module_external_calling_convention{$module}{"\@$ordinal"}=$calling_convention;
+ }
if(!$$function_internal_name{$external_name}) {
$$function_internal_name{$external_name} = $internal_name;
} else {
@@ -341,7 +344,11 @@
my $internal_name = $external_name;
- $$function_stub{$module}{$external_name} = 1;
+ if ($external_name ne "@") {
+ $$module_external_calling_convention{$module}{$external_name}="stub";
+ } else {
+ $$module_external_calling_convention{$module}{"\@$ordinal"}="stub";
+ }
if(!$$function_internal_name{$external_name}) {
$$function_internal_name{$external_name} = $internal_name;
} else {
@@ -376,6 +386,11 @@
my $forward_module = lc($3);
my $forward_name = $4;
+ if ($external_name ne "@") {
+ $$module_external_calling_convention{$module}{$external_name}="forward";
+ } else {
+ $$module_external_calling_convention{$module}{"\@$1"}="forward";
+ }
$$function_forward{$external_name} = "$module:$forward_module.$forward_name";
} elsif(/^(\d+|@)\s+(equate|extern|variable)/) {
# ignore
@@ -641,20 +653,20 @@
sub all_external_functions {
my $self = shift;
- my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
+ my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
- return sort(keys(%$function_internal_name));
+ return sort(keys(%$function_external_name));
}
sub all_external_functions_in_module {
my $self = shift;
- my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
+ my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
my $module = shift;
my @names;
- foreach my $name (keys(%$function_internal_name)) {
+ foreach my $name (keys(%$function_external_name)) {
if($$function_external_module{$name} eq $module) {
push @names, $name;
}
@@ -663,25 +675,13 @@
return sort(@names);
}
-sub all_functions_stub {
+sub all_functions_in_module {
my $self = shift;
- my $function_stub = \%{$self->{FUNCTION_STUB}};
- my $modules = \%{$self->{MODULES}};
-
- my @stubs = ();
- foreach my $module (keys(%$modules)) {
- push @stubs, keys(%{$$function_stub{$module}});
- }
- return sort(@stubs);
-}
-
-sub all_functions_stub_in_module {
- my $self = shift;
- my $function_stub = \%{$self->{FUNCTION_STUB}};
+ my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
my $module = shift;
- return sort(keys(%{$$function_stub{$module}}));
+ return sort(keys(%{$$module_external_calling_convention{$module}}));
}
sub function_internal_ordinal {
@@ -720,6 +720,16 @@
return $$function_external_calling_convention{$name};
}
+sub function_external_calling_convention_in_module {
+ my $self = shift;
+ my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
+
+ my $module = shift;
+ my $name = shift;
+
+ return $$module_external_calling_convention{$module}{$name};
+}
+
sub function_internal_name {
my $self = shift;
my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
@@ -810,14 +820,14 @@
sub is_function_stub {
my $self = shift;
- my $function_stub = \%{$self->{FUNCTION_STUB}};
+ my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
my $modules = \%{$self->{MODULES}};
my $module = shift;
my $name = shift;
foreach my $module (keys(%$modules)) {
- if($$function_stub{$module}{$name}) {
+ if($$module_external_calling_convention{$module}{$name} eq "stub") {
return 1;
}
}
@@ -827,13 +837,16 @@
sub is_function_stub_in_module {
my $self = shift;
- my $function_stub = \%{$self->{FUNCTION_STUB}};
+ my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
my $module = shift;
my $name = shift;
- return $$function_stub{$module}{$name};
+ if (!defined $$module_external_calling_convention{$module}{$name}) {
+ return 0;
+ }
+ return $$module_external_calling_convention{$module}{$name} eq "stub";
}
########################################################################
--- ../wine2/tools/winapi/winapi_extract Sun Jul 21 03:05:00 2002
+++ tools/winapi/winapi_extract Sun Jul 21 02:56:34 2002
@@ -391,15 +391,10 @@
if($type eq "win16" && !$options->win16) { next; }
if($type eq "win32" && !$options->win32) { next; }
- my %module_stub_count;
- my %module_total_count;
-
- foreach my $internal_name ($winapi->all_internal_functions,$winapi->all_functions_stub) {
- foreach my $module (split(/ \& /, $winapi->function_internal_module($internal_name))) {
- if($winapi->is_function_stub_in_module($module, $internal_name)) {
- $module_stub_count{$module}++;
- }
- $module_total_count{$module}++;
+ my %module_counts;
+ foreach my $module ($winapi->all_modules()) {
+ foreach my $external_name ($winapi->all_functions_in_module($module)) {
+ $module_counts{$module}{$winapi->function_external_calling_convention_in_module($module,$external_name)}++;
}
}
@@ -410,18 +405,23 @@
} elsif($winapi->name eq "win32") {
$pseudo_stubs = $module_pseudo_stub_count32{$module};
}
+ $pseudo_stubs = 0 if (!defined $pseudo_stubs);
+
+ my $real_stubs = $module_counts{$module}{stub};
+ $real_stubs = 0 if (!defined $real_stubs);
- my $real_stubs = $module_stub_count{$module};
- my $total = $module_total_count{$module};
+ my $forwards = $module_counts{$module}{forward};
+ $forwards = 0 if (!defined $forwards);
- if(!defined($real_stubs)) { $real_stubs = 0; }
- if(!defined($pseudo_stubs)) { $pseudo_stubs = 0; }
- if(!defined($total)) { $total = 0;}
+ my $total = 0;
+ foreach my $count (values %{$module_counts{$module}}) {
+ $total += $count;
+ }
my $stubs = $real_stubs + $pseudo_stubs;
$output->write("*.c: $module: ");
- $output->write("$stubs of $total functions are stubs ($real_stubs real, $pseudo_stubs pseudo)\n");
+ $output->write("$stubs of $total functions are stubs ($real_stubs real, $pseudo_stubs pseudo) and $forwards are forwards\n");
}
}
}
More information about the wine-devel
mailing list