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
19 package winapi_check_options
;
26 use vars
qw($VERSION @ISA @EXPORT @EXPORT_OK);
31 @EXPORT_OK = qw($options);
33 use config qw($current_dir $wine_dir);
34 use options qw($options parse_comma_list);
37 "debug" => { default => 0, description => "debug mode" },
38 "help" => { default => 0, description => "help mode" },
39 "verbose" => { default => 0, description => "verbose mode" },
41 "progress" => { default => 1, description => "show progress" },
43 "win16" => { default => 1, description => "Win16 checking" },
44 "win32" => { default => 1, description => "Win32 checking" },
46 "shared" => { default => 0, description => "show shared functions between Win16 and Win32" },
47 "shared-segmented" => { default => 0, description => "segmented shared functions between Win16 and Win32 checking" },
49 "config" => { default => 1, parent => "local", description => "check configuration include consistency" },
50 "config-unnecessary" => { default => 0, parent => "config", description => "check for unnecessary #include \"config.h\"" },
52 "spec-mismatch" => { default => 0, description => "spec file mismatch checking" },
54 "local" => { default => 1, description => "local checking" },
56 default => { active => 1, filter => 0, hash => {} },
58 parser => \&parse_comma_list,
59 description => "module filter"
62 "argument" => { default => 1, parent => "local", description => "argument checking" },
63 "argument-count" => { default => 1, parent => "argument", description => "argument count checking" },
64 "argument-forbidden" => {
65 default => { active => 1, filter => 0, hash => {} },
67 parser => \&parse_comma_list,
68 description => "argument forbidden checking"
71 default => { active => 1, filter => 1, hash => { double => 1 } },
73 parser => \&parse_comma_list,
74 description => "argument kind checking"
76 "calling-convention" => { default => 1, parent => "local", description => "calling convention checking" },
77 "calling-convention-win16" => { default => 0, parent => "calling-convention", description => "calling convention checking (Win16)" },
78 "calling-convention-win32" => { default => 1, parent => "calling-convention", description => "calling convention checking (Win32)" },
79 "misplaced" => { default => 1, parent => "local", description => "check for misplaced functions" },
80 "statements" => { default => 0, parent => "local", description => "check for statements inconsistencies" },
81 "cross-call" => { default => 0, parent => ["statements", "win16", "win32"], description => "check for cross calling functions" },
82 "cross-call-win32-win16" => {
83 default => 0, parent => "cross-call", description => "check for cross calls between win32 and win16"
85 "cross-call-unicode-ascii" => {
86 default => 0, parent => "cross-call", description => "check for cross calls between Unicode and ASCII"
88 "debug-messages" => { default => 0, parent => "statements", description => "check for debug messages inconsistencies" },
93 description => "comments checking"
95 "comments-cplusplus" => {
98 description => "C++ comments checking"
104 description => "check for documentation inconsistencies"
106 "documentation-pedantic" => {
108 parent => "documentation",
109 description => "be pedantic when checking for documentation inconsistencies"
112 "documentation-arguments" => {
114 parent => "documentation",
115 description => "check for arguments documentation inconsistencies\n"
117 "documentation-comment-indent" => {
119 parent => "documentation", description => "check for documentation comment indent inconsistencies"
121 "documentation-comment-width" => {
123 parent => "documentation", description => "check for documentation comment width inconsistencies"
125 "documentation-name" => {
127 parent => "documentation",
128 description => "check for documentation name inconsistencies\n"
130 "documentation-ordinal" => {
132 parent => "documentation",
133 description => "check for documentation ordinal inconsistencies\n"
135 "documentation-wrong" => {
137 parent => "documentation",
138 description => "check for wrong documentation\n"
141 "prototype" => {default => 0, parent => ["local", "headers"], description => "prototype checking" },
142 "global" => { default => 1, description => "global checking" },
143 "declared" => { default => 1, parent => "global", description => "declared checking" },
144 "implemented" => { default => 0, parent => "local", description => "implemented checking" },
145 "implemented-win32" => { default => 0, parent => "implemented", description => "implemented as win32 checking" },
146 "include" => { default => 1, parent => "global", description => "include checking" },
148 "headers" => { default => 0, description => "headers checking" },
149 "headers-duplicated" => { default => 0, parent => "headers", description => "duplicated function declarations checking" },
150 "headers-misplaced" => { default => 0, parent => "headers", description => "misplaced function declarations checking" },
151 "headers-needed" => { default => 1, parent => "headers", description => "headers needed checking" },
152 "headers-unused" => { default => 0, parent => "headers", description => "headers unused checking" },
155 my %options_short = (
161 my $options_usage = "usage: winapi_check [--help] [<files>]\n";
163 $options = '_winapi_check_options'->new(\%options_long, \%options_short, $options_usage);
165 package _winapi_check_options;
170 use base qw(_options);
172 sub report_module
($$) {
174 my $refvalue = $self->{MODULE
};
179 return $$refvalue->{active
} && (!$$refvalue->{filter
} || $$refvalue->{hash
}->{$name});
185 sub report_argument_forbidden
($$) {
187 my $refargument_forbidden = $self->{ARGUMENT_FORBIDDEN
};
191 return $$refargument_forbidden->{active
} && (!$$refargument_forbidden->{filter
} || $$refargument_forbidden->{hash
}->{$type});
194 sub report_argument_kind
($$) {
196 my $refargument_kind = $self->{ARGUMENT_KIND
};
200 return $$refargument_kind->{active
} && (!$$refargument_kind->{filter
} || $$refargument_kind->{hash
}->{$kind});