typedef int (*JSNative) (void *cx, void *obj, unsigned int argc, long *argv, long *rval); int math_round(void *cx, void *obj, unsigned int argc, long *argv, long *rval) { double x; return js_NewNumberValue(cx, copysign(floor(x + 0.5), x), rval); } int math_toSource(void *cx, void *obj, unsigned int argc, long *argv, long *rval) { } void *math__methods[]; void *js_InitMathClass(void *cx, void *obj) { void *Math; if (!JS_DefineFunctions(cx, Math, math__methods)) return ((void *)0); }