summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-09-14 10:42:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:44 -0500
commitd203c7899dbdb7b0b2a321215f3c67e6c9320e1c (patch)
tree2e755ed3d50df51b72f95322849c012def48293a /source4/build/pidl
parentce694e7051dca90cdb5700e3865315d16931c3c1 (diff)
downloadsamba-d203c7899dbdb7b0b2a321215f3c67e6c9320e1c.tar.gz
samba-d203c7899dbdb7b0b2a321215f3c67e6c9320e1c.tar.bz2
samba-d203c7899dbdb7b0b2a321215f3c67e6c9320e1c.zip
r2335: Zero function parameter struct so we can do a bit more testing. To be removed later.
Generate more stub code for union arms. (This used to be commit f8a14e808eb9ec2910fb22f35d828a7eeea14aec)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/swig.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm
index 05d68a8f79..9fb08c49c9 100644
--- a/source4/build/pidl/swig.pm
+++ b/source4/build/pidl/swig.pm
@@ -145,6 +145,9 @@ sub ParseFunction($)
$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 @@ sub ParseUnion($)
$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";