18 #include "precompiled.h"
25 "Vector3D", JSCLASS_HAS_PRIVATE,
26 JS_PropertyStub, JS_PropertyStub,
28 JS_EnumerateStub, JS_ResolveStub,
30 NULL, NULL, NULL, NULL
91 freshenFn = _freshenFn;
103 if (!JSID_IS_INT(
id))
115 switch (JSID_TO_INT(
id))
118 return JS_NewNumberValue(cx, vectorData->
X, vp);
120 return JS_NewNumberValue(cx, vectorData->
Y, vp);
122 return JS_NewNumberValue(cx, vectorData->
Z, vp);
130 if (!JSID_IS_INT(
id))
142 switch (JSID_TO_INT(
id))
168 JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(vector));
179 JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(vector));
185 JS_ReportError(cx,
"Invalid parameters to Vector3D constructor");
206 sprintf_s(buffer,
ARRAY_SIZE(buffer),
"[object Vector3D: ( %f, %f, %f )]", vectorData->
X, vectorData->
Y, vectorData->
Z);
207 JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buffer)));
JSFunctionSpec JSI_methods[]
void finalize(JSContext *cx, JSObject *obj)
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
JSPropertySpec JSI_props[]
void(IPropertyOwner::* updateFn)()
JSBool setProperty(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
int sprintf_s(char *buf, size_t max_chars, const char *fmt,...) PRINTF_ARGS(3)
JSBool construct(JSContext *cx, uintN argc, jsval *vp)
JSBool getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
JSFunctionSpec JSI_methods[]
#define JSU_REQUIRE_PARAMS(exact_number)
void(IPropertyOwner::* freshenFn)()
JSBool toString(JSContext *cx, uintN argc, jsval *vp)
JSPropertySpec JSI_props[]
bool ToPrimitive< float >(JSContext *cx, jsval v, float &Storage)