2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
# Copyright 1999, 2000, 2001 Patrik Stridvall
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
|
1999-09-23 17:14:20 +02:00
|
|
|
package winapi;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2001-07-11 19:27:45 +02:00
|
|
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
|
|
|
|
require Exporter;
|
|
|
|
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
@EXPORT = qw();
|
|
|
|
@EXPORT_OK = qw($win16api $win32api @winapis);
|
|
|
|
|
|
|
|
use vars qw($win16api $win32api @winapis);
|
2001-07-08 22:33:20 +02:00
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
use config qw($current_dir $wine_dir $winapi_dir);
|
2001-07-26 23:42:12 +02:00
|
|
|
use options qw($options);
|
|
|
|
use output qw($output);
|
|
|
|
|
2002-10-01 20:10:54 +02:00
|
|
|
use vars qw($modules);
|
2001-07-26 23:42:12 +02:00
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub found_shared_internal_function($$);
|
|
|
|
sub function_external_calling_convention_in_module($$$);
|
|
|
|
sub function_internal_module($$);
|
|
|
|
sub is_function_stub_in_module($$$);
|
|
|
|
sub new($$$);
|
|
|
|
sub parse_api_file($$);
|
|
|
|
sub parse_spec_file($$);
|
|
|
|
|
|
|
|
sub import(@) {
|
2002-10-01 20:10:54 +02:00
|
|
|
$Exporter::ExportLevel++;
|
2004-10-26 02:12:21 +02:00
|
|
|
Exporter::import(@_);
|
2002-10-01 20:10:54 +02:00
|
|
|
$Exporter::ExportLevel--;
|
2001-07-30 20:49:10 +02:00
|
|
|
|
2002-11-27 21:11:10 +01:00
|
|
|
if (defined($modules) && defined($win16api) && defined($win32api)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-10-01 20:10:54 +02:00
|
|
|
require modules;
|
|
|
|
import modules qw($modules);
|
2001-07-26 23:42:12 +02:00
|
|
|
|
2002-10-01 20:10:54 +02:00
|
|
|
my @spec_files16 = $modules->allowed_spec_files16;
|
|
|
|
$win16api = 'winapi'->new("win16", \@spec_files16);
|
2003-09-29 22:15:24 +02:00
|
|
|
|
2002-10-01 20:10:54 +02:00
|
|
|
my @spec_files32 = $modules->allowed_spec_files32;
|
|
|
|
$win32api = 'winapi'->new("win32", \@spec_files32);
|
2003-09-29 22:15:24 +02:00
|
|
|
|
2002-10-01 20:10:54 +02:00
|
|
|
@winapis = ($win16api, $win32api);
|
|
|
|
|
|
|
|
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->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);
|
|
|
|
}
|
2001-07-30 20:49:10 +02:00
|
|
|
}
|
2001-07-26 23:42:12 +02:00
|
|
|
}
|
|
|
|
|
2002-10-01 20:10:54 +02:00
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub new($$$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $proto = shift;
|
|
|
|
my $class = ref($proto) || $proto;
|
|
|
|
my $self = {};
|
|
|
|
bless ($self, $class);
|
|
|
|
|
1999-10-24 23:45:39 +02:00
|
|
|
my $name = \${$self->{NAME}};
|
2001-07-30 20:49:10 +02:00
|
|
|
my $function_forward = \%{$self->{FUNCTION_FORWARD}};
|
|
|
|
my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
|
|
|
|
my $function_module = \%{$self->{FUNCTION_MODULE}};
|
1999-10-24 23:45:39 +02:00
|
|
|
|
|
|
|
$$name = shift;
|
2001-07-30 20:49:10 +02:00
|
|
|
my $refspec_files = shift;
|
|
|
|
|
|
|
|
foreach my $file (@$refspec_files) {
|
|
|
|
$self->parse_spec_file("$wine_dir/$file");
|
|
|
|
}
|
1999-10-24 23:45:39 +02:00
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
$self->parse_api_file("$$name.api");
|
2002-06-01 04:55:48 +02:00
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
foreach my $module (sort(keys(%$function_forward))) {
|
|
|
|
foreach my $external_name (sort(keys(%{$$function_forward{$module}}))) {
|
|
|
|
(my $forward_module, my $forward_external_name) = @{$$function_forward{$module}{$external_name}};
|
|
|
|
my $forward_internal_name = $$function_internal_name{$forward_external_name};
|
|
|
|
if(defined($forward_internal_name)) {
|
|
|
|
$$function_module{$forward_internal_name} .= " & $module";
|
|
|
|
}
|
2001-07-30 20:49:10 +02:00
|
|
|
}
|
|
|
|
}
|
1999-10-24 23:45:39 +02:00
|
|
|
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub win16api() {
|
2001-07-11 19:27:45 +02:00
|
|
|
return $win16api;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub win32api() {
|
2001-07-11 19:27:45 +02:00
|
|
|
return $win32api;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub parse_api_file($$) {
|
1999-10-24 23:45:39 +02:00
|
|
|
my $self = shift;
|
2000-04-15 22:39:55 +02:00
|
|
|
|
1999-09-23 17:14:20 +02:00
|
|
|
my $allowed_kind = \%{$self->{ALLOWED_KIND}};
|
|
|
|
my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
|
|
|
|
my $allowed_modules_limited = \%{$self->{ALLOWED_MODULES_LIMITED}};
|
1999-10-24 23:45:39 +02:00
|
|
|
my $allowed_modules_unlimited = \%{$self->{ALLOWED_MODULES_UNLIMITED}};
|
1999-09-23 17:14:20 +02:00
|
|
|
my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
|
2000-05-11 23:46:17 +02:00
|
|
|
my $type_format = \%{$self->{TYPE_FORMAT}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
|
|
|
my $file = shift;
|
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
my $module;
|
1999-09-23 17:14:20 +02:00
|
|
|
my $kind;
|
2000-05-11 23:46:17 +02:00
|
|
|
my $format;
|
1999-09-23 17:14:20 +02:00
|
|
|
my $forbidden = 0;
|
|
|
|
|
2001-08-22 20:09:15 +02:00
|
|
|
$output->lazy_progress("$file");
|
1999-10-24 23:45:39 +02:00
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
open(IN, "< $winapi_dir/$file") || die "$winapi_dir/$file: $!\n";
|
1999-09-23 17:14:20 +02:00
|
|
|
$/ = "\n";
|
2007-01-26 13:21:54 +01:00
|
|
|
my $linenum=0;
|
1999-09-23 17:14:20 +02:00
|
|
|
while(<IN>) {
|
2007-01-26 13:21:54 +01:00
|
|
|
$linenum++;
|
1999-09-23 17:14:20 +02:00
|
|
|
s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begin and end of line
|
|
|
|
s/^(.*?)\s*#.*$/$1/; # remove comments
|
|
|
|
/^$/ && next; # skip empty lines
|
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
if(/^%%(\S+)$/) {
|
|
|
|
$module = $1;
|
|
|
|
$module =~ s/\.dll$//; # FIXME: Kludge
|
|
|
|
} elsif(!$modules->is_allowed_module($module)) {
|
|
|
|
# Nothing
|
|
|
|
} elsif(s/^%(\S+)\s*//) {
|
1999-09-23 17:14:20 +02:00
|
|
|
$kind = $1;
|
2000-05-11 23:46:17 +02:00
|
|
|
$format = undef;
|
1999-09-23 17:14:20 +02:00
|
|
|
$forbidden = 0;
|
|
|
|
|
|
|
|
$$allowed_kind{$kind} = 1;
|
1999-10-24 23:45:39 +02:00
|
|
|
if(/^--forbidden/) {
|
1999-09-23 17:14:20 +02:00
|
|
|
$forbidden = 1;
|
2000-05-11 23:46:17 +02:00
|
|
|
} elsif(/^--format=(\".*?\"|\S*)/) {
|
|
|
|
$format = $1;
|
|
|
|
$format =~ s/^\"(.*?)\"$/$1/;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!defined($format)) {
|
|
|
|
if($kind eq "long") {
|
|
|
|
$format = "%d|%u|%x|%X|";
|
|
|
|
$format .= "%hd|%hu|%hx|%hX|";
|
|
|
|
$format .= "%ld|%lu|%lx|%lX|";
|
|
|
|
$format .= "%04x|%04X|0x%04x|0x%04X|";
|
|
|
|
$format .= "%08x|%08X|0x%08x|0x%08X|";
|
|
|
|
$format .= "%08lx|%08lX|0x%08lx|0x%08lX";
|
|
|
|
} elsif($kind eq "longlong") {
|
|
|
|
$format = "%lld";
|
|
|
|
} elsif($kind eq "ptr") {
|
|
|
|
$format = "%p";
|
|
|
|
} elsif($kind eq "segptr") {
|
|
|
|
$format = "%p";
|
|
|
|
} elsif($kind eq "str") {
|
|
|
|
$format = "%p|%s";
|
|
|
|
} elsif($kind eq "wstr") {
|
|
|
|
$format = "%p|%s";
|
|
|
|
} elsif($kind eq "word") {
|
|
|
|
$format = "%d|%u|%x|%X|";
|
|
|
|
$format .= "%hd|%hu|%hx|%hX|";
|
|
|
|
$format .= "%04x|%04X|0x%04x|0x%04X";
|
|
|
|
} else {
|
|
|
|
$format = "<unknown>";
|
|
|
|
}
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
} elsif(defined($kind)) {
|
|
|
|
my $type = $_;
|
2007-01-26 18:21:54 +01:00
|
|
|
if ($type =~ /^long\b/)
|
|
|
|
{
|
|
|
|
$output->write("$file:$linenum: type ($type) is not Win64 compatible\n");
|
|
|
|
}
|
1999-09-23 17:14:20 +02:00
|
|
|
if(!$forbidden) {
|
1999-10-24 23:45:39 +02:00
|
|
|
if(defined($module)) {
|
|
|
|
if($$allowed_modules_unlimited{$type}) {
|
2007-01-26 13:21:54 +01:00
|
|
|
$output->write("$file:$linenum: type ($type) already specified as an unlimited type\n");
|
1999-10-24 23:45:39 +02:00
|
|
|
} elsif(!$$allowed_modules{$type}{$module}) {
|
|
|
|
$$allowed_modules{$type}{$module} = 1;
|
|
|
|
$$allowed_modules_limited{$type} = 1;
|
|
|
|
} else {
|
2007-01-26 13:21:54 +01:00
|
|
|
$output->write("$file:$linenum: type ($type) already specified\n");
|
1999-10-24 23:45:39 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$$allowed_modules_unlimited{$type} = 1;
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$$allowed_modules_limited{$type} = 1;
|
|
|
|
}
|
1999-10-24 23:45:39 +02:00
|
|
|
if(defined($$translate_argument{$type}) && $$translate_argument{$type} ne $kind) {
|
2007-01-26 13:21:54 +01:00
|
|
|
$output->write("$file:$linenum: type ($type) respecified as different kind ($kind != $$translate_argument{$type})\n");
|
1999-10-24 23:45:39 +02:00
|
|
|
} else {
|
|
|
|
$$translate_argument{$type} = $kind;
|
|
|
|
}
|
2002-06-01 04:55:48 +02:00
|
|
|
|
2000-05-11 23:46:17 +02:00
|
|
|
$$type_format{$module}{$type} = $format;
|
1999-09-23 17:14:20 +02:00
|
|
|
} else {
|
2007-01-26 13:21:54 +01:00
|
|
|
$output->write("$file:$linenum: file must begin with %<type> statement\n");
|
1999-09-23 17:14:20 +02:00
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(IN);
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub parse_spec_file($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
1999-10-24 23:45:39 +02:00
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_arguments = \%{$self->{FUNCTION_INTERNAL_ARGUMENTS}};
|
|
|
|
my $function_external_arguments = \%{$self->{FUNCTION_EXTERNAL_ARGUMENTS}};
|
|
|
|
my $function_internal_ordinal = \%{$self->{FUNCTION_INTERNAL_ORDINAL}};
|
|
|
|
my $function_external_ordinal = \%{$self->{FUNCTION_EXTERNAL_ORDINAL}};
|
|
|
|
my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
|
|
|
|
my $function_external_calling_convention = \%{$self->{FUNCTION_EXTERNAL_CALLING_CONVENTION}};
|
2000-07-15 23:32:55 +02:00
|
|
|
my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
|
2000-05-24 01:37:51 +02:00
|
|
|
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
|
2000-07-15 23:32:55 +02:00
|
|
|
my $function_forward = \%{$self->{FUNCTION_FORWARD}};
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
|
|
|
|
my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
|
2002-09-24 20:27:47 +02:00
|
|
|
my $function_wine_extension = \%{$self->{FUNCTION_WINE_EXTENSION}};
|
2000-04-15 22:39:55 +02:00
|
|
|
my $modules = \%{$self->{MODULES}};
|
2000-06-11 22:02:29 +02:00
|
|
|
my $module_files = \%{$self->{MODULE_FILES}};
|
2002-07-22 22:37:30 +02:00
|
|
|
my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
|
|
|
my $file = shift;
|
2001-06-21 00:53:21 +02:00
|
|
|
$file =~ s%^\./%%;
|
1999-10-24 23:45:39 +02:00
|
|
|
|
|
|
|
my %ordinals;
|
1999-09-23 17:14:20 +02:00
|
|
|
my $module;
|
2002-09-24 20:27:47 +02:00
|
|
|
my $wine_extension = 0;
|
1999-09-23 17:14:20 +02:00
|
|
|
|
2001-08-22 20:09:15 +02:00
|
|
|
$output->lazy_progress("$file");
|
1999-10-24 23:45:39 +02:00
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
$module = $file;
|
|
|
|
$module =~ s/^.*?([^\/]*)\.spec$/$1/;
|
|
|
|
|
1999-09-23 17:14:20 +02:00
|
|
|
open(IN, "< $file") || die "$file: $!\n";
|
|
|
|
$/ = "\n";
|
|
|
|
my $header = 1;
|
|
|
|
my $lookahead = 0;
|
|
|
|
while($lookahead || defined($_ = <IN>)) {
|
|
|
|
$lookahead = 0;
|
|
|
|
s/^\s*(.*?)\s*$/$1/;
|
2002-09-24 20:27:47 +02:00
|
|
|
if(s/^(.*?)\s*\#\s*(.*)\s*$/$1/) {
|
|
|
|
my $comment = $2;
|
2003-08-08 23:04:17 +02:00
|
|
|
if ($comment =~ /^Wine/i) { # FIXME: Kludge
|
2002-09-24 20:27:47 +02:00
|
|
|
$wine_extension = 1;
|
|
|
|
}
|
|
|
|
}
|
1999-09-23 17:14:20 +02:00
|
|
|
/^$/ && next;
|
|
|
|
|
|
|
|
if($header) {
|
2000-04-15 22:39:55 +02:00
|
|
|
if(/^\d+|@/) { $header = 0; $lookahead = 1; }
|
1999-09-23 17:14:20 +02:00
|
|
|
next;
|
2002-06-01 04:55:48 +02:00
|
|
|
}
|
1999-09-23 17:14:20 +02:00
|
|
|
|
1999-10-24 23:45:39 +02:00
|
|
|
my $ordinal;
|
2000-11-30 02:31:44 +01:00
|
|
|
if(/^(\d+|@)\s+
|
2003-09-29 22:15:24 +02:00
|
|
|
(pascal|stdcall|cdecl|varargs)\s+
|
|
|
|
((?:(?:-noname|-norelay|-i386|-ret16|-ret64|-register|-interrupt|-private)\s+)*)(\S+)\s*\(\s*(.*?)\s*\)\s*(\S*)$/x)
|
2000-11-30 02:31:44 +01:00
|
|
|
{
|
1999-10-24 23:45:39 +02:00
|
|
|
my $calling_convention = $2;
|
2002-01-07 22:08:18 +01:00
|
|
|
my $flags = $3;
|
|
|
|
my $external_name = $4;
|
|
|
|
my $arguments = $5;
|
|
|
|
my $internal_name = $6;
|
|
|
|
|
1999-10-24 23:45:39 +02:00
|
|
|
$ordinal = $1;
|
1999-09-23 17:14:20 +02:00
|
|
|
|
2002-01-07 22:08:18 +01:00
|
|
|
$flags =~ s/\s+/ /g;
|
|
|
|
|
2007-02-09 12:31:57 +01:00
|
|
|
if (!$internal_name)
|
|
|
|
{
|
|
|
|
$internal_name = ($flags =~ /-register/ ? "__regs_" : "") . $external_name;
|
|
|
|
}
|
2003-08-08 23:04:17 +02:00
|
|
|
|
2002-08-09 03:03:48 +02:00
|
|
|
if($flags =~ /-noname/) {
|
|
|
|
# $external_name = "@";
|
|
|
|
}
|
|
|
|
|
2002-01-07 22:08:18 +01:00
|
|
|
if($flags =~ /(?:-register|-interrupt)/) {
|
|
|
|
if($arguments) { $arguments .= " "; }
|
|
|
|
$arguments .= "ptr";
|
2002-11-27 21:11:10 +01:00
|
|
|
$calling_convention .= " -register";
|
2002-01-07 22:08:18 +01:00
|
|
|
}
|
2007-02-09 12:31:57 +01:00
|
|
|
if($flags =~ /(?:-i386)/) {
|
|
|
|
$calling_convention .= " -i386";
|
|
|
|
}
|
2002-01-07 22:08:18 +01:00
|
|
|
|
2003-01-02 20:26:11 +01:00
|
|
|
if ($internal_name =~ /^(.*?)\.(.*?)$/) {
|
2003-08-08 23:04:17 +02:00
|
|
|
my $forward_module = lc($1);
|
2003-01-02 20:26:11 +01:00
|
|
|
my $forward_name = $2;
|
|
|
|
|
|
|
|
if (0) {
|
|
|
|
$calling_convention .= " -forward";
|
|
|
|
} else {
|
|
|
|
$calling_convention = "forward";
|
|
|
|
}
|
|
|
|
|
|
|
|
$$function_forward{$module}{$external_name} = [$forward_module, $forward_name];
|
|
|
|
}
|
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
if($external_name ne "@") {
|
|
|
|
$$module_external_calling_convention{$module}{$external_name} = $calling_convention;
|
|
|
|
} else {
|
|
|
|
$$module_external_calling_convention{$module}{"\@$ordinal"} = $calling_convention;
|
|
|
|
}
|
2001-06-28 20:01:39 +02:00
|
|
|
if(!$$function_internal_name{$external_name}) {
|
|
|
|
$$function_internal_name{$external_name} = $internal_name;
|
|
|
|
} else {
|
|
|
|
$$function_internal_name{$external_name} .= " & $internal_name";
|
|
|
|
}
|
|
|
|
if(!$$function_external_name{$internal_name}) {
|
|
|
|
$$function_external_name{$internal_name} = $external_name;
|
|
|
|
} else {
|
|
|
|
$$function_external_name{$internal_name} .= " & $external_name";
|
|
|
|
}
|
2001-06-19 05:34:52 +02:00
|
|
|
$$function_internal_arguments{$internal_name} = $arguments;
|
|
|
|
$$function_external_arguments{$external_name} = $arguments;
|
2001-06-21 00:53:21 +02:00
|
|
|
if(!$$function_internal_ordinal{$internal_name}) {
|
|
|
|
$$function_internal_ordinal{$internal_name} = $ordinal;
|
|
|
|
} else {
|
|
|
|
$$function_internal_ordinal{$internal_name} .= " & $ordinal";
|
|
|
|
}
|
|
|
|
if(!$$function_external_ordinal{$external_name}) {
|
|
|
|
$$function_external_ordinal{$external_name} = $ordinal;
|
|
|
|
} else {
|
|
|
|
$$function_external_ordinal{$external_name} .= " & $ordinal";
|
|
|
|
}
|
2001-06-19 05:34:52 +02:00
|
|
|
$$function_internal_calling_convention{$internal_name} = $calling_convention;
|
|
|
|
$$function_external_calling_convention{$external_name} = $calling_convention;
|
|
|
|
if(!$$function_internal_module{$internal_name}) {
|
|
|
|
$$function_internal_module{$internal_name} = "$module";
|
2001-06-28 20:01:39 +02:00
|
|
|
} else {
|
2001-06-19 05:34:52 +02:00
|
|
|
$$function_internal_module{$internal_name} .= " & $module";
|
|
|
|
}
|
|
|
|
if(!$$function_external_module{$external_name}) {
|
|
|
|
$$function_external_module{$external_name} = "$module";
|
2001-06-28 20:01:39 +02:00
|
|
|
} else {
|
2001-06-19 05:34:52 +02:00
|
|
|
$$function_external_module{$external_name} .= " & $module";
|
1999-12-12 00:01:45 +01:00
|
|
|
}
|
2002-09-24 20:27:47 +02:00
|
|
|
$$function_wine_extension{$module}{$external_name} = $wine_extension;
|
2000-04-06 22:11:04 +02:00
|
|
|
|
2001-07-26 23:42:12 +02:00
|
|
|
if(0 && $options->spec_mismatch) {
|
2000-04-06 22:11:04 +02:00
|
|
|
if($external_name eq "@") {
|
|
|
|
if($internal_name !~ /^\U$module\E_$ordinal$/) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$output->write("$file: $external_name: the internal name ($internal_name) mismatch\n");
|
2000-04-06 22:11:04 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
my $name = $external_name;
|
|
|
|
|
|
|
|
my $name1 = $name;
|
|
|
|
$name1 =~ s/^Zw/Nt/;
|
|
|
|
|
|
|
|
my $name2 = $name;
|
|
|
|
$name2 =~ s/^(?:_|Rtl|k32|K32)//;
|
|
|
|
|
|
|
|
my $name3 = $name;
|
|
|
|
$name3 =~ s/^INT_Int[0-9a-f]{2}Handler$/BUILTIN_DefaultIntHandler/;
|
|
|
|
|
|
|
|
my $name4 = $name;
|
|
|
|
$name4 =~ s/^(VxDCall)\d$/$1/;
|
|
|
|
|
2007-02-20 15:57:10 +01:00
|
|
|
# FIXME: This special case is because of a very ugly kludge that should be fixed IMHO
|
2000-04-06 22:11:04 +02:00
|
|
|
my $name5 = $name;
|
|
|
|
$name5 =~ s/^(.*?16)_(.*?)$/$1_fn$2/;
|
|
|
|
|
|
|
|
if(uc($internal_name) ne uc($external_name) &&
|
|
|
|
$internal_name !~ /(\Q$name\E|\Q$name1\E|\Q$name2\E|\Q$name3\E|\Q$name4\E|\Q$name5\E)/)
|
|
|
|
{
|
2001-07-26 23:42:12 +02:00
|
|
|
$output->write("$file: $external_name: internal name ($internal_name) mismatch\n");
|
2000-04-06 22:11:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-09-29 22:15:24 +02:00
|
|
|
} elsif(/^(\d+|@)\s+stub(?:\s+(-noname|-norelay|-i386|-ret16|-ret64|-private))?\s+(\S+)$/) {
|
1999-10-24 23:45:39 +02:00
|
|
|
$ordinal = $1;
|
|
|
|
|
2002-08-09 03:03:48 +02:00
|
|
|
my $flags = $2;
|
|
|
|
my $external_name = $3;
|
|
|
|
|
|
|
|
$flags = "" if !defined($flags);
|
|
|
|
|
|
|
|
if($flags =~ /-noname/) {
|
|
|
|
# $external_name = "@";
|
|
|
|
}
|
|
|
|
|
2002-07-19 02:31:05 +02:00
|
|
|
my $internal_name = $external_name;
|
1999-12-12 00:01:45 +01:00
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
if ($external_name ne "@") {
|
|
|
|
$$module_external_calling_convention{$module}{$external_name} = "stub";
|
|
|
|
} else {
|
|
|
|
$$module_external_calling_convention{$module}{"\@$ordinal"} = "stub";
|
|
|
|
}
|
2001-07-08 22:33:20 +02:00
|
|
|
if(!$$function_internal_name{$external_name}) {
|
|
|
|
$$function_internal_name{$external_name} = $internal_name;
|
|
|
|
} else {
|
|
|
|
$$function_internal_name{$external_name} .= " & $internal_name";
|
|
|
|
}
|
|
|
|
if(!$$function_external_name{$internal_name}) {
|
|
|
|
$$function_external_name{$internal_name} = $external_name;
|
|
|
|
} else {
|
|
|
|
$$function_external_name{$internal_name} .= " & $external_name";
|
|
|
|
}
|
2001-06-21 00:53:21 +02:00
|
|
|
if(!$$function_internal_ordinal{$internal_name}) {
|
|
|
|
$$function_internal_ordinal{$internal_name} = $ordinal;
|
|
|
|
} else {
|
|
|
|
$$function_internal_ordinal{$internal_name} .= " & $ordinal";
|
|
|
|
}
|
|
|
|
if(!$$function_external_ordinal{$external_name}) {
|
|
|
|
$$function_external_ordinal{$external_name} = $ordinal;
|
|
|
|
} else {
|
|
|
|
$$function_external_ordinal{$external_name} .= " & $ordinal";
|
|
|
|
}
|
2001-06-19 05:34:52 +02:00
|
|
|
if(!$$function_internal_module{$internal_name}) {
|
|
|
|
$$function_internal_module{$internal_name} = "$module";
|
2001-06-21 00:53:21 +02:00
|
|
|
} else { # if($$function_internal_module{$internal_name} !~ /$module/) {
|
2001-06-19 05:34:52 +02:00
|
|
|
$$function_internal_module{$internal_name} .= " & $module";
|
|
|
|
}
|
|
|
|
if(!$$function_external_module{$external_name}) {
|
|
|
|
$$function_external_module{$external_name} = "$module";
|
2001-06-21 00:53:21 +02:00
|
|
|
} else { # if($$function_external_module{$external_name} !~ /$module/) {
|
2001-06-19 05:34:52 +02:00
|
|
|
$$function_external_module{$external_name} .= " & $module";
|
1999-12-12 00:01:45 +01:00
|
|
|
}
|
2003-09-29 22:15:24 +02:00
|
|
|
} elsif(/^(\d+|@)\s+extern(?:\s+(?:-norelay|-i386|-ret16|-ret64))?\s+(\S+)\s*(\S*)$/) {
|
2002-07-22 22:37:30 +02:00
|
|
|
$ordinal = $1;
|
|
|
|
|
|
|
|
my $external_name = $2;
|
|
|
|
my $internal_name = $3;
|
|
|
|
|
2003-08-08 23:04:17 +02:00
|
|
|
$internal_name = $external_name if !$internal_name;
|
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
if ($external_name ne "@") {
|
|
|
|
$$module_external_calling_convention{$module}{$external_name} = "extern";
|
|
|
|
} else {
|
|
|
|
$$module_external_calling_convention{$module}{"\@$ordinal"} = "extern";
|
|
|
|
}
|
2004-10-22 21:55:42 +02:00
|
|
|
} elsif(/^(?:\d+|@)\s+(?:equate|variable)/) {
|
1999-09-23 17:14:20 +02:00
|
|
|
# ignore
|
|
|
|
} else {
|
|
|
|
my $next_line = <IN>;
|
2000-04-15 22:39:55 +02:00
|
|
|
if(!defined($next_line) || $next_line =~ /^\s*\d|@/) {
|
1999-09-23 17:14:20 +02:00
|
|
|
die "$file: $.: syntax error: '$_'\n";
|
|
|
|
} else {
|
|
|
|
$_ .= $next_line;
|
|
|
|
$lookahead = 1;
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 04:55:48 +02:00
|
|
|
|
1999-10-24 23:45:39 +02:00
|
|
|
if(defined($ordinal)) {
|
2000-01-08 23:20:32 +01:00
|
|
|
if($ordinal ne "@" && $ordinals{$ordinal}) {
|
2001-07-26 23:42:12 +02:00
|
|
|
$output->write("$file: ordinal redefined: $_\n");
|
1999-10-24 23:45:39 +02:00
|
|
|
}
|
|
|
|
$ordinals{$ordinal}++;
|
|
|
|
}
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
close(IN);
|
2000-04-15 22:39:55 +02:00
|
|
|
|
|
|
|
$$modules{$module}++;
|
2001-06-19 05:34:52 +02:00
|
|
|
|
|
|
|
$$module_files{$module} = $file;
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub name($) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
1999-10-24 23:45:39 +02:00
|
|
|
my $name = \${$self->{NAME}};
|
|
|
|
|
|
|
|
return $$name;
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_allowed_kind($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $allowed_kind = \%{$self->{ALLOWED_KIND}};
|
|
|
|
|
|
|
|
my $kind = shift;
|
|
|
|
if(defined($kind)) {
|
|
|
|
return $$allowed_kind{$kind};
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2002-03-23 22:39:31 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub allow_kind($$) {
|
2002-03-23 22:39:31 +01:00
|
|
|
my $self = shift;
|
|
|
|
my $allowed_kind = \%{$self->{ALLOWED_KIND}};
|
|
|
|
|
|
|
|
my $kind = shift;
|
|
|
|
|
|
|
|
$$allowed_kind{$kind}++;
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_limited_type($$) {
|
1999-10-24 23:45:39 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $allowed_modules_limited = \%{$self->{ALLOWED_MODULES_LIMITED}};
|
|
|
|
|
|
|
|
my $type = shift;
|
|
|
|
|
|
|
|
return $$allowed_modules_limited{$type};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_allowed_type_in_module($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
|
|
|
|
my $allowed_modules_limited = \%{$self->{ALLOWED_MODULES_LIMITED}};
|
|
|
|
|
|
|
|
my $type = shift;
|
2000-01-29 22:01:47 +01:00
|
|
|
my @modules = split(/ \& /, shift);
|
|
|
|
|
|
|
|
if(!$$allowed_modules_limited{$type}) { return 1; }
|
1999-09-23 17:14:20 +02:00
|
|
|
|
2000-01-29 22:01:47 +01:00
|
|
|
foreach my $module (@modules) {
|
|
|
|
if($$allowed_modules{$type}{$module}) { return 1; }
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub allow_type_in_module($$) {
|
2002-03-23 22:39:31 +01:00
|
|
|
my $self = shift;
|
|
|
|
my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
|
|
|
|
|
|
|
|
my $type = shift;
|
|
|
|
my @modules = split(/ \& /, shift);
|
|
|
|
|
|
|
|
foreach my $module (@modules) {
|
|
|
|
$$allowed_modules{$type}{$module}++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub type_used_in_module($$) {
|
1999-10-24 23:45:39 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $used_modules = \%{$self->{USED_MODULES}};
|
|
|
|
|
|
|
|
my $type = shift;
|
2000-01-29 22:01:47 +01:00
|
|
|
my @modules = split(/ \& /, shift);
|
|
|
|
|
|
|
|
foreach my $module (@modules) {
|
|
|
|
$$used_modules{$type}{$module} = 1;
|
|
|
|
}
|
1999-10-24 23:45:39 +02:00
|
|
|
|
|
|
|
return ();
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub types_not_used($) {
|
1999-10-24 23:45:39 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $used_modules = \%{$self->{USED_MODULES}};
|
|
|
|
my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
|
|
|
|
|
|
|
|
my $not_used;
|
|
|
|
foreach my $type (sort(keys(%$allowed_modules))) {
|
|
|
|
foreach my $module (sort(keys(%{$$allowed_modules{$type}}))) {
|
|
|
|
if(!$$used_modules{$type}{$module}) {
|
|
|
|
$$not_used{$module}{$type} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $not_used;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub types_unlimited_used_in_modules($) {
|
2000-01-29 22:01:47 +01:00
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
my $used_modules = \%{$self->{USED_MODULES}};
|
|
|
|
my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
|
|
|
|
my $allowed_modules_unlimited = \%{$self->{ALLOWED_MODULES_UNLIMITED}};
|
|
|
|
|
|
|
|
my $used_types;
|
|
|
|
foreach my $type (sort(keys(%$allowed_modules_unlimited))) {
|
|
|
|
my $count = 0;
|
|
|
|
my @modules = ();
|
|
|
|
foreach my $module (sort(keys(%{$$used_modules{$type}}))) {
|
|
|
|
$count++;
|
|
|
|
push @modules, $module;
|
|
|
|
}
|
2000-02-29 22:59:09 +01:00
|
|
|
if($count) {
|
2000-01-29 22:01:47 +01:00
|
|
|
foreach my $module (@modules) {
|
|
|
|
$$used_types{$type}{$module} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $used_types;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub translate_argument($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
|
|
|
|
|
2002-03-23 22:39:31 +01:00
|
|
|
my $type = shift;
|
|
|
|
|
|
|
|
return $$translate_argument{$type};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub declare_argument($$$) {
|
2002-03-23 22:39:31 +01:00
|
|
|
my $self = shift;
|
|
|
|
my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
|
|
|
|
|
|
|
|
my $type = shift;
|
|
|
|
my $kind = shift;
|
1999-09-23 17:14:20 +02:00
|
|
|
|
2002-03-23 22:39:31 +01:00
|
|
|
$$translate_argument{$type} = $kind;
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_declared_types($) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
|
|
|
|
|
|
|
|
return sort(keys(%$translate_argument));
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_allowed_type_format($$$$) {
|
2000-05-11 23:46:17 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $type_format = \%{$self->{TYPE_FORMAT}};
|
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
my $type = shift;
|
|
|
|
my $format = shift;
|
|
|
|
|
|
|
|
my $formats;
|
|
|
|
|
|
|
|
if(defined($module) && defined($type)) {
|
|
|
|
local $_;
|
|
|
|
foreach (split(/ & /, $module)) {
|
2002-06-01 04:55:48 +02:00
|
|
|
if(defined($formats)) {
|
|
|
|
$formats .= "|";
|
2000-05-11 23:46:17 +02:00
|
|
|
} else {
|
|
|
|
$formats = "";
|
2002-06-01 04:55:48 +02:00
|
|
|
}
|
2000-05-11 23:46:17 +02:00
|
|
|
if(defined($$type_format{$_}{$type})) {
|
|
|
|
$formats .= $$type_format{$_}{$type};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(defined($formats)) {
|
|
|
|
local $_;
|
|
|
|
foreach (split(/\|/, $formats)) {
|
|
|
|
if($_ eq $format) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_modules($) {
|
2000-04-15 22:39:55 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $modules = \%{$self->{MODULES}};
|
|
|
|
|
|
|
|
return sort(keys(%$modules));
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_module($$) {
|
2000-04-24 20:02:32 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $modules = \%{$self->{MODULES}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$modules{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub module_file($$) {
|
2000-06-11 22:02:29 +02:00
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
|
|
|
|
my $module_files = \%{$self->{MODULE_FILES}};
|
|
|
|
|
|
|
|
return $$module_files{$module};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_internal_functions($) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
return sort(keys(%$function_internal_calling_convention));
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_internal_functions_in_module($$) {
|
2000-05-18 02:07:31 +02:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
|
|
|
|
my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
|
2000-05-18 02:07:31 +02:00
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
|
|
|
|
my @names;
|
2001-06-19 05:34:52 +02:00
|
|
|
foreach my $name (keys(%$function_internal_calling_convention)) {
|
|
|
|
if($$function_internal_module{$name} eq $module) {
|
2000-05-18 02:07:31 +02:00
|
|
|
push @names, $name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sort(@names);
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_external_functions($) {
|
2001-07-14 02:48:41 +02:00
|
|
|
my $self = shift;
|
2002-07-22 22:37:30 +02:00
|
|
|
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
|
2001-07-14 02:48:41 +02:00
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
return sort(keys(%$function_external_name));
|
2001-07-14 02:48:41 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_external_functions_in_module($$) {
|
2001-07-14 02:48:41 +02:00
|
|
|
my $self = shift;
|
2002-07-22 22:37:30 +02:00
|
|
|
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
|
2001-07-14 02:48:41 +02:00
|
|
|
my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
|
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
|
|
|
|
my @names;
|
2002-07-22 22:37:30 +02:00
|
|
|
foreach my $name (keys(%$function_external_name)) {
|
2001-07-14 02:48:41 +02:00
|
|
|
if($$function_external_module{$name} eq $module) {
|
|
|
|
push @names, $name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sort(@names);
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_functions_in_module($$) {
|
2000-04-06 22:11:04 +02:00
|
|
|
my $self = shift;
|
2002-07-22 22:37:30 +02:00
|
|
|
my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
|
2001-07-13 00:22:05 +02:00
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
my $module = shift;
|
|
|
|
|
|
|
|
return sort(keys(%{$$module_external_calling_convention{$module}}));
|
2001-07-13 00:22:05 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_broken_forwards($) {
|
2001-07-13 00:22:05 +02:00
|
|
|
my $self = shift;
|
2002-07-22 22:37:30 +02:00
|
|
|
my $function_forward = \%{$self->{FUNCTION_FORWARD}};
|
2001-07-13 00:22:05 +02:00
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
my @broken_forwards = ();
|
|
|
|
foreach my $module (sort(keys(%$function_forward))) {
|
|
|
|
foreach my $external_name (sort(keys(%{$$function_forward{$module}}))) {
|
|
|
|
(my $forward_module, my $forward_external_name) = @{$$function_forward{$module}{$external_name}};
|
2000-04-06 22:11:04 +02:00
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
my $forward_external_calling_convention =
|
|
|
|
$self->function_external_calling_convention_in_module($forward_module, $forward_external_name);
|
|
|
|
|
|
|
|
if(!defined($forward_external_calling_convention)) {
|
|
|
|
push @broken_forwards, [$module, $external_name, $forward_module, $forward_external_name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return @broken_forwards;
|
2000-04-06 22:11:04 +02:00
|
|
|
}
|
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_internal_ordinal($$) {
|
2001-06-19 05:34:52 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_internal_ordinal = \%{$self->{FUNCTION_INTERNAL_ORDINAL}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_internal_ordinal{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_external_ordinal($$) {
|
2001-06-19 05:34:52 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_external_ordinal = \%{$self->{FUNCTION_EXTERNAL_ORDINAL}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_external_ordinal{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_internal_calling_convention($$) {
|
2000-12-21 22:05:52 +01:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
|
2000-12-21 22:05:52 +01:00
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
return $$function_internal_calling_convention{$name};
|
2000-12-21 22:05:52 +01:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_external_calling_convention($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_external_calling_convention = \%{$self->{FUNCTION_EXTERNAL_CALLING_CONVENTION}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
return $$function_external_calling_convention{$name};
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_external_calling_convention_in_module($$$) {
|
2002-07-22 22:37:30 +02:00
|
|
|
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};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_internal_name($$) {
|
2001-07-02 03:21:48 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_internal_name{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_external_name($$) {
|
2000-05-24 01:37:51 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_external_name{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_forward_final_destination($$$) {
|
2002-07-22 22:37:30 +02:00
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
my $function_forward = \%{$self->{FUNCTION_FORWARD}};
|
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
my $forward_module = $module;
|
|
|
|
my $forward_name = $name;
|
|
|
|
while(defined(my $forward = $$function_forward{$forward_module}{$forward_name})) {
|
|
|
|
($forward_module, $forward_name) = @$forward;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ($forward_module, $forward_name);
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_function($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
return $$function_internal_calling_convention{$name};
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub all_shared_internal_functions($$) {
|
2001-07-11 19:27:45 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_shared = \%{$self->{FUNCTION_SHARED}};
|
|
|
|
|
|
|
|
return sort(keys(%$function_shared));
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_shared_internal_function($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_shared = \%{$self->{FUNCTION_SHARED}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_shared{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub found_shared_internal_function($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_shared = \%{$self->{FUNCTION_SHARED}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
$$function_shared{$name} = 1;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_internal_arguments($$) {
|
2001-06-19 05:34:52 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_internal_arguments = \%{$self->{FUNCTION_INTERNAL_ARGUMENTS}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_internal_arguments{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_external_arguments($$) {
|
2001-06-19 05:34:52 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_external_arguments = \%{$self->{FUNCTION_EXTERNAL_ARGUMENTS}};
|
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_external_arguments{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_internal_module($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
return $$function_internal_module{$name};
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_external_module($$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
2001-06-19 05:34:52 +02:00
|
|
|
my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
|
|
|
my $name = shift;
|
|
|
|
|
2001-06-19 05:34:52 +02:00
|
|
|
return $$function_external_module{$name};
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub function_wine_extension($$$) {
|
2002-09-24 20:27:47 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $function_wine_extension = \%{$self->{FUNCTION_WINE_EXTENSION}};
|
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
return $$function_wine_extension{$module}{$name};
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_function_stub($$$) {
|
2001-07-13 00:22:05 +02:00
|
|
|
my $self = shift;
|
2002-07-22 22:37:30 +02:00
|
|
|
my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
|
2001-07-13 00:22:05 +02:00
|
|
|
|
|
|
|
my $module = shift;
|
|
|
|
my $name = shift;
|
|
|
|
|
2003-08-08 23:04:17 +02:00
|
|
|
if($$module_external_calling_convention{$module}{$name} eq "stub") {
|
|
|
|
return 1;
|
2001-07-13 00:22:05 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub is_function_stub_in_module($$$) {
|
1999-09-23 17:14:20 +02:00
|
|
|
my $self = shift;
|
2002-07-22 22:37:30 +02:00
|
|
|
my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
|
1999-09-23 17:14:20 +02:00
|
|
|
|
2001-07-13 00:22:05 +02:00
|
|
|
my $module = shift;
|
1999-09-23 17:14:20 +02:00
|
|
|
my $name = shift;
|
|
|
|
|
2002-07-22 22:37:30 +02:00
|
|
|
if(!defined($$module_external_calling_convention{$module}{$name})) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return $$module_external_calling_convention{$module}{$name} eq "stub";
|
1999-09-23 17:14:20 +02:00
|
|
|
}
|
|
|
|
|
2001-07-08 22:33:20 +02:00
|
|
|
########################################################################
|
|
|
|
# class methods
|
|
|
|
#
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub _get_all_module_internal_ordinal($$) {
|
2001-07-11 19:27:45 +02:00
|
|
|
my $winapi = shift;
|
2001-07-08 22:33:20 +02:00
|
|
|
my $internal_name = shift;
|
|
|
|
|
|
|
|
my @entries = ();
|
2001-07-11 19:27:45 +02:00
|
|
|
|
|
|
|
my @name = (); {
|
|
|
|
my $name = $winapi->function_external_name($internal_name);
|
|
|
|
if(defined($name)) {
|
|
|
|
@name = split(/ & /, $name);
|
2001-07-08 22:33:20 +02:00
|
|
|
}
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
my @module = (); {
|
|
|
|
my $module = $winapi->function_internal_module($internal_name);
|
|
|
|
if(defined($module)) {
|
|
|
|
@module = split(/ & /, $module);
|
2001-07-08 22:33:20 +02:00
|
|
|
}
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
2001-07-08 22:33:20 +02:00
|
|
|
|
2001-07-11 19:27:45 +02:00
|
|
|
my @ordinal = (); {
|
|
|
|
my $ordinal = $winapi->function_internal_ordinal($internal_name);
|
|
|
|
if(defined($ordinal)) {
|
|
|
|
@ordinal = split(/ & /, $ordinal);
|
2001-07-08 22:33:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-11 19:27:45 +02:00
|
|
|
my $name;
|
|
|
|
my $module;
|
|
|
|
my $ordinal;
|
|
|
|
while(defined($name = shift @name) &&
|
|
|
|
defined($module = shift @module) &&
|
2002-06-01 04:55:48 +02:00
|
|
|
defined($ordinal = shift @ordinal))
|
2001-07-11 19:27:45 +02:00
|
|
|
{
|
|
|
|
push @entries, [$name, $module, $ordinal];
|
|
|
|
}
|
|
|
|
|
2001-07-08 22:33:20 +02:00
|
|
|
return @entries;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub get_all_module_internal_ordinal16($) {
|
|
|
|
return _get_all_module_internal_ordinal($win16api, $_[0]);
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
2001-07-08 22:33:20 +02:00
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub get_all_module_internal_ordinal32($) {
|
|
|
|
return _get_all_module_internal_ordinal($win32api, $_[0]);
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub get_all_module_internal_ordinal($) {
|
2001-07-08 22:33:20 +02:00
|
|
|
my @entries = ();
|
|
|
|
foreach my $winapi (@winapis) {
|
2004-10-26 02:12:21 +02:00
|
|
|
push @entries, _get_all_module_internal_ordinal($winapi, $_[0]);
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return @entries;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub _get_all_module_external_ordinal($$) {
|
2001-07-11 19:27:45 +02:00
|
|
|
my $winapi = shift;
|
|
|
|
my $external_name = shift;
|
|
|
|
|
|
|
|
my @entries = ();
|
|
|
|
|
|
|
|
my @name = (); {
|
|
|
|
my $name = $winapi->function_internal_name($external_name);
|
|
|
|
if(defined($name)) {
|
|
|
|
@name = split(/ & /, $name);
|
2001-07-08 22:33:20 +02:00
|
|
|
}
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
my @module = (); {
|
|
|
|
my $module = $winapi->function_external_module($external_name);
|
|
|
|
if(defined($module)) {
|
|
|
|
@module = split(/ & /, $module);
|
2001-07-08 22:33:20 +02:00
|
|
|
}
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
2001-07-08 22:33:20 +02:00
|
|
|
|
2001-07-11 19:27:45 +02:00
|
|
|
my @ordinal = (); {
|
|
|
|
my $ordinal = $winapi->function_external_ordinal($external_name);
|
|
|
|
if(defined($ordinal)) {
|
|
|
|
@ordinal = split(/ & /, $ordinal);
|
2001-07-08 22:33:20 +02:00
|
|
|
}
|
|
|
|
}
|
2002-06-01 04:55:48 +02:00
|
|
|
|
2001-07-11 19:27:45 +02:00
|
|
|
my $name;
|
|
|
|
my $module;
|
|
|
|
my $ordinal;
|
|
|
|
while(defined($name = shift @name) &&
|
|
|
|
defined($module = shift @module) &&
|
2002-06-01 04:55:48 +02:00
|
|
|
defined($ordinal = shift @ordinal))
|
2001-07-11 19:27:45 +02:00
|
|
|
{
|
|
|
|
push @entries, [$name, $module, $ordinal];
|
|
|
|
}
|
2002-06-01 04:55:48 +02:00
|
|
|
|
2001-07-11 19:27:45 +02:00
|
|
|
return @entries;
|
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub get_all_module_external_ordinal16($) {
|
|
|
|
return _get_all_module_external_ordinal($win16api, $_[0]);
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub get_all_module_external_ordinal32($) {
|
|
|
|
return _get_all_module_external_ordinal($win32api, $_[0]);
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub get_all_module_external_ordinal($) {
|
2001-07-11 19:27:45 +02:00
|
|
|
my @entries = ();
|
|
|
|
foreach my $winapi (@winapis) {
|
2004-10-26 02:12:21 +02:00
|
|
|
push @entries, _get_all_module_external_ordinal($winapi, $_[0]);
|
2001-07-11 19:27:45 +02:00
|
|
|
}
|
2001-07-08 22:33:20 +02:00
|
|
|
|
|
|
|
return @entries;
|
|
|
|
}
|
|
|
|
|
1999-09-23 17:14:20 +02:00
|
|
|
1;
|