2 # Copyright 1999, 2000, 2001 Patrik Stridvall
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 use vars
qw($VERSION @ISA @EXPORT @EXPORT_OK);
29 @EXPORT_OK = qw($win16api $win32api @winapis);
31 use vars qw($win16api $win32api @winapis);
33 use config qw($current_dir $wine_dir $winapi_dir);
34 use options qw($options);
35 use output qw($output);
37 use vars qw($modules);
39 sub found_shared_internal_function($$);
40 sub function_external_calling_convention_in_module($$$);
41 sub function_internal_module($$);
42 sub is_function_stub_in_module($$$);
44 sub parse_api_file($$);
45 sub parse_spec_file($$);
48 $Exporter::ExportLevel++;
50 $Exporter::ExportLevel--;
52 if (defined($modules) && defined($win16api) && defined($win32api)) {
57 import modules qw($modules);
59 my @spec_files16 = $modules->allowed_spec_files16;
60 $win16api = 'winapi'->new("win16", \@spec_files16);
62 my @spec_files32 = $modules->allowed_spec_files32;
63 $win32api = 'winapi'->new("win32", \@spec_files32);
65 @winapis = ($win16api, $win32api);
67 for my $internal_name ($win32api->all_internal_functions) {
68 my $module16 = $win16api->function_internal_module($internal_name);
69 my $module32 = $win16api->function_internal_module($internal_name);
70 if(defined($module16) &&
71 !$win16api->is_function_stub_in_module($module16, $internal_name) &&
72 !$win32api->is_function_stub_in_module($module32, $internal_name))
74 $win16api->found_shared_internal_function($internal_name);
75 $win32api->found_shared_internal_function($internal_name);
83 my $class = ref($proto) || $proto;
85 bless ($self, $class);
87 my $name = \${$self->{NAME}};
88 my $function_forward = \%{$self->{FUNCTION_FORWARD}};
89 my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
90 my $function_module = \%{$self->{FUNCTION_MODULE}};
93 my $refspec_files = shift;
95 foreach my $file (@$refspec_files) {
96 $self->parse_spec_file("$wine_dir/$file");
99 $self->parse_api_file("$$name.api");
101 foreach my $module (sort(keys(%$function_forward))) {
102 foreach my $external_name (sort(keys(%{$$function_forward{$module}}))) {
103 (my $forward_module, my $forward_external_name) = @{$$function_forward{$module}{$external_name}};
104 my $forward_internal_name = $$function_internal_name{$forward_external_name};
105 if(defined($forward_internal_name)) {
106 $$function_module{$forward_internal_name} .= " & $module";
122 sub parse_api_file($$) {
125 my $allowed_kind = \%{$self->{ALLOWED_KIND}};
126 my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
127 my $allowed_modules_limited = \%{$self->{ALLOWED_MODULES_LIMITED}};
128 my $allowed_modules_unlimited = \%{$self->{ALLOWED_MODULES_UNLIMITED}};
129 my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
130 my $type_format = \%{$self->{TYPE_FORMAT}};
139 $output->lazy_progress("$file");
141 open(IN, "< $winapi_dir/$file") || die "$winapi_dir/$file: $!\n";
146 s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begin and end of line
147 s/^(.*?)\s*#.*$/$1/; # remove comments
148 /^$/ && next; # skip empty lines
152 $module =~ s/\.dll$//; # FIXME: Kludge
153 } elsif(!$modules->is_allowed_module($module)) {
155 } elsif(s/^%(\S+)\s*//) {
160 $$allowed_kind{$kind} = 1;
163 } elsif(/^--format=(\".*?\"|\S*)/) {
165 $format =~ s/^\"(.*?)\"$/$1/;
168 if(!defined($format)) {
169 if($kind eq "long") {
170 $format = "%d|%u|%x|%X|";
171 $format .= "%hd|%hu|%hx|%hX|";
172 $format .= "%ld|%lu|%lx|%lX|";
173 $format .= "%04x|%04X|0x%04x|0x%04X|";
174 $format .= "%08x|%08X|0x%08x|0x%08X|";
175 $format .= "%08lx|%08lX|0x%08lx|0x%08lX";
176 } elsif($kind eq "longlong") {
178 } elsif($kind eq "ptr") {
180 } elsif($kind eq "segptr") {
182 } elsif($kind eq "str") {
184 } elsif($kind eq "wstr") {
186 } elsif($kind eq "word") {
187 $format = "%d|%u|%x|%X|";
188 $format .= "%hd|%hu|%hx|%hX|";
189 $format .= "%04x|%04X|0x%04x|0x%04X";
191 $format = "<unknown>";
194 } elsif(defined($kind)) {
196 if ($type =~ /\blong\b/)
198 $output->write("$file:$linenum: type ($type) is not Win64 compatible\n");
201 if(defined($module)) {
202 if($$allowed_modules_unlimited{$type}) {
203 $output->write("$file:$linenum: type ($type) already specified as an unlimited type\n");
204 } elsif(!$$allowed_modules{$type}{$module}) {
205 $$allowed_modules{$type}{$module} = 1;
206 $$allowed_modules_limited{$type} = 1;
208 $output->write("$file:$linenum: type ($type) already specified\n");
211 $$allowed_modules_unlimited{$type} = 1;
214 $$allowed_modules_limited{$type} = 1;
216 if(defined($$translate_argument{$type}) && $$translate_argument{$type} ne $kind) {
217 $output->write("$file:$linenum: type ($type) respecified as different kind ($kind != $$translate_argument{$type})\n");
219 $$translate_argument{$type} = $kind;
222 $$type_format{$module}{$type} = $format;
224 $output->write("$file:$linenum: file must begin with %<type> statement\n");
231 sub parse_spec_file($$) {
234 my $function_internal_arguments = \%{$self->{FUNCTION_INTERNAL_ARGUMENTS}};
235 my $function_external_arguments = \%{$self->{FUNCTION_EXTERNAL_ARGUMENTS}};
236 my $function_internal_ordinal = \%{$self->{FUNCTION_INTERNAL_ORDINAL}};
237 my $function_external_ordinal = \%{$self->{FUNCTION_EXTERNAL_ORDINAL}};
238 my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
239 my $function_external_calling_convention = \%{$self->{FUNCTION_EXTERNAL_CALLING_CONVENTION}};
240 my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
241 my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
242 my $function_forward = \%{$self->{FUNCTION_FORWARD}};
243 my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
244 my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
245 my $function_wine_extension = \%{$self->{FUNCTION_WINE_EXTENSION}};
246 my $modules = \%{$self->{MODULES}};
247 my $module_files = \%{$self->{MODULE_FILES}};
248 my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
255 my $wine_extension = 0;
257 $output->lazy_progress("$file");
260 $module =~ s/^.*?([^\/]*)\.spec$/$1/;
262 open(IN, "< $file") || die "$file: $!\n";
266 while($lookahead || defined($_ = <IN>)) {
269 if(s/^(.*?)\s*\#\s*(.*)\s*$/$1/) {
271 if ($comment =~ /^Wine/i) { # FIXME: Kludge
278 if(/^\d+|@/) { $header = 0; $lookahead = 1; }
283 my $ARCHES="arm|arm64|i386|powerpc|win32|win64|x86_64";
285 (cdecl|pascal|stdcall|varargs|thiscall)\s+
286 ((?:(?:-arch=!?(?:$ARCHES)(?:,(?:$ARCHES))*|-import|-noname|-norelay|-ordinal|-i386|-ret16|-ret64|-fastcall|-register|-interrupt|-private)\s+)*)(\S+)\s*\(\s*(.*?)\s*\)\s*(\S*)$/x)
288 my $calling_convention = $2;
290 my $external_name = $4;
292 my $internal_name = $6;
300 $internal_name = ($flags =~ /-register/ ? "__regs_" : "") . $external_name;
303 if($flags =~ /-noname/) {
304 # $external_name = "@";
307 if($flags =~ /(?:-register|-interrupt)/) {
308 if($arguments) { $arguments .= " "; }
310 $calling_convention .= " -register";
312 if($flags =~ /(?:-i386)/) {
313 $calling_convention .= " -i386";
316 if ($internal_name =~ /^(.*?)\.(.*?)$/) {
317 my $forward_module = lc($1);
318 my $forward_name = $2;
319 $calling_convention = "forward";
320 $$function_forward{$module}{$external_name} = [$forward_module, $forward_name];
323 if($external_name ne "@") {
324 $$module_external_calling_convention{$module}{$external_name} = $calling_convention;
326 $$module_external_calling_convention{$module}{"\@$ordinal"} = $calling_convention;
328 if(!$$function_internal_name{$external_name}) {
329 $$function_internal_name{$external_name} = $internal_name;
331 $$function_internal_name{$external_name} .= " & $internal_name";
333 if(!$$function_external_name{$internal_name}) {
334 $$function_external_name{$internal_name} = $external_name;
336 $$function_external_name{$internal_name} .= " & $external_name";
338 $$function_internal_arguments{$internal_name} = $arguments;
339 $$function_external_arguments{$external_name} = $arguments;
340 if(!$$function_internal_ordinal{$internal_name}) {
341 $$function_internal_ordinal{$internal_name} = $ordinal;
343 $$function_internal_ordinal{$internal_name} .= " & $ordinal";
345 if(!$$function_external_ordinal{$external_name}) {
346 $$function_external_ordinal{$external_name} = $ordinal;
348 $$function_external_ordinal{$external_name} .= " & $ordinal";
350 $$function_internal_calling_convention{$internal_name} = $calling_convention;
351 $$function_external_calling_convention{$external_name} = $calling_convention;
352 if(!$$function_internal_module{$internal_name}) {
353 $$function_internal_module{$internal_name} = "$module";
355 $$function_internal_module{$internal_name} .= " & $module";
357 if(!$$function_external_module{$external_name}) {
358 $$function_external_module{$external_name} = "$module";
360 $$function_external_module{$external_name} .= " & $module";
362 $$function_wine_extension{$module}{$external_name} = $wine_extension;
364 if(0 && $options->spec_mismatch) {
365 if($external_name eq "@") {
366 if($internal_name !~ /^\U$module\E_$ordinal$/) {
367 $output->write("$file: $external_name: the internal name ($internal_name) mismatch\n");
370 my $name = $external_name;
376 $name2 =~ s/^(?:_|Rtl|k32|K32)//;
379 $name3 =~ s/^INT_Int[0-9a-f]{2}Handler$/BUILTIN_DefaultIntHandler/;
382 $name4 =~ s/^(VxDCall)\d$/$1/;
384 # FIXME: This special case is because of a very ugly kludge that should be fixed IMHO
386 $name5 =~ s/^(.*?16)_(.*?)$/$1_fn$2/;
388 if(uc($internal_name) ne uc($external_name) &&
389 $internal_name !~ /(\Q$name\E|\Q$name1\E|\Q$name2\E|\Q$name3\E|\Q$name4\E|\Q$name5\E)/)
391 $output->write("$file: $external_name: internal name ($internal_name) mismatch\n");
395 } elsif(/^(\d+|@)\s+stub(?:\s+(-arch=(?:$ARCHES)(?:,(?:$ARCHES))*|-noname|-norelay|-ordinal|-i386|-ret16|-ret64|-private))*\s+(\S+?)\s*(\(\s*(.*?)\s*\))?$/) {
399 my $external_name = $3;
401 $flags = "" if !defined($flags);
403 if($flags =~ /-noname/) {
404 # $external_name = "@";
407 my $internal_name = $external_name;
409 if ($external_name ne "@") {
410 $$module_external_calling_convention{$module}{$external_name} = "stub";
412 $$module_external_calling_convention{$module}{"\@$ordinal"} = "stub";
414 if(!$$function_internal_name{$external_name}) {
415 $$function_internal_name{$external_name} = $internal_name;
417 $$function_internal_name{$external_name} .= " & $internal_name";
419 if(!$$function_external_name{$internal_name}) {
420 $$function_external_name{$internal_name} = $external_name;
422 $$function_external_name{$internal_name} .= " & $external_name";
424 if(!$$function_internal_ordinal{$internal_name}) {
425 $$function_internal_ordinal{$internal_name} = $ordinal;
427 $$function_internal_ordinal{$internal_name} .= " & $ordinal";
429 if(!$$function_external_ordinal{$external_name}) {
430 $$function_external_ordinal{$external_name} = $ordinal;
432 $$function_external_ordinal{$external_name} .= " & $ordinal";
434 if(!$$function_internal_module{$internal_name}) {
435 $$function_internal_module{$internal_name} = "$module";
436 } else { # if($$function_internal_module{$internal_name} !~ /$module/) {
437 $$function_internal_module{$internal_name} .= " & $module";
439 if(!$$function_external_module{$external_name}) {
440 $$function_external_module{$external_name} = "$module";
441 } else { # if($$function_external_module{$external_name} !~ /$module/) {
442 $$function_external_module{$external_name} .= " & $module";
444 } elsif(/^(\d+|@)\s+extern(?:\s+(?:-arch=(?:$ARCHES)(?:,(?:$ARCHES))*|-noname|-norelay|-ordinal|-i386|-ret16|-ret64))*\s+(\S+)\s*(\S*)$/) {
447 my $external_name = $2;
448 my $internal_name = $3;
450 $internal_name = $external_name if !$internal_name;
452 if ($external_name ne "@") {
453 $$module_external_calling_convention{$module}{$external_name} = "extern";
455 $$module_external_calling_convention{$module}{"\@$ordinal"} = "extern";
457 } elsif(/^(?:\d+|@)\s+(?:equate|variable)/) {
460 my $next_line = <IN>;
461 if(!defined($next_line) || $next_line =~ /^\s*\d|@/) {
462 die "$file: $.: syntax error: '$_'\n";
469 if(defined($ordinal)) {
470 if($ordinal ne "@" && $ordinals{$ordinal}) {
471 $output->write("$file: ordinal redefined: $_\n");
473 $ordinals{$ordinal}++;
478 $$modules{$module}++;
480 $$module_files{$module} = $file;
485 my $name = \${$self->{NAME}};
490 sub is_allowed_kind($$) {
492 my $allowed_kind = \%{$self->{ALLOWED_KIND}};
496 return $$allowed_kind{$kind};
505 my $allowed_kind = \%{$self->{ALLOWED_KIND}};
509 $$allowed_kind{$kind}++;
512 sub is_limited_type($$) {
514 my $allowed_modules_limited = \%{$self->{ALLOWED_MODULES_LIMITED}};
518 return $$allowed_modules_limited{$type};
521 sub is_allowed_type_in_module($$) {
523 my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
524 my $allowed_modules_limited = \%{$self->{ALLOWED_MODULES_LIMITED}};
527 my @modules = split(/ \& /, shift);
529 if(!$$allowed_modules_limited{$type}) { return 1; }
531 foreach my $module (@modules) {
532 if($$allowed_modules{$type}{$module}) { return 1; }
538 sub allow_type_in_module($$) {
540 my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
543 my @modules = split(/ \& /, shift);
545 foreach my $module (@modules) {
546 $$allowed_modules{$type}{$module}++;
550 sub type_used_in_module($$) {
552 my $used_modules = \%{$self->{USED_MODULES}};
555 my @modules = split(/ \& /, shift);
557 foreach my $module (@modules) {
558 $$used_modules{$type}{$module} = 1;
564 sub types_not_used($) {
566 my $used_modules = \%{$self->{USED_MODULES}};
567 my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
570 foreach my $type (sort(keys(%$allowed_modules))) {
571 foreach my $module (sort(keys(%{$$allowed_modules{$type}}))) {
572 if(!$$used_modules{$type}{$module}) {
573 $$not_used{$module}{$type} = 1;
580 sub types_unlimited_used_in_modules($) {
583 my $used_modules = \%{$self->{USED_MODULES}};
584 my $allowed_modules = \%{$self->{ALLOWED_MODULES}};
585 my $allowed_modules_unlimited = \%{$self->{ALLOWED_MODULES_UNLIMITED}};
588 foreach my $type (sort(keys(%$allowed_modules_unlimited))) {
591 foreach my $module (sort(keys(%{$$used_modules{$type}}))) {
593 push @modules, $module;
596 foreach my $module (@modules) {
597 $$used_types{$type}{$module} = 1;
604 sub translate_argument($$) {
606 my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
610 return $$translate_argument{$type};
613 sub declare_argument($$$) {
615 my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
620 $$translate_argument{$type} = $kind;
623 sub all_declared_types($) {
625 my $translate_argument = \%{$self->{TRANSLATE_ARGUMENT}};
627 return sort(keys(%$translate_argument));
630 sub is_allowed_type_format($$$$) {
632 my $type_format = \%{$self->{TYPE_FORMAT}};
640 if(defined($module) && defined($type)) {
642 foreach (split(/ & /, $module)) {
643 if(defined($formats)) {
648 if(defined($$type_format{$_}{$type})) {
649 $formats .= $$type_format{$_}{$type};
654 if(defined($formats)) {
656 foreach (split(/\|/, $formats)) {
668 my $modules = \%{$self->{MODULES}};
670 return sort(keys(%$modules));
675 my $modules = \%{$self->{MODULES}};
679 return $$modules{$name};
682 sub module_file($$) {
687 my $module_files = \%{$self->{MODULE_FILES}};
689 return $$module_files{$module};
692 sub all_internal_functions($) {
694 my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
696 return sort(keys(%$function_internal_calling_convention));
699 sub all_internal_functions_in_module($$) {
701 my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
702 my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
707 foreach my $name (keys(%$function_internal_calling_convention)) {
708 if($$function_internal_module{$name} eq $module) {
716 sub all_external_functions($) {
718 my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
720 return sort(keys(%$function_external_name));
723 sub all_external_functions_in_module($$) {
725 my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
726 my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
731 foreach my $name (keys(%$function_external_name)) {
732 if($$function_external_module{$name} eq $module) {
740 sub all_functions_in_module($$) {
742 my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
746 return sort(keys(%{$$module_external_calling_convention{$module}}));
749 sub all_broken_forwards($) {
751 my $function_forward = \%{$self->{FUNCTION_FORWARD}};
753 my @broken_forwards = ();
754 foreach my $module (sort(keys(%$function_forward))) {
755 foreach my $external_name (sort(keys(%{$$function_forward{$module}}))) {
756 (my $forward_module, my $forward_external_name) = @{$$function_forward{$module}{$external_name}};
758 my $forward_external_calling_convention =
759 $self->function_external_calling_convention_in_module($forward_module, $forward_external_name);
761 if(!defined($forward_external_calling_convention)) {
762 push @broken_forwards, [$module, $external_name, $forward_module, $forward_external_name];
766 return @broken_forwards;
770 sub function_internal_ordinal($$) {
772 my $function_internal_ordinal = \%{$self->{FUNCTION_INTERNAL_ORDINAL}};
776 return $$function_internal_ordinal{$name};
779 sub function_external_ordinal($$) {
781 my $function_external_ordinal = \%{$self->{FUNCTION_EXTERNAL_ORDINAL}};
785 return $$function_external_ordinal{$name};
788 sub function_internal_calling_convention($$) {
790 my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
794 return $$function_internal_calling_convention{$name};
797 sub function_external_calling_convention($$) {
799 my $function_external_calling_convention = \%{$self->{FUNCTION_EXTERNAL_CALLING_CONVENTION}};
803 return $$function_external_calling_convention{$name};
806 sub function_external_calling_convention_in_module($$$) {
808 my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
813 return $$module_external_calling_convention{$module}{$name};
816 sub function_internal_name($$) {
818 my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
822 return $$function_internal_name{$name};
825 sub function_external_name($$) {
827 my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
831 return $$function_external_name{$name};
834 sub function_forward_final_destination($$$) {
837 my $function_forward = \%{$self->{FUNCTION_FORWARD}};
842 my $forward_module = $module;
843 my $forward_name = $name;
844 while(defined(my $forward = $$function_forward{$forward_module}{$forward_name})) {
845 ($forward_module, $forward_name) = @$forward;
848 return ($forward_module, $forward_name);
851 sub is_function($$) {
853 my $function_internal_calling_convention = \%{$self->{FUNCTION_INTERNAL_CALLING_CONVENTION}};
857 return $$function_internal_calling_convention{$name};
860 sub all_shared_internal_functions($$) {
862 my $function_shared = \%{$self->{FUNCTION_SHARED}};
864 return sort(keys(%$function_shared));
867 sub is_shared_internal_function($$) {
869 my $function_shared = \%{$self->{FUNCTION_SHARED}};
873 return $$function_shared{$name};
876 sub found_shared_internal_function($$) {
878 my $function_shared = \%{$self->{FUNCTION_SHARED}};
882 $$function_shared{$name} = 1;
885 sub function_internal_arguments($$) {
887 my $function_internal_arguments = \%{$self->{FUNCTION_INTERNAL_ARGUMENTS}};
891 return $$function_internal_arguments{$name};
894 sub function_external_arguments($$) {
896 my $function_external_arguments = \%{$self->{FUNCTION_EXTERNAL_ARGUMENTS}};
900 return $$function_external_arguments{$name};
903 sub function_internal_module($$) {
905 my $function_internal_module = \%{$self->{FUNCTION_INTERNAL_MODULE}};
909 return $$function_internal_module{$name};
912 sub function_external_module($$) {
914 my $function_external_module = \%{$self->{FUNCTION_EXTERNAL_MODULE}};
918 return $$function_external_module{$name};
921 sub function_wine_extension($$$) {
923 my $function_wine_extension = \%{$self->{FUNCTION_WINE_EXTENSION}};
928 return $$function_wine_extension{$module}{$name};
931 sub is_function_stub($$$) {
933 my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
938 if($$module_external_calling_convention{$module}{$name} eq "stub") {
944 sub is_function_stub_in_module($$$) {
946 my $module_external_calling_convention = \%{$self->{MODULE_EXTERNAL_CALLING_CONVENTION}};
951 if(!defined($$module_external_calling_convention{$module}{$name})) {
954 return $$module_external_calling_convention{$module}{$name} eq "stub";
957 ########################################################################
961 sub _get_all_module_internal_ordinal($$) {
963 my $internal_name = shift;
968 my $name = $winapi->function_external_name($internal_name);
970 @name = split(/ & /, $name);
975 my $module = $winapi->function_internal_module($internal_name);
976 if(defined($module)) {
977 @module = split(/ & /, $module);
982 my $ordinal = $winapi->function_internal_ordinal($internal_name);
983 if(defined($ordinal)) {
984 @ordinal = split(/ & /, $ordinal);
991 while(defined($name = shift @name) &&
992 defined($module = shift @module) &&
993 defined($ordinal = shift @ordinal))
995 push @entries, [$name, $module, $ordinal];
1001 sub get_all_module_internal_ordinal16($) {
1002 return _get_all_module_internal_ordinal($win16api, $_[0]);
1005 sub get_all_module_internal_ordinal32($) {
1006 return _get_all_module_internal_ordinal($win32api, $_[0]);
1009 sub get_all_module_internal_ordinal($) {
1011 foreach my $winapi (@winapis) {
1012 push @entries, _get_all_module_internal_ordinal($winapi, $_[0]);
1018 sub _get_all_module_external_ordinal($$) {
1020 my $external_name = shift;
1025 my $name = $winapi->function_internal_name($external_name);
1026 if(defined($name)) {
1027 @name = split(/ & /, $name);
1032 my $module = $winapi->function_external_module($external_name);
1033 if(defined($module)) {
1034 @module = split(/ & /, $module);
1039 my $ordinal = $winapi->function_external_ordinal($external_name);
1040 if(defined($ordinal)) {
1041 @ordinal = split(/ & /, $ordinal);
1048 while(defined($name = shift @name) &&
1049 defined($module = shift @module) &&
1050 defined($ordinal = shift @ordinal))
1052 push @entries, [$name, $module, $ordinal];
1058 sub get_all_module_external_ordinal16($) {
1059 return _get_all_module_external_ordinal($win16api, $_[0]);
1062 sub get_all_module_external_ordinal32($) {
1063 return _get_all_module_external_ordinal($win32api, $_[0]);
1066 sub get_all_module_external_ordinal($) {
1068 foreach my $winapi (@winapis) {
1069 push @entries, _get_all_module_external_ordinal($winapi, $_[0]);