2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
# Copyright 1999, 2000, 2001 Patrik Stridvall
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
|
2001-07-24 01:20:56 +02:00
|
|
|
package winapi_check_options;
|
|
|
|
use base qw(options);
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
|
|
|
|
require Exporter;
|
|
|
|
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
@EXPORT = qw();
|
|
|
|
@EXPORT_OK = qw($options);
|
|
|
|
|
|
|
|
use config qw($current_dir $wine_dir);
|
2004-10-07 06:20:41 +02:00
|
|
|
use options qw($options parse_comma_list);
|
2001-07-24 01:20:56 +02:00
|
|
|
|
|
|
|
my %options_long = (
|
|
|
|
"debug" => { default => 0, description => "debug mode" },
|
|
|
|
"help" => { default => 0, description => "help mode" },
|
|
|
|
"verbose" => { default => 0, description => "verbose mode" },
|
|
|
|
|
|
|
|
"progress" => { default => 1, description => "show progress" },
|
|
|
|
|
|
|
|
"win16" => { default => 1, description => "Win16 checking" },
|
|
|
|
"win32" => { default => 1, description => "Win32 checking" },
|
|
|
|
|
|
|
|
"shared" => { default => 0, description => "show shared functions between Win16 and Win32" },
|
|
|
|
"shared-segmented" => { default => 0, description => "segmented shared functions between Win16 and Win32 checking" },
|
|
|
|
|
2003-10-28 22:45:30 +01:00
|
|
|
"config" => { default => 1, parent => "local", description => "check configuration include consistency" },
|
|
|
|
"config-unnecessary" => { default => 0, parent => "config", description => "check for unnecessary #include \"config.h\"" },
|
2001-07-24 01:20:56 +02:00
|
|
|
|
|
|
|
"spec-mismatch" => { default => 0, description => "spec file mismatch checking" },
|
|
|
|
|
|
|
|
"local" => { default => 1, description => "local checking" },
|
2002-06-01 04:55:48 +02:00
|
|
|
"module" => {
|
2001-07-24 01:20:56 +02:00
|
|
|
default => { active => 1, filter => 0, hash => {} },
|
|
|
|
parent => "local",
|
2004-10-07 06:20:41 +02:00
|
|
|
parser => \&parse_comma_list,
|
2001-07-24 01:20:56 +02:00
|
|
|
description => "module filter"
|
|
|
|
},
|
|
|
|
|
|
|
|
"argument" => { default => 1, parent => "local", description => "argument checking" },
|
|
|
|
"argument-count" => { default => 1, parent => "argument", description => "argument count checking" },
|
|
|
|
"argument-forbidden" => {
|
|
|
|
default => { active => 1, filter => 0, hash => {} },
|
|
|
|
parent => "argument",
|
2004-10-07 06:20:41 +02:00
|
|
|
parser => \&parse_comma_list,
|
2001-07-24 01:20:56 +02:00
|
|
|
description => "argument forbidden checking"
|
|
|
|
},
|
|
|
|
"argument-kind" => {
|
|
|
|
default => { active => 1, filter => 1, hash => { double => 1 } },
|
|
|
|
parent => "argument",
|
2004-10-07 06:20:41 +02:00
|
|
|
parser => \&parse_comma_list,
|
2001-07-24 01:20:56 +02:00
|
|
|
description => "argument kind checking"
|
|
|
|
},
|
|
|
|
"calling-convention" => { default => 1, parent => "local", description => "calling convention checking" },
|
|
|
|
"calling-convention-win16" => { default => 0, parent => "calling-convention", description => "calling convention checking (Win16)" },
|
|
|
|
"calling-convention-win32" => { default => 1, parent => "calling-convention", description => "calling convention checking (Win32)" },
|
|
|
|
"misplaced" => { default => 1, parent => "local", description => "check for misplaced functions" },
|
2005-12-02 16:15:09 +01:00
|
|
|
"statements" => { default => 0, parent => "local", description => "check for statements inconsistencies" },
|
2002-11-27 21:11:10 +01:00
|
|
|
"cross-call" => { default => 0, parent => ["statements", "win16", "win32"], description => "check for cross calling functions" },
|
2002-06-01 04:55:48 +02:00
|
|
|
"cross-call-win32-win16" => {
|
2001-07-24 01:20:56 +02:00
|
|
|
default => 0, parent => "cross-call", description => "check for cross calls between win32 and win16"
|
|
|
|
},
|
2002-06-01 04:55:48 +02:00
|
|
|
"cross-call-unicode-ascii" => {
|
|
|
|
default => 0, parent => "cross-call", description => "check for cross calls between Unicode and ASCII"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
2005-12-02 16:15:09 +01:00
|
|
|
"debug-messages" => { default => 0, parent => "statements", description => "check for debug messages inconsistencies" },
|
2001-07-24 01:20:56 +02:00
|
|
|
|
2002-04-29 20:45:12 +02:00
|
|
|
"comments" => {
|
|
|
|
default => 1,
|
|
|
|
parent => "local",
|
|
|
|
description => "comments checking"
|
|
|
|
},
|
|
|
|
"comments-cplusplus" => {
|
|
|
|
default => 1,
|
|
|
|
parent => "comments",
|
|
|
|
description => "C++ comments checking"
|
|
|
|
},
|
|
|
|
|
2001-07-24 01:20:56 +02:00
|
|
|
"documentation" => {
|
|
|
|
default => 1,
|
2002-06-01 04:55:48 +02:00
|
|
|
parent => "local",
|
2005-12-02 16:15:09 +01:00
|
|
|
description => "check for documentation inconsistencies"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
2002-06-01 04:55:48 +02:00
|
|
|
"documentation-pedantic" => {
|
|
|
|
default => 0,
|
|
|
|
parent => "documentation",
|
2006-10-03 14:10:58 +02:00
|
|
|
description => "be pedantic when checking for documentation inconsistencies"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
"documentation-arguments" => {
|
|
|
|
default => 1,
|
|
|
|
parent => "documentation",
|
2005-12-02 16:15:09 +01:00
|
|
|
description => "check for arguments documentation inconsistencies\n"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
|
|
|
"documentation-comment-indent" => {
|
2002-06-01 04:55:48 +02:00
|
|
|
default => 0,
|
2005-12-02 16:15:09 +01:00
|
|
|
parent => "documentation", description => "check for documentation comment indent inconsistencies"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
|
|
|
"documentation-comment-width" => {
|
2002-06-01 04:55:48 +02:00
|
|
|
default => 0,
|
2005-12-02 16:15:09 +01:00
|
|
|
parent => "documentation", description => "check for documentation comment width inconsistencies"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
|
|
|
"documentation-name" => {
|
|
|
|
default => 1,
|
|
|
|
parent => "documentation",
|
2005-12-02 16:15:09 +01:00
|
|
|
description => "check for documentation name inconsistencies\n"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
|
|
|
"documentation-ordinal" => {
|
|
|
|
default => 1,
|
|
|
|
parent => "documentation",
|
2005-12-02 16:15:09 +01:00
|
|
|
description => "check for documentation ordinal inconsistencies\n"
|
2001-07-24 01:20:56 +02:00
|
|
|
},
|
|
|
|
"documentation-wrong" => {
|
|
|
|
default => 1,
|
|
|
|
parent => "documentation",
|
|
|
|
description => "check for wrong documentation\n"
|
|
|
|
},
|
|
|
|
|
|
|
|
"prototype" => {default => 0, parent => ["local", "headers"], description => "prototype checking" },
|
|
|
|
"global" => { default => 1, description => "global checking" },
|
|
|
|
"declared" => { default => 1, parent => "global", description => "declared checking" },
|
|
|
|
"implemented" => { default => 0, parent => "local", description => "implemented checking" },
|
|
|
|
"implemented-win32" => { default => 0, parent => "implemented", description => "implemented as win32 checking" },
|
|
|
|
"include" => { default => 1, parent => "global", description => "include checking" },
|
|
|
|
|
|
|
|
"headers" => { default => 0, description => "headers checking" },
|
|
|
|
"headers-duplicated" => { default => 0, parent => "headers", description => "duplicated function declarations checking" },
|
|
|
|
"headers-misplaced" => { default => 0, parent => "headers", description => "misplaced function declarations checking" },
|
|
|
|
"headers-needed" => { default => 1, parent => "headers", description => "headers needed checking" },
|
|
|
|
"headers-unused" => { default => 0, parent => "headers", description => "headers unused checking" },
|
|
|
|
);
|
|
|
|
|
|
|
|
my %options_short = (
|
|
|
|
"d" => "debug",
|
|
|
|
"?" => "help",
|
|
|
|
"v" => "verbose"
|
|
|
|
);
|
|
|
|
|
2001-07-26 23:42:12 +02:00
|
|
|
my $options_usage = "usage: winapi_check [--help] [<files>]\n";
|
2001-07-24 01:20:56 +02:00
|
|
|
|
|
|
|
$options = '_winapi_check_options'->new(\%options_long, \%options_short, $options_usage);
|
|
|
|
|
|
|
|
package _winapi_check_options;
|
|
|
|
use base qw(_options);
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub report_module($$) {
|
2001-07-24 01:20:56 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $refvalue = $self->{MODULE};
|
2002-06-01 04:55:48 +02:00
|
|
|
|
2001-07-24 01:20:56 +02:00
|
|
|
my $name = shift;
|
|
|
|
|
|
|
|
if(defined($name)) {
|
2002-06-01 04:55:48 +02:00
|
|
|
return $$refvalue->{active} && (!$$refvalue->{filter} || $$refvalue->{hash}->{$name});
|
2001-07-24 01:20:56 +02:00
|
|
|
} else {
|
|
|
|
return 0;
|
2002-06-01 04:55:48 +02:00
|
|
|
}
|
2001-07-24 01:20:56 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub report_argument_forbidden($$) {
|
2002-06-01 04:55:48 +02:00
|
|
|
my $self = shift;
|
2001-07-24 01:20:56 +02:00
|
|
|
my $refargument_forbidden = $self->{ARGUMENT_FORBIDDEN};
|
|
|
|
|
|
|
|
my $type = shift;
|
|
|
|
|
2002-06-01 04:55:48 +02:00
|
|
|
return $$refargument_forbidden->{active} && (!$$refargument_forbidden->{filter} || $$refargument_forbidden->{hash}->{$type});
|
2001-07-24 01:20:56 +02:00
|
|
|
}
|
|
|
|
|
2004-10-26 02:12:21 +02:00
|
|
|
sub report_argument_kind($$) {
|
2001-07-24 01:20:56 +02:00
|
|
|
my $self = shift;
|
|
|
|
my $refargument_kind = $self->{ARGUMENT_KIND};
|
|
|
|
|
|
|
|
my $kind = shift;
|
|
|
|
|
2002-06-01 04:55:48 +02:00
|
|
|
return $$refargument_kind->{active} && (!$$refargument_kind->{filter} || $$refargument_kind->{hash}->{$kind});
|
2001-07-24 01:20:56 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|