1 typedef struct JSObject JSObject;
2 typedef int (* JSNative)(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval);
3 extern const char js_toSource_str[];
4 int math_abs(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) {
6 int math_round(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) {
8 return js_NewNumberValue(cx,
9 copysign(floor(x + 0.5), x),
12 int math_toSource(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) {
14 void *math__methods[] = {
16 js_toSource_str, math_toSource, 0, 0, 0}
18 "round", math_round, 1, 0, 0}
20 JSObject * js_InitMathClass(void *cx, JSObject *obj) {
22 if (!JS_DefineFunctions(cx, Math, math__methods)) return ((void *)0);