Rev 11556: Fix warning when using anonymous types, initial work on nested type support in ejs. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

Jelmer Vernooij jelmer at samba.org
Wed Feb 21 11:30:46 GMT 2007


At file:///home/jelmer/bzr.samba/SAMBA_4_0/

------------------------------------------------------------
revno: 11556
revision-id: jelmer at samba.org-20070221113036-clajwiyqor6weyhh
parent: svn-v2:21486 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Wed 2007-02-21 12:30:36 +0100
message:
  Fix warning when using anonymous types, initial work on nested type support in ejs.
modified:
  source/librpc/idl/echo.idl     svn-v2:6 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flibrpc%2fidl%2fecho.idl
  source/pidl/lib/Parse/Pidl/Samba4/EJS.pm svn-v2:12463 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fSamba4%2fEJS.pm
  source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm svn-v2:12463 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fSamba4%2fNDR%2fParser.pm
=== modified file 'source/librpc/idl/echo.idl'
--- a/source/librpc/idl/echo.idl	2006-09-18 21:52:00 +0000
+++ b/source/librpc/idl/echo.idl	2007-02-21 11:30:36 +0000
@@ -99,7 +99,7 @@
 	} echo_Enum1_32;
 
 	typedef struct {
-		echo_Enum1 e1;
+		enum { foo=1, bar=2} e1;
 		echo_Enum1_32 e2;
 	} echo_Enum2;
 

=== modified file 'source/pidl/lib/Parse/Pidl/Samba4/EJS.pm'
--- a/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm	2007-02-21 10:31:14 +0000
+++ b/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm	2007-02-21 11:30:36 +0000
@@ -157,7 +157,15 @@
 	    and (defined($pl) and $pl->{TYPE} eq "POINTER")) {
                 $var = get_pointer_to($var);
         }
-	pidl "NDR_CHECK(ejs_pull_$e->{TYPE}(ejs, v, $name, $var));";
+
+	my $t;
+	if (ref($e->{TYPE}) eq "HASH") {
+		$t = "$e->{TYPE}->{TYPE}_$e->{TYPE}->{NAME}";
+	} else {
+		$t = $e->{TYPE};
+	}
+
+	pidl "NDR_CHECK(ejs_pull_$t(ejs, v, $name, $var));";
 }
 
 ###########################
@@ -449,7 +457,15 @@
 	    or (defined($pl) and $pl->{TYPE} eq "POINTER")) {
                 $var = get_pointer_to($var);
         }
-	pidl "NDR_CHECK(ejs_push_$e->{TYPE}(ejs, v, $name, $var));";
+
+	my $t;
+	if (ref($e->{TYPE}) eq "HASH") {
+		$t = "$e->{TYPE}->{TYPE}_$e->{TYPE}->{NAME}";
+	} else {
+		$t = $e->{TYPE};
+	}
+
+	pidl "NDR_CHECK(ejs_push_$t(ejs, v, $name, $var));";
 }
 
 ###########################
@@ -877,11 +893,17 @@
 
 	foreach (@{$t->{DATA}->{ELEMENTS}}) {
 		next if (has_property($_, "subcontext")); #FIXME: Support subcontexts
-		unless (defined($needed->{"pull_$_->{TYPE}"})) {
-			$needed->{"pull_$_->{TYPE}"} = $needed->{"pull_$t->{NAME}"};
-		}
-		unless (defined($needed->{"push_$_->{TYPE}"})) {
-			$needed->{"push_$_->{TYPE}"} = $needed->{"push_$t->{NAME}"};
+		my $n;
+		if (ref($_->{TYPE}) eq "HASH") {
+			$n = "$_->{TYPE}->{TYPE}_$_->{TYPE}->{NAME}";
+		} else {
+			$n = $_->{TYPE};
+		}
+		unless (defined($needed->{"pull_$n"})) {
+			$needed->{"pull_$n"} = $needed->{"pull_$t->{NAME}"};
+		}
+		unless (defined($needed->{"push_$n"})) {
+			$needed->{"push_$n"} = $needed->{"push_$t->{NAME}"};
 		}
 	}
 }

=== modified file 'source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm'
--- a/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm	2007-02-21 10:31:14 +0000
+++ b/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm	2007-02-21 11:30:36 +0000
@@ -2651,6 +2651,9 @@
 
 	return if ($e->{TYPE} eq "EMPTY");
 
+	return if (ref($e->{TYPE}) eq "HASH" and 
+		       not defined($e->{TYPE}->{NAME}));
+
 	my ($t, $rt);
 	if (ref($e->{TYPE}) eq "HASH") {
 		$t = $e->{TYPE}->{TYPE}."_".$e->{TYPE}->{NAME};



More information about the samba-cvs mailing list