summaryrefslogtreecommitdiff
path: root/source4/build/pidl/esp.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-06-01 00:12:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:21 -0500
commitcc89874f521532721e8ccb402c638c558e409811 (patch)
tree8f9b905211cd22f3984b17ec91e87d0be992166a /source4/build/pidl/esp.pm
parent03c2d642a620380d96a9e745ceb1cd19ffea2160 (diff)
downloadsamba-cc89874f521532721e8ccb402c638c558e409811.tar.gz
samba-cc89874f521532721e8ccb402c638c558e409811.tar.bz2
samba-cc89874f521532721e8ccb402c638c558e409811.zip
r7160: Initial work on an esp function wrapper generator
(This used to be commit aaf097ec101b5e31b00e6e9a211e247ee69a118a)
Diffstat (limited to 'source4/build/pidl/esp.pm')
-rw-r--r--source4/build/pidl/esp.pm76
1 files changed, 76 insertions, 0 deletions
diff --git a/source4/build/pidl/esp.pm b/source4/build/pidl/esp.pm
new file mode 100644
index 0000000000..8625544fda
--- /dev/null
+++ b/source4/build/pidl/esp.pm
@@ -0,0 +1,76 @@
+###################################################
+# ESP function wrapper generator
+# Copyright jelmer@samba.org 2005
+# released under the GNU GPL
+
+package EspClient;
+
+use strict;
+use pidl::typelist;
+
+my($res);
+
+sub pidl ($)
+{
+ $res .= shift;
+}
+
+sub ESPFunction($)
+{
+ my $d = shift;
+
+ pidl "static int esp_$d->{NAME}(struct EspRequest *ep, int argc, struct MprVar **argv)\n";
+ pidl "{\n";
+
+ # FIXME
+
+ pidl "\treturn 0;\n";
+ pidl "}\n\n";
+}
+
+#####################################################################
+# parse the interface definitions
+sub ESPInterface($)
+{
+ my($interface) = shift;
+ my @fns = ();
+
+ foreach my $d (@{$interface->{FUNCTIONS}}) {
+ next if not defined($d->{OPNUM});
+
+ ESPFunction($d);
+
+ push (@fns, $d->{NAME});
+ }
+
+ return @fns;
+}
+
+#####################################################################
+# parse a parsed IDL into a C header
+sub Parse($$)
+{
+ my($ndr) = shift;
+ my $hdr = shift;
+ my @fns = ();
+
+ $res = "";
+ pidl "#include \"$hdr\"\n\n";
+ pidl "/* ESP wrapper functions auto-generated by pidl */\n\n";
+ foreach my $x (@{$ndr}) {
+ if ($x->{TYPE} eq "INTERFACE") {
+ push (@fns, ESPInterface($x));
+ }
+ }
+
+ pidl "void setup_ejs_functions(void)\n";
+ pidl "{\n";
+ foreach (@fns) {
+ pidl "\tespDefineCFunction(NULL, \"$_\", esp_$_, NULL);\n";
+ }
+ pidl "}\n";
+
+ return $res;
+}
+
+1;