summaryrefslogtreecommitdiff
path: root/source4/build/pidl/swig.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/pidl/swig.pm')
-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";