Dzianis Barzakouski
2011-05-25 19:20:41 UTC
Hi All,
I have a simple app that uses SpiderMonkey for scripting purposes
( calls C functions from JS ). I do following (example from
http://www.mozilla.org/js/spidermonkey/tutorial.html) :
#define DOIT_MINARGS 2
static JSBool
doit_in_c(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
*rval)
{
...
}
ok = JS_DefineFunction(cx, global, "doit", doit_in_c, DOIT_MINARGS,
0);
everything works fine and and I get doit_in_c executed when I call
doit(..) in JS. Now I have a lot of small functions with same params,
only name differs and I would like to do some code refactoring and
place all functions logic under the same c-handler. Is there any
opportunity to get functions java-script name defined as third
parameter in JS_DefineFunction from doit_in_c? Is java-script function
name placed somewhere in JSContext or JSObject? I have spent without
success a lot of time looking for it in a debugger..
Thanks for help!
bz
I have a simple app that uses SpiderMonkey for scripting purposes
( calls C functions from JS ). I do following (example from
http://www.mozilla.org/js/spidermonkey/tutorial.html) :
#define DOIT_MINARGS 2
static JSBool
doit_in_c(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
*rval)
{
...
}
ok = JS_DefineFunction(cx, global, "doit", doit_in_c, DOIT_MINARGS,
0);
everything works fine and and I get doit_in_c executed when I call
doit(..) in JS. Now I have a lot of small functions with same params,
only name differs and I would like to do some code refactoring and
place all functions logic under the same c-handler. Is there any
opportunity to get functions java-script name defined as third
parameter in JS_DefineFunction from doit_in_c? Is java-script function
name placed somewhere in JSContext or JSObject? I have spent without
success a lot of time looking for it in a debugger..
Thanks for help!
bz