Support pyhelper property to allow additional methods to be tucked onto a
authorJelmer Vernooij <jelmer@samba.org>
Fri, 12 Dec 2008 11:40:11 +0000 (12:40 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 12 Dec 2008 11:40:11 +0000 (12:40 +0100)
pidl-generated type.

pidl/lib/Parse/Pidl/NDR.pm
pidl/lib/Parse/Pidl/Samba4/Python.pm

index 3daad24c5da5ea4fc63137d2e7cbf40afd728ea1..5ee26d16b68c76f611c4fedc832aab5671f513e1 100644 (file)
@@ -855,6 +855,7 @@ my %property_list = (
        "endpoint"              => ["INTERFACE"],
        "pointer_default"       => ["INTERFACE"],
        "helper"                => ["INTERFACE"],
        "endpoint"              => ["INTERFACE"],
        "pointer_default"       => ["INTERFACE"],
        "helper"                => ["INTERFACE"],
+       "pyhelper"              => ["INTERFACE"],
        "authservice"           => ["INTERFACE"],
        "restricted"    => ["INTERFACE"],
 
        "authservice"           => ["INTERFACE"],
        "restricted"    => ["INTERFACE"],
 
index 90dcba0780dd7e588ba1c246849e2ee4d3b915a0..2c64f06aa48ddb0972950c2e2ff5d7df4b3f0577 100644 (file)
@@ -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->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("};");
                $self->pidl("{ NULL, NULL, 0, NULL }");
                $self->deindent;
                $self->pidl("};");
@@ -624,6 +629,10 @@ sub Interface($$$)
 
        $self->pidl_hdr("\n");
 
 
        $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}}) {
        $self->Const($_) foreach (@{$interface->{CONSTS}});
 
        foreach my $d (@{$interface->{TYPES}}) {