]> git.wh0rd.org - ICEs.git/blob - 137526/jsmath.i.2
add bfin ice
[ICEs.git] / 137526 / jsmath.i.2
1 typedef struct JSFunctionSpec JSFunctionSpec;
2 typedef struct JSObject JSObject;
3 typedef int (* JSNative)(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval);
4 struct JSConstDoubleSpec {
5 };
6 struct JSFunctionSpec {
7 const char *name;
8 JSNative call;
9 };
10 extern const char js_toSource_str[];
11 static int math_abs(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) {
12 }
13 static int math_round(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) {
14 double x;
15 return js_NewNumberValue(cx,
16 copysign(floor(x + 0.5), x),
17 rval);
18 }
19 static int math_toSource(void *cx, JSObject *obj, unsigned int argc, long *argv, long *rval) {
20 }
21 static JSFunctionSpec math_static_methods[] = {
22 {
23 js_toSource_str, math_toSource, 0, 0, 0}
24 , {
25 "round", math_round, 1, 0, 0}
26 };
27 JSObject * js_InitMathClass(void *cx, JSObject *obj) {
28 JSObject *Math;
29 if (!JS_DefineFunctions(cx, Math, math_static_methods)) return ((void *)0);
30 }