1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2026-01-20 22:24:38 +01:00

Refactor the binding library even further to reduce code size and complexity.

This commit is contained in:
Sandu Liviu Catalin
2018-07-30 21:44:04 +03:00
parent ecca09d6ce
commit 0deb209e7b
4 changed files with 298 additions and 454 deletions

View File

@@ -1177,52 +1177,40 @@ inline void PushVarR(HSQUIRRELVM vm, T& value) {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Helper used to process formatted arguments when necessary.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class> struct ArgPopHasFmt { static constexpr bool value = false; };
template<> struct ArgPopHasFmt<StackStrF> { static constexpr bool value = true; };
template<> struct ArgPopHasFmt<const StackStrF> { static constexpr bool value = true; };
template<> struct ArgPopHasFmt<StackStrF&> { static constexpr bool value = true; };
template<> struct ArgPopHasFmt<const StackStrF&> { static constexpr bool value = true; };
template<class> struct ArgFwdHasFmt { static constexpr bool value = false; };
template<> struct ArgFwdHasFmt<StackStrF> { static constexpr bool value = true; };
template<> struct ArgFwdHasFmt<const StackStrF> { static constexpr bool value = true; };
template<> struct ArgFwdHasFmt<StackStrF&> { static constexpr bool value = true; };
template<> struct ArgFwdHasFmt<const StackStrF&> { static constexpr bool value = true; };
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Helper used to process formatted arguments when necessary.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<bool> struct ArgPopFmt {
template<class T> static inline SQInteger Proc(T &, bool) {
return SQ_OK;
}
template<class T> static inline SQInteger Get(T &) {
return SQ_OK;
}
template<bool> struct ArgFwdFmt {
template<class T> static inline SQInteger Proc(T &, bool) noexcept { return SQ_OK; }
template<class T> static inline SQInteger Get(T &) noexcept { return SQ_OK; }
};
template<> struct ArgPopFmt<true> {
static inline SQInteger Proc(StackStrF & s, bool dummy = false) {
return s.Proc(true, dummy);
}
static inline SQInteger Get(StackStrF & s) {
return s.mRes;
}
template<> struct ArgFwdFmt<true> {
static inline SQInteger Proc(StackStrF & s, bool dummy = false) noexcept { return s.Proc(true, dummy); }
static inline SQInteger Get(StackStrF & s) noexcept { return s.mRes; }
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Helper used to pop multiple variables from the stack and forward them to a functor.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class...> struct ArgPop;
template<class...> struct ArgFwd;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Special case for when nothing has to be popped.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<>
struct ArgPop<> {
struct ArgFwd<> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = false;
// Base constructor. Does nothing.
ArgPop(HSQUIRRELVM /*vm*/, SQInteger /*idx*/)
{ }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { (void)(dummy); return SQ_OK; }
SQInteger ProcRes() { return SQ_OK; }
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger /*idx*/, F f) {
f(vm);
}
};
@@ -1231,443 +1219,308 @@ struct ArgPop<> {
/// Incremental specialization for when types are actually specified.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class T1>
struct ArgPop<T1> {
struct ArgFwd<T1> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T1>::value;
// Implement ours
Var<T1> V1;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: V1(vm, idx)
{ }
// Retrieve the last popped variable
Var<T1> & Last() { return V1; }
const Var<T1> & Last() const { return V1; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V1.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V1.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T1>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
mRes = ArgFwdFmt<HASFMT>::Proc(a1.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value);
}
};
template<class T1,class T2>
struct ArgPop<T1,T2> : public ArgPop<T1> {
using Base = ArgPop<T1>;
struct ArgFwd<T1,T2> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T2>::value;
// Import from base classes
using Base::V1;
// Implement ours
Var<T2> V2;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1>(vm, idx)
, V2(vm, idx+1)
{ }
// Retrieve the last popped variable
Var<T2> & Last() { return V2; }
const Var<T2> & Last() const { return V2; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V2.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V2.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T2>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
mRes = ArgFwdFmt<HASFMT>::Proc(a2.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value);
}
};
template<class T1,class T2,class T3>
struct ArgPop<T1,T2,T3> : public ArgPop<T1,T2> {
using Base = ArgPop<T1,T2>;
struct ArgFwd<T1,T2,T3> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T3>::value;
// Import from base classes
using Base::V1;
using Base::V2;
// Implement ours
Var<T3> V3;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2>(vm, idx)
, V3(vm, idx+2)
{ }
// Retrieve the last popped variable
Var<T3> & Last() { return V3; }
const Var<T3> & Last() const { return V3; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V3.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V3.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T3>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
mRes = ArgFwdFmt<HASFMT>::Proc(a3.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value);
}
};
template<class T1,class T2,class T3,class T4>
struct ArgPop<T1,T2,T3,T4> : public ArgPop<T1,T2,T3> {
using Base = ArgPop<T1,T2,T3>;
struct ArgFwd<T1,T2,T3,T4> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T4>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
// Implement ours
Var<T4> V4;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3>(vm, idx)
, V4(vm, idx+3)
{ }
// Retrieve the last popped variable
Var<T4> & Last() { return V4; }
const Var<T4> & Last() const { return V4; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V4.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V4.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T4>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
mRes = ArgFwdFmt<HASFMT>::Proc(a4.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value);
}
};
template<class T1,class T2,class T3,class T4,class T5>
struct ArgPop<T1,T2,T3,T4,T5> : public ArgPop<T1,T2,T3,T4> {
using Base = ArgPop<T1,T2,T3,T4>;
struct ArgFwd<T1,T2,T3,T4,T5> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T5>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
// Implement ours
Var<T5> V5;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4>(vm, idx)
, V5(vm, idx+4)
{ }
// Retrieve the last popped variable
Var<T5> & Last() { return V5; }
const Var<T5> & Last() const { return V5; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V5.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V5.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T5>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
mRes = ArgFwdFmt<HASFMT>::Proc(a5.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6>
struct ArgPop<T1,T2,T3,T4,T5,T6> : public ArgPop<T1,T2,T3,T4,T5> {
using Base = ArgPop<T1,T2,T3,T4,T5>;
struct ArgFwd<T1,T2,T3,T4,T5,T6> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T6>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
// Implement ours
Var<T6> V6;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5>(vm, idx)
, V6(vm, idx+5)
{ }
// Retrieve the last popped variable
Var<T6> & Last() { return V6; }
const Var<T6> & Last() const { return V6; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V6.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V6.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T6>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
mRes = ArgFwdFmt<HASFMT>::Proc(a6.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7> : public ArgPop<T1,T2,T3,T4,T5,T6> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T7>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
// Implement ours
Var<T7> V7;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6>(vm, idx)
, V7(vm, idx+6)
{ }
// Retrieve the last popped variable
Var<T7> & Last() { return V7; }
const Var<T7> & Last() const { return V7; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V7.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V7.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T7>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
mRes = ArgFwdFmt<HASFMT>::Proc(a7.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8> : public ArgPop<T1,T2,T3,T4,T5,T6,T7> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T8>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
// Implement ours
Var<T8> V8;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7>(vm, idx)
, V8(vm, idx+7)
{ }
// Retrieve the last popped variable
Var<T8> & Last() { return V8; }
const Var<T8> & Last() const { return V8; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V8.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V8.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T8>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
mRes = ArgFwdFmt<HASFMT>::Proc(a8.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9> : public ArgPop<T1,T2,T3,T4,T5,T6,T7,T8> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7,T8>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8,T9> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T9>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
using Base::V8;
// Implement ours
Var<T9> V9;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7,T8>(vm, idx)
, V9(vm, idx+8)
{ }
// Retrieve the last popped variable
Var<T9> & Last() { return V9; }
const Var<T9> & Last() const { return V9; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V9.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V9.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T9>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
Var<T9> a9(vm, idx+8);
mRes = ArgFwdFmt<HASFMT>::Proc(a9.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value,a9.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> : public ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T10>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
using Base::V8;
using Base::V9;
// Implement ours
Var<T10> V10;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9>(vm, idx)
, V10(vm, idx+9)
{ }
// Retrieve the last popped variable
Var<T10> & Last() { return V10; }
const Var<T10> & Last() const { return V10; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V10.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V10.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T10>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
Var<T9> a9(vm, idx+8);
Var<T10> a10(vm, idx+9);
mRes = ArgFwdFmt<HASFMT>::Proc(a10.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value,a9.value,a10.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> : public ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T11>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
using Base::V8;
using Base::V9;
using Base::V10;
// Implement ours
Var<T11> V11;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(vm, idx)
, V11(vm, idx+10)
{ }
// Retrieve the last popped variable
Var<T11> & Last() { return V11; }
const Var<T11> & Last() const { return V11; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V11.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V11.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T11>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
Var<T9> a9(vm, idx+8);
Var<T10> a10(vm, idx+9);
Var<T11> a11(vm, idx+10);
mRes = ArgFwdFmt<HASFMT>::Proc(a11.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value,a9.value,a10.value,a11.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> : public ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T12>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
using Base::V8;
using Base::V9;
using Base::V10;
using Base::V11;
// Implement ours
Var<T12> V12;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(vm, idx)
, V12(vm, idx+11)
{ }
// Retrieve the last popped variable
Var<T12> & Last() { return V12; }
const Var<T12> & Last() const { return V12; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V12.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V12.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T12>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value,V12.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
Var<T9> a9(vm, idx+8);
Var<T10> a10(vm, idx+9);
Var<T11> a11(vm, idx+10);
Var<T12> a12(vm, idx+11);
mRes = ArgFwdFmt<HASFMT>::Proc(a12.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value,a9.value,a10.value,a11.value,a12.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> : public ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T13>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
using Base::V8;
using Base::V9;
using Base::V10;
using Base::V11;
using Base::V12;
// Implement ours
Var<T13> V13;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(vm, idx)
, V13(vm, idx+12)
{ }
// Retrieve the last popped variable
Var<T13> & Last() { return V13; }
const Var<T13> & Last() const { return V13; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V13.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V13.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T13>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value,V12.value,V13.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
Var<T9> a9(vm, idx+8);
Var<T10> a10(vm, idx+9);
Var<T11> a11(vm, idx+10);
Var<T12> a12(vm, idx+11);
Var<T13> a13(vm, idx+12);
mRes = ArgFwdFmt<HASFMT>::Proc(a13.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value,a9.value,a10.value,a11.value,a12.value,a13.value);
}
};
template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14>
struct ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> : public ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> {
using Base = ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>;
struct ArgFwd<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> {
// Used to tell whether the last template parameter is a StackStrF type
static constexpr bool HASFMT = ArgPopHasFmt<T14>::value;
// Import from base classes
using Base::V1;
using Base::V2;
using Base::V3;
using Base::V4;
using Base::V5;
using Base::V6;
using Base::V7;
using Base::V8;
using Base::V9;
using Base::V10;
using Base::V11;
using Base::V12;
using Base::V13;
// Implement ours
Var<T14> V14;
// Base constructor. Can also pass extra parameters to the last popped argument.
ArgPop(HSQUIRRELVM vm, SQInteger idx)
: ArgPop<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(vm, idx)
, V14(vm, idx+13)
{ }
// Retrieve the last popped variable
Var<T14> & Last() { return V14; }
const Var<T14> & Last() const { return V14; }
// Process formatted arguments if necessary
SQInteger Proc(bool dummy = false) { return ArgPopFmt<HASFMT>::Proc(V14.value, dummy); }
SQInteger ProcRes() { return ArgPopFmt<HASFMT>::Get(V14.value); }
static constexpr bool HASFMT = ArgFwdHasFmt<T14>::value;
// Where Squirrel result codes can be stored
SQInteger mRes;
// Forward the arguments to a function object
template<class F> void Call(HSQUIRRELVM vm, F f) {
f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value,V12.value,V13.value,V14.value);
template<class F> inline void Call(HSQUIRRELVM vm, SQInteger idx, F f) {
Var<T1> a1(vm, idx);
Var<T2> a2(vm, idx+1);
Var<T3> a3(vm, idx+2);
Var<T4> a4(vm, idx+3);
Var<T5> a5(vm, idx+4);
Var<T6> a6(vm, idx+5);
Var<T7> a7(vm, idx+6);
Var<T8> a8(vm, idx+7);
Var<T9> a9(vm, idx+8);
Var<T10> a10(vm, idx+9);
Var<T11> a11(vm, idx+10);
Var<T12> a12(vm, idx+11);
Var<T13> a13(vm, idx+12);
Var<T14> a14(vm, idx+13);
mRes = ArgFwdFmt<HASFMT>::Proc(a14.value, sq_gettop(vm) < idx);
if (SQ_SUCCEEDED(mRes))
f(vm,a1.value,a2.value,a3.value,a4.value,a5.value,a6.value,a7.value,a8.value,a9.value,a10.value,a11.value,a12.value,a13.value,a14.value);
}
};
}
#endif