summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/Header.pm27
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm15
2 files changed, 30 insertions, 12 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm
index 6254abaa2d..4579ae2ec0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/Header.pm
@@ -15,7 +15,10 @@ use vars qw($VERSION);
$VERSION = '0.01';
my $res = "";
-sub pidl($) { my $x = shift; $res .= "$x\n"; }
+my $tabs = "";
+sub indent() { $tabs.="\t"; }
+sub deindent() { $tabs = substr($tabs, 1); }
+sub pidl($) { $res .= $tabs.(shift)."\n"; }
sub fatal($$) { my ($e,$s) = @_; die("$e->{FILE}:$e->{LINE}: $s\n"); }
sub warning($$) { my ($e,$s) = @_; warn("$e->{FILE}:$e->{LINE}: $s\n"); }
@@ -101,7 +104,11 @@ sub ParseUnion($$$)
{
my ($if,$u,$n) = @_;
- my $extra = {"switch_value" => 1};
+ my $extra = {};
+
+ unless (has_property($u, "nodiscriminant")) {
+ $extra->{switch_value} = 1;
+ }
foreach my $e (@{$u->{ELEMENTS}}) {
foreach my $l (@{$e->{LEVELS}}) {
@@ -121,10 +128,17 @@ sub ParseUnion($$$)
}
pidl "typedef struct $if->{NAME}_$n\_ctr {";
- pidl "\tuint32 $_;" foreach (keys %$extra);
- pidl "\tunion {";
- ParseElement($_) foreach (@{$u->{ELEMENTS}});
- pidl "\t} u;";
+ indent;
+ pidl "uint32 $_;" foreach (keys %$extra);
+ pidl "union {";
+ indent;
+ foreach (@{$u->{ELEMENTS}}) {
+ next if ($_->{TYPE} eq "EMPTY");
+ pidl "\t" . DeclShort($_) . ";";
+ }
+ deindent;
+ pidl "} u;";
+ deindent;
pidl "} ".uc("$if->{NAME}_$n\_ctr") .";";
pidl "";
}
@@ -185,6 +199,7 @@ sub Parse($$)
my($ndr,$filename) = @_;
$res = "";
+ $tabs = "";
pidl "/*";
pidl " * Unix SMB/CIFS implementation.";
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
index 49c7cf5e81..d1188e7011 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
@@ -75,6 +75,7 @@ sub ParseElementLevelArray($$$$$$)
if ($l->{IS_ZERO_TERMINATED}) {
fatal($e, "[string] attribute not supported for Samba3 yet");
+
#FIXME
}
@@ -123,12 +124,6 @@ sub ParseElementLevelSwitch($$$$$$)
{
my ($e,$l,$nl,$env,$varname,$what) = @_;
- if ($what == PRIMITIVES) {
- pidl "if (!prs_uint32(\"level\", ps, depth, &" . ParseExpr("level_$e->{NAME}", $env) . "))";
- pidl "\treturn False;";
- pidl "";
- }
-
ParseElementLevel($e,$nl,$env,$varname,$what);
}
@@ -353,6 +348,14 @@ sub ParseUnion($$$)
pidl "\treturn False;";
pidl "";
+ if (has_property($u, "nodiscriminant")) {
+ pidl "if (!prs_uint32(\"switch_value\", ps, depth, &v->switch_value))";
+ pidl "\treturn False;";
+ pidl "";
+ }
+
+ # Maybe check here that level and v->switch_value are equal?
+
pidl "switch (level) {";
indent;