summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-08-15 06:08:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:51 -0500
commit645e87281c78f944fd6fe2ae52c6e0f058c665ff (patch)
tree507d531b6432c5123a043925bad7925d2ee86a23 /source4/pidl
parent2b3161d8de92528be192f593256e97ec9658f88b (diff)
downloadsamba-645e87281c78f944fd6fe2ae52c6e0f058c665ff.tar.gz
samba-645e87281c78f944fd6fe2ae52c6e0f058c665ff.tar.bz2
samba-645e87281c78f944fd6fe2ae52c6e0f058c665ff.zip
r24446: We only need one genric GenerateFunctionInEnv
function metze (This used to be commit 0c5be644ba13c68b7378a6ae9dcd314018ece25d)
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm17
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm18
2 files changed, 13 insertions, 22 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 27b71053fb..5352e41f24 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -16,6 +16,7 @@ use Parse::Pidl::Typelist qw(hasType getType mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(has_property is_constant ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use Parse::Pidl::Samba4 qw(DeclLong);
+use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -33,20 +34,6 @@ sub new($)
bless($self, $class);
}
-sub GenerateFunctionInEnv($)
-{
- my $fn = shift;
- my %env;
-
- foreach my $e (@{$fn->{ELEMENTS}}) {
- if (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r.in.$e->{NAME}";
- }
- }
-
- return \%env;
-}
-
sub ParseFunction($$$)
{
my ($self, $uif, $fn) = @_;
@@ -110,7 +97,7 @@ sub ParseFunction($$$)
# Since the data is being copied into a user-provided data
# structure, the user should be able to know the size beforehand
# to allocate a structure of the right size.
- my $env = GenerateFunctionInEnv($fn);
+ my $env = GenerateFunctionInEnv($fn, "r.");
my $size_is = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e);
$self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);");
} else {
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index b65df06884..73ff28eed0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -243,30 +243,34 @@ sub EnvSubstituteValue($$)
return $env;
}
-sub GenerateFunctionInEnv($)
+sub GenerateFunctionInEnv($;$)
{
- my $fn = shift;
+ my ($fn, $base) = @_;
my %env;
+ $base = "r->" unless defined($base);
+
foreach my $e (@{$fn->{ELEMENTS}}) {
if (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r->in.$e->{NAME}";
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
}
}
return \%env;
}
-sub GenerateFunctionOutEnv($)
+sub GenerateFunctionOutEnv($;$)
{
- my $fn = shift;
+ my ($fn, $base) = @_;
my %env;
+ $base = "r->" unless defined($base);
+
foreach my $e (@{$fn->{ELEMENTS}}) {
if (grep (/out/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r->out.$e->{NAME}";
+ $env{$e->{NAME}} = $base."out.$e->{NAME}";
} elsif (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r->in.$e->{NAME}";
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
}
}