static JSBool rpmaug_ctor( JSContext* cx, uintN argc, jsval* vp ) { jsval *argv = JS_ARGV( cx , vp ); JSObject *obj = JS_NewObjectForConstructor( cx , vp ); if( ! obj ) { JS_ReportError( cx , "Failed to create 'this' object" ); return JS_FALSE; } JSBool ok = JS_FALSE; const char * _root = _rpmaugRoot; const char * _loadpath = _rpmaugLoadpath; unsigned int _flags = _rpmaugFlags; _CTOR_DEBUG_ENTRY(_debug, vp); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ssu", &_root, &_loadpath, &_flags))) goto exit; if (JS_IsConstructing(cx, vp)) { if (rpmaug_init(cx, obj, _root, _loadpath, _flags) == NULL) goto exit; } else { if ((obj = JS_NewObject(cx, &rpmaugClass, NULL, NULL)) == NULL) goto exit; JS_SET_RVAL( cx , vp , OBJECT_TO_JSVAL( obj ) ); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmsp_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx , vp); JSObject *obj = JS_NewObjectForConstructor(cx , vp); if(!obj) { JS_ReportError(cx , "Failed to create 'this' object"); return JS_FALSE; } JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (JS_IsConstructing(cx, vp)) { (void) rpmsp_init(cx, obj); } else { if ((obj = JS_NewObject(cx, &rpmspClass, NULL, NULL)) == NULL) goto exit; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmmg_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx , vp); JSObject *obj = JS_NewObjectForConstructor(cx , vp); if(!obj) { JS_ReportError(cx , "Failed to create 'this' object"); return JS_FALSE; } JSBool ok = JS_FALSE; const char * _magicfile = NULL; int _flags = 0; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/su", &_magicfile, &_flags))) goto exit; if (JS_IsConstructing(cx, vp)) { (void) rpmmg_init(cx, obj, _magicfile, _flags); } else { if ((obj = JS_NewObject(cx, &rpmmgClass, NULL, NULL)) == NULL) goto exit; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmbf_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSObject *obj = JS_NewObjectForConstructor(cx, vp); unsigned int _m = 0; unsigned int _k = 0; unsigned int _flags = 0; JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/uuu", &_m, &_k, &_flags))) goto exit; ok = JS_FALSE; /* XXX reset */ if (JS_IsConstructing(cx, vp)) { if ((obj = JS_NewObject(cx, &rpmbfClass, NULL, NULL)) == NULL) goto exit; if (rpmbf_init(cx, obj, _m, _k, _flags) == NULL) goto exit; } else { obj = JS_THIS_OBJECT(cx, vp); *vp = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmhdr_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx , vp); JSObject *obj = JS_NewObjectForConstructor(cx , vp); if(!obj) { JS_ReportError(cx , "Failed to create 'this' object"); return JS_FALSE; } JSBool ok = JS_FALSE; JSObject *tso = NULL; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/o", &tso))) goto exit; if (JS_IsConstructing(cx, vp)) { if (rpmhdr_init(cx, obj, NULL)) goto exit; } else { if ((obj = JS_NewObject(cx, &rpmhdrClass, NULL, NULL)) == NULL) goto exit; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmseq_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx , vp); JSObject *obj = JS_NewObjectForConstructor(cx , vp); if(!obj) { JS_ReportError(cx , "Failed to create 'this' object"); return JS_FALSE; } JSObject * o = NULL; DB * _db = NULL; uint32_t _flags = 0; JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags))) goto exit; if (OBJ_IS_RPMDB(cx, o)) _db = JS_GetInstancePrivate(cx, o, &rpmdbClass, NULL); if (JS_IsConstructing(cx, vp)) { (void) rpmseq_init(cx, obj, _db, _flags); } else { if ((obj = JS_NewObject(cx, &rpmseqClass, NULL, NULL)) == NULL) goto exit; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmte_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { JSBool ok = JS_FALSE; JSObject *tso = NULL; JSObject *hdro = NULL; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/o", &tso, &hdro))) goto exit; if (JS_IsConstructing(cx)) { rpmts ts = JS_GetInstancePrivate(cx, tso, &rpmtsClass, NULL); if (rpmte_init(cx, obj, ts, hdro) == NULL) goto exit; } else { if ((obj = JS_NewObject(cx, &rpmteClass, NULL, NULL)) == NULL) goto exit; *rval = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmdir_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSObject *obj = JS_NewObjectForConstructor(cx, vp); JSBool ok = JS_FALSE; const char * _dn = NULL; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/s", &_dn))) goto exit; if (JS_IsConstructing(cx, vp)) { (void) rpmdir_init(cx, obj, _dn); } else { if ((obj = JS_NewObject(cx, &rpmdirClass, NULL, NULL)) == NULL) goto exit; *vp = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmmpf_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (JS_IsConstructing(cx)) { (void) rpmmpf_init(cx, obj); } else { if ((obj = JS_NewObject(cx, &rpmmpfClass, NULL, NULL)) == NULL) goto exit; *rval = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmfc_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSObject *obj = JS_NewObjectForConstructor(cx, vp); JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (JS_IsConstructing(cx, vp)) { (void) rpmfc_init(cx, obj); } else { if ((obj = JS_NewObject(cx, &rpmfcClass, NULL, NULL)) == NULL) goto exit; *vp = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool syck_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (JS_IsConstructing(cx)) { JSSyck ptr = xcalloc(0, sizeof(*ptr)); if (ptr == NULL || !JS_SetPrivate(cx, obj, ptr)) { ptr = _free(ptr); goto exit; } } else { if ((obj = JS_NewObject(cx, &syckClass, NULL, NULL)) == NULL) goto exit; *rval = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmdc_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { JSBool ok = JS_FALSE; unsigned int _dalgo = PGPHASHALGO_NONE; unsigned int _flags = RPMDIGEST_NONE; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/uu", &_dalgo, &_flags))) goto exit; if (JS_IsConstructing(cx)) { (void) rpmdc_init(cx, obj, _dalgo, _flags); } else { if ((obj = JS_NewObject(cx, &rpmdcClass, NULL, NULL)) == NULL) goto exit; *rval = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
static JSBool rpmxar_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { const char * _fn = "popt-1.14.xar"; const char * _fmode = "r"; JSBool ok = JS_FALSE; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ss", &_fn, &_fmode))) goto exit; if (JS_IsConstructing(cx)) { (void) rpmxar_init(cx, obj, _fn, _fmode); } else { if ((obj = JS_NewObject(cx, &rpmxarClass, NULL, NULL)) == NULL) goto exit; *rval = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }