diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-24 22:11:44 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:47:42 -0500 |
commit | ebfbb2a7abe33e47af48d69164c37f4c24b7f8ed (patch) | |
tree | 259c6b4bd5c79ed9112a07cc7e671775813c8f59 /source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm | |
parent | e791dd73b98308b949f4ecfb91b5c87183b5de76 (diff) | |
download | samba-ebfbb2a7abe33e47af48d69164c37f4c24b7f8ed.tar.gz samba-ebfbb2a7abe33e47af48d69164c37f4c24b7f8ed.tar.bz2 samba-ebfbb2a7abe33e47af48d69164c37f4c24b7f8ed.zip |
r12463: Rename 'Samba' namespace to 'Samba4'
(This used to be commit f25358270d44a5642adbb85ecaa50b2e5730d7f0)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm new file mode 100644 index 0000000000..a204ee7a56 --- /dev/null +++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJSHeader.pm @@ -0,0 +1,79 @@ +################################################### +# create C header files for an EJS mapping functions +# Copyright tridge@samba.org 2005 +# released under the GNU GPL + +package Parse::Pidl::Samba4::EJSHeader; + +use strict; +use Parse::Pidl::Typelist; +use Parse::Pidl::Util qw(has_property); + +use vars qw($VERSION); +$VERSION = '0.01'; + +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; |