void TestACLsInfer::createMeta() { mCLSID = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mPropIDs[1]); lV[1].setParam(0); lET = mSession->expr(OP_IN, 2, lV); } TVERIFYRC(lQ->addCondition(lVar,lET)); lET->destroy(); char lB[124]; sprintf(lB, "TestACLsInfer.%s.Family.%d", mClassStr.c_str(), 0); TVERIFYRC(defineClass(mSession,lB, lQ, &mCLSID)); } mCLSID2 = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mPropIDs[2]); lV[1].setParam(0); lET = mSession->expr(OP_IN, 2, lV); } TVERIFYRC(lQ->addCondition(lVar,lET)); lET->destroy(); char lB[124]; sprintf(lB, "TestACLsInfer.%s.Family.%d", mClassStr.c_str(), 1); TVERIFYRC(defineClass(mSession,lB, lQ, &mCLSID2)); } }
void windowBindingInit(mrb_state *mrb) { RClass *klass = defineClass(mrb, "Window"); disposableBindingInit <Window>(mrb, klass); viewportElementBindingInit<Window>(mrb, klass); mrb_define_method(mrb, klass, "initialize", windowInitialize, MRB_ARGS_REQ(1)); mrb_define_method(mrb, klass, "update", windowUpdate, MRB_ARGS_NONE()); INIT_PROP_BIND( Window, Windowskin, "windowskin" ); INIT_PROP_BIND( Window, Contents, "contents" ); INIT_PROP_BIND( Window, Stretch, "stretch" ); INIT_PROP_BIND( Window, CursorRect, "cursor_rect" ); INIT_PROP_BIND( Window, Active, "active" ); INIT_PROP_BIND( Window, Pause, "pause" ); INIT_PROP_BIND( Window, X, "x" ); INIT_PROP_BIND( Window, Y, "y" ); INIT_PROP_BIND( Window, Width, "width" ); INIT_PROP_BIND( Window, Height, "height" ); INIT_PROP_BIND( Window, OX, "ox" ); INIT_PROP_BIND( Window, OY, "oy" ); INIT_PROP_BIND( Window, Opacity, "opacity" ); INIT_PROP_BIND( Window, BackOpacity, "back_opacity" ); INIT_PROP_BIND( Window, ContentsOpacity, "contents_opacity" ); mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE()); }
void testmassiveclassification::defineClasses(int ClassCount) { string strRand ; char * className; int i; mLogger.out()<<endl<<"Defining "<<COUNT_CLASS<< " classes."<<std::flush; long const lBef = getTimeInMs(); for(i=0;i<ClassCount;i++) { MVTRand::getString( strRand, 20, 0 ) ; char lB[64]; sprintf(lB, "%d.massive.class.%s", i,strRand.c_str()); className=lB; IStmt *lClassQ=mSession->createStmt() ; unsigned char lVar = lClassQ->addVariable() ; Value ops[1] ; ops[0].setVarRef(0, mProp[i] ) ; IExprNode *lE=mSession->expr(OP_EXISTS, 1, ops ) ; lClassQ->addCondition( lVar, lE ) ; TVERIFYRC(defineClass(mSession, lB, lClassQ )); lClassQ->destroy(); lE->destroy(); if(!(i%100)) std::cout<<"."<<std::flush; } mDefineTime = getTimeInMs()-lBef ; mLogger.out()<<endl<<"Defining "<<COUNT_CLASS<< " classes done!"; }
void listInit(void* state){ VirtualMachine *vm = (VirtualMachine*)state; ClsType* cls = defineClass(state, "list"); vm->listCls = cls; assert(cls != NULL); defineClassMethod(state, cls, "constructor", listNew, ANYARG); defineClassMethod(state, cls, "[]", listGet, 2); defineClassMethod(state, cls, "[]=", listSet, 3); defineClassMethod(state, cls, "str", listStr, 1); defineClassMethod(state, cls, "len", listLen, 1); defineClassMethod(state, cls, "append", listAppend, ANYARG); }
JavaClass *JNIKit::defineClass(string name, string filename, jobject classLoader) { // Load the file data std::ifstream file(filename, std::ios::binary); file.seekg(0, std::ios::end); std::streamsize size = file.tellg(); file.seekg(0, std::ios::beg); std::vector<char> buffer(size); if (!file.read(buffer.data(), size)) { throw JNIError("could not read file contents into buffer"); } // Construct new class from data buffer return defineClass(name, buffer, classLoader); }
void TestFamilyOrder::createFamily(unsigned int flag) { IStmt *lFamilyQ = mSession->createStmt(); unsigned char lVar = lFamilyQ->addVariable() ; Value ops[2] ; ops[0].setVarRef(lVar, mPropIDs[0]); ops[1].setParam(0); IExprNode *lE = mSession->expr(OP_BEGINS, 2, ops, flag); lFamilyQ->addCondition( lVar, lE ) ; Tstring randStr; MVTApp::randomString(randStr,10,20); randStr += ".family"; fID = STORE_INVALID_CLASSID; TVERIFYRC(defineClass(mSession, randStr.c_str(), lFamilyQ, &fID)); lFamilyQ->destroy(); }
// Attempt to repro an issue in the app with IPC - no success yet // (even running the test multiple times concurrently). THREAD_SIGNATURE threadTestStreamsBashQuery(void * pStop) { ISession * const lSession = MVTApp::startSession(); // Define a class of all pins created by this test. DataEventID lClsid; if (RC_OK != lSession->getDataEventID("teststreams.bashquery", lClsid)) { IStmt * const lQClass = lSession->createStmt(); unsigned char const lVarClass = lQClass->addVariable(); PropertyID const lPropIDsClass[] = {1000}; lQClass->setPropCondition(lVarClass, lPropIDsClass, 1); defineClass(lSession,"teststreams.bashquery", lQClass, &lClsid); lQClass->destroy(); } // Define a query for this class. IStmt * const lQ = lSession->createStmt(); SourceSpec lCS; lCS.objectID = lClsid; lCS.nParams = 0; lCS.params = NULL; lQ->addVariable(&lCS, 1); // Periodically query the pins, while the test creates them. int j; long volatile & lStop = *(long volatile *)pStop; for (j = 0; j < 5000 && 0 == lStop; j++) { ICursor * lR = lQ->execute(); IPIN * lP; for (lP = lR ? lR->next() : NULL; lP; lP = lR->next()) { lP->destroy(); } lR->destroy(); Sleep(100); } lQ->destroy(); lSession->terminate(); return 0; }
void planeBindingInit(mrb_state *mrb) { RClass *klass = defineClass(mrb, "Plane"); disposableBindingInit<Plane> (mrb, klass); viewportElementBindingInit<Plane>(mrb, klass); mrb_define_method(mrb, klass, "initialize", planeInitialize, MRB_ARGS_OPT(1)); INIT_PROP_BIND( Plane, Bitmap, "bitmap" ); INIT_PROP_BIND( Plane, OX, "ox" ); INIT_PROP_BIND( Plane, OY, "oy" ); INIT_PROP_BIND( Plane, ZoomX, "zoom_x" ); INIT_PROP_BIND( Plane, ZoomY, "zoom_y" ); INIT_PROP_BIND( Plane, Opacity, "opacity" ); INIT_PROP_BIND( Plane, BlendType, "blend_type" ); INIT_PROP_BIND( Plane, Color, "color" ); INIT_PROP_BIND( Plane, Tone, "tone" ); mrb_define_method(mrb, klass, "inspect", inspectObject, MRB_ARGS_NONE()); }
void wrenInitializeCore(WrenVM* vm) { ObjModule* coreModule = wrenNewModule(vm, NULL); wrenPushRoot(vm, (Obj*)coreModule); // The core module's key is null in the module map. wrenMapSet(vm, vm->modules, NULL_VAL, OBJ_VAL(coreModule)); wrenPopRoot(vm); // coreModule. // Define the root Object class. This has to be done a little specially // because it has no superclass. vm->objectClass = defineClass(vm, coreModule, "Object"); PRIMITIVE(vm->objectClass, "!", object_not); PRIMITIVE(vm->objectClass, "==(_)", object_eqeq); PRIMITIVE(vm->objectClass, "!=(_)", object_bangeq); PRIMITIVE(vm->objectClass, "is(_)", object_is); PRIMITIVE(vm->objectClass, "toString", object_toString); PRIMITIVE(vm->objectClass, "type", object_type); // Now we can define Class, which is a subclass of Object. vm->classClass = defineClass(vm, coreModule, "Class"); wrenBindSuperclass(vm, vm->classClass, vm->objectClass); PRIMITIVE(vm->classClass, "name", class_name); PRIMITIVE(vm->classClass, "supertype", class_supertype); PRIMITIVE(vm->classClass, "toString", class_toString); // Finally, we can define Object's metaclass which is a subclass of Class. ObjClass* objectMetaclass = defineClass(vm, coreModule, "Object metaclass"); // Wire up the metaclass relationships now that all three classes are built. vm->objectClass->obj.classObj = objectMetaclass; objectMetaclass->obj.classObj = vm->classClass; vm->classClass->obj.classObj = vm->classClass; // Do this after wiring up the metaclasses so objectMetaclass doesn't get // collected. wrenBindSuperclass(vm, objectMetaclass, vm->classClass); PRIMITIVE(objectMetaclass, "same(_,_)", object_same); // The core class diagram ends up looking like this, where single lines point // to a class's superclass, and double lines point to its metaclass: // // .------------------------------------. .====. // | .---------------. | # # // v | v | v # // .---------. .-------------------. .-------. # // | Object |==>| Object metaclass |==>| Class |==" // '---------' '-------------------' '-------' // ^ ^ ^ ^ ^ // | .--------------' # | # // | | # | # // .---------. .-------------------. # | # -. // | Base |==>| Base metaclass |======" | # | // '---------' '-------------------' | # | // ^ | # | // | .------------------' # | Example classes // | | # | // .---------. .-------------------. # | // | Derived |==>| Derived metaclass |==========" | // '---------' '-------------------' -' // The rest of the classes can now be defined normally. wrenInterpretInModule(vm, NULL, coreModuleSource); vm->boolClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Bool")); PRIMITIVE(vm->boolClass, "toString", bool_toString); PRIMITIVE(vm->boolClass, "!", bool_not); vm->fiberClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Fiber")); PRIMITIVE(vm->fiberClass->obj.classObj, "new(_)", fiber_new); PRIMITIVE(vm->fiberClass->obj.classObj, "abort(_)", fiber_abort); PRIMITIVE(vm->fiberClass->obj.classObj, "current", fiber_current); PRIMITIVE(vm->fiberClass->obj.classObj, "suspend()", fiber_suspend); PRIMITIVE(vm->fiberClass->obj.classObj, "yield()", fiber_yield); PRIMITIVE(vm->fiberClass->obj.classObj, "yield(_)", fiber_yield1); PRIMITIVE(vm->fiberClass, "call()", fiber_call); PRIMITIVE(vm->fiberClass, "call(_)", fiber_call1); PRIMITIVE(vm->fiberClass, "error", fiber_error); PRIMITIVE(vm->fiberClass, "isDone", fiber_isDone); PRIMITIVE(vm->fiberClass, "transfer()", fiber_transfer); PRIMITIVE(vm->fiberClass, "transfer(_)", fiber_transfer1); PRIMITIVE(vm->fiberClass, "transferError(_)", fiber_transferError); PRIMITIVE(vm->fiberClass, "try()", fiber_try); vm->fnClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Fn")); PRIMITIVE(vm->fnClass->obj.classObj, "new(_)", fn_new); PRIMITIVE(vm->fnClass, "arity", fn_arity); fnCall(vm, "call()"); fnCall(vm, "call(_)"); fnCall(vm, "call(_,_)"); fnCall(vm, "call(_,_,_)"); fnCall(vm, "call(_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)"); fnCall(vm, "call(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)"); PRIMITIVE(vm->fnClass, "toString", fn_toString); vm->nullClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Null")); PRIMITIVE(vm->nullClass, "!", null_not); PRIMITIVE(vm->nullClass, "toString", null_toString); vm->numClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Num")); PRIMITIVE(vm->numClass->obj.classObj, "fromString(_)", num_fromString); PRIMITIVE(vm->numClass->obj.classObj, "pi", num_pi); PRIMITIVE(vm->numClass, "-(_)", num_minus); PRIMITIVE(vm->numClass, "+(_)", num_plus); PRIMITIVE(vm->numClass, "*(_)", num_multiply); PRIMITIVE(vm->numClass, "/(_)", num_divide); PRIMITIVE(vm->numClass, "<(_)", num_lt); PRIMITIVE(vm->numClass, ">(_)", num_gt); PRIMITIVE(vm->numClass, "<=(_)", num_lte); PRIMITIVE(vm->numClass, ">=(_)", num_gte); PRIMITIVE(vm->numClass, "&(_)", num_bitwiseAnd); PRIMITIVE(vm->numClass, "|(_)", num_bitwiseOr); PRIMITIVE(vm->numClass, "^(_)", num_bitwiseXor); PRIMITIVE(vm->numClass, "<<(_)", num_bitwiseLeftShift); PRIMITIVE(vm->numClass, ">>(_)", num_bitwiseRightShift); PRIMITIVE(vm->numClass, "abs", num_abs); PRIMITIVE(vm->numClass, "acos", num_acos); PRIMITIVE(vm->numClass, "asin", num_asin); PRIMITIVE(vm->numClass, "atan", num_atan); PRIMITIVE(vm->numClass, "ceil", num_ceil); PRIMITIVE(vm->numClass, "cos", num_cos); PRIMITIVE(vm->numClass, "floor", num_floor); PRIMITIVE(vm->numClass, "-", num_negate); PRIMITIVE(vm->numClass, "sin", num_sin); PRIMITIVE(vm->numClass, "sqrt", num_sqrt); PRIMITIVE(vm->numClass, "tan", num_tan); PRIMITIVE(vm->numClass, "%(_)", num_mod); PRIMITIVE(vm->numClass, "~", num_bitwiseNot); PRIMITIVE(vm->numClass, "..(_)", num_dotDot); PRIMITIVE(vm->numClass, "...(_)", num_dotDotDot); PRIMITIVE(vm->numClass, "atan(_)", num_atan2); PRIMITIVE(vm->numClass, "fraction", num_fraction); PRIMITIVE(vm->numClass, "isInfinity", num_isInfinity); PRIMITIVE(vm->numClass, "isInteger", num_isInteger); PRIMITIVE(vm->numClass, "isNan", num_isNan); PRIMITIVE(vm->numClass, "sign", num_sign); PRIMITIVE(vm->numClass, "toString", num_toString); PRIMITIVE(vm->numClass, "truncate", num_truncate); // These are defined just so that 0 and -0 are equal, which is specified by // IEEE 754 even though they have different bit representations. PRIMITIVE(vm->numClass, "==(_)", num_eqeq); PRIMITIVE(vm->numClass, "!=(_)", num_bangeq); vm->stringClass = AS_CLASS(wrenFindVariable(vm, coreModule, "String")); PRIMITIVE(vm->stringClass->obj.classObj, "fromCodePoint(_)", string_fromCodePoint); PRIMITIVE(vm->stringClass, "+(_)", string_plus); PRIMITIVE(vm->stringClass, "[_]", string_subscript); PRIMITIVE(vm->stringClass, "byteAt_(_)", string_byteAt); PRIMITIVE(vm->stringClass, "byteCount_", string_byteCount); PRIMITIVE(vm->stringClass, "codePointAt_(_)", string_codePointAt); PRIMITIVE(vm->stringClass, "contains(_)", string_contains); PRIMITIVE(vm->stringClass, "endsWith(_)", string_endsWith); PRIMITIVE(vm->stringClass, "indexOf(_)", string_indexOf); PRIMITIVE(vm->stringClass, "iterate(_)", string_iterate); PRIMITIVE(vm->stringClass, "iterateByte_(_)", string_iterateByte); PRIMITIVE(vm->stringClass, "iteratorValue(_)", string_iteratorValue); PRIMITIVE(vm->stringClass, "startsWith(_)", string_startsWith); PRIMITIVE(vm->stringClass, "toString", string_toString); vm->listClass = AS_CLASS(wrenFindVariable(vm, coreModule, "List")); PRIMITIVE(vm->listClass->obj.classObj, "new()", list_new); PRIMITIVE(vm->listClass, "[_]", list_subscript); PRIMITIVE(vm->listClass, "[_]=(_)", list_subscriptSetter); PRIMITIVE(vm->listClass, "add(_)", list_add); PRIMITIVE(vm->listClass, "addCore_(_)", list_addCore); PRIMITIVE(vm->listClass, "clear()", list_clear); PRIMITIVE(vm->listClass, "count", list_count); PRIMITIVE(vm->listClass, "insert(_,_)", list_insert); PRIMITIVE(vm->listClass, "iterate(_)", list_iterate); PRIMITIVE(vm->listClass, "iteratorValue(_)", list_iteratorValue); PRIMITIVE(vm->listClass, "removeAt(_)", list_removeAt); vm->mapClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Map")); PRIMITIVE(vm->mapClass->obj.classObj, "new()", map_new); PRIMITIVE(vm->mapClass, "[_]", map_subscript); PRIMITIVE(vm->mapClass, "[_]=(_)", map_subscriptSetter); PRIMITIVE(vm->mapClass, "addCore_(_,_)", map_addCore); PRIMITIVE(vm->mapClass, "clear()", map_clear); PRIMITIVE(vm->mapClass, "containsKey(_)", map_containsKey); PRIMITIVE(vm->mapClass, "count", map_count); PRIMITIVE(vm->mapClass, "remove(_)", map_remove); PRIMITIVE(vm->mapClass, "iterate_(_)", map_iterate); PRIMITIVE(vm->mapClass, "keyIteratorValue_(_)", map_keyIteratorValue); PRIMITIVE(vm->mapClass, "valueIteratorValue_(_)", map_valueIteratorValue); vm->rangeClass = AS_CLASS(wrenFindVariable(vm, coreModule, "Range")); PRIMITIVE(vm->rangeClass, "from", range_from); PRIMITIVE(vm->rangeClass, "to", range_to); PRIMITIVE(vm->rangeClass, "min", range_min); PRIMITIVE(vm->rangeClass, "max", range_max); PRIMITIVE(vm->rangeClass, "isInclusive", range_isInclusive); PRIMITIVE(vm->rangeClass, "iterate(_)", range_iterate); PRIMITIVE(vm->rangeClass, "iteratorValue(_)", range_iteratorValue); PRIMITIVE(vm->rangeClass, "toString", range_toString); ObjClass* systemClass = AS_CLASS(wrenFindVariable(vm, coreModule, "System")); PRIMITIVE(systemClass->obj.classObj, "clock", system_clock); PRIMITIVE(systemClass->obj.classObj, "gc()", system_gc); // TODO: Do we want to give these magic names that can't be called from // regular code? PRIMITIVE(systemClass->obj.classObj, "getModuleVariable(_,_)", system_getModuleVariable); PRIMITIVE(systemClass->obj.classObj, "importModule(_)", system_importModule); PRIMITIVE(systemClass->obj.classObj, "writeString_(_)", system_writeString); // While bootstrapping the core types and running the core module, a number // of string objects have been created, many of which were instantiated // before stringClass was stored in the VM. Some of them *must* be created // first -- the ObjClass for string itself has a reference to the ObjString // for its name. // // These all currently have a NULL classObj pointer, so go back and assign // them now that the string class is known. for (Obj* obj = vm->first; obj != NULL; obj = obj->next) { if (obj->type == OBJ_STRING) obj->classObj = vm->stringClass; } }
int testjoinorderby::execute() { ISession * mSession ;int i; if (!MVTApp::startStore()) {mLogger.print("Failed to start store\n"); return RC_NOACCESS;} mSession = MVTApp::startSession(); //Properties - mapping properties PropertyID date_original_modifiedPropID; char *propName2;char lB[64]; sprintf(lB, "http://vmware.com/core/date_original_modified");propName2=lB; date_original_modifiedPropID=MVTUtil::getPropRand(mSession,propName2); for(i=0;i<6;i++) { char lB[64]; sprintf(lB, "%d.propery", i); propName2=lB; mProp[i]=MVTUtil::getPropRand(mSession,propName2); } //DEfining Classes const char *lClassList[] = {"unprocessedAudioMP31","unprocessedMeta1","unprocessedPDF1","unprocessedDocx1","unprocessedTXT1"}; const char *lClassList2[] = {"hostingPinsPushShredder","hostingPinsNotShredded1"}; size_t nClasses = sizeof(lClassList)/sizeof(lClassList[0]); for(i=0;i<6;i++) { IStmt *lFamilyQ=mSession->createStmt() ; unsigned char lVar = lFamilyQ->addVariable() ; Value ops[2] ; Value ops1[1] ; Value ops2[2] ; ops[0].setVarRef(0, date_original_modifiedPropID ) ;ops[1].setParam(0); IExprNode *lE= mSession->expr(OP_IN, 2, ops ) ; ops1[0].setVarRef(0, mProp[i] ) ; IExprNode *lE1= mSession->expr(OP_EXISTS, 1, ops1 ) ; ops2[0].set(lE); ops2[1].set(lE1); IExprNode *lE2= mSession->expr(OP_LAND, 2, ops2 ) ; TVERIFYRC(lFamilyQ->addCondition( lVar, lE2 )) ; if(i<4) { TVERIFYRC(defineClass(mSession, lClassList[i], lFamilyQ )); } else { TVERIFYRC(defineClass(mSession, lClassList2[i-4], lFamilyQ )); } lE2->destroy(); lFamilyQ->destroy(); } //Creating Pins { Value lV[7]; TIMESTAMP lTS; for(i=0;i<15;i++) { lTS=MVTRand::getDateTime(mSession); lV[0].setDateTime(lTS);lV[0].setPropID(date_original_modifiedPropID); lV[1].setDateTime(lTS);lV[1].property=mProp[0]; lV[2].setDateTime(lTS);lV[2].property=mProp[1]; lV[3].setDateTime(lTS);lV[3].property=mProp[2]; lV[4].setDateTime(lTS);lV[4].property=mProp[3]; lV[5].setDateTime(lTS);lV[5].property=mProp[4]; lV[6].setDateTime(lTS);lV[6].property=mProp[5]; TVERIFYRC(mSession->createPIN(lV,7,NULL,MODE_COPY_VALUES|MODE_PERSISTENT)); } } //Query IStmt *lQuery = mSession->createStmt(); //union of four classes RC rc = RC_OK; if(lQuery) { unsigned char lastvar = 0;bool bSuccess = true; for(unsigned long iidx = 0 ; iidx < nClasses && bSuccess; iidx++) { Afy::SourceSpec lclassSpec; lclassSpec.nParams=0; lclassSpec.params=NULL; if(RC_OK == (rc = mSession->getDataEventID(lClassList[iidx],lclassSpec.objectID))) { unsigned char tmpVar = lQuery->addVariable(&lclassSpec,1); lastvar = iidx==0 ? tmpVar : lQuery->setOp(lastvar,tmpVar,Afy::QRY_UNION); } else bSuccess = false; } //intersection of fifth class Afy::Value lrange[2];Afy::Value lparam; if(bSuccess) { Afy::SourceSpec lclassSpec; if( RC_OK == (rc =mSession->getDataEventID("hostingPinsPushShredder",lclassSpec.objectID))) { lclassSpec.nParams=0; lclassSpec.params=NULL; unsigned char tmpVar = lQuery->addVariable(&lclassSpec,1); lastvar = lQuery->setOp(lastvar,tmpVar,Afy::QRY_INTERSECT); if( RC_OK == (rc =mSession->getDataEventID("hostingPinsNotShredded1",lclassSpec.objectID))) { TIMESTAMP lTS;getTimestamp(lTS); DateTime lDT;mSession->convDateTime(lTS,lDT,true/*UTC*/); lrange[0].setDateTime(0); lrange[1].setDateTime(lTS); lparam.setRange(lrange); lclassSpec.nParams=1; lclassSpec.params=&lparam; tmpVar = lQuery->addVariable(&lclassSpec,1); lastvar = lQuery->setOp(lastvar,tmpVar,Afy::QRY_UNION); } else bSuccess = false; } else bSuccess = false; } OrderSeg ord = {NULL,date_original_modifiedPropID,ORD_DESC,0,0}; TVERIFYRC(lQuery->setOrder( &ord,1)); //Execution int ncount=9; Afy::ICursor *lResult = NULL; TVERIFYRC(lQuery->execute(&lResult,NULL, 0,(unsigned int)ncount,0)) ; //Afy::ICursor *lResult = lQuery->execute(); IPIN *pin; const Value * rV; uint16_t tempYear=0; i=0; while( pin = lResult->next() ) { DateTime lDT2; rV=pin->getValue(date_original_modifiedPropID); TVERIFYRC(mSession->convDateTime(rV->ui64,lDT2)); if(i!=0) { TVERIFY(lDT2.year<=tempYear); } tempYear=lDT2.year;i++; } } lQuery->destroy(); mSession->terminate(); MVTApp::stopStore(); return RC_OK; }
void TestLeftJoin::createMeta() { // Family #0 DataEventID lLHSFamilyID = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mLHSPropID); lV[1].setParam(0); lET = mSession->expr(OP_EQ, 2, lV, CASE_INSENSITIVE_OP); } lQ->addCondition(lVar,lET); char lB[64]; sprintf(lB, "TestLeftJoin.%s.Family%d", mClassStr.c_str(), 0); if(RC_OK!=defineClass(mSession,lB, lQ, &lLHSFamilyID)){ mLogger.out() << "ERROR(TestLeftJoin): Failed to create Family " << lB << std::endl; } } // Family #1 DataEventID lRHSFamilyID = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mRHSPropID); lV[1].setParam(0); lET = mSession->expr(OP_EQ, 2, lV, CASE_INSENSITIVE_OP); } lQ->addCondition(lVar,lET); char lB[64]; sprintf(lB, "TestLeftJoin.%s.Family%d", mClassStr.c_str(), 1); if(RC_OK!=defineClass(mSession,lB, lQ, &lRHSFamilyID)){ mLogger.out() << "ERROR(TestLeftJoin): Failed to create Family " << lB << std::endl; } } // Family #2 DataEventID lLHSFamilyID2 = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mLHSPropID); lV[1].setParam(0); lET = mSession->expr(OP_IN, 2, lV, CASE_INSENSITIVE_OP); } lQ->addCondition(lVar,lET); char lB[64]; sprintf(lB, "TestLeftJoin.%s.Family%d", mClassStr.c_str(), 2); if(RC_OK!=defineClass(mSession,lB, lQ, &lLHSFamilyID2)){ mLogger.out() << "ERROR(TestLeftJoin): Failed to create Family " << lB << std::endl; } } // Family #3 DataEventID lRHSFamilyID2 = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mRHSPropID); lV[1].setParam(0); lET = mSession->expr(OP_IN, 2, lV, CASE_INSENSITIVE_OP); } lQ->addCondition(lVar,lET); char lB[64]; sprintf(lB, "TestLeftJoin.%s.Family%d", mClassStr.c_str(), 3); if(RC_OK!=defineClass(mSession,lB, lQ, &lRHSFamilyID2)){ mLogger.out() << "ERROR(TestLeftJoin): Failed to create Family " << lB << std::endl; } } // Family #4 DataEventID lLHSFamilyID3 = STORE_INVALID_CLASSID; { IStmt *lQ = mSession->createStmt(); unsigned char lVar = lQ->addVariable(); IExprNode *lET; { Value lV[2]; lV[0].setVarRef(0,mRefPropID); lV[1].setParam(0); lET = mSession->expr(OP_EQ, 2, lV, CASE_INSENSITIVE_OP); } lQ->addCondition(lVar,lET); char lB[64]; sprintf(lB, "TestLeftJoin.%s.Family%d", mClassStr.c_str(), 4); if(RC_OK!=defineClass(mSession,lB, lQ, &lLHSFamilyID3)){ mLogger.out() << "ERROR(TestLeftJoin): Failed to create Family " << lB << std::endl; } } }
/* * Create a Class and Family to query for deleted PINs * */ void TestUndelete::createMeta() { // Create a Family Tstring lRandStr; MVTRand::getString(lRandStr, 10, 0, false, false); { CmvautoPtr<IStmt> lQ(mSession->createStmt()); unsigned const char lVar = lQ->addVariable(); Value lV[2]; lV[0].setVarRef(0,mPropIDs[0]); lV[1].setParam(0); CmvautoPtr<IExprNode> lET(mSession->expr(OP_BEGINS, 2, lV)); TVERIFYRC(lQ->addCondition(lVar,lET)); char lB[64]; sprintf(lB, "TestUndelete.%s.%d", lRandStr.c_str(), 0); TVERIFYRC(defineClass(mSession,lB, lQ, &mFamilyID)); } // Create a Family on PIN Index aka prop1 { CmvautoPtr<IStmt> lQ(mSession->createStmt()); unsigned const char lVar = lQ->addVariable(); Value lV[2]; lV[0].setVarRef(0,mPropIDs[1]); lV[1].setParam(0); CmvautoPtr<IExprNode> lET(mSession->expr(OP_EQ, 2, lV)); TVERIFYRC(lQ->addCondition(lVar,lET)); char lB[64]; sprintf(lB, "TestUndelete.%s.%d", lRandStr.c_str(), 1); TVERIFYRC(defineClass(mSession,lB, lQ, &mFamilyID1)); } // Create a Family on prop2 { CmvautoPtr<IStmt> lQ(mSession->createStmt()); unsigned const char lVar = lQ->addVariable(); Value lV[2]; lV[0].setVarRef(0,mPropIDs[2]); lV[1].setParam(0); CmvautoPtr<IExprNode> lET(mSession->expr(OP_EQ, 2, lV)); TVERIFYRC(lQ->addCondition(lVar,lET)); char lB[64]; sprintf(lB, "TestUndelete.%s.%d", lRandStr.c_str(), 2); TVERIFYRC(defineClass(mSession,lB, lQ, &mFamilyID2)); } // Create a Class { CmvautoPtr<IStmt> lQ(mSession->createStmt()); unsigned const char lVar = lQ->addVariable(); Value lV[1]; lV[0].setVarRef(0,mPropIDs[2]); CmvautoPtr<IExprNode> lET(mSession->expr(OP_EXISTS, 1, lV)); TVERIFYRC(lQ->addCondition(lVar,lET)); char lB[64]; sprintf(lB, "TestUndelete.%s.%d", lRandStr.c_str(), 3); TVERIFYRC(defineClass(mSession,lB, lQ, &mCLSID)); } // Create a family for specific case purge after undelete { CmvautoPtr<IStmt> lQ(mSession->createStmt()); unsigned const char lVar = lQ->addVariable(); Value lV[2]; lV[0].setVarRef(0,mPropIDs[3]); lV[1].setParam(0); CmvautoPtr<IExprNode> lET(mSession->expr(OP_EQ, 2, lV)); TVERIFYRC(lQ->addCondition(lVar,lET)); char lB[64]; sprintf(lB, "TestUndelete.%s.%d", lRandStr.c_str(), 4); TVERIFYRC(defineClass(mSession,lB, lQ, &mFamilyID3)); } }
// Implement this test. int TestMergeCollections::execute() { bool lSuccess = true; if (MVTApp::startStore()) { ISession * const lSession = MVTApp::startSession(); // Declare properties. URIMap lData[2]; MVTApp::mapURIs(lSession,"TestMergeCollections.prop",2,lData); PropertyID const lPropIdVal = lData[0].uid; PropertyID const lPropIdRef = lData[1].uid; PropertyID const lPropIdPinId = PROP_SPEC_PINID; DataEventID lClassVal = STORE_INVALID_CLASSID; { char lB[100]; sprintf(lB,"TestMergeCollections.ClassVal.%d",rand()); Value lV[2]; lV[0].setVarRef(0,lPropIdVal); lV[1].setParam(0); IExprNode *expr=lSession->expr(OP_LT,2,lV); IStmt *lQ = lSession->createStmt(); lQ->addVariable(NULL,0,expr); TVERIFYRC(defineClass(lSession,lB,lQ,&lClassVal)); lQ->destroy(); } DataEventID lClassRef = STORE_INVALID_CLASSID; { char lB[100]; sprintf(lB,"TestMergeCollections.ClassRef.%d",rand()); IStmt *lQ = lSession->createStmt(); lQ->addVariable(); lQ->setPropCondition(0,&lPropIdRef,1); TVERIFYRC(defineClass(lSession,lB,lQ,&lClassRef)); lQ->destroy(); } /** * The following creates the family on reference class... **/ DataEventID lClassFamilyOnRef = STORE_INVALID_CLASSID; { char lB[100]; sprintf(lB,"TestMergeCollections.ClassFamilyOnRef.%d",rand()); Value lVFoR[2]; lVFoR[0].setVarRef(0,lPropIdRef); lVFoR[1].setParam(0); IExprNode *expr=lSession->expr(OP_IN,2,lVFoR); IStmt *lQ = lSession->createStmt(); lQ->addVariable(NULL,0,expr); TVERIFYRC(defineClass(lSession,lB,lQ,&lClassFamilyOnRef)); lQ->destroy(); } // Create a few pins mLogger.out() << "Creating " << NPINS*2 << " pins... "; PID pins[NPINS]; bool lfMember[NPINS]; PID refferedPins[NPINS]; //Creating first group of pins: // - each pin may have an interger value, or collection of interger values; // - each pin may have the same interger value within collection; // - if at least one of the values within pin < treshold, it should be picked up by the family... const int threshold = RANGE/3; int i; if(isVerbose()) mLogger.out() << " List of PINs with value less than threshold " << std::endl; for (i = 0; i < NPINS; i++) { Value lV[2]; int val = MVTRand::getRange(0, RANGE); lfMember[i] = val < threshold; SETVALUE(lV[0], lPropIdVal, val, OP_SET); CREATEPIN(lSession, &pins[i], lV, 1); IPIN *ppin = lSession->getPIN(pins[i]); int elemincollection = MVTRand::getRange(1, MAX_ELEM_INCOLLECTION); for(int jj = 0; jj < elemincollection; jj++) { int val2 = MVTRand::getRange(1, RANGE); if(!lfMember[i] && (val2 < threshold)) lfMember[i] = true; SETVALUE_C(lV[0], lPropIdVal, val2, OP_ADD, STORE_LAST_ELEMENT); TVERIFYRC(ppin->modify(lV,1)); } if(isVerbose() && lfMember[i]) mLogger.out() << std::hex << pins[i].pid << std::endl; ppin->destroy(); } // Create second group of pins: // - each pin within that group has either reference or collection of references // to a random pin(s) in the set above // - the reference to the pin, which value < threshold may be within any position within collection; // - it may be multiple references to the same pin, including the pin which value < threshold; if(isVerbose()) mLogger.out() << " List of PINs with refs whose value is less than threshold " << std::endl; int lCount = 0; int lCountDiff = 0; //counts how many pins with value < threshold has been added while creating collection... for (i = 0; i < NPINS; i++) { PID lReferPID; INITLOCALPID(lReferPID); lReferPID.pid = STORE_INVALID_PID; Value lV[2]; int idx = MVTRand::getRange(0, NPINS-1); PID id; bool willbefound = false; if (lfMember[idx]) { lCount++; willbefound = true; // The referenced pin will match the family query lReferPID = pins[idx]; } SETVALUE(lV[0], lPropIdRef, pins[idx], OP_SET); refferedPins[i] = pins[idx]; // to remember reffered pins; CREATEPIN(lSession, &id, lV, 1); IPIN *ppin = lSession->getPIN(id); int elemincollection = MVTRand::getRange(1, MAX_ELEM_INCOLLECTION); for(int jj = 0; jj < elemincollection; jj++) { int idx1 = MVTRand::getRange(0, NPINS-1); SETVALUE_C(lV[0], lPropIdRef, pins[idx1], OP_ADD, STORE_LAST_ELEMENT); TVERIFYRC(ppin->modify(lV,1)); if(!willbefound && lfMember[idx1]) { lCount++; willbefound = true; lReferPID = pins[idx1]; lCountDiff++; } } if(isVerbose() && willbefound) mLogger.out() << std::hex << id.pid << " with ref to " << lReferPID.pid << std::endl; ppin->destroy(); } mLogger.out() << std::dec << "DONE" << std::endl; // Do a simple join search. // " All pins from lClassFamilyOnRef Family, where any of the PINs in lPropIdRef has (lPropIdVal < threshhold) // "All pins, from lClassRef class, where the lPropIdRef property is equal // to the PROP_SPEC_PINID of a PIN matching the lClassVal query of (lPropIdVal < threshhold)" // IStmt *lQ = lSession->createStmt(); Value lV[4]; lV[0].setError(lPropIdRef); lV[1].setError(lPropIdRef); lV[2].setRange(&lV[0]); lV[3].set(threshold); // Family query will find all pins with lPropIdVal < threshhold SourceSpec classSpec[2]={{lClassFamilyOnRef,1,&lV[2]},{lClassVal,1,&lV[3]}}; unsigned char lVar1 = lQ->addVariable(&classSpec[0],1),lVar2 = lQ->addVariable(&classSpec[1],1); lV[0].setVarRef(lVar1,lPropIdRef); lV[1].setVarRef(lVar2,lPropIdPinId); IExprNode *expr = lSession->expr(OP_EQ,2,lV); lQ->join(lVar1,lVar2,expr); OrderSeg ord={NULL,lPropIdRef,0,0,0}; lQ->setOrder(&ord,1); uint64_t lCnt = 0; TVERIFYRC(lQ->count(lCnt,NULL,0,~0u)); TVERIFY((int)lCnt == lCount); { mLogger.out() << "Count returned = " << lCnt << "; Expected Count = " << lCount << "; lCountDiff = " << lCountDiff << ";" << std::endl; //The query below - attempt to find how many pins with at least one value < threshold were found by Family... mLogger.out() << "The query below - attempt to find how many pins with at least one value < threshold were found by Family..." << std::endl; IStmt *lQFamily = lSession->createStmt(); lQFamily->addVariable(&classSpec[1],1); uint64_t lCntFFound = 0; TVERIFYRC(lQFamily->count(lCntFFound)); mLogger.out() << "lCntFFound= " << lCntFFound << ";" << std::endl; lQFamily->destroy(); } ICursor *lR = NULL; TVERIFYRC(lQ->execute(&lR, NULL,0,~0u,0)); int lResultCount = 0; IPIN *pInResults; if (isVerbose()) mLogger.out() << "List of PINs returned " << std::endl; while((pInResults=lR->next())!=NULL) { lResultCount++; //if (isVerbose()) MVTApp::output(*pInResults,mLogger.out()); if (isVerbose()) mLogger.out() << std::hex << pInResults->getPID().pid << std::endl; const Value * refVal = pInResults->getValue(lPropIdRef); if ( refVal!=NULL ) { MvStoreEx::CollectionIterator lCollection(refVal); bool lBelongs = false; const Value *lValue; for(lValue = lCollection.getFirst(); lValue!=NULL; lValue = lCollection.getNext()) { TVERIFY(lValue->type == VT_REFID); IPIN *lPIN = lSession->getPIN(lValue->id); TVERIFY(lPIN != NULL); const Value *lVal = lPIN->getValue(lPropIdVal); MvStoreEx::CollectionIterator lValues(lVal); const Value *lVal1; for(lVal1 = lValues.getFirst(); lVal1!=NULL; lVal1 = lValues.getNext()) { TVERIFY(lVal1->type == VT_INT); if(lVal1->i < threshold) { lBelongs = true; break; } } lPIN->destroy(); if(lBelongs) break; } TVERIFY(lBelongs && "Unexpected PIN returned"); } else { TVERIFY(false && "Failed to fetch the collection"); } pInResults->destroy(); } mLogger.out() << " Total PINs returned in the result set " << std::dec << lResultCount << std::endl; TVERIFY(lResultCount == lCount); lR->destroy(); lQ->destroy(); lSession->terminate(); MVTApp::stopStore(); } else { TVERIFY(!"could not open store") ; } return lSuccess ? 0 : 1; }
void wrenInitializeCore(WrenVM* vm) { // Define the root Object class. This has to be done a little specially // because it has no superclass and an unusual metaclass (Class). vm->objectClass = defineSingleClass(vm, "Object"); NATIVE(vm->objectClass, "== ", object_eqeq); NATIVE(vm->objectClass, "!= ", object_bangeq); NATIVE(vm->objectClass, "new", object_new); NATIVE(vm->objectClass, "toString", object_toString); NATIVE(vm->objectClass, "type", object_type); NATIVE(vm->objectClass, " instantiate", object_instantiate); // Now we can define Class, which is a subclass of Object, but Object's // metaclass. vm->classClass = defineSingleClass(vm, "Class"); // Now that Object and Class are defined, we can wire them up to each other. wrenBindSuperclass(vm, vm->classClass, vm->objectClass); vm->objectClass->metaclass = vm->classClass; vm->classClass->metaclass = vm->classClass; // Define the methods specific to Class after wiring up its superclass to // prevent the inherited ones from overwriting them. NATIVE(vm->classClass, " instantiate", class_instantiate); NATIVE(vm->classClass, "name", class_name); // The core class diagram ends up looking like this, where single lines point // to a class's superclass, and double lines point to its metaclass: // // __________ /====\ // / \ // \\ // v \ v \\ // .---------. .--------------. // // | Object |==>| Class |==/ // '---------' '--------------' // ^ ^ // | | // .---------. .--------------. \ // | Base |==>| Base.type | | // '---------' '--------------' | // ^ ^ | Hypothetical example classes // | | | // .---------. .--------------. | // | Derived |==>| Derived.type | | // '---------' '--------------' / // The rest of the classes can not be defined normally. vm->boolClass = defineClass(vm, "Bool"); NATIVE(vm->boolClass, "toString", bool_toString); NATIVE(vm->boolClass, "!", bool_not); // TODO: Make fibers inherit Sequence and be iterable. vm->fiberClass = defineClass(vm, "Fiber"); NATIVE(vm->fiberClass->metaclass, " instantiate", fiber_instantiate); NATIVE(vm->fiberClass->metaclass, "new ", fiber_new); NATIVE(vm->fiberClass->metaclass, "yield", fiber_yield); NATIVE(vm->fiberClass->metaclass, "yield ", fiber_yield1); NATIVE(vm->fiberClass, "call", fiber_call); NATIVE(vm->fiberClass, "call ", fiber_call1); NATIVE(vm->fiberClass, "isDone", fiber_isDone); NATIVE(vm->fiberClass, "run", fiber_run); NATIVE(vm->fiberClass, "run ", fiber_run1); vm->fnClass = defineClass(vm, "Fn"); NATIVE(vm->fnClass->metaclass, " instantiate", fn_instantiate); NATIVE(vm->fnClass->metaclass, "new ", fn_new); NATIVE(vm->fnClass, "call", fn_call0); NATIVE(vm->fnClass, "call ", fn_call1); NATIVE(vm->fnClass, "call ", fn_call2); NATIVE(vm->fnClass, "call ", fn_call3); NATIVE(vm->fnClass, "call ", fn_call4); NATIVE(vm->fnClass, "call ", fn_call5); NATIVE(vm->fnClass, "call ", fn_call6); NATIVE(vm->fnClass, "call ", fn_call7); NATIVE(vm->fnClass, "call ", fn_call8); NATIVE(vm->fnClass, "call ", fn_call9); NATIVE(vm->fnClass, "call ", fn_call10); NATIVE(vm->fnClass, "call ", fn_call11); NATIVE(vm->fnClass, "call ", fn_call12); NATIVE(vm->fnClass, "call ", fn_call13); NATIVE(vm->fnClass, "call ", fn_call14); NATIVE(vm->fnClass, "call ", fn_call15); NATIVE(vm->fnClass, "call ", fn_call16); NATIVE(vm->fnClass, "toString", fn_toString); vm->nullClass = defineClass(vm, "Null"); NATIVE(vm->nullClass, "toString", null_toString); vm->numClass = defineClass(vm, "Num"); NATIVE(vm->numClass, "abs", num_abs); NATIVE(vm->numClass, "ceil", num_ceil); NATIVE(vm->numClass, "cos", num_cos); NATIVE(vm->numClass, "floor", num_floor); NATIVE(vm->numClass, "isNan", num_isNan); NATIVE(vm->numClass, "sin", num_sin); NATIVE(vm->numClass, "sqrt", num_sqrt); NATIVE(vm->numClass, "toString", num_toString) NATIVE(vm->numClass, "-", num_negate); NATIVE(vm->numClass, "- ", num_minus); NATIVE(vm->numClass, "+ ", num_plus); NATIVE(vm->numClass, "* ", num_multiply); NATIVE(vm->numClass, "/ ", num_divide); NATIVE(vm->numClass, "% ", num_mod); NATIVE(vm->numClass, "< ", num_lt); NATIVE(vm->numClass, "> ", num_gt); NATIVE(vm->numClass, "<= ", num_lte); NATIVE(vm->numClass, ">= ", num_gte); NATIVE(vm->numClass, "~", num_bitwiseNot); NATIVE(vm->numClass, "& ", num_bitwiseAnd); NATIVE(vm->numClass, "| ", num_bitwiseOr); NATIVE(vm->numClass, ".. ", num_dotDot); NATIVE(vm->numClass, "... ", num_dotDotDot); vm->stringClass = defineClass(vm, "String"); NATIVE(vm->stringClass, "contains ", string_contains); NATIVE(vm->stringClass, "count", string_count); NATIVE(vm->stringClass, "toString", string_toString) NATIVE(vm->stringClass, "+ ", string_plus); NATIVE(vm->stringClass, "== ", string_eqeq); NATIVE(vm->stringClass, "!= ", string_bangeq); NATIVE(vm->stringClass, "[ ]", string_subscript); wrenInterpret(vm, "Wren core library", libSource); vm->listClass = AS_CLASS(findGlobal(vm, "List")); NATIVE(vm->listClass->metaclass, " instantiate", list_instantiate); NATIVE(vm->listClass, "add ", list_add); NATIVE(vm->listClass, "clear", list_clear); NATIVE(vm->listClass, "count", list_count); NATIVE(vm->listClass, "insert ", list_insert); NATIVE(vm->listClass, "iterate ", list_iterate); NATIVE(vm->listClass, "iteratorValue ", list_iteratorValue); NATIVE(vm->listClass, "removeAt ", list_removeAt); NATIVE(vm->listClass, "[ ]", list_subscript); NATIVE(vm->listClass, "[ ]=", list_subscriptSetter); vm->rangeClass = AS_CLASS(findGlobal(vm, "Range")); NATIVE(vm->rangeClass, "from", range_from); NATIVE(vm->rangeClass, "to", range_to); NATIVE(vm->rangeClass, "min", range_min); NATIVE(vm->rangeClass, "max", range_max); NATIVE(vm->rangeClass, "isInclusive", range_isInclusive); NATIVE(vm->rangeClass, "iterate ", range_iterate); NATIVE(vm->rangeClass, "iteratorValue ", range_iteratorValue); NATIVE(vm->rangeClass, "toString", range_toString); // These are defined just so that 0 and -0 are equal, which is specified by // IEEE 754 even though they have different bit representations. NATIVE(vm->numClass, "== ", num_eqeq); NATIVE(vm->numClass, "!= ", num_bangeq); }