diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-21 23:30:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:17 -0500 |
commit | 59b13f9a1d684a632c2c73352f0ec08a63bc0913 (patch) | |
tree | 14b0a564e4db3377f7ad2fa1f9671f8e04405962 /source4/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm | |
parent | efc03df292aa84edb592c22191dbf86cdf8c32d0 (diff) | |
download | samba-59b13f9a1d684a632c2c73352f0ec08a63bc0913.tar.gz samba-59b13f9a1d684a632c2c73352f0ec08a63bc0913.tar.bz2 samba-59b13f9a1d684a632c2c73352f0ec08a63bc0913.zip |
r9460: - Move pidl to lib/. This fixes standalone installation of pidl.
- Update the README
- Allow building the docs stand-alone
(This used to be commit b56084ce251ab7a35dd1422f38de258e8e1e1477)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm b/source4/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm new file mode 100644 index 0000000000..81c75705de --- /dev/null +++ b/source4/pidl/lib/Parse/Pidl/Samba/EJSHeader.pm @@ -0,0 +1,76 @@ +################################################### +# create C header files for an EJS mapping functions +# Copyright tridge@samba.org 2005 +# released under the GNU GPL + +package Parse::Pidl::Samba::EJSHeader; + +use strict; +use Parse::Pidl::Typelist; +use Parse::Pidl::Util qw(has_property); + +my($res); + +sub pidl ($) +{ + $res .= shift; +} + +##################################################################### +# prototype a typedef +sub HeaderTypedefProto($) +{ + my $d = shift; + my $name = $d->{NAME}; + + return unless has_property($d, "public"); + + my $type_decl = Parse::Pidl::Typelist::mapType($name); + + pidl "NTSTATUS ejs_push_$d->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const $type_decl *);\n"; + pidl "NTSTATUS ejs_pull_$d->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, $type_decl *);\n"; +} + +##################################################################### +# parse the interface definitions +sub HeaderInterface($) +{ + my($interface) = shift; + + my $count = 0; + + pidl "#ifndef _HEADER_EJS_$interface->{NAME}\n"; + pidl "#define _HEADER_EJS_$interface->{NAME}\n\n"; + + if (defined $interface->{PROPERTIES}->{depends}) { + my @d = split / /, $interface->{PROPERTIES}->{depends}; + foreach my $i (@d) { + pidl "#include \"librpc/gen_ndr/ndr_$i\_ejs\.h\"\n"; + } + } + + pidl "\n"; + + foreach my $d (@{$interface->{TYPEDEFS}}) { + HeaderTypedefProto($d); + } + + pidl "\n"; + pidl "#endif /* _HEADER_EJS_$interface->{NAME} */\n"; +} + +##################################################################### +# parse a parsed IDL into a C header +sub Parse($) +{ + my($idl) = shift; + + $res = ""; + pidl "/* header auto-generated by pidl */\n\n"; + foreach my $x (@{$idl}) { + ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x); + } + return $res; +} + +1; |