typedef int JSIntn; typedef unsigned int JSUintn; typedef double JSFloat64; typedef JSIntn JSBool; typedef long JSWord; typedef JSFloat64 float64; typedef JSUintn uintN; typedef JSWord jsword; typedef float64 jsdouble; typedef jsword jsval; typedef struct JSContext JSContext; typedef struct JSFunctionSpec JSFunctionSpec; typedef struct JSObject JSObject; typedef JSBool (* JSNative)(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval); struct JSConstDoubleSpec { }; struct JSFunctionSpec { const char *name; JSNative call; }; extern const char js_toSource_str[]; static JSBool math_abs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { } static JSBool math_round(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { jsdouble x, z; z = copysign(floor(x + 0.5), x); return js_NewNumberValue(cx, z, rval); } static JSBool math_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { } static JSFunctionSpec math_static_methods[] = { { js_toSource_str, math_toSource, 0, 0, 0} , { "round", math_round, 1, 0, 0} }; JSObject * js_InitMathClass(JSContext *cx, JSObject *obj) { JSObject *Math; if (!JS_DefineFunctions(cx, Math, math_static_methods)) return ((void *)0); }