mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-19 12:07:13 +01:00
Multiple fixes for last refactoring.
This commit is contained in:
parent
a75f87b77c
commit
4e31fc478c
@ -462,7 +462,7 @@ public:
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<class F>
|
template<class F>
|
||||||
Class& GlobalFmtFunc(const SQChar* name, F method) {
|
Class& GlobalFmtFunc(const SQChar* name, F method) {
|
||||||
BindFunc(name, &method, sizeof(method), SqMemberGlobalFmtFunc(method));
|
BindFunc(name, &method, sizeof(method), SqMemberGlobalFunc(method));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ template <class R> struct SqGlobal {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqGlobalProxy<R>::Run(vm, startIdx);
|
return SqGlobalProxy<R>::template Run<A...>(vm, startIdx);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ template <class R> struct SqGlobal<R&> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqGlobalProxy<R&>::Run(vm, startIdx);
|
return SqGlobalProxy<R&>::template Run<A...>(vm, startIdx);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ template <> struct SqGlobal<void> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqGlobalProxy<void>::Run(vm, startIdx);
|
return SqGlobalProxy<void>::Run<A...>(vm, startIdx);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ template <class C,class R> struct SqMemberProxy {
|
|||||||
typedef R(C::*M)(A...);
|
typedef R(C::*M)(A...);
|
||||||
C* inst = Var<C*>(vm, 1).value;
|
C* inst = Var<C*>(vm, 1).value;
|
||||||
M* methodPtr;
|
M* methodPtr;
|
||||||
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), NULL);
|
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), nullptr);
|
||||||
M method = *methodPtr;
|
M method = *methodPtr;
|
||||||
R ret = (inst->*method)(a...);
|
R ret = (inst->*method)(a...);
|
||||||
PushVar(vm, ret);
|
PushVar(vm, ret);
|
||||||
@ -70,7 +70,7 @@ template <class C,class R> struct SqMemberProxy {
|
|||||||
typedef R(C::*M)(A...) const;
|
typedef R(C::*M)(A...) const;
|
||||||
C* inst = Var<C*>(vm, 1).value;
|
C* inst = Var<C*>(vm, 1).value;
|
||||||
M* methodPtr;
|
M* methodPtr;
|
||||||
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), NULL);
|
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), nullptr);
|
||||||
M method = *methodPtr;
|
M method = *methodPtr;
|
||||||
R ret = (inst->*method)(a...);
|
R ret = (inst->*method)(a...);
|
||||||
PushVar(vm, ret);
|
PushVar(vm, ret);
|
||||||
@ -83,7 +83,7 @@ template <class C,class R> struct SqMemberProxy {
|
|||||||
// reference return specialization
|
// reference return specialization
|
||||||
//
|
//
|
||||||
|
|
||||||
template <class C, class R> struct SqMemberProxy<C, R&> {
|
template <class C, class R> struct SqMemberProxy<C,R&> {
|
||||||
template <class... A> static SQInteger Run(HSQUIRRELVM vm) noexcept {
|
template <class... A> static SQInteger Run(HSQUIRRELVM vm) noexcept {
|
||||||
ArgPop<A...> a(vm, 2);
|
ArgPop<A...> a(vm, 2);
|
||||||
if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) {
|
if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) {
|
||||||
@ -93,7 +93,7 @@ template <class C, class R> struct SqMemberProxy<C, R&> {
|
|||||||
typedef R&(C::*M)(A...);
|
typedef R&(C::*M)(A...);
|
||||||
C* inst = Var<C*>(vm, 1).value;
|
C* inst = Var<C*>(vm, 1).value;
|
||||||
M* methodPtr;
|
M* methodPtr;
|
||||||
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), NULL);
|
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), nullptr);
|
||||||
M method = *methodPtr;
|
M method = *methodPtr;
|
||||||
R& ret = (inst->*method)(a...);
|
R& ret = (inst->*method)(a...);
|
||||||
PushVarR(vm, ret);
|
PushVarR(vm, ret);
|
||||||
@ -109,7 +109,7 @@ template <class C, class R> struct SqMemberProxy<C, R&> {
|
|||||||
typedef R&(C::*M)(A...) const;
|
typedef R&(C::*M)(A...) const;
|
||||||
C* inst = Var<C*>(vm, 1).value;
|
C* inst = Var<C*>(vm, 1).value;
|
||||||
M* methodPtr;
|
M* methodPtr;
|
||||||
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), NULL);
|
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), nullptr);
|
||||||
M method = *methodPtr;
|
M method = *methodPtr;
|
||||||
R& ret = (inst->*method)(a...);
|
R& ret = (inst->*method)(a...);
|
||||||
PushVarR(vm, ret);
|
PushVarR(vm, ret);
|
||||||
@ -132,7 +132,7 @@ template <class C> struct SqMemberProxy<C, void> {
|
|||||||
typedef void(C::*M)(A...);
|
typedef void(C::*M)(A...);
|
||||||
C* inst = Var<C*>(vm, 1).value;
|
C* inst = Var<C*>(vm, 1).value;
|
||||||
M* methodPtr;
|
M* methodPtr;
|
||||||
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), NULL);
|
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), nullptr);
|
||||||
M method = *methodPtr;
|
M method = *methodPtr;
|
||||||
(inst->*method)(a...);
|
(inst->*method)(a...);
|
||||||
});
|
});
|
||||||
@ -147,7 +147,7 @@ template <class C> struct SqMemberProxy<C, void> {
|
|||||||
typedef void(C::*M)(A...) const;
|
typedef void(C::*M)(A...) const;
|
||||||
C* inst = Var<C*>(vm, 1).value;
|
C* inst = Var<C*>(vm, 1).value;
|
||||||
M* methodPtr;
|
M* methodPtr;
|
||||||
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), NULL);
|
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&methodPtr), nullptr);
|
||||||
M method = *methodPtr;
|
M method = *methodPtr;
|
||||||
(inst->*method)(a...);
|
(inst->*method)(a...);
|
||||||
});
|
});
|
||||||
@ -180,7 +180,7 @@ template <class C,class R> struct SqMember {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqMemberProxy<C, R>::Run(vm);
|
return SqMemberProxy<C, R>:: template Run<A...>(vm);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ template <class C,class R> struct SqMember {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqMemberProxy<C,R>::RunC(vm);
|
return SqMemberProxy<C,R>::template RunC<A...>(vm);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ template <class C,class R> struct SqMember {
|
|||||||
// reference return specialization
|
// reference return specialization
|
||||||
//
|
//
|
||||||
|
|
||||||
template <class C, class R> struct SqMember<C, R&> {
|
template <class C, class R> struct SqMember<C,R&> {
|
||||||
// Function proxy
|
// Function proxy
|
||||||
template <bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept {
|
template <bool overloaded, class... A> static SQFUNCTION GetProxy() noexcept {
|
||||||
return +[](HSQUIRRELVM vm) noexcept -> SQInteger {
|
return +[](HSQUIRRELVM vm) noexcept -> SQInteger {
|
||||||
@ -221,7 +221,7 @@ template <class C, class R> struct SqMember<C, R&> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqMemberProxy<C, R&>::Run(vm);
|
return SqMemberProxy<C,R&>::template Run<A...>(vm);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ template <class C, class R> struct SqMember<C, R&> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqMemberProxy<C,R&>::RunC(vm);
|
return SqMemberProxy<C,R&>::template RunC<A...>(vm);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ template <class C> struct SqMember<C, void> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqMemberProxy<C, void>::Run(vm);
|
return SqMemberProxy<C, void>::template Run<A...>(vm);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ template <class C> struct SqMember<C, void> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
return SqMemberProxy<C,void>::RunC(vm);
|
return SqMemberProxy<C,void>::template RunC<A...>(vm);
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
return sq_throwerror(vm, e.what());
|
return sq_throwerror(vm, e.what());
|
||||||
}
|
}
|
||||||
@ -327,8 +327,8 @@ inline SQInteger sqDefaultGet(HSQUIRRELVM vm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef V C::*M;
|
typedef V C::*M;
|
||||||
M* memberPtr = NULL;
|
M* memberPtr = nullptr;
|
||||||
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, NULL); // Get Member...
|
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, nullptr); // Get Member...
|
||||||
M member = *memberPtr;
|
M member = *memberPtr;
|
||||||
|
|
||||||
PushVarR(vm, ptr->*member);
|
PushVarR(vm, ptr->*member);
|
||||||
@ -339,8 +339,8 @@ inline SQInteger sqDefaultGet(HSQUIRRELVM vm) {
|
|||||||
template <class C, class V>
|
template <class C, class V>
|
||||||
inline SQInteger sqStaticGet(HSQUIRRELVM vm) {
|
inline SQInteger sqStaticGet(HSQUIRRELVM vm) {
|
||||||
typedef V *M;
|
typedef V *M;
|
||||||
M* memberPtr = NULL;
|
M* memberPtr = nullptr;
|
||||||
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, NULL); // Get Member...
|
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, nullptr); // Get Member...
|
||||||
M member = *memberPtr;
|
M member = *memberPtr;
|
||||||
|
|
||||||
PushVarR(vm, *member);
|
PushVarR(vm, *member);
|
||||||
@ -399,8 +399,8 @@ inline SQInteger sqDefaultSet(HSQUIRRELVM vm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef V C::*M;
|
typedef V C::*M;
|
||||||
M* memberPtr = NULL;
|
M* memberPtr = nullptr;
|
||||||
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, NULL); // Get Member...
|
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, nullptr); // Get Member...
|
||||||
M member = *memberPtr;
|
M member = *memberPtr;
|
||||||
|
|
||||||
SQTRY()
|
SQTRY()
|
||||||
@ -422,8 +422,8 @@ inline SQInteger sqDefaultSet(HSQUIRRELVM vm) {
|
|||||||
template <class C, class V>
|
template <class C, class V>
|
||||||
inline SQInteger sqStaticSet(HSQUIRRELVM vm) {
|
inline SQInteger sqStaticSet(HSQUIRRELVM vm) {
|
||||||
typedef V *M;
|
typedef V *M;
|
||||||
M* memberPtr = NULL;
|
M* memberPtr = nullptr;
|
||||||
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, NULL); // Get Member...
|
sq_getuserdata(vm, -1, (SQUserPointer*)&memberPtr, nullptr); // Get Member...
|
||||||
M member = *memberPtr;
|
M member = *memberPtr;
|
||||||
|
|
||||||
SQTRY()
|
SQTRY()
|
||||||
|
@ -1187,7 +1187,10 @@ template<> struct ArgPopHasFmt<const StackStrF&> { static constexpr bool value =
|
|||||||
/// Helper used to process formatted arguments when necessary.
|
/// Helper used to process formatted arguments when necessary.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template<bool> struct ArgPopFmt {
|
template<bool> struct ArgPopFmt {
|
||||||
static inline SQInteger Proc(StackStrF &, bool) {
|
template<class T> static inline SQInteger Proc(T &, bool) {
|
||||||
|
return SQ_OK;
|
||||||
|
}
|
||||||
|
template<class T> static inline SQInteger Get(T &) {
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user