svn commit: samba r2335 - in branches/SAMBA_4_0/source/build/pidl: .

tpot at samba.org tpot at samba.org
Tue Sep 14 10:42:53 GMT 2004


Author: tpot
Date: 2004-09-14 10:42:52 +0000 (Tue, 14 Sep 2004)
New Revision: 2335

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2335&nolog=1

Log:
Zero function parameter struct so we can do a bit more testing.  To be removed later.

Generate more stub code for union arms.

Modified:
   branches/SAMBA_4_0/source/build/pidl/swig.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-14 01:49:50 UTC (rev 2334)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-14 10:42:52 UTC (rev 2335)
@@ -145,6 +145,9 @@
 
     $res .= "\tstruct $fn->{NAME} *s = talloc(mem_ctx, sizeof(struct $fn->{NAME}));\n\n";
 
+    # Remove this when all elements are initialised
+    $res .= "\tmemset(s, 0, sizeof(struct $fn->{NAME}));\n\n";
+
     foreach my $e (@{$fn->{DATA}}) {
 	$res .= XFromPython($e, "in.") if util::has_property($e, "in")
     }
@@ -246,6 +249,23 @@
 
     $res .= "union $u->{NAME} *$u->{NAME}_from_python(TALLOC_CTX *mem_ctx, PyObject *obj)\n";
     $res .= "{\n";
+
+    $res .= "\tunion $u->{NAME} *u = talloc(mem_ctx, sizeof(struct $u->{NAME}));\n";
+    $res .= "\tPyObject *dict;\n\n";
+
+    
+    for my $e (@{$u->{DATA}{DATA}}) {
+	$res .= "\tif ((dict = PyDict_GetItem(obj, PyString_FromString(\"$e->{DATA}{NAME}\")))) {\n";
+#	if ($e->{DATA}{POINTERS} == 0) {
+#	    $res .= "\t\t// $e->{TYPE} pointers=$e->{DATA}{POINTERS}\n";
+#	} else {
+#	    $res .= "\t\t// $e->{TYPE} pointers=$e->{DATA}{POINTERS}\n";
+#	}
+
+	$res .= "\t\treturn u;\n";
+	$res .= "\t}\n\n";
+    }
+
     $res .= "\treturn NULL;\n";
     $res .= "}\n\n";
 



More information about the samba-cvs mailing list