diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-11-25 04:53:54 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:46:08 +0100 |
commit | c0a37093547a76c3a292c5a01250b9711a415ff3 (patch) | |
tree | c41fb862b4a8be94d014a496598cba043204e29b /source4/pidl/lib/Parse/Pidl/Samba4 | |
parent | 0cc955f958cdc722e2b0b6b68d0cd37f541e9d96 (diff) | |
download | samba-c0a37093547a76c3a292c5a01250b9711a415ff3.tar.gz samba-c0a37093547a76c3a292c5a01250b9711a415ff3.tar.bz2 samba-c0a37093547a76c3a292c5a01250b9711a415ff3.zip |
r26110: Create separate function for connecting, add helper for creating result typemaps.
(This used to be commit 9b5b77c399894fc7fdf0d61a14cfbcef6dbf678c)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/SWIG.pm | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/SWIG.pm b/source4/pidl/lib/Parse/Pidl/Samba4/SWIG.pm index 1eea561c7a..29f7835949 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/SWIG.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/SWIG.pm @@ -36,6 +36,22 @@ sub IgnoreInterface($$) } } +sub GenerateResultTypemap($) +{ + my $name = shift; + pidl "%typemap(in,numinputs=0) $name*result ($name tmp) {"; + indent; + pidl "\$1 = &tmp;"; + deindent; + pidl "}"; + pidl ""; + pidl "%typemap(argout) $name*result {"; + indent; + pidl "\$result = SWIG_NewPointerObj(*\$1, \$1_descriptor, 0);"; + deindent; + pidl "}"; +} + sub ParseInterface($$) { my ($basename,$if) = @_; @@ -46,12 +62,16 @@ sub ParseInterface($$) pidl ""; pidl "\%extend $if->{NAME} {"; indent(); - pidl "NTSTATUS $if->{NAME} (const char *binding, struct cli_credentials *cred, TALLOC_CTX *mem_ctx, struct event_context *event, struct $if->{NAME} **result)"; - pidl "{"; + pidl "$if->{NAME} () {"; indent; - pidl "*result = talloc(mem_ctx, struct $if->{NAME});"; + pidl "return talloc(NULL, struct $if->{NAME});"; + deindent; + pidl "}"; pidl ""; - pidl "return dcerpc_pipe_connect(mem_ctx, &(*result)->pipe, binding, &ndr_table_$if->{NAME}, cred, event);"; + pidl "NTSTATUS connect (const char *binding, struct cli_credentials *cred, struct event_context *event)"; + pidl "{"; + indent; + pidl "return dcerpc_pipe_connect(\$self, &\$self->pipe, binding, &ndr_table_$if->{NAME}, cred, event);"; deindent; pidl "}"; pidl ""; @@ -85,7 +105,7 @@ sub ParseInterface($$) } pidl ""; - pidl "status = dcerpc_$fn->{NAME}(self->pipe, mem_ctx, &r);"; + pidl "status = dcerpc_$fn->{NAME}(\$self->pipe, mem_ctx, &r);"; pidl "if (NT_STATUS_IS_ERR(status)) {"; pidl "\treturn status;"; pidl "}"; |