From: Jelmer Vernooij Date: Fri, 12 Dec 2008 11:40:11 +0000 (+0100) Subject: Support pyhelper property to allow additional methods to be tucked onto a X-Git-Tag: samba-4.0.0alpha6~479^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=850abaffbe057f504d47ae91ea6f3ad544d39ebe;p=thirdparty%2Fsamba.git Support pyhelper property to allow additional methods to be tucked onto a pidl-generated type. --- diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 3daad24c5da..5ee26d16b68 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -855,6 +855,7 @@ my %property_list = ( "endpoint" => ["INTERFACE"], "pointer_default" => ["INTERFACE"], "helper" => ["INTERFACE"], + "pyhelper" => ["INTERFACE"], "authservice" => ["INTERFACE"], "restricted" => ["INTERFACE"], diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 90dcba0780d..2c64f06aa48 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -280,6 +280,11 @@ sub PythonStruct($$$$$$) $self->indent; $self->pidl("{ \"__ndr_pack__\", (PyCFunction)py_$name\_ndr_pack, METH_NOARGS, \"S.pack() -> blob\\nNDR pack\" },"); $self->pidl("{ \"__ndr_unpack__\", (PyCFunction)py_$name\_ndr_unpack, METH_VARARGS, \"S.unpack(blob) -> None\\nNDR unpack\" },"); + $self->deindent; + $self->pidl("#ifdef ".uc("py_$name\_extra_methods")); + $self->pidl("\t" .uc("py_$name\_extra_methods")); + $self->pidl("#endif"); + $self->indent; $self->pidl("{ NULL, NULL, 0, NULL }"); $self->deindent; $self->pidl("};"); @@ -624,6 +629,10 @@ sub Interface($$$) $self->pidl_hdr("\n"); + if (has_property($interface, "pyhelper")) { + $self->pidl("#include \"".unmake_str($interface->{PROPERTIES}->{pyhelper})."\"\n"); + } + $self->Const($_) foreach (@{$interface->{CONSTS}}); foreach my $d (@{$interface->{TYPES}}) {