twain_32/tests: Add a trailing '\n' to ok() calls.
[wine/gsoc-2012-control.git] / tools / winapi / winapi_check_options.pm
blob23abb1ff487b3835ea61a20d6e50f4ff37b00299
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;
20 use base qw(options);
22 use strict;
24 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
25 require Exporter;
27 @ISA = qw(Exporter);
28 @EXPORT = qw();
29 @EXPORT_OK = qw($options);
31 use config qw($current_dir $wine_dir);
32 use options qw($options parse_comma_list);
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" },
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" },
53 "module" => {
54 default => { active => 1, filter => 0, hash => {} },
55 parent => "local",
56 parser => \&parse_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 => {} },
64 parent => "argument",
65 parser => \&parse_comma_list,
66 description => "argument forbidden checking"
68 "argument-kind" => {
69 default => { active => 1, filter => 1, hash => { double => 1 } },
70 parent => "argument",
71 parser => \&parse_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 inconsistencies" },
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 inconsistencies" },
88 "comments" => {
89 default => 1,
90 parent => "local",
91 description => "comments checking"
93 "comments-cplusplus" => {
94 default => 1,
95 parent => "comments",
96 description => "C++ comments checking"
99 "documentation" => {
100 default => 1,
101 parent => "local",
102 description => "check for documentation inconsistencies"
104 "documentation-pedantic" => {
105 default => 0,
106 parent => "documentation",
107 description => "be pedantic when checking for documentation inconsistencies"
110 "documentation-arguments" => {
111 default => 1,
112 parent => "documentation",
113 description => "check for arguments documentation inconsistencies\n"
115 "documentation-comment-indent" => {
116 default => 0,
117 parent => "documentation", description => "check for documentation comment indent inconsistencies"
119 "documentation-comment-width" => {
120 default => 0,
121 parent => "documentation", description => "check for documentation comment width inconsistencies"
123 "documentation-name" => {
124 default => 1,
125 parent => "documentation",
126 description => "check for documentation name inconsistencies\n"
128 "documentation-ordinal" => {
129 default => 1,
130 parent => "documentation",
131 description => "check for documentation ordinal inconsistencies\n"
133 "documentation-wrong" => {
134 default => 1,
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 = (
154 "d" => "debug",
155 "?" => "help",
156 "v" => "verbose"
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);
166 use strict;
168 sub report_module($$) {
169 my $self = shift;
170 my $refvalue = $self->{MODULE};
172 my $name = shift;
174 if(defined($name)) {
175 return $$refvalue->{active} && (!$$refvalue->{filter} || $$refvalue->{hash}->{$name});
176 } else {
177 return 0;
181 sub report_argument_forbidden($$) {
182 my $self = shift;
183 my $refargument_forbidden = $self->{ARGUMENT_FORBIDDEN};
185 my $type = shift;
187 return $$refargument_forbidden->{active} && (!$$refargument_forbidden->{filter} || $$refargument_forbidden->{hash}->{$type});
190 sub report_argument_kind($$) {
191 my $self = shift;
192 my $refargument_kind = $self->{ARGUMENT_KIND};
194 my $kind = shift;
196 return $$refargument_kind->{active} && (!$$refargument_kind->{filter} || $$refargument_kind->{hash}->{$kind});