diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-11-01 05:25:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:08 -0500 |
commit | 2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed (patch) | |
tree | 4da99bdf8b7211c15158bae19a4b76b1e42df862 /source4/build/pidl/header.pm | |
parent | 38ee8f04ef945f9b109f8cdb39dc7c3c5ee90dd3 (diff) | |
download | samba-2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed.tar.gz samba-2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed.tar.bz2 samba-2c52f52e02ca1e7286d0faa15d5031f2a4ac11ed.zip |
r3423: auto-generate prototypes for all external functions in pidl
(This used to be commit 009488dfe55f5219b24c30222b1a8bf411a7e939)
Diffstat (limited to 'source4/build/pidl/header.pm')
-rw-r--r-- | source4/build/pidl/header.pm | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index f9acc5e222..58707a90a5 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -6,6 +6,7 @@ package IdlHeader; use strict; +use needed; my($res); my($tab_depth); @@ -178,6 +179,35 @@ sub HeaderTypedef($) } ##################################################################### +# prototype a typedef +sub HeaderTypedefProto($) +{ + my($d) = shift; + if (!util::has_property($d->{DATA}, "public")) { + return; + } + + if ($d->{DATA}{TYPE} eq "STRUCT") { + $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *, int , struct $d->{NAME} *);\n"; + $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *, int , struct $d->{NAME} *);\n"; + if (!util::has_property($d->{DATA}, "noprint")) { + $res .= "void ndr_print_$d->{NAME}(struct ndr_print *, const char *, struct $d->{NAME} *);\n"; + } + + if (needed::is_needed("ndr_size_$d->{NAME}")) { + $res .= "size_t ndr_size_$d->{NAME}(int , struct $d->{NAME} *, int );\n"; + } + } + if ($d->{DATA}{TYPE} eq "UNION") { + $res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *, int, int, union $d->{NAME} *);\n"; + $res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *, int, int, union $d->{NAME} *);\n"; + if (!util::has_property($d->{DATA}, "noprint")) { + $res .= "void ndr_print_$d->{NAME}(struct ndr_print *, const char *, int, union $d->{NAME} *);\n"; + } + } +} + +##################################################################### # parse a typedef sub HeaderConst($) { @@ -267,6 +297,18 @@ sub HeaderFunction($) } ##################################################################### +# output prototypes for a IDL function +sub HeaderFnProto($) +{ + my $fn = shift; + my $name = $fn->{NAME}; + $res .= "void ndr_print_$name(struct ndr_print *, const char *, int, struct $name *);\n"; + $res .= "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *, TALLOC_CTX *, struct $name *);\n"; + $res .= "NTSTATUS dcerpc_$name(struct dcerpc_pipe *, TALLOC_CTX *, struct $name *);\n"; + $res .= "\n"; +} + +##################################################################### # parse the interface definitions sub HeaderInterface($) { @@ -310,8 +352,12 @@ sub HeaderInterface($) HeaderConst($d); ($d->{TYPE} eq "TYPEDEF") && HeaderTypedef($d); + ($d->{TYPE} eq "TYPEDEF") && + HeaderTypedefProto($d); ($d->{TYPE} eq "FUNCTION") && HeaderFunction($d); + ($d->{TYPE} eq "FUNCTION") && + HeaderFnProto($d); } $res .= "#endif /* _HEADER_NDR_$interface->{NAME} */\n"; @@ -326,8 +372,10 @@ sub Parse($) $res = "/* header auto-generated by pidl */\n\n"; foreach my $x (@{$idl}) { - ($x->{TYPE} eq "INTERFACE") && - HeaderInterface($x); + if ($x->{TYPE} eq "INTERFACE") { + needed::BuildNeeded($x); + HeaderInterface($x); + } } return $res; } |