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

Several additions and bug fixes.

parent 987ea468
......@@ -117,7 +117,17 @@ foreach my $file (@c_files) {
$output->prefix("$file: " . $function->prefix);
my @module_ordinal_entries = $function->get_all_module_ordinal;
my @module_ordinal_entries = ();
foreach my $entry2 ($function->get_all_module_ordinal) {
(my $external_name2, my $module2, my $ordinal2) = @$entry2;
if(($external_name2 eq "@" ||
($win16api->is_module($module2) && !$win16api->is_function_stub_in_module($module2, $external_name2)) ||
($win32api->is_module($module2) && !$win32api->is_function_stub_in_module($module2, $external_name2))) &&
$modules->is_allowed_module_in_file($module2, "$current_dir/$file"))
{
push @module_ordinal_entries, $entry2;
}
}
my $spec_modified = 0;
......@@ -398,7 +408,7 @@ foreach my $file (@c_files) {
my $found = 0;
foreach my $entry2 (@module_ordinal_entries) {
(my $external_name2, my $module2, my $ordinal2) = @$entry2;
if($external_name eq $external_name2 &&
lc($module) eq $module2 &&
$ordinal eq $ordinal2)
......
......@@ -98,8 +98,6 @@ dlls/imm32
% dlls/kernel/kernel.spec
dlls/kernel
dlls/shell32
dlls/win32s
files
loader/ne
loader
......@@ -187,7 +185,6 @@ dlls/msvideo
% dlls/ntdll/ntdll.spec
dlls/ntdll
memory
misc
scheduler
......@@ -303,7 +300,6 @@ misc
% dlls/shell32/shell32.spec
dlls/shell32
memory
% dlls/shdocvw/shdocvw.spec
......@@ -377,7 +373,6 @@ dlls/win32s
% dlls/win32s/w32sys.spec
dlls/kernel
dlls/win32s
% dlls/win32s/win32s16.spec
......
......@@ -2,6 +2,15 @@ package modules;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw($modules);
use vars qw($modules);
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
......@@ -81,6 +90,8 @@ sub new {
}
}
$modules = $self;
return $self;
}
......
%long
BOOL
DWORD
HRASCONN
%ptr
LPBOOL
LPCSTR *
LPCWSTR *
LPDWORD
LPRASAUTODIALENTRYA
LPRASAUTODIALENTRYW
LPRASCONNA
LPRASDEVINFOA
LPRASDEVINFOW
LPRASDIALPARAMSA
LPRASENTRYNAMEA
LPVOID
%str
LPCSTR
%wstr
LPCWSTR
......@@ -2,11 +2,30 @@
HMODULE
HRESULT
RPC_IF_HANDLE
RPC_STATUS
UINT
ULONG
%ptr
CLSID *
LPSTR *
LPVOID
LPWSTR *
PRPC_POLICY
RPC_AUTH_KEY_RETRIEVAL_FN
RPC_BINDING_HANDLE *
RPC_IF_CALLBACK_FN *
RPC_MGR_EPV *
UUID *
unsigned char **
void **
\ No newline at end of file
void **
%str
LPSTR
%wstr
LPWSTR
......@@ -23,6 +23,7 @@ SOCKET16
FARPROC
INT *
LPDWORD
LPINT
LPVOID
LPWSABUF
LPWSADATA
......
......@@ -226,9 +226,10 @@ sub read_spec_files {
for my $internal_name ($win32api->all_internal_functions) {
my $module16 = $win16api->function_internal_module($internal_name);
my $module32 = $win16api->function_internal_module($internal_name);
if(defined($module16) &&
!$win16api->function_stub($internal_name) &&
!$win32api->function_stub($internal_name))
!$win16api->is_function_stub_in_module($module16, $internal_name) &&
!$win32api->is_function_stub_in_module($module32, $internal_name))
{
$win16api->found_shared_internal_function($internal_name);
$win32api->found_shared_internal_function($internal_name);
......@@ -248,7 +249,7 @@ sub read_all_spec_files {
my $win32api = shift;
my @files = map {
s%^\./%%;
s%^$wine_dir/%%;
if(&$file_type($_) eq "winelib") {
$_;
} else {
......@@ -403,7 +404,7 @@ sub parse_spec_file {
$internal_name = $external_name;
}
$$function_stub{$external_name} = 1;
$$function_stub{$module}{$external_name} = 1;
if(!$$function_internal_name{$external_name}) {
$$function_internal_name{$external_name} = $internal_name;
} else {
......@@ -691,8 +692,22 @@ sub all_internal_functions_in_module {
sub all_functions_stub {
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 = shift;
return sort(keys(%$function_stub));
return sort(keys(%{$$function_stub{$module}}));
}
sub all_internal_functions_found {
......@@ -826,13 +841,31 @@ sub function_external_module {
return $$function_external_module{$name};
}
sub function_stub {
sub is_function_stub {
my $self = shift;
my $function_stub = \%{$self->{FUNCTION_STUB}};
my $modules = \%{$self->{MODULES}};
my $module = shift;
my $name = shift;
foreach my $module (keys(%$modules)) {
if($$function_stub{$module}{$name}) {
return 1;
}
}
return 0;
}
sub is_function_stub_in_module {
my $self = shift;
my $function_stub = \%{$self->{FUNCTION_STUB}};
my $module = shift;
my $name = shift;
return $$function_stub{$name};
return $$function_stub{$module}{$name};
}
sub found_internal_function {
......
......@@ -276,23 +276,29 @@ foreach my $file (@c_files) {
{
if($options->win16 && $options->report_module($module16))
{
if($file ne "library/port.c" &&
if($file ne "library/port.c" &&
!$nativeapi->is_function($internal_name) &&
!$win16api->function_stub($internal_name) &&
!is_subset($module16, $file_module16))
{
$output->write("is misplaced\n");
foreach my $module16 (split(/\s*&\s*/, $module16)) {
if(!$win16api->is_function_stub($module16, $internal_name)) {
$output->write("is misplaced ($module16)\n");
}
}
}
}
if($options->win32 && $options->report_module($module32))
{
if($file ne "library/port.c" &&
if($file ne "library/port.c" &&
!$nativeapi->is_function($internal_name) &&
!$win32api->function_stub($internal_name) &&
!is_subset($module32, $file_module32))
{
$output->write("is misplaced\n");
foreach my $module32 (split(/\s*&\s*/, $module32)) {
if(!$win32api->is_function_stub($module32, $internal_name)) {
$output->write("is misplaced ($module32)\n");
}
}
}
}
}
......@@ -351,7 +357,7 @@ foreach my $file (@c_files) {
(defined($module16) || defined($module32)) &&
$linkage ne "extern" && defined($statements))
{
winapi_documentation::check_documentation $options, $output, $win16api, $win32api, $function;
winapi_documentation::check_documentation $options, $output, $win16api, $win32api, $modules, $function;
}
$output->prefix("");
}
......
......@@ -2,6 +2,8 @@ package winapi_documentation;
use strict;
use config qw($current_dir $wine_dir);
my %comment_width;
my %comment_indent;
my %comment_spacing;
......@@ -13,13 +15,17 @@ sub check_documentation {
my $output = shift;
my $win16api = shift;
my $win32api = shift;
my $modules = shift;
my $function = shift;
my $module16 = $function->module16;
my $module32 = $function->module32;
my $file = $function->file;
my $external_name16 = $function->external_name16;
my $external_name32 = $function->external_name32;
my $internal_name = $function->internal_name;
my $module16 = $function->module16;
my $module32 = $function->module32;
my $ordinal16 = $function->ordinal16;
my $ordinal32 = $function->ordinal32;
my $documentation = $function->documentation;
my $documentation_line = $function->documentation_line;
my @argument_documentations = @{$function->argument_documentations};
......@@ -33,16 +39,18 @@ sub check_documentation {
my @winapis = ($win16api, $win32api);
my @modules = ($module16, $module32);
my @external_names = ($external_name16, $external_name32);
my @ordinals = ($ordinal16, $ordinal32);
while(
defined(my $winapi = shift @winapis) &&
defined(my $external_name = shift @external_names) &&
defined(my $module = shift @modules))
defined(my $module = shift @modules) &&
defined(my $ordinal = shift @ordinals))
{
if($winapi->function_stub($internal_name)) { next; }
if($winapi->is_function_stub_in_module($module, $internal_name)) { next; }
my @external_name = split(/\s*\&\s*/, $external_name);
my @modules = split(/\s*\&\s*/, $module);
my @ordinals = split(/\s*\&\s*/, $winapi->function_internal_ordinal($internal_name));
my @ordinals = split(/\s*\&\s*/, $ordinal);
my $pedantic_failed = 0;
while(defined(my $external_name = shift @external_name) &&
......@@ -98,10 +106,14 @@ sub check_documentation {
my $found = 0;
foreach my $entry2 (winapi::get_all_module_internal_ordinal($internal_name)) {
(my $external_name2, my $module2, my $ordinal2) = @$entry2;
if($external_name eq $external_name2 &&
lc($module) eq $module2 &&
$ordinal eq $ordinal2)
$ordinal eq $ordinal2 &&
($external_name2 eq "@" ||
($win16api->is_module($module2) && !$win16api->is_function_stub_in_module($module2, $external_name2)) ||
($win32api->is_module($module2) && !$win32api->is_function_stub_in_module($module2, $external_name2))) &&
$modules->is_allowed_module_in_file($module2, "$current_dir/$file"))
{
$found = 1;
}
......
......@@ -3,6 +3,8 @@ use base qw(function);
use strict;
use config qw($current_dir $wine_dir);
use modules qw($modules);
use util qw(&normalize_set);
use winapi qw($win16api $win32api @winapis);
......@@ -20,123 +22,174 @@ sub new {
}
########################################################################
# winapi
# external_name
#
sub external_name16 {
sub _external_name {
my $self = shift;
my $winapi = shift;
my $file = $self->file;
my $internal_name = $self->internal_name;
return $win16api->function_external_name($internal_name);
}
my $external_name = $winapi->function_external_name($internal_name);
my $module = $winapi->function_internal_module($internal_name);
sub external_names16 {
my $self = shift;
my $external_name16 = $self->external_name16;
if(defined($external_name16)) {
return split(/\s*&\s*/, $external_name16);
} else {
return ();
if(!defined($external_name) && !defined($module)) {
return undef;
}
}
sub external_name32 {
my $self = shift;
my $internal_name = $self->internal_name;
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($modules->is_allowed_module_in_file($module, "$current_dir/$file")) {
push @external_names2, $external_name;
}
}
return $win32api->function_external_name($internal_name);
return join(" & ", @external_names2);
}
sub external_names32 {
sub _external_names {
my $self = shift;
my $external_name32 = $self->external_name32;
my $winapi = shift;
my $external_name = $self->_external_name($winapi);
if(defined($external_name32)) {
return split(/\s*&\s*/, $external_name32);
if(defined($external_name)) {
return split(/\s*&\s*/, $external_name);
} else {
return ();
}
}
sub external_names {
my $self = shift;
sub external_name16 { my $self = shift; return $self->_external_name($win16api, @_); }
sub external_name32{ my $self = shift; return $self->_external_name($win32api, @_); }
my @external_names;
push @external_names, $self->external_names16;
push @external_names, $self->external_names32;
sub external_names16 { my $self = shift; return $self->_external_names($win16api, @_); }
sub external_names32 { my $self = shift; return $self->_external_names($win32api, @_); }
return @external_names;
}
sub external_names { my $self = shift; return ($self->external_names16,$self->external_names32); }
sub module16 {
########################################################################
# module
#
sub _module {
my $self = shift;
my $winapi = shift;
my $file = $self->file;
my $internal_name = $self->internal_name;
return $win16api->function_internal_module($internal_name);
my $module = $winapi->function_internal_module($internal_name);
if(!defined($module)) {
return undef;
}
my @modules;
foreach my $module (split(/\s*&\s*/, $module)) {
if($modules->is_allowed_module_in_file($module, "$current_dir/$file")) {
push @modules, $module;
}
}
return join(" & ", @modules);
}
sub modules16 {
sub _modules {
my $self = shift;
my $module16 = $self->module16;
my $winapi = shift;
my $module = $self->_module($winapi);
if(defined($module16)) {
return split(/\s*&\s*/, $module16);
if(defined($module)) {
return split(/\s*&\s*/, $module);
} else {
return ();
}
}
sub module32 {
sub module16 { my $self = shift; return $self->_module($win16api, @_); }
sub module32 { my $self = shift; return $self->_module($win32api, @_); }
sub module { my $self = shift; return join (" & ", $self->modules); }
sub modules16 { my $self = shift; return $self->_modules($win16api, @_); }
sub modules32 { my $self = shift; return $self->_modules($win32api, @_); }
sub modules { my $self = shift; return ($self->modules16, $self->modules32); }
########################################################################
# ordinal
#
sub _ordinal {
my $self = shift;
my $winapi = shift;
my $file = $self->file;
my $internal_name = $self->internal_name;
return $win32api->function_internal_module($internal_name);
}
my $ordinal = $winapi->function_internal_ordinal($internal_name);
my $module = $winapi->function_internal_module($internal_name);
sub modules32 {
my $self = shift;
my $module32 = $self->module32;
if(!defined($ordinal) && !defined($module)) {
return undef;
}
my @ordinals = split(/\s*&\s*/, $ordinal);
my @modules = split(/\s*&\s*/, $module);
if(defined($module32)) {
return split(/\s*&\s*/, $module32);
} else {
return ();
my @ordinals2;
while(defined(my $ordinal = shift @ordinals) &&
defined(my $module = shift @modules))
{
if($modules->is_allowed_module_in_file($module, "$current_dir/$file")) {
push @ordinals2, $ordinal;
}
}
return join(" & ", @ordinals2);
}
sub module {
sub _ordinals {
my $self = shift;
my $module16 = $self->module16;
my $module32 = $self->module32;
my $winapi = shift;
my $module;
if(defined($module16) && defined($module32)) {
$module = "$module16 & $module32";
} elsif(defined($module16)) {
$module = $module16;
} elsif(defined($module32)) {
$module = $module32;
my $ordinal = $self->_ordinal($winapi);
if(defined($ordinal)) {
return split(/\s*&\s*/, $ordinal);
} else {
$module = "";
return ();
}
}
sub modules {
my $self = shift;
sub ordinal16 { my $self = shift; return $self->_ordinal($win16api, @_); }
sub ordinal32 { my $self = shift; return $self->_ordinal($win32api, @_); }
my @modules;
push @modules, $self->modules16;
push @modules, $self->modules32;
sub ordinal { my $self = shift; return join (" & ", $self->ordinals); }
return @modules;
}
sub ordinals16 { my $self = shift; return $self->_ordinals($win16api, @_); }
sub ordinals32 { my $self = shift; return $self->_ordinals($win32api, @_); }
sub ordinals { my $self = shift; return ($self->ordinals16, $self->ordinals32); }
########################################################################
# prefix
#
sub prefix {
my $self = shift;
my $module16 = $self->module16;
my $module32 = $self->module32;
my $file = $self->file;
my $return_type = $self->return_type;
my $internal_name = $self->internal_name;
my $calling_convention = $self->calling_convention;
......@@ -147,12 +200,17 @@ sub prefix {
}
my $prefix = "";
if(defined($module16) && !defined($module32)) {
$prefix .= normalize_set($module16) . ": ";
} elsif(!defined($module16) && defined($module32)) {
$prefix .= normalize_set($module32) . ": ";
} elsif(defined($module16) && defined($module32)) {
$prefix .= normalize_set($module16) . " & " . normalize_set($module32) . ": ";
my @modules = ();
my %used;
foreach my $module ($self->modules) {
if($used{$module}) { next; }
push @modules, $module;
$used{$module}++;
}
$prefix .= "$file: ";
if($#modules >= 0) {
$prefix .= join(" & ", @modules) . ": ";
} else {
$prefix .= "<>: ";
}
......@@ -163,6 +221,10 @@ sub prefix {
return $prefix;
}
########################################################################
# calling_convention
#
sub calling_convention16 {
my $self = shift;
my $return_kind16 = $self->return_kind16;
......
......@@ -17,18 +17,18 @@ sub check_function {
my $module = $winapi->function_internal_module($internal_name);
if($winapi->name eq "win16") {
if($winapi->function_stub($internal_name)) {
if($winapi->is_function_stub_in_module($module, $internal_name)) {
if($options->implemented) {
$output->write("function implemented but declared as stub in .spec file\n");
}
return;
} elsif($winapi->function_stub($internal_name)) {
} elsif($winapi->is_function_stub_in_module($module, $internal_name)) {
if($options->implemented_win32) {
$output->write("32-bit variant of function implemented but declared as stub in .spec file\n");
}
return;
}
} elsif($winapi->function_stub($internal_name)) {
} elsif($winapi->is_function_stub_in_module($module, $internal_name)) {
if($options->implemented) {
$output->write("function implemented but declared as stub in .spec file\n");
}
......
......@@ -56,11 +56,11 @@ sub parse_c_file {
my $function_end = sub {
my $function = 'winapi_function'->new;
$function->file($file);
$function->debug_channels([@$debug_channels]);
$function->documentation($documentation);
$function->documentation_line($documentation_line);
$function->linkage($linkage);
$function->file($file);
$function->return_type($return_type);
$function->calling_convention($calling_convention);
$function->internal_name($internal_name);
......
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