rpmsw-js.c | rpmsw-js.c | |||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
enum rpmsw_tinyid { | enum rpmsw_tinyid { | |||
_DEBUG = -2, | _DEBUG = -2, | |||
}; | }; | |||
static JSPropertySpec rpmsw_props[] = { | static JSPropertySpec rpmsw_props[] = { | |||
{"debug", _DEBUG, JSPROP_ENUMERATE, NULL, NULL}, | {"debug", _DEBUG, JSPROP_ENUMERATE, NULL, NULL}, | |||
{NULL, 0, 0, NULL, NULL} | {NULL, 0, 0, NULL, NULL} | |||
}; | }; | |||
static JSBool | static JSBool | |||
rpmsw_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp) | rpmsw_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp) | |||
{ | { | |||
void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | |||
jsint tiny = JSVAL_TO_INT(id); | jsint tiny = JSVAL_TO_INT(id); | |||
/* XXX the class has ptr == NULL, instances have ptr != NULL. */ | /* XXX the class has ptr == NULL, instances have ptr != NULL. */ | |||
if (ptr == NULL) | if (ptr == NULL) | |||
return JS_TRUE; | return JS_TRUE; | |||
switch (tiny) { | switch (tiny) { | |||
case _DEBUG: | case _DEBUG: | |||
*vp = INT_TO_JSVAL(_debug); | *vp = INT_TO_JSVAL(_debug); | |||
break; | break; | |||
default: | default: | |||
break; | break; | |||
} | } | |||
return JS_TRUE; | return JS_TRUE; | |||
} | } | |||
static JSBool | static JSBool | |||
rpmsw_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp) | rpmsw_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval * vp) | |||
{ | { | |||
void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | |||
jsint tiny = JSVAL_TO_INT(id); | jsint tiny = JSVAL_TO_INT(id); | |||
/* XXX the class has ptr == NULL, instances have ptr != NULL. */ | /* XXX the class has ptr == NULL, instances have ptr != NULL. */ | |||
if (ptr == NULL) | if (ptr == NULL) | |||
return JS_TRUE; | return JS_TRUE; | |||
switch (tiny) { | switch (tiny) { | |||
case _DEBUG: | case _DEBUG: | |||
skipping to change at line 104 | skipping to change at line 104 | |||
break; | break; | |||
break; | break; | |||
default: | default: | |||
break; | break; | |||
} | } | |||
return JS_TRUE; | return JS_TRUE; | |||
} | } | |||
static JSBool | static JSBool | |||
rpmsw_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, | rpmsw_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, | |||
JSObject **objp) | JSObject **objp) | |||
{ | { | |||
void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | |||
_RESOLVE_DEBUG_ENTRY(_debug < 0); | _RESOLVE_DEBUG_ENTRY(_debug < 0); | |||
if ((flags & JSRESOLVE_ASSIGNING) | if ((flags & JSRESOLVE_ASSIGNING) | |||
|| (ptr == NULL)) { /* don't resolve to parent prototypes objects. */ | || (ptr == NULL)) { /* don't resolve to parent prototypes objects. */ | |||
*objp = NULL; | *objp = NULL; | |||
goto exit; | goto exit; | |||
skipping to change at line 132 | skipping to change at line 132 | |||
static JSBool | static JSBool | |||
rpmsw_enumerate(JSContext *cx, JSObject *obj, JSIterateOp op, | rpmsw_enumerate(JSContext *cx, JSObject *obj, JSIterateOp op, | |||
jsval *statep, jsid *idp) | jsval *statep, jsid *idp) | |||
{ | { | |||
_ENUMERATE_DEBUG_ENTRY(_debug < 0); | _ENUMERATE_DEBUG_ENTRY(_debug < 0); | |||
switch (op) { | switch (op) { | |||
case JSENUMERATE_INIT: | case JSENUMERATE_INIT: | |||
case JSENUMERATE_INIT_ALL: | ||||
*statep = JSVAL_VOID; | *statep = JSVAL_VOID; | |||
if (idp) | if (idp) | |||
*idp = JSVAL_ZERO; | *idp = JSVAL_ZERO; | |||
break; | break; | |||
case JSENUMERATE_NEXT: | case JSENUMERATE_NEXT: | |||
*statep = JSVAL_VOID; | *statep = JSVAL_VOID; | |||
if (*idp != JSVAL_VOID) | if (!JSID_IS_VOID(*idp)) | |||
break; | break; | |||
/*@fallthrough@*/ | /*@fallthrough@*/ | |||
case JSENUMERATE_DESTROY: | case JSENUMERATE_DESTROY: | |||
*statep = JSVAL_NULL; | *statep = JSVAL_NULL; | |||
break; | break; | |||
} | } | |||
return JS_TRUE; | return JS_TRUE; | |||
} | } | |||
/* --- Object ctors/dtors */ | /* --- Object ctors/dtors */ | |||
skipping to change at line 176 | skipping to change at line 177 | |||
{ | { | |||
void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL); | |||
rpmsw sw = ptr; | rpmsw sw = ptr; | |||
_DTOR_DEBUG_ENTRY(_debug); | _DTOR_DEBUG_ENTRY(_debug); | |||
(void) rpmswFree(sw); | (void) rpmswFree(sw); | |||
} | } | |||
static JSBool | static JSBool | |||
rpmsw_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv al) | rpmsw_ctor(JSContext *cx, uintN argc, jsval *vp) | |||
{ | { | |||
jsval *argv = JS_ARGV(cx, vp); | ||||
JSObject *obj = JS_NewObjectForConstructor(cx, vp); | ||||
JSBool ok = JS_FALSE; | JSBool ok = JS_FALSE; | |||
_CTOR_DEBUG_ENTRY(_debug); | _CTOR_DEBUG_ENTRY(_debug); | |||
if (JS_IsConstructing(cx)) { | if (JS_IsConstructing(cx, vp)) { | |||
(void) rpmsw_init(cx, obj); | (void) rpmsw_init(cx, obj); | |||
} else { | } else { | |||
if ((obj = JS_NewObject(cx, &rpmswClass, NULL, NULL)) == NULL) | if ((obj = JS_NewObject(cx, &rpmswClass, NULL, NULL)) == NULL) | |||
goto exit; | goto exit; | |||
*rval = OBJECT_TO_JSVAL(obj); | *vp = OBJECT_TO_JSVAL(obj); | |||
} | } | |||
ok = JS_TRUE; | ok = JS_TRUE; | |||
exit: | exit: | |||
return ok; | return ok; | |||
} | } | |||
/* --- Class initialization */ | /* --- Class initialization */ | |||
JSClass rpmswClass = { | JSClass rpmswClass = { | |||
"Sw", JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE | JSCLASS_HAS_PRIVATE , | "Sw", JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE | JSCLASS_HAS_PRIVATE , | |||
End of changes. 9 change blocks. | ||||
7 lines changed or deleted | 10 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |