summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Wireshark
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-01-03 15:34:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:36:04 -0500
commitf97f11eab25f0c294ff02b3c4485d7a0a91b5501 (patch)
treee1a2547a15afc65dcb118a39a74ae1b4e4a865f7 /source4/pidl/lib/Parse/Pidl/Wireshark
parentbc32b30011ec0b35d40f659675f9e4cc28ec3c79 (diff)
downloadsamba-f97f11eab25f0c294ff02b3c4485d7a0a91b5501.tar.gz
samba-f97f11eab25f0c294ff02b3c4485d7a0a91b5501.tar.bz2
samba-f97f11eab25f0c294ff02b3c4485d7a0a91b5501.zip
r20511: Combine warnings/errors/fatal functions and move them to Parse::Pidl.
(This used to be commit 959adfd0a682a4894c3bdd4ae9c6fc3ebfeeef1f)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Wireshark')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm29
-rw-r--r--source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm27
2 files changed, 27 insertions, 29 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
index 163b3053f4..4ad60319a6 100644
--- a/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
+++ b/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
@@ -100,6 +100,7 @@ $VERSION = '0.01';
use strict;
+use Parse::Pidl qw(fatal warning error);
use Parse::Pidl::Util qw(has_property);
sub handle_type($$$$$$$$$$)
@@ -107,20 +108,20 @@ sub handle_type($$$$$$$$$$)
my ($pos,$data,$name,$dissectorname,$ft_type,$base_type,$mask,$valsstring,$alignment) = @_;
unless(defined($alignment)) {
- print "$pos: error incomplete TYPE command\n";
+ error($pos, "incomplete TYPE command");
return;
}
unless ($dissectorname =~ /.*dissect_.*/) {
- print "$pos: warning: dissector name does not contain `dissect'\n";
+ warning($pos, "dissector name does not contain `dissect'");
}
unless(valid_ft_type($ft_type)) {
- print "$pos: warning: invalid FT_TYPE `$ft_type'\n";
+ warning($pos, "invalid FT_TYPE `$ft_type'");
}
unless (valid_base_type($base_type)) {
- print "$pos: warning: invalid BASE_TYPE `$base_type'\n";
+ warning($pos, "invalid BASE_TYPE `$base_type'");
}
$data->{types}->{$name} = {
@@ -141,7 +142,7 @@ sub handle_tfs($$$$$)
my ($pos,$data,$hf,$trues,$falses) = @_;
unless(defined($falses)) {
- print "$pos: error: incomplete TFS command\n";
+ error($pos, "incomplete TFS command");
return;
}
@@ -156,7 +157,7 @@ sub handle_hf_rename($$$$)
my ($pos,$data,$old,$new) = @_;
unless(defined($new)) {
- print "$pos: error: incomplete HF_RENAME command\n";
+ error($pos, "incomplete HF_RENAME command");
return;
}
@@ -173,7 +174,7 @@ sub handle_param_value($$$$)
my ($pos,$data,$dissector_name,$value) = @_;
unless(defined($value)) {
- print "$pos: error: incomplete PARAM_VALUE command\n";
+ error($pos, "incomplete PARAM_VALUE command");
return;
}
@@ -204,16 +205,16 @@ sub handle_hf_field($$$$$$$$$$)
my ($pos,$data,$index,$name,$filter,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;
unless(defined($blurb)) {
- print "$pos: error: incomplete HF_FIELD command\n";
+ error($pos, "incomplete HF_FIELD command");
return;
}
unless(valid_ft_type($ft_type)) {
- print "$pos: warning: invalid FT_TYPE `$ft_type'\n";
+ warning($pos, "invalid FT_TYPE `$ft_type'");
}
unless(valid_base_type($base_type)) {
- print "$pos: warning: invalid BASE_TYPE `$base_type'\n";
+ warning($pos, "invalid BASE_TYPE `$base_type'");
}
$data->{header_fields}->{$index} = {
@@ -284,7 +285,7 @@ sub handle_import
my $dissectorname = shift @_;
unless(defined($dissectorname)) {
- print "$pos: error: no dissectorname specified\n";
+ error($pos, "no dissectorname specified");
return;
}
@@ -346,12 +347,14 @@ sub ReadConformance($$)
shift @fields;
+ my $pos = { FILE => $f, LINE => $ln };
+
if (not defined($field_handlers{$cmd})) {
- print "$f:$ln: warning: Unknown command `$cmd'\n";
+ warning($pos, "Unknown command `$cmd'");
next;
}
- $field_handlers{$cmd}("$f:$ln", $data, @fields);
+ $field_handlers{$cmd}($pos, $data, @fields);
}
close(IN);
diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 14b922353a..9526d76a37 100644
--- a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -17,6 +17,7 @@ Parse::Pidl::Wireshark::NDR - Parser generator for Wireshark
package Parse::Pidl::Wireshark::NDR;
use strict;
+use Parse::Pidl qw(error);
use Parse::Pidl::Typelist qw(getType);
use Parse::Pidl::Util qw(has_property ParseExpr property_matches make_str);
use Parse::Pidl::NDR qw(ContainsString GetNextLevel);
@@ -27,12 +28,6 @@ use File::Basename;
use vars qw($VERSION);
$VERSION = '0.01';
-sub error($$)
-{
- my ($e,$t) = @_;
- print "$e->{FILE}:$e->{LINE}: $t\n";
-}
-
my @ett;
my %hf_used = ();
@@ -441,10 +436,10 @@ sub Function($$$)
} elsif ($type->{DATA}->{TYPE} eq "SCALAR") {
pidl_code "g$fn->{RETURN_TYPE} status;\n";
} else {
- print "$fn->{FILE}:$fn->{LINE}: error: return type `$fn->{RETURN_TYPE}' not yet supported\n";
+ error($fn, "return type `$fn->{RETURN_TYPE}' not yet supported");
}
} else {
- print "$fn->{FILE}:$fn->{LINE}: error: unknown return type `$fn->{RETURN_TYPE}'\n";
+ error($fn, "unknown return type `$fn->{RETURN_TYPE}'");
}
foreach (@{$fn->{ELEMENTS}}) {
@@ -828,7 +823,7 @@ sub Initialize($)
header_fields=> {}
};
- ReadConformance($cnf_file, $conformance) or print "Warning: No conformance file `$cnf_file'\n";
+ ReadConformance($cnf_file, $conformance) or print STDERR "warning: No conformance file `$cnf_file'\n";
foreach my $bytes (qw(1 2 4 8)) {
my $bits = $bytes * 8;
@@ -1054,43 +1049,43 @@ sub CheckUsed($)
my $conformance = shift;
foreach (values %{$conformance->{header_fields}}) {
if (not defined($hf_used{$_->{INDEX}})) {
- print "$_->{POS}: warning: hf field `$_->{INDEX}' not used\n";
+ warning($_->{POS}, "hf field `$_->{INDEX}' not used");
}
}
foreach (values %{$conformance->{hf_renames}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: hf field `$_->{OLDNAME}' not used\n";
+ warning($_->{POS}, "hf field `$_->{OLDNAME}' not used");
}
}
foreach (values %{$conformance->{dissectorparams}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: dissector param never used\n";
+ warning($_->{POS}, "dissector param never used");
}
}
foreach (values %{$conformance->{imports}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: import never used\n";
+ warning($_->{POS}, "import never used");
}
}
foreach (values %{$conformance->{types}}) {
if (not $_->{USED} and defined($_->{POS})) {
- print "$_->{POS}: warning: type never used\n";
+ warning($_->{POS}, "type never used");
}
}
foreach (values %{$conformance->{fielddescription}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: description never used\n";
+ warning($_->{POS}, "description never used");
}
}
foreach (values %{$conformance->{tfs}}) {
if (not $_->{USED}) {
- print "$_->{POS}: warning: True/False description never used\n";
+ warning($_->{POS}, "True/False description never used");
}
}
}