Update output for current build process.
[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 nativeapi qw($nativeapi);
24 use options qw($options);
25 use output qw($output);
26 use winapi qw($win16api $win32api @winapis);
27
28 sub check {
29     my $type_found = shift;
30
31     if($options->win16) {
32         _check($win16api, $type_found);
33     }
34
35     if($options->win32) {
36         _check($win32api, $type_found);
37     }
38 }
39
40 sub _check {
41     my $winapi = shift;
42     my $type_found = shift;
43
44     my $winver = $winapi->name;
45
46     if($options->argument) {
47         foreach my $type ($winapi->all_declared_types) {
48             if(!$$type_found{$type} && !$winapi->is_limited_type($type) && $type ne "CONTEXT86 *") {
49                 $output->write("*.c: $winver: ");
50                 $output->write("type ($type) not used\n");
51             }
52         }
53     }
54
55     if($options->argument && $options->argument_forbidden) {
56         my $types_used = $winapi->types_unlimited_used_in_modules;
57
58         foreach my $type (sort(keys(%$types_used))) {
59             $output->write("*.c: type ($type) only used in module[s] (");
60             my $count = 0;
61             foreach my $module (sort(keys(%{$$types_used{$type}}))) {
62                 if($count++) { $output->write(", "); }
63                 $output->write("$module");
64             }
65             $output->write(")\n");
66         }
67     }
68 }
69
70 1;
71