summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-12 12:40:11 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-12 12:40:11 +0100
commit850abaffbe057f504d47ae91ea6f3ad544d39ebe (patch)
treedb7b7da11456655cfc01bc8a3a2ee2840c81710e /pidl/lib/Parse
parentd1101dba79d65b0991668069b91946198f343ead (diff)
downloadsamba-850abaffbe057f504d47ae91ea6f3ad544d39ebe.tar.gz
samba-850abaffbe057f504d47ae91ea6f3ad544d39ebe.tar.bz2
samba-850abaffbe057f504d47ae91ea6f3ad544d39ebe.zip
Support pyhelper property to allow additional methods to be tucked onto a
pidl-generated type.
Diffstat (limited to 'pidl/lib/Parse')
-rw-r--r--pidl/lib/Parse/Pidl/NDR.pm1
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm9
2 files changed, 10 insertions, 0 deletions
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index 3daad24c5d..5ee26d16b6 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 90dcba0780..2c64f06aa4 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}}) {