Author: jelmer Date: 2005-04-21 08:03:38 +0000 (Thu, 21 Apr 2005) New Revision: 6418
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6418 Log: Allow determining the prefix necessary for getting to the value of a variable Modified: branches/tmp/pidl2/source/build/pidl/ndr_parser.pm Changeset: Modified: branches/tmp/pidl2/source/build/pidl/ndr_parser.pm =================================================================== --- branches/tmp/pidl2/source/build/pidl/ndr_parser.pm 2005-04-21 07:57:52 UTC (rev 6417) +++ branches/tmp/pidl2/source/build/pidl/ndr_parser.pm 2005-04-21 08:03:38 UTC (rev 6418) @@ -21,6 +21,25 @@ return $typefamily{$n}; } +sub append_prefix($$) +{ + my $e = shift; + my $var_name = shift; + my $pointers = 0; + + foreach my $l (@{$e->{LEVELS}}) { + if ($l->{TYPE} eq "POINTER") { + $pointers++; + } elsif ($l->{TYPE} eq "DATA") { + if ($l->{DATA_TYPE} eq "string") { + return get_value_of($var_name) unless ($pointers); + } + } + } + + return $var_name; +} + # see if a variable needs to be allocated by the NDR subsystem on pull sub need_alloc($) { @@ -628,6 +647,8 @@ my $var_name = $var_prefix.$e->{NAME}; + $var_name = append_prefix($e, $var_name); + return unless $primitives or ($deferred and ContainsDeferred($e)); start_flags($e); @@ -717,6 +738,7 @@ my($var_name) = shift; my $env = shift; + $var_name = append_prefix($e, $var_name); return if (util::has_property($e, "noprint")); if (my $value = util::has_property($e, "value")) { @@ -886,6 +908,8 @@ my $var_name = $var_prefix.$e->{NAME}; + $var_name = append_prefix($e, $var_name); + my $previous = undef; return unless $primitives or ($deferred and ContainsDeferred($e));