summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ejs_header.pm
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-08 08:18:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:23 -0500
commitf55b2b96108d71197807b46af16085167556bf6e (patch)
tree2b566f6a0c7e16d8f65f3653c9737c68f3954be3 /source4/build/pidl/ejs_header.pm
parent0b92507760910872d5f0f3fe2c45f4f3af3466eb (diff)
downloadsamba-f55b2b96108d71197807b46af16085167556bf6e.tar.gz
samba-f55b2b96108d71197807b46af16085167556bf6e.tar.bz2
samba-f55b2b96108d71197807b46af16085167556bf6e.zip
r8233: - added support for more base types in pidl ejs
- added auto generation of a header with prototypes for public ejs functions - make public functions non-static - fixed allocation of fixed sized arrays - added 'noejs' flag indicating that a typedef will be handled manually by ejs - added manual functions for sid and GUID, so they show up as nice strings in ejs scripts This allows ejs to bring in samr, security, lsa and misc IDL functions (This used to be commit a8cb2dbdcc2871090a26f580f67db8f0636d1e7e)
Diffstat (limited to 'source4/build/pidl/ejs_header.pm')
-rw-r--r--source4/build/pidl/ejs_header.pm75
1 files changed, 75 insertions, 0 deletions
diff --git a/source4/build/pidl/ejs_header.pm b/source4/build/pidl/ejs_header.pm
new file mode 100644
index 0000000000..af6b4d426d
--- /dev/null
+++ b/source4/build/pidl/ejs_header.pm
@@ -0,0 +1,75 @@
+###################################################
+# create C header files for an EJS mapping functions
+# Copyright tridge@samba.org 2005
+# released under the GNU GPL
+
+package EjsHeader;
+
+use strict;
+use pidl::typelist;
+
+my($res);
+
+sub pidl ($)
+{
+ $res .= shift;
+}
+
+#####################################################################
+# prototype a typedef
+sub HeaderTypedefProto($)
+{
+ my $d = shift;
+ my $name = $d->{NAME};
+
+ return unless util::has_property($d, "public");
+
+ my $type_decl = 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;