1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 15:17:13 +02:00

Replace GetObject with GetObj to avoid collisions on Windows.

ef you MS
This commit is contained in:
Sandu Liviu Catalin
2020-04-17 17:42:09 +03:00
parent 1242b8a2fc
commit e13d1a91e7
22 changed files with 94 additions and 95 deletions

View File

@ -140,9 +140,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQInteger index, Object& obj) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
sq_pushobject(vm, obj.GetObject());
sq_pushobject(vm, obj.GetObj());
sq_set(vm, -3);
sq_pop(vm,1); // pop array
}
@ -158,7 +158,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& SquirrelFunc(const SQInteger index, SQFUNCTION func, const SQChar* name = nullptr) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -181,7 +181,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& SquirrelFunc(const SQInteger index, SQFUNCTION func, SQInteger pnum, const SQChar * mask, const SQChar* name = nullptr) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -206,7 +206,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& SetValue(const SQInteger index, const V& val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
PushVar(vm, val);
sq_set(vm, -3);
@ -303,7 +303,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function GetFunction(const SQInteger index) {
HSQOBJECT funcObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if(SQ_FAILED(sq_get(vm, -2))) {
@ -319,7 +319,7 @@ public:
sq_get(vm, -2);
#endif
sq_getstackobj(vm, -1, &funcObj);
Function ret(vm, GetObject(), funcObj); // must addref before the pop!
Function ret(vm, GetObj(), funcObj); // must addref before the pop!
sq_pop(vm, 2);
return ret;
}
@ -339,7 +339,7 @@ public:
template <typename T>
void GetArray(T* array, int size) const
{
HSQOBJECT value = GetObject();
HSQOBJECT value = GetObj();
sq_pushobject(vm, value);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if (size > sq_getsize(vm, -1)) {
@ -384,7 +384,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Append(const V& val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayappend(vm, -2);
sq_pop(vm,1); // pop array
@ -403,7 +403,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Append(V* val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayappend(vm, -2);
sq_pop(vm,1); // pop array
@ -423,7 +423,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Insert(const SQInteger destpos, const V& val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayinsert(vm, -2, destpos);
sq_pop(vm,1); // pop array
@ -443,7 +443,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class V>
ArrayBase& Insert(const SQInteger destpos, V* val) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
PushVar(vm, val);
sq_arrayinsert(vm, -2, destpos);
sq_pop(vm,1); // pop array
@ -458,7 +458,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Object Pop() {
HSQOBJECT slotObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
if(SQ_FAILED(sq_arraypop(vm, -1, true))) {
sq_pop(vm, 1);
return Object(); // Return a NULL object
@ -479,7 +479,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& Remove(const SQInteger itemidx) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_arrayremove(vm, -1, itemidx);
sq_pop(vm,1); // pop array
return *this;
@ -494,7 +494,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& Resize(const SQInteger newsize) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_arrayresize(vm, -1, newsize);
sq_pop(vm,1); // pop array
return *this;
@ -507,7 +507,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ArrayBase& Reverse() {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_arrayreverse(vm, -1);
sq_pop(vm,1); // pop array
return *this;
@ -539,7 +539,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class F>
ArrayBase& AppendFrom(F&& func) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
while (func(vm))
{
sq_arrayappend(vm, -2);
@ -695,7 +695,7 @@ struct Var<Array> {
static void push(HSQUIRRELVM vm, const Array& value) {
HSQOBJECT obj;
sq_resetobject(&obj);
obj = value.GetObject();
obj = value.GetObj();
sq_pushobject(vm,obj);
}
};

View File

@ -132,7 +132,7 @@ public:
/// \return Squirrel object representing the Squirrel class
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT GetObject() const {
virtual HSQOBJECT GetObj() const {
return ClassType<C>::getClassData(vm)->classObj;
}
@ -142,7 +142,7 @@ public:
/// \return Squirrel object representing the Squirrel class
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT& GetObject() {
virtual HSQOBJECT& GetObj() {
return ClassType<C>::getClassData(vm)->classObj;
}

View File

@ -359,9 +359,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ConstTable& Enum(const SQChar* name, Enumeration& en) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, en.GetObject());
sq_pushobject(vm, en.GetObj());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
return *this;

View File

@ -65,10 +65,10 @@ struct Function {
sq_resetobject(&sf.GetFunc());
}
// Constructs a Function from a slot in an Object
Function(const Object& e, const SQChar* slot) : mEnv(e.GetObject()) {
Function(const Object& e, const SQChar* slot) : mEnv(e.GetObj()) {
sq_addref(DefaultVM::Get_(), &mEnv);
Object so = e.GetSlot(slot);
mObj = so.GetObject();
mObj = so.GetObj();
sq_addref(DefaultVM::Get_(), &mObj);
#if !defined (SCRAT_NO_ERROR_CHECKING)
SQObjectType value_type = so.GetType();

View File

@ -223,7 +223,7 @@ public:
vm = so.vm;
obj = so.obj;
release = so.release;
sq_addref(vm, &GetObject());
sq_addref(vm, &GetObj());
return *this;
}
@ -271,7 +271,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void ResetObj() {
sq_resetobject(&GetObject());
sq_resetobject(&GetObj());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -280,7 +280,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Reset() {
vm = nullptr;
sq_resetobject(&GetObject());
sq_resetobject(&GetObj());
release = false;
}
@ -311,7 +311,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SQObjectType GetType() const {
return GetObject()._type;
return GetObj()._type;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -321,7 +321,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool IsNull() const {
return sq_isnull(GetObject());
return sq_isnull(GetObj());
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -330,7 +330,7 @@ public:
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT GetObject() const {
virtual HSQOBJECT GetObj() const {
return obj;
}
@ -340,7 +340,7 @@ public:
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual HSQOBJECT& GetObject() {
virtual HSQOBJECT& GetObj() {
return obj;
}
@ -349,7 +349,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
operator HSQOBJECT&() {
return GetObject();
return GetObj();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -371,7 +371,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Object GetSlot(const SQChar* slot) const {
HSQOBJECT slotObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, slot, -1);
#if !defined (SCRAT_NO_ERROR_CHECKING)
@ -403,7 +403,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Object GetSlot(SQInteger index) const {
HSQOBJECT slotObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
#if !defined (SCRAT_NO_ERROR_CHECKING)
@ -434,7 +434,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(const SQChar* key) const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, key, -1);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
@ -453,7 +453,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool HasKey(SQInteger index) const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
if (SQ_FAILED(sq_get(vm, -2))) {
sq_pop(vm, 1);
@ -476,7 +476,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <class T>
T Cast() const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
T ret = Var<T>(vm, -1).value;
sq_pop(vm, 1);
return ret;
@ -505,7 +505,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SQInteger GetSize() const {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
SQInteger ret = sq_getsize(vm, -1);
sq_pop(vm, 1);
return ret;
@ -623,7 +623,7 @@ protected:
// Bind a function and it's associated Squirrel closure to the object
inline void BindFunc(const SQChar* name, void* method, size_t methodSize, SQFUNCTION func, bool staticVar = false) {
// Push object/environment
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
// Push name where the closure will be stored
sq_pushstring(vm, name, -1);
// Push the native closure pointer as a free variable
@ -641,7 +641,7 @@ protected:
inline void BindFunc(const SQInteger index, void* method, size_t methodSize, SQFUNCTION func, bool staticVar = false, const SQChar* name = nullptr) {
// Push object/environment
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
// Push index where the closure will be stored
sq_pushinteger(vm, index);
// Push the native closure pointer as a free variable
@ -664,7 +664,7 @@ protected:
overloadName.reserve(15);
SqOverloadName::Get(name, argCount, overloadName);
// Push object/environment
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
// Bind overload handler
sq_pushstring(vm, name, -1);
@ -694,7 +694,7 @@ protected:
// Set the value of a variable on the object. Changes to values set this way are not reciprocated
template<class V>
inline void BindValue(const SQChar* name, const V& val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -702,7 +702,7 @@ protected:
}
template<class V>
inline void BindValue(const SQInteger index, const V& val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -712,7 +712,7 @@ protected:
// Set the value of an instance on the object. Changes to values set this way are reciprocated back to the source instance
template<class V>
inline void BindInstance(const SQChar* name, V* val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -720,7 +720,7 @@ protected:
}
template<class V>
inline void BindInstance(const SQInteger index, V* val, bool staticVar = false) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
PushVar(vm, val);
sq_newslot(vm, -3, staticVar);
@ -733,7 +733,7 @@ protected:
/// @cond DEV
template<>
inline void Object::BindValue<int>(const SQChar* name, const int & val, bool staticVar /* = false */) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
PushVar<int>(vm, val);
sq_newslot(vm, -3, staticVar);
@ -770,7 +770,7 @@ struct Var<Object> {
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static void push(HSQUIRRELVM vm, const Object& value) {
sq_pushobject(vm, value.GetObject());
sq_pushobject(vm, value.GetObj());
}
};
@ -900,7 +900,7 @@ struct LightObj {
/// \param so Object to copy
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LightObj(const Object& obj) : mObj(obj.GetObject()) {
LightObj(const Object& obj) : mObj(obj.GetObj()) {
if (!sq_isnull(mObj)) {
sq_addref(obj.GetVM(), &mObj);
}
@ -1055,7 +1055,7 @@ struct LightObj {
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HSQOBJECT GetObject() const {
HSQOBJECT GetObj() const {
return mObj;
}
@ -1065,7 +1065,7 @@ struct LightObj {
/// \return Squirrel object
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HSQOBJECT& GetObject() {
HSQOBJECT& GetObj() {
return mObj;
}
@ -1174,7 +1174,7 @@ inline Object& Object::operator=(const LightObj& so) {
vm = SqVM();
obj = so.mObj;
release = !so.IsNull();
sq_addref(vm, &GetObject());
sq_addref(vm, &GetObj());
return *this;
}

View File

@ -158,9 +158,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQChar* name, Object& obj) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, obj.GetObject());
sq_pushobject(vm, obj.GetObj());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
}
@ -176,9 +176,9 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Bind(const SQChar* name, LightObj& obj) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_pushobject(vm, obj.GetObject());
sq_pushobject(vm, obj.GetObj());
sq_newslot(vm, -3, false);
sq_pop(vm,1); // pop table
}
@ -193,7 +193,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TableBase& SquirrelFunc(const SQChar* name, SQFUNCTION func) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -215,7 +215,7 @@ public:
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TableBase& SquirrelFunc(const SQChar* name, SQFUNCTION func, SQInteger pnum, const SQChar * mask) {
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
sq_newclosure(vm, func, 0);
// Set the closure name (for debug purposes)
@ -469,7 +469,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function GetFunction(const SQChar* name) {
HSQOBJECT funcObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushstring(vm, name, -1);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if(SQ_FAILED(sq_get(vm, -2))) {
@ -485,7 +485,7 @@ public:
sq_get(vm, -2);
#endif
sq_getstackobj(vm, -1, &funcObj);
Function ret(vm, GetObject(), funcObj); // must addref before the pop!
Function ret(vm, GetObj(), funcObj); // must addref before the pop!
sq_pop(vm, 2);
return ret;
}
@ -500,7 +500,7 @@ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function GetFunction(const SQInteger index) {
HSQOBJECT funcObj;
sq_pushobject(vm, GetObject());
sq_pushobject(vm, GetObj());
sq_pushinteger(vm, index);
#if !defined (SCRAT_NO_ERROR_CHECKING)
if(SQ_FAILED(sq_get(vm, -2))) {
@ -516,7 +516,7 @@ public:
sq_get(vm, -2);
#endif
sq_getstackobj(vm, -1, &funcObj);
Function ret(vm, GetObject(), funcObj); // must addref before the pop!
Function ret(vm, GetObj(), funcObj); // must addref before the pop!
sq_pop(vm, 2);
return ret;
}
@ -722,7 +722,7 @@ struct Var<Table> {
static void push(HSQUIRRELVM vm, const Table& value) {
HSQOBJECT obj;
sq_resetobject(&obj);
obj = value.GetObject();
obj = value.GetObj();
sq_pushobject(vm,obj);
}
};