svn commit: samba r24446 - in
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl: Samba3 Samba4/NDR
metze at samba.org
metze at samba.org
Wed Aug 15 06:08:03 GMT 2007
Author: metze
Date: 2007-08-15 06:08:02 +0000 (Wed, 15 Aug 2007)
New Revision: 24446
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24446
Log:
We only need one genric GenerateFunctionInEnv
function
metze
Modified:
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm 2007-08-15 01:54:37 UTC (rev 24445)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm 2007-08-15 06:08:02 UTC (rev 24446)
@@ -16,6 +16,7 @@
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 @@
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 @@
# 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 {
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 2007-08-15 01:54:37 UTC (rev 24445)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 2007-08-15 06:08:02 UTC (rev 24446)
@@ -243,30 +243,34 @@
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}";
}
}
More information about the samba-cvs
mailing list