void SQVM::Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger type) { SQObjectPtr exptypes = SQString::Create(_ss(this), "", -1); SQInteger found = 0; for(SQInteger i=0; i<16; i++) { SQInteger mask = 0x00000001 << i; if(typemask & (mask)) { if(found>0) StringCat(exptypes,SQString::Create(_ss(this), "|", -1), exptypes); found ++; StringCat(exptypes,SQString::Create(_ss(this), IdType2Name((SQObjectType)mask), -1), exptypes); } } Raise_Error("parameter %d has an invalid type '%s' ; expected: '%s'", nparam, IdType2Name((SQObjectType)type), _stringval(exptypes)); }
bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2) { SQInteger res; if((type(o1)|type(o2)) == OT_INTEGER) { SQInteger i1 = _integer(o1), i2 = _integer(o2); switch(op) { case BW_AND: res = i1 & i2; break; case BW_OR: res = i1 | i2; break; case BW_XOR: res = i1 ^ i2; break; case BW_SHIFTL: res = i1 << i2; break; case BW_SHIFTR: res = i1 >> i2; break; case BW_USHIFTR:res = (SQInteger)(*((SQUnsignedInteger*)&i1) >> i2); break; default: { Raise_Error(_SC("internal vm error bitwise op failed")); return false; } } }
bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2) { SQInteger res; SQInteger i1 = _integer(o1), i2 = _integer(o2); if((type(o1)==OT_INTEGER) && (type(o2)==OT_INTEGER)) { switch(op) { case BW_AND: res = i1 & i2; break; case BW_OR: res = i1 | i2; break; case BW_XOR: res = i1 ^ i2; break; case BW_SHIFTL: res = i1 << i2; break; case BW_SHIFTR: res = i1 >> i2; break; case BW_USHIFTR:res = (SQInteger)(*((SQUnsignedInteger*)&i1) >> i2); break; default: { Raise_Error("internal vm error bitwise op failed"); return false; } } } else { Raise_Error("bitwise op between '%s' and '%s'",GetTypeName(o1),GetTypeName(o2)); return false;}
void SQVM::Raise_IdxError(const SQObject &o) { SQObjectPtr oval = PrintObjVal(o); Raise_Error("the index '%.50s' does not exist", _stringval(oval)); }
void SQVM::Raise_CompareError(const SQObject &o1, const SQObject &o2) { SQObjectPtr oval1 = PrintObjVal(o1), oval2 = PrintObjVal(o2); Raise_Error("comparison between '%.50s' and '%.50s'", _stringval(oval1), _stringval(oval2)); }
void SQVM::Raise_ErrorV(const SQChar *s, va_list &vl) { scvsprintf(_sp(rsl((SQInteger)scstrlen(s)+(NUMBER_MAX_CHAR*2))), s, vl); Raise_Error(_spval); }