Fixed one more HeapReAlloc call.
[wine] / tools / winapi_check / winapi_global.pm
1 #
2 # Copyright 1999, 2000, 2001 Patrik Stridvall
3 #
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.
8 #
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.
13 #
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 #
18
19 package winapi_global;
20
21 use strict;
22
23 use modules qw($modules);
24 use nativeapi qw($nativeapi);
25 use options qw($options);
26 use output qw($output);
27 use winapi qw(@winapis);
28
29 sub check_modules {
30     my $complete_module = shift;
31     my $module2functions = shift;
32
33     my @complete_modules = sort(keys(%$complete_module));
34
35     if($options->declared) {
36         foreach my $module (@complete_modules) {
37             foreach my $winapi (@winapis) {
38                 if(!$winapi->is_module($module)) { next; }
39                 my $functions = $$module2functions{$module};
40                 foreach my $internal_name ($winapi->all_internal_functions_in_module($module)) {
41                     next if $internal_name =~ /\./;
42                     my $function = $functions->{$internal_name};
43                     if(!defined($function) && !$nativeapi->is_function($internal_name) &&
44                        !($module eq "user" && $internal_name =~
45                          /^(?:GlobalAddAtomA|GlobalDeleteAtom|GlobalFindAtomA|
46                             GlobalGetAtomNameA|lstrcmpiA)$/x))
47                     {
48                         $output->write("*.c: $module: $internal_name: " .
49                                        "function declared but not implemented or declared external\n");
50                     }
51                 }
52             }
53         }
54     }
55
56     if($options->argument && $options->argument_forbidden) {
57         foreach my $winapi (@winapis) {
58             my $types_not_used = $winapi->types_not_used;
59             foreach my $module (sort(keys(%$types_not_used))) {
60                 if(!$$complete_module{$module}) { next; }
61                 foreach my $type (sort(keys(%{$$types_not_used{$module}}))) {
62                     $output->write("*.c: $module: type ($type) not used\n");
63                 }
64             }
65         }
66     }
67 }
68
69 sub check_all_modules {
70     my $include2info = shift;
71
72     &winapi_documentation::report_documentation;
73     
74     if($options->headers_unused && $options->include) {
75         foreach my $name (sort(keys(%$include2info))) {
76             if(!$$include2info{$name}{used}) {
77                 $output->write("*.c: $name: include file is never used\n");
78             }
79         }
80     }
81     
82     $modules->global_report;
83     $nativeapi->global_report;
84 }
85
86 1;