From cff1f3e8a961ffc15c09ef5de1aa965122e6e4f6 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 13 Sep 2004 12:44:36 +0000 Subject: r2325: Generate conversion stubs for IDL unions. (This used to be commit a06727b79228865e03430e41fc991c3d39eca220) --- source4/build/pidl/swig.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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); } } -- cgit