svn commit: samba r2253 - in branches/SAMBA_4_0/source: build/pidl script scripting/swig

tpot at samba.org tpot at samba.org
Wed Sep 8 11:54:02 GMT 2004


Author: tpot
Date: 2004-09-08 11:54:01 +0000 (Wed, 08 Sep 2004)
New Revision: 2253

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

Log:
Add test program, as small example of what's going on.

Added:
   branches/SAMBA_4_0/source/build/pidl/swig.pm
   branches/SAMBA_4_0/source/scripting/swig/test
Modified:
   branches/SAMBA_4_0/source/build/pidl/pidl.pl
   branches/SAMBA_4_0/source/script/build_idl.sh
   branches/SAMBA_4_0/source/scripting/swig/dcerpc.i


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/pidl.pl
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/pidl.pl	2004-09-08 11:01:18 UTC (rev 2252)
+++ branches/SAMBA_4_0/source/build/pidl/pidl.pl	2004-09-08 11:54:01 UTC (rev 2253)
@@ -22,6 +22,7 @@
 use validator;
 use util;
 use template;
+use swig;
 
 my($opt_help) = 0;
 my($opt_parse) = 0;
@@ -33,6 +34,7 @@
 my($opt_parser) = 0;
 my($opt_eparser) = 0;
 my($opt_keep) = 0;
+my($opt_swig) = 0;
 my($opt_output);
 
 my $idl_parser = new idl;
@@ -86,7 +88,8 @@
 	    'parser' => \$opt_parser,
 	    'eparser' => \$opt_eparser,
 	    'diff' => \$opt_diff,
-	    'keep' => \$opt_keep
+	    'keep' => \$opt_keep,
+	    'swig' => \$opt_swig
 	    );
 
 if ($opt_help) {
@@ -155,6 +158,13 @@
 		close(OUT);
 	}
 
+	if ($opt_swig) {
+	        my($filename) = $output;
+	        $filename =~ s/\/ndr_/\//;
+		$filename = util::ChangeExtension($filename, ".i");
+		util::FileSave($filename, IdlSwig::Parse($pidl));
+	}
+
 	if ($opt_diff) {
 		my($tempfile) = util::ChangeExtension($output, ".tmp");
 		util::FileSave($tempfile, IdlDump::Dump($pidl));

Added: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-08 11:01:18 UTC (rev 2252)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm	2004-09-08 11:54:01 UTC (rev 2253)
@@ -0,0 +1,24 @@
+###################################################
+# Samba4 parser generator for swig wrappers
+# Copyright tpot at samba.org 2004
+# released under the GNU GPL
+
+package IdlSwig;
+
+use strict;
+
+sub Parse($)
+{
+    my($idl) = shift;
+    my($res) = "";
+
+    $res = "/* header auto-generated by pidl */\n\n";
+
+    foreach my $x (@{$idl}) {
+#	($x->{TYPE} eq "INTERFACE") && HeaderInterface($x);
+    }
+
+    return $res;
+}
+
+1;

Modified: branches/SAMBA_4_0/source/script/build_idl.sh
===================================================================
--- branches/SAMBA_4_0/source/script/build_idl.sh	2004-09-08 11:01:18 UTC (rev 2252)
+++ branches/SAMBA_4_0/source/script/build_idl.sh	2004-09-08 11:54:01 UTC (rev 2253)
@@ -4,7 +4,7 @@
 
 [ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
 
-PIDL="$PERL ./build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --server"
+PIDL="$PERL ./build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --server --swig"
 TABLES="$PERL ./build/pidl/tables.pl --output librpc/gen_ndr/tables"
 
 if [ x$FULLBUILD = xFULL ]; then

Modified: branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/dcerpc.i	2004-09-08 11:01:18 UTC (rev 2252)
+++ branches/SAMBA_4_0/source/scripting/swig/dcerpc.i	2004-09-08 11:54:01 UTC (rev 2253)
@@ -112,6 +112,8 @@
 
 %types(struct dcerpc_pipe *);
 
+%rename(pipe_connect) dcerpc_pipe_connect;
+
 NTSTATUS dcerpc_pipe_connect(struct dcerpc_pipe **OUT,
                              const char *binding,
                              const char *pipe_uuid,

Added: branches/SAMBA_4_0/source/scripting/swig/test
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/test	2004-09-08 11:01:18 UTC (rev 2252)
+++ branches/SAMBA_4_0/source/scripting/swig/test	2004-09-08 11:54:01 UTC (rev 2253)
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+
+import dcerpc
+import gc
+gc.set_debug(gc.DEBUG_LEAK)
+
+handle = dcerpc.pipe_connect("ncacn_np:win2k3dc",
+	dcerpc.DCERPC_SAMR_UUID, dcerpc.DCERPC_SAMR_VERSION,
+	"win2k3dom", "administrator", "penguin")
+
+connect = {"system_name": "win2k3dc", "access_mask": 12345}
+
+print dcerpc.samr_Connect2(handle, connect)


Property changes on: branches/SAMBA_4_0/source/scripting/swig/test
___________________________________________________________________
Name: svn:executable
   + *



More information about the samba-cvs mailing list