summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-19 22:10:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:38 -0500
commit4e757aa64c76a4d15db88cfb20cf118cc739789d (patch)
tree431090cca59bddb608fdbfac4e05cd06ec5fee8c /source4/pidl/lib/Parse
parentac0433e3d3b5feb7629f67f35ea914c11686591c (diff)
downloadsamba-4e757aa64c76a4d15db88cfb20cf118cc739789d.tar.gz
samba-4e757aa64c76a4d15db88cfb20cf118cc739789d.tar.bz2
samba-4e757aa64c76a4d15db88cfb20cf118cc739789d.zip
r21457: Cope with anonymous nested types in the NDR layer. This doesn't handled
named nested types yet, as these have to be registered. (This used to be commit 9b0416b5d06286c81c73477a24cb591fd4b23d18)
Diffstat (limited to 'source4/pidl/lib/Parse')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm37
1 files changed, 19 insertions, 18 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index d55df7a452..a921e5cbe5 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -257,8 +257,6 @@ sub GetElementLevelTable($)
push (@$order, {
TYPE => "DATA",
- CONVERT_TO => has_property($e, ""),
- CONVERT_FROM => has_property($e, ""),
DATA_TYPE => $e->{TYPE},
IS_DEFERRED => $is_deferred,
CONTAINS_DEFERRED => can_contain_deferred($e),
@@ -360,12 +358,16 @@ sub align_type($)
die("Unknown data type type $dt->{TYPE}");
}
-sub ParseElement($)
+sub ParseElement($$)
{
- my $e = shift;
+ my ($e, $pointer_default) = @_;
$e->{TYPE} = expandAlias($e->{TYPE});
+ if (ref($e->{TYPE}) eq "HASH") {
+ $e->{TYPE} = ParseType($e->{TYPE}, $pointer_default);
+ }
+
return {
NAME => $e->{NAME},
TYPE => $e->{TYPE},
@@ -379,14 +381,13 @@ sub ParseElement($)
sub ParseStruct($$)
{
- my ($ndr,$struct) = @_;
+ my ($struct, $pointer_default) = @_;
my @elements = ();
my $surrounding = undef;
-
foreach my $x (@{$struct->{ELEMENTS}})
{
- my $e = ParseElement($x);
+ my $e = ParseElement($x, $pointer_default);
if ($x != $struct->{ELEMENTS}[-1] and
$e->{LEVELS}[0]->{IS_SURROUNDING}) {
fatal($x, "conformant member not at end of struct");
@@ -423,7 +424,7 @@ sub ParseStruct($$)
sub ParseUnion($$)
{
- my ($ndr,$e) = @_;
+ my ($e, $pointer_default) = @_;
my @elements = ();
my $switch_type = has_property($e, "switch_type");
unless (defined($switch_type)) { $switch_type = "uint32"; }
@@ -437,7 +438,7 @@ sub ParseUnion($$)
if ($x->{TYPE} eq "EMPTY") {
$t = { TYPE => "EMPTY" };
} else {
- $t = ParseElement($x);
+ $t = ParseElement($x, $pointer_default);
}
if (has_property($x, "default")) {
$t->{CASE} = "default";
@@ -463,7 +464,7 @@ sub ParseUnion($$)
sub ParseEnum($$)
{
- my ($ndr,$e) = @_;
+ my ($e, $pointer_default) = @_;
return {
TYPE => "ENUM",
@@ -477,7 +478,7 @@ sub ParseEnum($$)
sub ParseBitmap($$)
{
- my ($ndr,$e) = @_;
+ my ($e, $pointer_default) = @_;
return {
TYPE => "BITMAP",
@@ -491,10 +492,10 @@ sub ParseBitmap($$)
sub ParseType($$)
{
- my ($ndr, $d) = @_;
+ my ($d, $pointer_default) = @_;
if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") {
- CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default});
+ CheckPointerTypes($d, $pointer_default);
}
my $data = {
@@ -503,20 +504,20 @@ sub ParseType($$)
ENUM => \&ParseEnum,
BITMAP => \&ParseBitmap,
TYPEDEF => \&ParseTypedef,
- }->{$d->{TYPE}}->($ndr, $d);
+ }->{$d->{TYPE}}->($d, $pointer_default);
return $data;
}
sub ParseTypedef($$)
{
- my ($ndr,$d) = @_;
+ my ($d, $pointer_default) = @_;
if (defined($d->{DATA}->{PROPERTIES}) && !defined($d->{PROPERTIES})) {
$d->{PROPERTIES} = $d->{DATA}->{PROPERTIES};
}
- my $data = ParseType($ndr, $d->{DATA});
+ my $data = ParseType($d->{DATA}, $pointer_default);
$data->{ALIGN} = align_type($d->{NAME});
return {
@@ -550,7 +551,7 @@ sub ParseFunction($$$)
}
foreach my $x (@{$d->{ELEMENTS}}) {
- my $e = ParseElement($x);
+ my $e = ParseElement($x, $ndr->{PROPERTIES}->{pointer_default});
push (@{$e->{DIRECTION}}, "in") if (has_property($x, "in"));
push (@{$e->{DIRECTION}}, "out") if (has_property($x, "out"));
@@ -618,7 +619,7 @@ sub ParseInterface($)
} elsif ($d->{TYPE} eq "CONST") {
push (@consts, ParseConst($idl, $d));
} else {
- push (@types, ParseType($idl, $d));
+ push (@types, ParseType($d, $idl->{PROPERTIES}->{pointer_default}));
}
}