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