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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 package winapi_check_options;
24 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
29 @EXPORT_OK = qw($options);
31 use config qw($current_dir $wine_dir);
32 use options qw($options &parse_comma_list);
35 "debug" => { default => 0, description => "debug mode" },
36 "help" => { default => 0, description => "help mode" },
37 "verbose" => { default => 0, description => "verbose mode" },
39 "progress" => { default => 1, description => "show progress" },
41 "win16" => { default => 1, description => "Win16 checking" },
42 "win32" => { default => 1, description => "Win32 checking" },
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" },
47 "config" => { default => 1, parent => "local", description => "check configuration include consistency" },
48 "config-unnecessary" => { default => 0, parent => "config", description => "check for unnecessary #include \"config.h\"" },
50 "spec-mismatch" => { default => 0, description => "spec file mismatch checking" },
52 "local" => { default => 1, description => "local checking" },
54 default => { active => 1, filter => 0, hash => {} },
56 parser => \&parser_comma_list,
57 description => "module filter"
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 => {} },
65 parser => \&parser_comma_list,
66 description => "argument forbidden checking"
69 default => { active => 1, filter => 1, hash => { double => 1 } },
71 parser => \&parser_comma_list,
72 description => "argument kind checking"
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", "win16", "win32"], 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"
83 "cross-call-unicode-ascii" => {
84 default => 0, parent => "cross-call", description => "check for cross calls between Unicode and ASCII"
86 "debug-messages" => { default => 0, parent => "statements", description => "check for debug messages inconsistances" },
91 description => "comments checking"
93 "comments-cplusplus" => {
96 description => "C++ comments checking"
102 description => "check for documentation inconsistances"
104 "documentation-pedantic" => {
106 parent => "documentation",
107 description => "be pendantic when checking for documentation inconsistances"
110 "documentation-arguments" => {
112 parent => "documentation",
113 description => "check for arguments documentation inconsistances\n"
115 "documentation-comment-indent" => {
117 parent => "documentation", description => "check for documentation comment indent inconsistances"
119 "documentation-comment-width" => {
121 parent => "documentation", description => "check for documentation comment width inconsistances"
123 "documentation-name" => {
125 parent => "documentation",
126 description => "check for documentation name inconsistances\n"
128 "documentation-ordinal" => {
130 parent => "documentation",
131 description => "check for documentation ordinal inconsistances\n"
133 "documentation-wrong" => {
135 parent => "documentation",
136 description => "check for wrong documentation\n"
139 "prototype" => {default => 0, parent => ["local", "headers"], description => "prototype checking" },
140 "global" => { default => 1, description => "global checking" },
141 "declared" => { default => 1, parent => "global", description => "declared checking" },
142 "implemented" => { default => 0, parent => "local", description => "implemented checking" },
143 "implemented-win32" => { default => 0, parent => "implemented", description => "implemented as win32 checking" },
144 "include" => { default => 1, parent => "global", description => "include checking" },
146 "headers" => { default => 0, description => "headers checking" },
147 "headers-duplicated" => { default => 0, parent => "headers", description => "duplicated function declarations checking" },
148 "headers-misplaced" => { default => 0, parent => "headers", description => "misplaced function declarations checking" },
149 "headers-needed" => { default => 1, parent => "headers", description => "headers needed checking" },
150 "headers-unused" => { default => 0, parent => "headers", description => "headers unused checking" },
153 my %options_short = (
159 my $options_usage = "usage: winapi_check [--help] [<files>]\n";
161 $options = '_winapi_check_options'->new(\%options_long, \%options_short, $options_usage);
163 package _winapi_check_options;
164 use base qw(_options);
170 my $refvalue = $self->{MODULE};
175 return $$refvalue->{active} && (!$$refvalue->{filter} || $$refvalue->{hash}->{$name});
181 sub report_argument_forbidden {
183 my $refargument_forbidden = $self->{ARGUMENT_FORBIDDEN};
187 return $$refargument_forbidden->{active} && (!$$refargument_forbidden->{filter} || $$refargument_forbidden->{hash}->{$type});
190 sub report_argument_kind {
192 my $refargument_kind = $self->{ARGUMENT_KIND};
196 return $$refargument_kind->{active} && (!$$refargument_kind->{filter} || $$refargument_kind->{hash}->{$kind});