]>
Commit | Line | Data |
---|---|---|
45516216 | 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) { | |
5 | } | |
6 | int math_round(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) { | |
7 | double x; | |
8 | return js_NewNumberValue(cx, | |
9 | copysign(floor(x + 0.5), x), | |
10 | rval); | |
11 | } | |
12 | int math_toSource(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) { | |
13 | } | |
14 | void *math__methods[] = { | |
15 | { | |
16 | js_toSource_str, math_toSource, 0, 0, 0} | |
17 | , { | |
18 | "round", math_round, 1, 0, 0} | |
19 | }; | |
20 | JSObject * js_InitMathClass(void *cx, JSObject *obj) { | |
21 | JSObject *Math; | |
22 | if (!JS_DefineFunctions(cx, Math, math__methods)) return ((void *)0); | |
23 | } |