summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-08-02 17:02:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:58 -0500
commit30c3c77306ad48e41c9d2558f0a05b4cd3c9255b (patch)
tree485a5b584d53333212cde83d5263babd8a6696d3
parent08b2b7e3e1557ec7b0ddca09695844b7839a7ddf (diff)
downloadsamba-30c3c77306ad48e41c9d2558f0a05b4cd3c9255b.tar.gz
samba-30c3c77306ad48e41c9d2558f0a05b4cd3c9255b.tar.bz2
samba-30c3c77306ad48e41c9d2558f0a05b4cd3c9255b.zip
r8925: Start generating header and implementation files for smb_interfaces.h
(This used to be commit 3a93f1125539eec6bd17003a748f1b7dd76d0031)
-rwxr-xr-xsource4/script/build_smb_interfaces.pl54
1 files changed, 49 insertions, 5 deletions
diff --git a/source4/script/build_smb_interfaces.pl b/source4/script/build_smb_interfaces.pl
index 31309220c1..cc3a352987 100755
--- a/source4/script/build_smb_interfaces.pl
+++ b/source4/script/build_smb_interfaces.pl
@@ -1,10 +1,54 @@
#!/usr/bin/perl
+#
+# Create ejs interfaces for structures in a C header file
+#
-my $idl_file = shift;
+use File::Basename;
+my $file = shift;
+my $basename = basename($file, ".h");
require smb_interfaces;
-my $idl_parser = new smb_interfaces;
-$parse = $idl_parser->parse($idl_file);
+my $parser = new smb_interfaces;
+$header = $parser->parse($file);
-use Data::Dumper;
-print Dumper($parse);
+#use Data::Dumper;
+#print Dumper($header);
+
+# Create header
+
+open(FILE, ">ejs_${basename}.h");
+
+print FILE "/* header auto-generated by build_smb_interfaces.pl */\n\n";
+
+print FILE "#ifndef _ejs_${basename}_h\n";
+print FILE "#define _ejs_${basename}_h\n\n";
+
+foreach my $x (@{$header}) {
+ print FILE "NTSTATUS ejs_push_$x->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const uint32_t *);\n";
+ print FILE "NTSTATUS ejs_pull_$x->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const uint32_t *);\n";
+}
+
+print FILE "#endif\n";
+
+close(FILE);
+
+# Create file
+
+open(FILE, ">ejs_${basename}.c");
+
+print FILE "/* EJS wrapper functions auto-generated by build_smb_interfaces.pl */\n\n";
+
+# Top level functions
+
+foreach my $x (@{$header}) {
+ print FILE "NTSTATUS ejs_push_$x->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const uint32_t *)\n";
+ print FILEq "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+ print FILE "NTSTATUS ejs_pull_$x->{NAME}(struct ejs_rpc *, struct MprVar *, const char *, const uint32_t *)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+}
+
+close(FILE);