From a0bc4da1a307753e3b28a11863f50d66b0894190 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Jul 2005 07:18:23 +0000 Subject: r8483: switched our generated ejs rpc code over to the new OO interface. This means we don't pollute the name space, and also makes for faster startup times as we only create variables for the pipes that we use, not all pipes (This used to be commit 57d7a585e8162d21c7152952aa0cc7471968784f) --- source4/build/pidl/Parse/Pidl/Samba/EJS.pm | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'source4/build/pidl') diff --git a/source4/build/pidl/Parse/Pidl/Samba/EJS.pm b/source4/build/pidl/Parse/Pidl/Samba/EJS.pm index d2d8b41507..0aa8de7c93 100644 --- a/source4/build/pidl/Parse/Pidl/Samba/EJS.pm +++ b/source4/build/pidl/Parse/Pidl/Samba/EJS.pm @@ -689,33 +689,30 @@ sub EjsInterface($$) EjsConst($d); } - pidl "void setup_ejs_$name(void)"; + pidl "static int ejs_$name\_init(int eid, int argc, struct MprVar **argv)"; pidl "{"; indent; + pidl "struct MprVar obj = mprObject(\"$name\");"; foreach (@fns) { - pidl "ejsDefineCFunction(-1, \"dcerpc_$_\", ejs_$_, NULL, MPR_VAR_SCRIPT_HANDLE);"; + pidl "mprSetCFunction(&obj, \"$_\", ejs_$_);"; } - deindent; - pidl "}\n"; - - pidl "void setup_ejs_constants_$name(int eid)"; - pidl "{"; - indent; foreach my $v (keys %constants) { my $value = $constants{$v}; if (substr($value, 0, 1) eq "\"") { - pidl "ejs_set_constant_string(eid, \"$v\", $value);"; + pidl "mprSetVar(&obj, \"$v\", mprString($value));"; } else { - pidl "ejs_set_constant_int(eid, \"$v\", $value);"; + pidl "mprSetVar(&obj, \"$v\", mprCreateNumberVar($value));"; } } + pidl "mpr_Return(eid, obj);"; + pidl "return 0;"; deindent; pidl "}\n"; pidl "NTSTATUS ejs_init_$name(void)"; pidl "{"; indent; - pidl "return smbcalls_register_ejs(\"$name\", setup_ejs_$name, setup_ejs_constants_$name);"; + pidl "return smbcalls_register_ejs(\"$name\_init\", ejs_$name\_init);"; deindent; pidl "}"; } @@ -734,6 +731,7 @@ sub Parse($$) #include \"includes.h\" #include \"lib/appweb/ejs/ejs.h\" #include \"scripting/ejs/ejsrpc.h\" +#include \"scripting/ejs/smbcalls.h\" #include \"librpc/gen_ndr/ndr_misc_ejs.h\" #include \"$hdr\" #include \"$ejs_hdr\" -- cgit