Fixed winelauncher for new dll files layout.
[wine] / tools / winapi / winapi_check_options.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_check_options;
20 use base qw(options);
21
22 use strict;
23
24 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
25 require Exporter;
26
27 @ISA = qw(Exporter);
28 @EXPORT = qw();
29 @EXPORT_OK = qw($options);
30
31 use config qw($current_dir $wine_dir);
32 use options qw($options &parse_comma_list);
33
34 my %options_long = (
35     "debug" => { default => 0, description => "debug mode" },
36     "help" => { default => 0, description => "help mode" },
37     "verbose" => { default => 0, description => "verbose mode" },
38
39     "progress" => { default => 1, description => "show progress" },
40
41     "win16" => { default => 1, description => "Win16 checking" },
42     "win32" => { default => 1, description => "Win32 checking" },
43
44     "shared" =>  { default => 0, description => "show shared functions between Win16 and Win32" },
45     "shared-segmented" =>  { default => 0, description => "segmented shared functions between Win16 and Win32 checking" },
46
47     "config" => { default => 1, parent => "local", description => "check configuration include consistancy" },
48     "config-unnessary" => { default => 0, parent => "config", description => "check for unnessary #include \"config.h\"" },
49
50     "spec-mismatch" => { default => 0, description => "spec file mismatch checking" },
51
52     "local" =>  { default => 1, description => "local checking" },
53     "module" => { 
54         default => { active => 1, filter => 0, hash => {} },
55         parent => "local",
56         parser => \&parser_comma_list,
57         description => "module filter"
58     },
59
60     "argument" => { default => 1, parent => "local", description => "argument checking" },
61     "argument-count" => { default => 1, parent => "argument", description => "argument count checking" },
62     "argument-forbidden" => {
63         default => { active => 1, filter => 0, hash => {} },
64         parent => "argument",
65         parser => \&parser_comma_list,
66         description => "argument forbidden checking"
67     },
68     "argument-kind" => {
69         default => { active => 1, filter => 1, hash => { double => 1 } },
70         parent => "argument",
71         parser => \&parser_comma_list,
72         description => "argument kind checking"
73     },
74     "calling-convention" => { default => 1, parent => "local", description => "calling convention checking" },
75     "calling-convention-win16" => { default => 0, parent => "calling-convention", description => "calling convention checking (Win16)" },
76     "calling-convention-win32" => { default => 1, parent => "calling-convention", description => "calling convention checking (Win32)" },
77     "misplaced" => { default => 1, parent => "local", description => "check for misplaced functions" },
78     "statements"  => { default => 0, parent => "local", description => "check for statements inconsistances" },
79     "cross-call" => { default => 0, parent => "statements",  description => "check for cross calling functions" },
80     "cross-call-win32-win16" => { 
81         default => 0, parent => "cross-call", description => "check for cross calls between win32 and win16"
82      },
83     "cross-call-unicode-ascii" => { 
84         default => 0, parent => "cross-call", description => "check for cross calls between Unicode and ASCII" 
85     },
86     "debug-messages" => { default => 0, parent => "statements", description => "check for debug messages inconsistances" },
87
88     "documentation" => {
89         default => 1,
90         parent => "local", 
91         description => "check for documentation inconsistances"
92         },
93     "documentation-pedantic" => { 
94         default => 0, 
95         parent => "documentation", 
96         description => "be pendantic when checking for documentation inconsistances"
97         },
98
99     "documentation-arguments" => {
100         default => 1,
101         parent => "documentation",
102         description => "check for arguments documentation inconsistances\n"
103         },
104     "documentation-comment-indent" => {
105         default => 0, 
106         parent => "documentation", description => "check for documentation comment indent inconsistances"
107         },
108     "documentation-comment-width" => {
109         default => 0, 
110         parent => "documentation", description => "check for documentation comment width inconsistances"
111         },
112     "documentation-name" => {
113         default => 1,
114         parent => "documentation",
115         description => "check for documentation name inconsistances\n"
116         },
117     "documentation-ordinal" => {
118         default => 1,
119         parent => "documentation",
120         description => "check for documentation ordinal inconsistances\n"
121         },
122     "documentation-wrong" => {
123         default => 1,
124         parent => "documentation",
125         description => "check for wrong documentation\n"
126         },
127
128     "prototype" => {default => 0, parent => ["local", "headers"], description => "prototype checking" },
129     "global" => { default => 1, description => "global checking" },
130     "declared" => { default => 1, parent => "global", description => "declared checking" },
131     "implemented" => { default => 0, parent => "local", description => "implemented checking" },
132     "implemented-win32" => { default => 0, parent => "implemented", description => "implemented as win32 checking" },
133     "include" => { default => 1, parent => "global", description => "include checking" },
134
135     "headers" => { default => 0, description => "headers checking" },
136     "headers-duplicated" => { default => 0, parent => "headers", description => "duplicated function declarations checking" },
137     "headers-misplaced" => { default => 0, parent => "headers", description => "misplaced function declarations checking" },
138     "headers-needed" => { default => 1, parent => "headers", description => "headers needed checking" },
139     "headers-unused" => { default => 0, parent => "headers", description => "headers unused checking" },
140 );
141
142 my %options_short = (
143     "d" => "debug",
144     "?" => "help",
145     "v" => "verbose"
146 );
147
148 my $options_usage = "usage: winapi_check [--help] [<files>]\n";
149
150 $options = '_winapi_check_options'->new(\%options_long, \%options_short, $options_usage);
151
152 package _winapi_check_options;
153 use base qw(_options);
154
155 use strict;
156
157 sub report_module {
158     my $self = shift;
159     my $refvalue = $self->{MODULE};
160     
161     my $name = shift;
162
163     if(defined($name)) {
164         return $$refvalue->{active} && (!$$refvalue->{filter} || $$refvalue->{hash}->{$name}); 
165     } else {
166         return 0;
167     } 
168 }
169
170 sub report_argument_forbidden {
171     my $self = shift;   
172     my $refargument_forbidden = $self->{ARGUMENT_FORBIDDEN};
173
174     my $type = shift;
175
176     return $$refargument_forbidden->{active} && (!$$refargument_forbidden->{filter} || $$refargument_forbidden->{hash}->{$type}); 
177 }
178
179 sub report_argument_kind {
180     my $self = shift;
181     my $refargument_kind = $self->{ARGUMENT_KIND};
182
183     my $kind = shift;
184
185     return $$refargument_kind->{active} && (!$$refargument_kind->{filter} || $$refargument_kind->{hash}->{$kind}); 
186
187 }
188
189 1;