summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Dump.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-18 16:46:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:33 -0500
commitf9885687878560c21c569a850cb7023b062b4e33 (patch)
tree115af1011cdaed8b1f5b724b23effe78b2bf1571 /source4/pidl/lib/Parse/Pidl/Dump.pm
parent8cf122c2d2a0913fd9a7c55032c549598844111c (diff)
downloadsamba-f9885687878560c21c569a850cb7023b062b4e33.tar.gz
samba-f9885687878560c21c569a850cb7023b062b4e33.tar.bz2
samba-f9885687878560c21c569a850cb7023b062b4e33.zip
r21431: More tests, work on support in wireshark for tagged types.
(This used to be commit a91e624af22aae5b460ccf94d2540b8780f90070)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Dump.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Dump.pm22
1 files changed, 12 insertions, 10 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Dump.pm b/source4/pidl/lib/Parse/Pidl/Dump.pm
index 88f18de322..bf5811c116 100644
--- a/source4/pidl/lib/Parse/Pidl/Dump.pm
+++ b/source4/pidl/lib/Parse/Pidl/Dump.pm
@@ -24,7 +24,7 @@ use Exporter;
use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
-@EXPORT_OK = qw(DumpTypedef DumpStruct DumpEnum DumpBitmap DumpUnion DumpFunction);
+@EXPORT_OK = qw(DumpType DumpTypedef DumpStruct DumpEnum DumpBitmap DumpUnion DumpFunction);
use strict;
use Parse::Pidl::Util qw(has_property);
@@ -87,7 +87,12 @@ sub DumpStruct($)
my($struct) = shift;
my($res);
- $res .= "struct {\n";
+ $res .= "struct ";
+ if ($struct->{NAME}) {
+ $res.="$struct->{NAME} ";
+ }
+
+ $res.="{\n";
if (defined $struct->{ELEMENTS}) {
foreach (@{$struct->{ELEMENTS}}) {
$res .= "\t" . DumpElement($_) . ";\n";
@@ -185,18 +190,15 @@ sub DumpUnion($)
sub DumpType($)
{
my($data) = shift;
- my($res);
if (ref($data) eq "HASH") {
- ($data->{TYPE} eq "STRUCT") && ($res .= DumpStruct($data));
- ($data->{TYPE} eq "UNION") && ($res .= DumpUnion($data));
- ($data->{TYPE} eq "ENUM") && ($res .= DumpEnum($data));
- ($data->{TYPE} eq "BITMAP") && ($res .= DumpBitmap($data));
+ return DumpStruct($data) if ($data->{TYPE} eq "STRUCT");
+ return DumpUnion($data) if ($data->{TYPE} eq "UNION");
+ return DumpEnum($data) if ($data->{TYPE} eq "ENUM");
+ return DumpBitmap($data) if ($data->{TYPE} eq "BITMAP");
} else {
- $res .= "$data";
+ return $data;
}
-
- return $res;
}
#####################################################################