summaryrefslogtreecommitdiff
path: root/source4/build/pidl/swig.pm
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-09-13 12:44:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:44 -0500
commitcff1f3e8a961ffc15c09ef5de1aa965122e6e4f6 (patch)
tree16744d535d7e63796ce4247a72701369e685c3c9 /source4/build/pidl/swig.pm
parent12b29d8bb7e0b984dc51644763cd544dbe350172 (diff)
downloadsamba-cff1f3e8a961ffc15c09ef5de1aa965122e6e4f6.tar.gz
samba-cff1f3e8a961ffc15c09ef5de1aa965122e6e4f6.tar.bz2
samba-cff1f3e8a961ffc15c09ef5de1aa965122e6e4f6.zip
r2325: Generate conversion stubs for IDL unions.
(This used to be commit a06727b79228865e03430e41fc991c3d39eca220)
Diffstat (limited to 'source4/build/pidl/swig.pm')
-rw-r--r--source4/build/pidl/swig.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm
index c6a398f6b4..05d68a8f79 100644
--- a/source4/build/pidl/swig.pm
+++ b/source4/build/pidl/swig.pm
@@ -237,12 +237,35 @@ sub ParseStruct($)
$res .= "\n%}\n\n";
}
+sub ParseUnion($)
+{
+ my($u) = shift;
+
+ $res .= "%{\n\n";
+ $res .= "/* Convert Python dict to union $u->{NAME} */\n\n";
+
+ $res .= "union $u->{NAME} *$u->{NAME}_from_python(TALLOC_CTX *mem_ctx, PyObject *obj)\n";
+ $res .= "{\n";
+ $res .= "\treturn NULL;\n";
+ $res .= "}\n\n";
+
+ $res .= "/* Convert union $u->{NAME} to Python dict */\n\n";
+
+ $res .= "PyObject *$u->{NAME}_to_python(TALLOC_CTX *mem_ctx, union $u->{NAME} *u)\n";
+ $res .= "{\n";
+ $res .= "\treturn NULL;\n";
+ $res .= "}\n\n";
+
+ $res .= "\n%}\n\n";
+}
+
sub ParseTypedef($)
{
my($t) = shift;
foreach my $e ($t) {
($e->{DATA}{TYPE} eq "STRUCT") && ParseStruct($e);
+ ($e->{DATA}{TYPE} eq "UNION") && ParseUnion($e);
}
}