diff options
-rw-r--r-- | source4/build/pidl/swig.pm | 23 |
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); } } |