|
From: <br...@us...> - 2010-09-18 17:54:58
|
Revision: 4196
http://openvrml.svn.sourceforge.net/openvrml/?rev=4196&view=rev
Author: braden
Date: 2010-09-18 17:54:51 +0000 (Sat, 18 Sep 2010)
Log Message:
-----------
SpiderMonkey included in the forthcoming XULRunner 1.9.3 includes changes to the JSPropertyOp function signature: a parameter that was a jsval in previous versions is now a jsid. Test for this and adjust our usage accordingly.
Modified Paths:
--------------
trunk/ChangeLog
trunk/configure.ac
trunk/src/script/javascript.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-09-15 16:50:40 UTC (rev 4195)
+++ trunk/ChangeLog 2010-09-18 17:54:51 UTC (rev 4196)
@@ -1,3 +1,13 @@
+2010-09-18 Braden McDaniel <br...@en...>
+
+ SpiderMonkey included in the forthcoming XULRunner 1.9.3 includes
+ changes to the JSPropertyOp function signature: a parameter that
+ was a jsval in previous versions is now a jsid. Test for this and
+ adjust our usage accordingly.
+
+ * configure.ac
+ * src/script/javascript.cpp
+
2010-09-15 Braden McDaniel <br...@en...>
* src/script/javascript.cpp: JS_NewDouble is deprecated; use
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2010-09-15 16:50:40 UTC (rev 4195)
+++ trunk/configure.ac 2010-09-18 17:54:51 UTC (rev 4196)
@@ -149,6 +149,36 @@
CPPFLAGS=$ov_save_CPPFLAGS
#
+# The JSPropertyOp function signature changed from XULRunner 1.9.2 to
+# 1.9.3: the third argument changed from jsval to jsid.
+#
+AC_CACHE_CHECK([whether JSPropertyOp uses jsid],
+[ov_cv_jspropertyop_uses_jsid],
+[ov_cv_jspropertyop_uses_jsid=no
+#
+# Test using C++ since C probably doesn't care so much about the type.
+#
+ov_save_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$JS_CFLAGS $CPPFLAGS"
+AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <jsapi.h>]],
+[[
+JSBool (*fn)(JSContext *, JSObject *, jsval, jsval*);
+JSPropertyOp op = fn;
+]])], ,
+[ov_cv_jspropertyop_uses_jsid=yes])
+AC_LANG_POP([C++])
+CPPFLAGS=$ov_save_CPPFLAGS
+])
+AS_IF([test X$ov_cv_jspropertyop_uses_jsid = Xyes],
+ [jspropertyop_uses_jsid=1],
+ [jspropertyop_uses_jsid=0])
+AC_DEFINE_UNQUOTED([OPENVRML_JSPROPERTYOP_USES_JSID],
+ [$jspropertyop_uses_jsid],
+ [Whether JSPropertyOp function signatures use jsid])
+
+#
# openvrml-xembed and openvrml-player both use GOption, which was
# introduced in GLib 2.6.
#
Modified: trunk/src/script/javascript.cpp
===================================================================
--- trunk/src/script/javascript.cpp 2010-09-15 16:50:40 UTC (rev 4195)
+++ trunk/src/script/javascript.cpp 2010-09-18 17:54:51 UTC (rev 4196)
@@ -38,6 +38,30 @@
namespace {
+# if OPENVRML_JSPROPERTYOP_USES_JSID
+ typedef jsid jspropertyop_id;
+# else
+ typedef jsval jspropertyop_id;
+# endif
+
+ JSBool jspropertyop_id_is_int(const jspropertyop_id id)
+ {
+# if OPENVRML_JSPROPERTYOP_USES_JSID
+ return JSID_IS_INT(id);
+# else
+ return JSVAL_IS_INT(id);
+# endif
+ }
+
+ ::int32 jspropertyop_id_to_int(const jspropertyop_id id)
+ {
+# if OPENVRML_JSPROPERTYOP_USES_JSID
+ return JSID_TO_INT(id);
+# else
+ return JSVAL_TO_INT(id);
+# endif
+ }
+
class SFNode;
class MFNode;
@@ -98,7 +122,7 @@
private:
static JSBool field_setProperty(JSContext * cx, JSObject * obj,
- jsval id, jsval * val)
+ jspropertyop_id id, jsval * val)
OPENVRML_NOTHROW;
virtual void do_initialize(double timeStamp);
@@ -359,10 +383,12 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
const jsdouble (&rgb)[3])
OPENVRML_NOTHROW;
- static JSBool getProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
- static JSBool setProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
+ static JSBool getProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
+ static JSBool setProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool setHSV(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
OPENVRML_NOTHROW;
@@ -392,10 +418,12 @@
uint32 x, uint32 y, uint32 comp,
JSObject * pixels_obj)
OPENVRML_NOTHROW;
- static JSBool getProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
- static JSBool setProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
+ static JSBool getProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
+ static JSBool setProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
};
class OPENVRML_JAVASCRIPT_LOCAL SFNode : public sfield {
@@ -419,10 +447,10 @@
JSString * vrmlstring)
OPENVRML_NOTHROW;
static JSBool getProperty(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp)
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
static JSBool setProperty(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp)
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
};
@@ -446,10 +474,12 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
const jsdouble (&rot)[4])
OPENVRML_NOTHROW;
- static JSBool getProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
- static JSBool setProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
+ static JSBool getProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
+ static JSBool setProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool getAxis(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
OPENVRML_NOTHROW;
@@ -483,11 +513,11 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
const jsdouble (&vec)[2])
OPENVRML_NOTHROW;
- static JSBool getProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * rval)
+ static JSBool getProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * rval)
OPENVRML_NOTHROW;
- static JSBool setProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp)
+ static JSBool setProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
static JSBool add(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
@@ -558,10 +588,12 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
const jsdouble (&vec)[3])
OPENVRML_NOTHROW;
- static JSBool getProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
- static JSBool setProperty(JSContext * cx, JSObject * obj, jsval id,
- jsval * vp) OPENVRML_NOTHROW;
+ static JSBool getProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
+ static JSBool setProperty(JSContext * cx, JSObject * obj,
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool add(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval) OPENVRML_NOTHROW;
static JSBool cross(JSContext * cx, JSObject * obj,
@@ -638,9 +670,11 @@
OPENVRML_NOTHROW;
static JSBool getElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool getLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
private:
MField();
@@ -661,9 +695,11 @@
uintN argc, jsval * argv, jsval * vp)
OPENVRML_NOTHROW;
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool setLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool toString(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
OPENVRML_NOTHROW;
@@ -690,9 +726,11 @@
uintN argc, jsval * argv, jsval * vp)
OPENVRML_NOTHROW;
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool setLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool toString(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
OPENVRML_NOTHROW;
@@ -721,9 +759,9 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv);
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp);
+ jspropertyop_id id, jsval * vp);
static JSBool setLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp);
+ jspropertyop_id id, jsval * vp);
static JSBool toString(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval);
static void finalize(JSContext * cx, JSObject * obj);
@@ -785,9 +823,9 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv);
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp);
+ jspropertyop_id id, jsval * vp);
static JSBool setLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp);
+ jspropertyop_id id, jsval * vp);
static JSBool toString(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval);
static void finalize(JSContext * cx, JSObject * obj);
@@ -818,9 +856,11 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv) OPENVRML_NOTHROW;
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool setLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool toString(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
OPENVRML_NOTHROW;
@@ -861,9 +901,11 @@
static JSBool initObject(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv) OPENVRML_NOTHROW;
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool setLength(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp) OPENVRML_NOTHROW;
+ jspropertyop_id id, jsval * vp)
+ OPENVRML_NOTHROW;
static JSBool toString(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
OPENVRML_NOTHROW;
@@ -956,10 +998,10 @@
jsval * vp)
OPENVRML_NOTHROW;
static JSBool getElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp)
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp)
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
};
@@ -975,10 +1017,10 @@
const jsdouble (&mat)[16])
OPENVRML_NOTHROW;
static JSBool getElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp)
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
static JSBool setElement(JSContext * cx, JSObject * obj,
- jsval id, jsval * vp)
+ jspropertyop_id id, jsval * vp)
OPENVRML_NOTHROW;
static JSBool setTransform(JSContext * cx, JSObject * obj,
uintN argc, jsval * argv, jsval * rval)
@@ -1018,7 +1060,7 @@
OPENVRML_JAVASCRIPT_LOCAL JSBool eventOut_setProperty(JSContext * cx,
JSObject * obj,
- jsval id,
+ jspropertyop_id id,
jsval * val)
OPENVRML_NOTHROW;
@@ -1607,7 +1649,7 @@
JSBool eventOut_setProperty(JSContext * const cx,
JSObject *,
- const jsval id,
+ const jspropertyop_id id,
jsval * const val)
OPENVRML_NOTHROW
{
@@ -1662,7 +1704,7 @@
JSBool script::field_setProperty(JSContext * const cx,
JSObject *,
- const jsval id,
+ const jspropertyop_id id,
jsval * const val)
OPENVRML_NOTHROW
{
@@ -2803,7 +2845,7 @@
JSBool SFColor::getProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const rval)
OPENVRML_NOTHROW
{
@@ -2814,10 +2856,11 @@
*boost::polymorphic_downcast<openvrml::sfcolor *>(
&sfdata.field_value());
- if (JSVAL_IS_INT(id)
- && JSVAL_TO_INT(id) >= 0
- && JSVAL_TO_INT(id) < 3) {
- if (!JS_NewNumberValue(cx, thisColor.value()[JSVAL_TO_INT(id)], rval))
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0
+ && jspropertyop_id_to_int(id) < 3) {
+ if (!JS_NewNumberValue(cx, thisColor.value()[jspropertyop_id_to_int(id)],
+ rval))
{
return JS_FALSE;
}
@@ -2827,7 +2870,7 @@
JSBool SFColor::setProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -2838,8 +2881,8 @@
*boost::polymorphic_downcast<openvrml::sfcolor *>(
&sfdata.field_value());
- if (!JSVAL_IS_INT(id)
- || JSVAL_TO_INT(id) < 0 || JSVAL_TO_INT(id) > 2) {
+ if (!jspropertyop_id_is_int(id)
+ || jspropertyop_id_to_int(id) < 0 || jspropertyop_id_to_int(id) > 2) {
JS_ReportError(cx, "component index out of range");
return JS_FALSE;
}
@@ -2854,7 +2897,7 @@
openvrml::color val = thisColor.value();
- switch (JSVAL_TO_INT(id)) {
+ switch (jspropertyop_id_to_int(id)) {
case 0:
val.r(float(d));
break;
@@ -3132,7 +3175,7 @@
*/
JSBool SFImage::getProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -3143,8 +3186,8 @@
*boost::polymorphic_downcast<openvrml::sfimage *>(
&sfdata.field_value());
- if (JSVAL_IS_INT(id)) {
- switch (JSVAL_TO_INT(id)) {
+ if (jspropertyop_id_is_int(id)) {
+ switch (jspropertyop_id_to_int(id)) {
case 0:
*vp = INT_TO_JSVAL(thisImage.value().x());
break;
@@ -3167,7 +3210,8 @@
*
* @todo Implement me!
*/
- JSBool SFImage::setProperty(JSContext *, JSObject *, jsval , jsval *)
+ JSBool SFImage::setProperty(JSContext *, JSObject *,
+ jspropertyop_id, jsval *)
OPENVRML_NOTHROW
{
// ...
@@ -3363,7 +3407,7 @@
//
JSBool SFNode::getProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -3395,7 +3439,7 @@
JSBool SFNode::setProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -3662,7 +3706,7 @@
JSBool SFRotation::getProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const rval)
OPENVRML_NOTHROW
{
@@ -3673,9 +3717,10 @@
*boost::polymorphic_downcast<openvrml::sfrotation *>(
&sfdata.field_value());
- if (JSVAL_IS_INT(id)
- && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4) {
- if (!JS_NewNumberValue(cx, thisRot.value()[JSVAL_TO_INT(id)], rval)) {
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 4) {
+ if (!JS_NewNumberValue(cx, thisRot.value()[jspropertyop_id_to_int(id)], rval))
+ {
return JS_FALSE;
}
}
@@ -3684,7 +3729,7 @@
JSBool SFRotation::setProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -3695,15 +3740,15 @@
*boost::polymorphic_downcast<openvrml::sfrotation *>(
&sfdata.field_value());
- if (JSVAL_IS_INT(id)
- && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4) {
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 4) {
jsdouble d;
if (!JS_ValueToNumber(cx, *vp, &d)) { return JS_FALSE; }
openvrml::vec3f axis = thisRot.value().axis();
float angle = thisRot.value().angle();
- switch (JSVAL_TO_INT(id)) {
+ switch (jspropertyop_id_to_int(id)) {
case 0:
axis.x(float(d));
break;
@@ -4145,20 +4190,22 @@
template <typename SFVec2>
JSBool sfvec2_jsobject<SFVec2>::getProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const rval)
OPENVRML_NOTHROW
{
typedef typename SFVec2::field_type sfvec2_t;
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 2) {
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 2) {
assert(JS_GetPrivate(cx, obj));
const sfield::sfdata & sfdata =
*static_cast<sfield::sfdata *>(JS_GetPrivate(cx, obj));
const sfvec2_t & thisVec =
*boost::polymorphic_downcast<sfvec2_t *>(&sfdata.field_value());
- if (!JS_NewNumberValue(cx, thisVec.value()[JSVAL_TO_INT(id)], rval)) {
+ if (!JS_NewNumberValue(cx, thisVec.value()[jspropertyop_id_to_int(id)],
+ rval)) {
return JS_FALSE;
}
}
@@ -4168,14 +4215,15 @@
template <typename SFVec2>
JSBool sfvec2_jsobject<SFVec2>::setProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
typedef typename SFVec2::field_type sfvec2_t;
typedef typename SFVec2::value_type vec2_t;
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 2) {
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 2) {
assert(JS_GetPrivate(cx, obj));
sfield::sfdata & sfdata =
*static_cast<sfield::sfdata *>(JS_GetPrivate(cx, obj));
@@ -4190,7 +4238,7 @@
}
vec2_t temp = thisVec.value();
- switch (JSVAL_TO_INT(id)) {
+ switch (jspropertyop_id_to_int(id)) {
case 0:
temp.x(d);
break;
@@ -4764,20 +4812,22 @@
template <typename SFVec3>
JSBool sfvec3_jsobject<SFVec3>::getProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
typedef typename SFVec3::field_type sfvec3_t;
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 3) {
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 3) {
assert(JS_GetPrivate(cx, obj));
const sfield::sfdata & sfdata =
*static_cast<sfield::sfdata *>(JS_GetPrivate(cx, obj));
const sfvec3_t & thisVec =
*boost::polymorphic_downcast<sfvec3_t *>(&sfdata.field_value());
- if (!JS_NewNumberValue(cx, thisVec.value()[JSVAL_TO_INT(id)], vp)) {
+ if (!JS_NewNumberValue(cx, thisVec.value()[jspropertyop_id_to_int(id)],
+ vp)) {
return JS_FALSE;
}
}
@@ -4787,14 +4837,15 @@
template <typename SFVec3>
JSBool sfvec3_jsobject<SFVec3>::setProperty(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
typedef typename SFVec3::field_type sfvec3_t;
typedef typename SFVec3::value_type vec3_t;
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 3) {
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 3) {
assert(JS_GetPrivate(cx, obj));
sfield::sfdata & sfdata =
*static_cast<sfield::sfdata *>(JS_GetPrivate(cx, obj));
@@ -4809,7 +4860,7 @@
}
vec3_t temp = thisVec.value();
- switch (JSVAL_TO_INT(id)) {
+ switch (jspropertyop_id_to_int(id)) {
case 0:
temp.x(d);
break;
@@ -5316,7 +5367,7 @@
JSBool MField::getElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -5326,17 +5377,17 @@
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
- if (JSVAL_IS_INT(id)
- && JSVAL_TO_INT(id) >= 0
- && size_t(JSVAL_TO_INT(id)) < mfdata->array.size()) {
- *vp = mfdata->array[JSVAL_TO_INT(id)];
+ if (jspropertyop_id_is_int(id)
+ && jspropertyop_id_to_int(id) >= 0
+ && size_t(jspropertyop_id_to_int(id)) < mfdata->array.size()) {
+ *vp = mfdata->array[jspropertyop_id_to_int(id)];
}
return JS_TRUE;
}
JSBool MField::getLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -5437,14 +5488,15 @@
template <typename Subclass>
JSBool MFJSObject<Subclass>::setElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
assert(cx);
assert(obj);
assert(vp);
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) > 0) {
+
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) > 0) {
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
@@ -5461,15 +5513,15 @@
//
// Grow array if necessary.
//
- if (size_t(JSVAL_TO_INT(id)) >= mfdata->array.size()) {
- jsval newLength = INT_TO_JSVAL(JSVAL_TO_INT(id) + 1);
+ if (size_t(jspropertyop_id_to_int(id)) >= mfdata->array.size()) {
+ jsval newLength = INT_TO_JSVAL(jspropertyop_id_to_int(id) + 1);
if (!setLength(cx, obj, 0, &newLength)) { return JS_FALSE; }
}
//
// Put the new element in the array.
//
- mfdata->array[JSVAL_TO_INT(id)] = *vp;
+ mfdata->array[jspropertyop_id_to_int(id)] = *vp;
mfdata->changed = true;
}
return JS_TRUE;
@@ -5478,7 +5530,7 @@
template <typename Subclass>
JSBool MFJSObject<Subclass>::setLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -5668,11 +5720,11 @@
template <typename Subclass>
JSBool MFJSDouble<Subclass>::setElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0) {
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0) {
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
@@ -5685,15 +5737,16 @@
//
// Grow array if necessary.
//
- if (size_t(JSVAL_TO_INT(id)) >= mfdata->array.size()) {
- jsval newLength = INT_TO_JSVAL(JSVAL_TO_INT(id) + 1);
+ if (size_t(jspropertyop_id_to_int(id)) >= mfdata->array.size()) {
+ jsval newLength = INT_TO_JSVAL(jspropertyop_id_to_int(id) + 1);
if (!setLength(cx, obj, 0, &newLength)) { return JS_FALSE; }
}
//
// Put the new element in the array.
//
- if (!JS_NewNumberValue(cx, number, &mfdata->array[JSVAL_TO_INT(id)])) {
+ if (!JS_NewNumberValue(cx, number,
+ &mfdata->array[jspropertyop_id_to_int(id)])) {
return JS_FALSE;
}
mfdata->changed = true;
@@ -5704,7 +5757,7 @@
template <typename Subclass>
JSBool MFJSDouble<Subclass>::setLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -5924,15 +5977,15 @@
JSBool MFBool::setElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
{
assert(cx);
assert(obj);
assert(vp);
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0) {
- const size_t index = JSVAL_TO_INT(id);
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0) {
+ const size_t index = jspropertyop_id_to_int(id);
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
@@ -5941,7 +5994,7 @@
// Grow array if necessary.
//
if (index >= mfdata->array.size()) {
- jsval newLength = INT_TO_JSVAL(JSVAL_TO_INT(id) + 1);
+ jsval newLength = INT_TO_JSVAL(jspropertyop_id_to_int(id) + 1);
if (!setLength(cx, obj, 0, &newLength)) { return JS_FALSE; }
}
@@ -5959,7 +6012,7 @@
JSBool MFBool::setLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
{
assert(cx);
@@ -6384,15 +6437,15 @@
JSBool MFInt32::setElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
{
assert(cx);
assert(obj);
assert(vp);
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0) {
- const size_t index = JSVAL_TO_INT(id);
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0) {
+ const size_t index = jspropertyop_id_to_int(id);
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
@@ -6401,7 +6454,7 @@
// Grow array if necessary.
//
if (index >= mfdata->array.size()) {
- jsval newLength = INT_TO_JSVAL(JSVAL_TO_INT(id) + 1);
+ jsval newLength = INT_TO_JSVAL(jspropertyop_id_to_int(id) + 1);
if (!setLength(cx, obj, 0, &newLength)) { return JS_FALSE; }
}
@@ -6421,7 +6474,7 @@
JSBool MFInt32::setLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
{
assert(cx);
@@ -6641,7 +6694,7 @@
JSBool MFNode::setElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -6649,7 +6702,7 @@
assert(obj);
assert(vp);
- if (!JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0) {
+ if (!jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0) {
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
@@ -6669,15 +6722,15 @@
//
// Grow array if necessary.
//
- if (size_t(JSVAL_TO_INT(id)) >= mfdata->array.size()) {
- jsval newLength = INT_TO_JSVAL(JSVAL_TO_INT(id) + 1);
+ if (size_t(jspropertyop_id_to_int(id)) >= mfdata->array.size()) {
+ jsval newLength = INT_TO_JSVAL(jspropertyop_id_to_int(id) + 1);
if (!setLength(cx, obj, 0, &newLength)) { return JS_FALSE; }
}
//
// Put the new element in the array.
//
- mfdata->array[JSVAL_TO_INT(id)] = *vp;
+ mfdata->array[jspropertyop_id_to_int(id)] = *vp;
mfdata->changed = true;
}
return JS_TRUE;
@@ -6685,7 +6738,7 @@
JSBool MFNode::setLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -7024,19 +7077,19 @@
JSBool MFString::setElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0) {
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0) {
MFData * const mfdata = static_cast<MFData *>(JS_GetPrivate(cx, obj));
assert(mfdata);
//
// Grow array if necessary.
//
- if (size_t(JSVAL_TO_INT(id)) >= mfdata->array.size()) {
- jsval newLength = INT_TO_JSVAL(JSVAL_TO_INT(id) + 1);
+ if (size_t(jspropertyop_id_to_int(id)) >= mfdata->array.size()) {
+ jsval newLength = INT_TO_JSVAL(jspropertyop_id_to_int(id) + 1);
if (!setLength(cx, obj, 0, &newLength)) { return JS_FALSE; }
}
@@ -7049,7 +7102,7 @@
//
// Put the new element in the array.
//
- mfdata->array[JSVAL_TO_INT(id)] = STRING_TO_JSVAL(str);
+ mfdata->array[jspropertyop_id_to_int(id)] = STRING_TO_JSVAL(str);
mfdata->changed = true;
}
return JS_TRUE;
@@ -7057,7 +7110,7 @@
JSBool MFString::setLength(JSContext * const cx,
JSObject * const obj,
- jsval,
+ jspropertyop_id,
jsval * const vp)
OPENVRML_NOTHROW
{
@@ -7583,39 +7636,41 @@
JSBool VrmlMatrix::Row::getElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
assert(cx);
assert(obj);
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4) {
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 4) {
assert(JS_GetPrivate(cx, obj));
const float (&row)[4] =
*static_cast<float (*)[4]>(JS_GetPrivate(cx, obj));
- if (!JS_NewNumberValue(cx, row[JSVAL_TO_INT(id)], vp)) {
+ if (!JS_NewNumberValue(cx, row[jspropertyop_id_to_int(id)], vp)) {
return JS_FALSE;
}
}
return JS_TRUE;
}
- JSBool VrmlMatrix::Row::setElement(JSContext * const cx, JSObject * const obj,
- const jsval id, jsval * const vp)
+ JSBool VrmlMatrix::Row::setElement(JSContext * const cx,
+ JSObject * const obj,
+ const jspropertyop_id id,
+ jsval * const vp)
OPENVRML_NOTHROW
{
assert(cx);
assert(obj);
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4) {
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 4) {
jsdouble d;
if (!JS_ValueToNumber(cx, *vp, &d)) { return JS_FALSE; }
assert(JS_GetPrivate(cx, obj));
float (&row)[4] = *static_cast<float (*)[4]>(JS_GetPrivate(cx, obj));
- row[JSVAL_TO_INT(id)] = float(d);
+ row[jspropertyop_id_to_int(id)] = float(d);
}
return JS_TRUE;
}
@@ -7718,14 +7773,14 @@
JSBool VrmlMatrix::getElement(JSContext * const cx,
JSObject * const obj,
- const jsval id,
+ const jspropertyop_id id,
jsval * const vp)
OPENVRML_NOTHROW
{
assert(cx);
assert(obj);
- if (JSVAL_IS_INT(id) && JSVAL_TO_INT(id) >= 0 && JSVAL_TO_INT(id) < 4) {
+ if (jspropertyop_id_is_int(id) && jspropertyop_id_to_int(id) >= 0 && jspropertyop_id_to_int(id) < 4) {
using openvrml::mat4f;
mat4f * const thisMat = static_cast<mat4f *>(JS_GetPrivate(cx, obj));
@@ -7736,14 +7791,15 @@
JS_GetParent(cx, obj));
if (!robj) { return JS_FALSE; }
- float (&row)[4] = (*thisMat)[JSVAL_TO_INT(id)];
+ float (&row)[4] = (*thisMat)[jspropertyop_id_to_int(id)];
if (!JS_SetPrivate(cx, robj, &row)) { return JS_FALSE; }
*vp = OBJECT_TO_JSVAL(robj);
}
return JS_TRUE;
}
- JSBool VrmlMatrix::setElement(JSContext *, JSObject *, jsval, jsval *)
+ JSBool VrmlMatrix::setElement(JSContext *, JSObject *,
+ jspropertyop_id, jsval *)
OPENVRML_NOTHROW
{
return JS_TRUE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|