summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
index ef22ff9788..513fa0826d 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
@@ -235,6 +235,20 @@ sub GenerateStructEnv($)
return \%env;
}
+sub EnvSubstituteValue($$)
+{
+ my ($env,$s) = @_;
+
+ # Substitute the value() values in the env
+ foreach my $e (@{$s->{ELEMENTS}}) {
+ next unless (my $v = has_property($e, "value"));
+
+ $env->{$e->{NAME}} = ParseExpr($v, $env);
+ }
+
+ return $env;
+}
+
sub GenerateFunctionInEnv($)
{
my $fn = shift;
@@ -1095,6 +1109,8 @@ sub ParseStructPush($$)
my $env = GenerateStructEnv($struct);
+ EnvSubstituteValue($env, $struct);
+
# save the old relative_base_offset
pidl "uint32_t _save_relative_base_offset = ndr_push_get_relative_base_offset(ndr);" if defined($struct->{PROPERTIES}{relative_base});
@@ -1326,6 +1342,8 @@ sub ParseStructPrint($$)
my $env = GenerateStructEnv($struct);
+ EnvSubstituteValue($env, $struct);
+
foreach my $e (@{$struct->{ELEMENTS}}) {
DeclareArrayVariables($e);
}
@@ -1870,6 +1888,7 @@ sub ParseFunctionPrint($)
pidl "ndr->depth++;";
my $env = GenerateFunctionInEnv($fn);
+ EnvSubstituteValue($env, $fn);
foreach my $e (@{$fn->{ELEMENTS}}) {
if (grep(/in/,@{$e->{DIRECTION}})) {
@@ -1925,6 +1944,8 @@ sub ParseFunctionPush($)
my $env = GenerateFunctionInEnv($fn);
+ EnvSubstituteValue($env, $fn);
+
foreach my $e (@{$fn->{ELEMENTS}}) {
if (grep(/in/,@{$e->{DIRECTION}})) {
ParseElementPush($e, "ndr", "r->in.", $env, 1, 1);