From e13d1a91e7d564a10bd1b3e2a876506bd1776034 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 17 Apr 2020 17:42:09 +0300 Subject: [PATCH] Replace GetObject with GetObj to avoid collisions on Windows. ef you MS --- module/Core.cpp | 9 +++--- module/Core.hpp | 4 +-- module/Core/Funcs.inc | 6 ++-- module/Entity/Blip.cpp | 2 +- module/Entity/Checkpoint.cpp | 2 +- module/Entity/Keybind.cpp | 2 +- module/Entity/Object.cpp | 4 +-- module/Entity/Pickup.cpp | 2 +- module/Entity/Player.cpp | 4 +-- module/Entity/Vehicle.cpp | 2 +- module/Library/SQLite.cpp | 2 +- module/Misc/Algo.hpp | 6 ++-- module/Misc/Command.hpp | 12 ++++---- module/Misc/Routine.hpp | 2 +- module/Misc/Signal.hpp | 2 +- module/Misc/Tasks.cpp | 4 +-- sqrat/sqrat/sqratArray.h | 36 ++++++++++++------------ sqrat/sqrat/sqratClass.h | 4 +-- sqrat/sqrat/sqratConst.h | 4 +-- sqrat/sqrat/sqratFunction.h | 4 +-- sqrat/sqrat/sqratObject.h | 54 ++++++++++++++++++------------------ sqrat/sqrat/sqratTable.h | 22 +++++++-------- 22 files changed, 94 insertions(+), 95 deletions(-) diff --git a/module/Core.cpp b/module/Core.cpp index a0781ca9..d9d374de 100644 --- a/module/Core.cpp +++ b/module/Core.cpp @@ -31,11 +31,6 @@ #include #include -// ------------------------------------------------------------------------------------------------ -#ifdef GetObject - #undef GetObject -#endif // ef you MS - // ------------------------------------------------------------------------------------------------ namespace SqMod { @@ -371,6 +366,8 @@ bool Core::Initialize() // Initialize routines and tasks InitializeRoutines(); InitializeTasks(); + // Initialize third-party + // Initialization successful return true; @@ -478,6 +475,8 @@ void Core::Terminate(bool shutdown) const ContainerCleaner cc_blips(m_Blips, ENT_BLIP, !shutdown); const ContainerCleaner cc_keybinds(m_Keybinds, ENT_KEYBIND, !shutdown); cLogDbg(m_Verbosity >= 1, "Terminating routines an commands"); + // Release third-party + // Release all resources from routines and tasks TerminateRoutines(); TerminateTasks(); diff --git a/module/Core.hpp b/module/Core.hpp index 36e160ff..38c5497b 100644 --- a/module/Core.hpp +++ b/module/Core.hpp @@ -1056,7 +1056,7 @@ public: BlipInst & GetBlip(Int32 id) { return m_Blips.at(static_cast< size_t >(id)); } CheckpointInst & GetCheckpoint(Int32 id) { return m_Checkpoints.at(static_cast< size_t >(id)); } KeybindInst & GetKeybind(Int32 id) { return m_Keybinds.at(static_cast< size_t >(id)); } - ObjectInst & GetObject(Int32 id) { return m_Objects.at(static_cast< size_t >(id)); } + ObjectInst & GetObj(Int32 id) { return m_Objects.at(static_cast< size_t >(id)); } PickupInst & GetPickup(Int32 id) { return m_Pickups.at(static_cast< size_t >(id)); } PlayerInst & GetPlayer(Int32 id) { return m_Players.at(static_cast< size_t >(id)); } VehicleInst & GetVehicle(Int32 id) { return m_Vehicles.at(static_cast< size_t >(id)); } @@ -1067,7 +1067,7 @@ public: const Blips & GetBlips() const { return m_Blips; } const Checkpoints & GetCheckpoints() const { return m_Checkpoints; } const Keybinds & GetKeybinds() const { return m_Keybinds; } - const Objects & GetObjects() const { return m_Objects; } + const Objects & GetObjs() const { return m_Objects; } const Pickups & GetPickups() const { return m_Pickups; } const Players & GetPlayers() const { return m_Players; } const Vehicles & GetVehicles() const { return m_Vehicles; } diff --git a/module/Core/Funcs.inc b/module/Core/Funcs.inc index 44eb240b..244d25f8 100644 --- a/module/Core/Funcs.inc +++ b/module/Core/Funcs.inc @@ -193,7 +193,7 @@ static LightObj & SqGetKeybind(Int32 id) } // ------------------------------------------------------------------------------------------------ -static LightObj & SqGetObject(Int32 id) +static LightObj & SqGetObj(Int32 id) { // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) @@ -201,7 +201,7 @@ static LightObj & SqGetObject(Int32 id) STHROWF("Out of range object identifier: %d", id); } // Return the requested information - return Core::Get().GetObject(id).mObj; + return Core::Get().GetObj(id).mObj; } // ------------------------------------------------------------------------------------------------ @@ -345,7 +345,7 @@ void Register_Core(HSQUIRRELVM vm) .Func(_SC("GetBlip"), &SqGetBlip) .Func(_SC("GetCheckpoint"), &SqGetCheckpoint) .Func(_SC("GetKeybind"), &SqGetKeybind) - .Func(_SC("GetObject"), &SqGetObject) + .Func(_SC("GetObj"), &SqGetObj) .Func(_SC("GetPickup"), &SqGetPickup) .Func(_SC("GetPlayer"), &SqGetPlayer) .Func(_SC("GetVehicle"), &SqGetVehicle) diff --git a/module/Entity/Blip.cpp b/module/Entity/Blip.cpp index e3e0253d..0e84e070 100644 --- a/module/Entity/Blip.cpp +++ b/module/Entity/Blip.cpp @@ -15,7 +15,7 @@ const Int32 CBlip::Max = SQMOD_BLIP_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CBlip::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullBlip().GetObject()); + sq_pushobject(vm, Core::Get().GetNullBlip().GetObj()); return 1; } diff --git a/module/Entity/Checkpoint.cpp b/module/Entity/Checkpoint.cpp index 7d830d0c..ae4c9e35 100644 --- a/module/Entity/Checkpoint.cpp +++ b/module/Entity/Checkpoint.cpp @@ -18,7 +18,7 @@ const Int32 CCheckpoint::Max = SQMOD_CHECKPOINT_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CCheckpoint::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullCheckpoint().GetObject()); + sq_pushobject(vm, Core::Get().GetNullCheckpoint().GetObj()); return 1; } diff --git a/module/Entity/Keybind.cpp b/module/Entity/Keybind.cpp index 4093e25b..f2a339a1 100644 --- a/module/Entity/Keybind.cpp +++ b/module/Entity/Keybind.cpp @@ -15,7 +15,7 @@ const Int32 CKeybind::Max = SQMOD_KEYBIND_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CKeybind::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullKeybind().GetObject()); + sq_pushobject(vm, Core::Get().GetNullKeybind().GetObj()); return 1; } diff --git a/module/Entity/Object.cpp b/module/Entity/Object.cpp index b7391964..89f8e6bf 100644 --- a/module/Entity/Object.cpp +++ b/module/Entity/Object.cpp @@ -18,7 +18,7 @@ const Int32 CObject::Max = SQMOD_OBJECT_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CObject::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullObject().GetObject()); + sq_pushobject(vm, Core::Get().GetNullObject().GetObj()); return 1; } @@ -107,7 +107,7 @@ LightObj & CObject::GetEvents() const // Validate the managed identifier Validate(); // Return the associated event table - return Core::Get().GetObject(m_ID).mEvents; + return Core::Get().GetObj(m_ID).mEvents; } // ------------------------------------------------------------------------------------------------ diff --git a/module/Entity/Pickup.cpp b/module/Entity/Pickup.cpp index 8a4da04a..3a6292f8 100644 --- a/module/Entity/Pickup.cpp +++ b/module/Entity/Pickup.cpp @@ -17,7 +17,7 @@ const Int32 CPickup::Max = SQMOD_PICKUP_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CPickup::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullPickup().GetObject()); + sq_pushobject(vm, Core::Get().GetNullPickup().GetObj()); return 1; } diff --git a/module/Entity/Player.cpp b/module/Entity/Player.cpp index a95a5be1..57ff8dee 100644 --- a/module/Entity/Player.cpp +++ b/module/Entity/Player.cpp @@ -27,7 +27,7 @@ const Int32 CPlayer::Max = SQMOD_PLAYER_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CPlayer::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullPlayer().GetObject()); + sq_pushobject(vm, Core::Get().GetNullPlayer().GetObj()); return 1; } @@ -1329,7 +1329,7 @@ LightObj & CPlayer::StandingOnObject() const if (VALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) { // Return the requested information - return Core::Get().GetObject(id).mObj; + return Core::Get().GetObj(id).mObj; } // Default to a null object return Core::Get().GetNullObject(); diff --git a/module/Entity/Vehicle.cpp b/module/Entity/Vehicle.cpp index 51f6243c..9a6cc021 100644 --- a/module/Entity/Vehicle.cpp +++ b/module/Entity/Vehicle.cpp @@ -20,7 +20,7 @@ const Int32 CVehicle::Max = SQMOD_VEHICLE_POOL; // ------------------------------------------------------------------------------------------------ SQInteger CVehicle::SqGetNull(HSQUIRRELVM vm) { - sq_pushobject(vm, Core::Get().GetNullVehicle().GetObject()); + sq_pushobject(vm, Core::Get().GetNullVehicle().GetObj()); return 1; } diff --git a/module/Library/SQLite.cpp b/module/Library/SQLite.cpp index 437e4062..28e9d4a7 100644 --- a/module/Library/SQLite.cpp +++ b/module/Library/SQLite.cpp @@ -661,7 +661,7 @@ Int32 SQLiteConnHnd::Flush(Uint32 num, Object & env, Function & func) num = mQueue.size(); } // Generate the function that should be called upon error - Function callback = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + Function callback = Function(env.GetVM(), env.GetObj(), func.GetFunc()); // Obtain iterators to the range of queries that should be flushed auto itr = mQueue.begin(); auto end = mQueue.begin() + num; diff --git a/module/Misc/Algo.hpp b/module/Misc/Algo.hpp index 83192030..19c22797 100644 --- a/module/Misc/Algo.hpp +++ b/module/Misc/Algo.hpp @@ -712,7 +712,7 @@ template <> struct InstSpec< CObject > */ static inline Instances::const_iterator CBegin() { - return Core::Get().GetObjects().cbegin(); + return Core::Get().GetObjs().cbegin(); } /* -------------------------------------------------------------------------------------------- @@ -720,7 +720,7 @@ template <> struct InstSpec< CObject > */ static inline Instances::const_iterator CEnd() { - return Core::Get().GetObjects().cend(); + return Core::Get().GetObjs().cend(); } /* -------------------------------------------------------------------------------------------- @@ -907,7 +907,7 @@ template < typename T > struct AppendElemFunc void operator () (const typename InstSpec< T >::Instance & inst) const { // Push the script object on the stack - sq_pushobject(mVM, inst.mObj.GetObject()); + sq_pushobject(mVM, inst.mObj.GetObj()); // Append the object at the back of the array if (SQ_FAILED(sq_arrayappend(mVM, mIdx))) { diff --git a/module/Misc/Command.hpp b/module/Misc/Command.hpp index e3c915c5..2c654a06 100644 --- a/module/Misc/Command.hpp +++ b/module/Misc/Command.hpp @@ -640,7 +640,7 @@ public: } else { - m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + m_OnFail = Function(env.GetVM(), env.GetObj(), func.GetFunc()); } } @@ -669,7 +669,7 @@ public: } else { - m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + m_OnAuth = Function(env.GetVM(), env.GetObj(), func.GetFunc()); } } @@ -1761,7 +1761,7 @@ public: } else { - m_OnExec = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + m_OnExec = Function(env.GetVM(), env.GetObj(), func.GetFunc()); } } @@ -1790,7 +1790,7 @@ public: } else { - m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + m_OnAuth = Function(env.GetVM(), env.GetObj(), func.GetFunc()); } } @@ -1819,7 +1819,7 @@ public: } else { - m_OnPost = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + m_OnPost = Function(env.GetVM(), env.GetObj(), func.GetFunc()); } } @@ -1848,7 +1848,7 @@ public: } else { - m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc()); + m_OnFail = Function(env.GetVM(), env.GetObj(), func.GetFunc()); } } diff --git a/module/Misc/Routine.hpp b/module/Misc/Routine.hpp index 165b3a82..2651ed4c 100644 --- a/module/Misc/Routine.hpp +++ b/module/Misc/Routine.hpp @@ -434,7 +434,7 @@ public: */ void SetEnv(const LightObj & env) { - GetValid().mEnv = env.IsNull() ? LightObj(RootTable().GetObject()) : env; + GetValid().mEnv = env.IsNull() ? LightObj(RootTable().GetObj()) : env; } /* -------------------------------------------------------------------------------------------- diff --git a/module/Misc/Signal.hpp b/module/Misc/Signal.hpp index fbbb6b96..8e15b8b5 100644 --- a/module/Misc/Signal.hpp +++ b/module/Misc/Signal.hpp @@ -113,7 +113,7 @@ protected: * Forwarding constructor. */ Slot(Object & env, Function & func) - : Slot(env.GetObject(), func.GetFunc()) + : Slot(env.GetObj(), func.GetFunc()) { /* ... */ } diff --git a/module/Misc/Tasks.cpp b/module/Misc/Tasks.cpp index 2cef7af2..1a16691f 100644 --- a/module/Misc/Tasks.cpp +++ b/module/Misc/Tasks.cpp @@ -190,7 +190,7 @@ LightObj & Tasks::FindEntity(Int32 id, Int32 type) case ENT_BLIP: return Core::Get().GetBlip(id).mObj; case ENT_CHECKPOINT: return Core::Get().GetCheckpoint(id).mObj; case ENT_KEYBIND: return Core::Get().GetKeybind(id).mObj; - case ENT_OBJECT: return Core::Get().GetObject(id).mObj; + case ENT_OBJECT: return Core::Get().GetObj(id).mObj; case ENT_PICKUP: return Core::Get().GetPickup(id).mObj; case ENT_PLAYER: return Core::Get().GetPlayer(id).mObj; case ENT_VEHICLE: return Core::Get().GetVehicle(id).mObj; @@ -244,7 +244,7 @@ SQInteger Tasks::Create(Int32 id, Int32 type, HSQUIRRELVM vm) // Attempt to retrieve the entity instance try { - inst = FindEntity(id, type).GetObject(); + inst = FindEntity(id, type).GetObj(); } catch (const std::exception & e) { diff --git a/sqrat/sqrat/sqratArray.h b/sqrat/sqrat/sqratArray.h index fa8e4c40..581c6b19 100644 --- a/sqrat/sqrat/sqratArray.h +++ b/sqrat/sqrat/sqratArray.h @@ -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 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 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 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 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 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 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 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 { static void push(HSQUIRRELVM vm, const Array& value) { HSQOBJECT obj; sq_resetobject(&obj); - obj = value.GetObject(); + obj = value.GetObj(); sq_pushobject(vm,obj); } }; diff --git a/sqrat/sqrat/sqratClass.h b/sqrat/sqrat/sqratClass.h index 5de499d5..3f67d91c 100644 --- a/sqrat/sqrat/sqratClass.h +++ b/sqrat/sqrat/sqratClass.h @@ -132,7 +132,7 @@ public: /// \return Squirrel object representing the Squirrel class /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - virtual HSQOBJECT GetObject() const { + virtual HSQOBJECT GetObj() const { return ClassType::getClassData(vm)->classObj; } @@ -142,7 +142,7 @@ public: /// \return Squirrel object representing the Squirrel class /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - virtual HSQOBJECT& GetObject() { + virtual HSQOBJECT& GetObj() { return ClassType::getClassData(vm)->classObj; } diff --git a/sqrat/sqrat/sqratConst.h b/sqrat/sqrat/sqratConst.h index 94f98105..79bb4d66 100644 --- a/sqrat/sqrat/sqratConst.h +++ b/sqrat/sqrat/sqratConst.h @@ -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; diff --git a/sqrat/sqrat/sqratFunction.h b/sqrat/sqrat/sqratFunction.h index ea325077..4e5e427e 100644 --- a/sqrat/sqrat/sqratFunction.h +++ b/sqrat/sqrat/sqratFunction.h @@ -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(); diff --git a/sqrat/sqrat/sqratObject.h b/sqrat/sqrat/sqratObject.h index 6e23275b..312fad16 100644 --- a/sqrat/sqrat/sqratObject.h +++ b/sqrat/sqrat/sqratObject.h @@ -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 T Cast() const { - sq_pushobject(vm, GetObject()); + sq_pushobject(vm, GetObj()); T ret = Var(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 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 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 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 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(const SQChar* name, const int & 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); @@ -770,7 +770,7 @@ struct Var { /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 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; } diff --git a/sqrat/sqrat/sqratTable.h b/sqrat/sqrat/sqratTable.h index 9b014f16..f5175f36 100644 --- a/sqrat/sqrat/sqratTable.h +++ b/sqrat/sqrat/sqratTable.h @@ -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 { static void push(HSQUIRRELVM vm, const Table& value) { HSQOBJECT obj; sq_resetobject(&obj); - obj = value.GetObject(); + obj = value.GetObj(); sq_pushobject(vm,obj); } };