svn commit: samba r2325 - in branches/SAMBA_4_0/source/build/pidl: .

tpot at samba.org tpot at samba.org
Mon Sep 13 12:44:37 GMT 2004


Author: tpot
Date: 2004-09-13 12:44:36 +0000 (Mon, 13 Sep 2004)
New Revision: 2325

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2325&nolog=1

Log:
Generate conversion stubs for IDL unions.

Modified:
   branches/SAMBA_4_0/source/build/pidl/swig.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-13 12:42:25 UTC (rev 2324)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-13 12:44:36 UTC (rev 2325)
@@ -237,12 +237,35 @@
     $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);
     }
 }
 



More information about the samba-cvs mailing list