summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-10-08 00:33:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:33 -0500
commit848dff8f0d9242c0c7a417a1482c14ac289deb6f (patch)
tree25019d0267b46b577aec10b4a7d2c8769e7239fb /source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
parentb1b6eb7b67542c656e1c087ba590c4269f867772 (diff)
downloadsamba-848dff8f0d9242c0c7a417a1482c14ac289deb6f.tar.gz
samba-848dff8f0d9242c0c7a417a1482c14ac289deb6f.tar.bz2
samba-848dff8f0d9242c0c7a417a1482c14ac289deb6f.zip
r10829: Documentation updates
Update TODO Some small fixes to the modules (This used to be commit 0c53e7c3cf7fd91fd34c48a5e68c1bcf70569854)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm40
1 files changed, 32 insertions, 8 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
index eaab50b553..c6cc188391 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
@@ -75,8 +75,18 @@ sub ParseElementLevelData($$$$$$$)
# See if we need to add a level argument because we're parsing a union
foreach (@{$e->{LEVELS}}) {
- push (@args, ParseExpr("level_$e->{NAME}", $env))
- if ($_->{TYPE} eq "SWITCH");
+ next unless ($_->{TYPE} eq "SWITCH");
+ my $t = getType($l->{DATA_TYPE});
+
+ # Set 0 here because one of the variables referenced in SWITCH_IS
+ # might be an in variable while this one is [out]
+ if (grep(/in/, @{$e->{DIRECTION}}) or
+ not defined($t) or
+ has_property($t->{DATA}, "nodiscriminant")) {
+ push (@args, ParseExpr($_->{SWITCH_IS}, $env));
+ } else {
+ push (@args, -1);
+ }
}
my $c = DissectType(@args);
@@ -263,7 +273,6 @@ sub GenerateEnvElement($$)
} elsif ($l->{TYPE} eq "POINTER") {
$env->{"ptr$l->{POINTER_INDEX}_$e->{NAME}"} = "v->ptr$l->{POINTER_INDEX}_$e->{NAME}";
} elsif ($l->{TYPE} eq "SWITCH") {
- $env->{"level_$e->{NAME}"} = "v->level_$e->{NAME}";
} elsif ($l->{TYPE} eq "ARRAY") {
$env->{"length_$e->{NAME}"} = "v->length_$e->{NAME}";
$env->{"size_$e->{NAME}"} = "v->size_$e->{NAME}";
@@ -368,7 +377,6 @@ sub UnionGenerateEnvElement($)
} elsif ($l->{TYPE} eq "POINTER") {
$env->{"ptr$l->{POINTER_INDEX}_$e->{NAME}"} = "v->ptr$l->{POINTER_INDEX}";
} elsif ($l->{TYPE} eq "SWITCH") {
- $env->{"level_$e->{NAME}"} = "v->level";
} elsif ($l->{TYPE} eq "ARRAY") {
$env->{"length_$e->{NAME}"} = "v->length";
$env->{"size_$e->{NAME}"} = "v->size";
@@ -394,15 +402,20 @@ sub ParseUnion($$$)
indent;
DeclareArrayVariables($u->{ELEMENTS});
- unless (has_property($u, "nodiscriminant")) {
- pidl "if (!prs_uint32(\"switch_value\", ps, depth, &v->switch_value))";
+ if (defined ($u->{SWITCH_TYPE})) {
+ pidl "if (MARSHALLING(ps)) ";
+ pidl "\tv->switch_value = level;";
+ pidl "";
+ pidl "if (!prs_$u->{SWITCH_TYPE}(\"switch_value\", ps, depth, &v->switch_value))";
pidl "\treturn False;";
pidl "";
+ } else {
+ pidl "v->switch_value = level;";
}
# Maybe check here that level and v->switch_value are equal?
- pidl "switch (level) {";
+ pidl "switch (v->switch_value) {";
indent;
foreach (@{$u->{ELEMENTS}}) {
@@ -420,19 +433,30 @@ sub ParseUnion($$$)
pidl "";
}
+ unless ($u->{HAS_DEFAULT}) {
+ pidl "default:";
+ pidl "\treturn False;";
+ pidl "";
+ }
+
deindent;
pidl "}";
pidl "";
pidl "return True;";
deindent;
pidl "}";
+ pidl "";
pidl "BOOL $dfn(const char *desc, $sn* v, uint32 level, prs_struct *ps, int depth)";
pidl "{";
indent;
DeclareArrayVariables($u->{ELEMENTS});
- pidl "switch (level) {";
+ if (defined($u->{SWITCH_TYPE})) {
+ pidl "switch (v->switch_value) {";
+ } else {
+ pidl "switch (level) {";
+ }
indent;
foreach (@{$u->{ELEMENTS}}) {