From f300e7ff4ad6555b065c8d70843c9753d6d2b823 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Mon, 30 Jul 2018 00:58:27 +0300 Subject: [PATCH] Massive code reduction in the binding utility by using variadic templates. Extensive code refactoring surrounding the StackStrF helper to facilitate the new changes. Various other miscellaneous changes and code refactoring to facilitate the new changes. --- include/sqrat/sqratAllocator.h | 34 +- include/sqrat/sqratClass.h | 4 +- include/sqrat/sqratGlobalMethods.h | 317 +- include/sqrat/sqratMemberMethods.h | 8906 +------------------------- include/sqrat/sqratOverloadMethods.h | 322 +- include/sqrat/sqratTable.h | 2 +- include/sqrat/sqratTypes.h | 319 +- include/sqrat/sqratUtil.h | 195 +- shared/Base/Utility.inl | 4 +- source/Base/Shared.cpp | 16 +- source/Core/Funcs.inc | 4 +- source/Entity/Player.cpp | 32 +- source/Library/Crypt/Hash.cpp | 16 +- source/Library/Numeric/Math.cpp | 8 +- source/Library/String.cpp | 12 +- source/Library/System.cpp | 4 +- source/Library/Utils.cpp | 4 +- source/Logger.cpp | 4 +- source/Misc/Broadcast.cpp | 24 +- source/Misc/Tasks.hpp | 4 +- 20 files changed, 724 insertions(+), 9507 deletions(-) diff --git a/include/sqrat/sqratAllocator.h b/include/sqrat/sqratAllocator.h index ac333cb3..7287352a 100644 --- a/include/sqrat/sqratAllocator.h +++ b/include/sqrat/sqratAllocator.h @@ -352,9 +352,9 @@ public: static SQInteger iFmtNew(HSQUIRRELVM vm) { SQTRY() - const StackStrF fmt(vm, 2, true); + StackStrF fmt(vm, 2); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -375,9 +375,9 @@ public: return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); } - const StackStrF fmt(vm, 3, true); + StackStrF fmt(vm, 3); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -425,9 +425,9 @@ public: return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); } - const StackStrF fmt(vm, 5, true); + StackStrF fmt(vm, 5); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -453,9 +453,9 @@ public: return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); } - const StackStrF fmt(vm, 6, true); + StackStrF fmt(vm, 6); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -515,9 +515,9 @@ public: return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); } - const StackStrF fmt(vm, 8, true); + StackStrF fmt(vm, 8); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -549,9 +549,9 @@ public: return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); } - const StackStrF fmt(vm, 9, true); + StackStrF fmt(vm, 9); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -843,7 +843,7 @@ public: std::pair::type> >* instance = reinterpret_cast::type> >*>(ptr); instance->second->erase(instance->first); // Only delete our pair instance and leave the actual instance untouched - //delete instance->first; + //delete instance->first; delete instance; return 0; } @@ -1220,9 +1220,9 @@ public: static SQInteger iFmtNew(HSQUIRRELVM vm) { SQTRY() - const StackStrF fmt(vm, 2, true); + StackStrF fmt(vm, 2); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } @@ -1243,9 +1243,9 @@ public: return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); } - const StackStrF fmt(vm, 3, true); + StackStrF fmt(vm, 3); // Validate the format - if (SQ_FAILED(fmt.mRes)) { + if (SQ_FAILED(fmt.Proc(true))) { return fmt.mRes; } diff --git a/include/sqrat/sqratClass.h b/include/sqrat/sqratClass.h index c3d7ae4b..5737154a 100644 --- a/include/sqrat/sqratClass.h +++ b/include/sqrat/sqratClass.h @@ -407,7 +407,7 @@ public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template Class& FmtFunc(const SQChar* name, F method) { - BindFunc(name, &method, sizeof(method), SqMemberFuncFmt(method)); + BindFunc(name, &method, sizeof(method), SqMemberFunc(method)); return *this; } @@ -496,7 +496,7 @@ public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template Class& StaticFmtFunc(const SQChar* name, F method) { - BindFunc(name, &method, sizeof(method), SqGlobalFmtFunc(method)); + BindFunc(name, &method, sizeof(method), SqGlobalFunc(method)); return *this; } diff --git a/include/sqrat/sqratGlobalMethods.h b/include/sqrat/sqratGlobalMethods.h index ea6812af..d2849013 100644 --- a/include/sqrat/sqratGlobalMethods.h +++ b/include/sqrat/sqratGlobalMethods.h @@ -41,38 +41,98 @@ namespace Sqrat { /// @cond DEV +// +// Squirrel Global Functions +// +template struct SqGlobalProxy { + template static SQInteger Run(HSQUIRRELVM vm, SQInteger idx) { + ArgPop a(vm, idx); + if (SQ_FAILED(a.Proc())) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef R(*M)(A...); + M* method; + sq_getuserdata(vm, -1, reinterpret_cast(&method), nullptr); + R ret = (*method)(a...); + PushVar(vm, ret); + }); + return 1; + } +}; + +// +// reference return specialization +// + +template struct SqGlobalProxy { + template static SQInteger Run(HSQUIRRELVM vm, SQInteger idx) { + ArgPop a(vm, idx); + if (SQ_FAILED(a.Proc())) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef R&(*M)(A...); + M* method; + sq_getuserdata(vm, -1, reinterpret_cast(&method), nullptr); + R& ret = (*method)(a...); + PushVarR(vm, ret); + }); + return 1; + } +}; + +// +// void return specialization +// + +template <> struct SqGlobalProxy { + template static SQInteger Run(HSQUIRRELVM vm, SQInteger idx) { + ArgPop a(vm, idx); + if (SQ_FAILED(a.Proc())) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef void(*M)(A...); + M* method; + sq_getuserdata(vm, -1, reinterpret_cast(&method), nullptr); + (*method)(a...); + }); + return 0; + } +}; + +template struct SqGlobalParamCheck { + static inline bool Invalid(SQInteger top, SQInteger count) { + return top != count; + } +}; +template<> struct SqGlobalParamCheck { + static inline bool Invalid(SQInteger top, SQInteger count) { + return top < count; + } +}; + // // Squirrel Global Functions // template struct SqGlobal { // Function proxy template static SQFUNCTION GetProxy() noexcept { - typedef R(*M)(A...); - return +[](HSQUIRRELVM vm) noexcept -> SQInteger { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { #if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != static_cast(startIdx + sizeof...(A))) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } #endif - M* method; - sq_getuserdata(vm, -1, reinterpret_cast(&method), NULL); - - SQTRY() - ArgPop a(vm, startIdx); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = a.template Eval(*method); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - - return 1; - }; + try { + return SqGlobalProxy::Run(vm, startIdx); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; } }; @@ -83,32 +143,20 @@ template struct SqGlobal { template struct SqGlobal { // Function proxy template static SQFUNCTION GetProxy() noexcept { - typedef R&(*M)(A...); - return +[](HSQUIRRELVM vm) noexcept -> SQInteger { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { #if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != static_cast(startIdx + sizeof...(A))) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } + if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } #endif - M* method; - sq_getuserdata(vm, -1, reinterpret_cast(&method), NULL); - - SQTRY() - ArgPop a(vm, startIdx); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = a.template Eval(*method); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - - return 1; - }; + try { + return SqGlobalProxy::Run(vm, startIdx); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; } }; @@ -119,31 +167,20 @@ template struct SqGlobal { template <> struct SqGlobal { // Function proxy template static SQFUNCTION GetProxy() noexcept { - typedef void(*M)(A...); - return +[](HSQUIRRELVM vm) noexcept -> SQInteger { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { #if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != static_cast(startIdx + sizeof...(A))) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } + if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), startIdx + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } #endif - M* method; - sq_getuserdata(vm, -1, reinterpret_cast(&method), NULL); - - SQTRY() - ArgPop a(vm, startIdx); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - a.template Exec(*method); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - - return 0; - }; + try { + return SqGlobalProxy::Run(vm, startIdx); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; } }; @@ -167,144 +204,6 @@ template SQFUNCTION SqMemberGlobalFunc(R& (* /*meth return SqGlobal::template GetProxy<1, false, T, A...>(); } -// -// Squirrel Global Functions -// -template struct SqGlobalFmt { - // Function proxy - template static SQFUNCTION GetProxy() noexcept { - typedef R(*M)(A...); - return +[](HSQUIRRELVM vm) noexcept -> SQInteger { -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < static_cast(startIdx + sizeof...(A))) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - M* method; - sq_getuserdata(vm, -1, reinterpret_cast(&method), NULL); - - SQTRY() - ArgPop a(vm, startIdx, true); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - // Validate the format - if (SQ_FAILED(a.Last().value.mRes)) { - return a.Last().value.mRes; - } - R ret = a.template Eval(*method); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - - return 1; - }; - } -}; - -// -// reference return specialization -// - -template struct SqGlobalFmt { - // Function proxy - template static SQFUNCTION GetProxy() noexcept { - typedef R&(*M)(A...); - return +[](HSQUIRRELVM vm) noexcept -> SQInteger { -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < static_cast(startIdx + sizeof...(A))) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - M* method; - sq_getuserdata(vm, -1, reinterpret_cast(&method), NULL); - - SQTRY() - ArgPop a(vm, startIdx, true); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - // Validate the format - if (SQ_FAILED(a.Last().value.mRes)) { - return a.Last().value.mRes; - } - R& ret = a.template Eval(*method); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - - return 1; - }; - } -}; - -// -// void return specialization -// - -template <> struct SqGlobalFmt { - // Function proxy - template static SQFUNCTION GetProxy() noexcept { - typedef void(*M)(A...); - return +[](HSQUIRRELVM vm) noexcept -> SQInteger { -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < static_cast(startIdx + sizeof...(A))) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - M* method; - sq_getuserdata(vm, -1, reinterpret_cast(&method), NULL); - - SQTRY() - ArgPop a(vm, startIdx, true); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - // Validate the format - if (SQ_FAILED(a.Last().value.mRes)) { - return a.Last().value.mRes; - } - a.template Exec(*method); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - - return 0; - }; - } -}; - -// Formatted Global Function Resolver -template SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A...)) noexcept { - return SqGlobalFmt::template GetProxy<2, false, A...>(); -} - -// Formatted Global Function Resolver -template SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A...)) noexcept { - return SqGlobalFmt::template GetProxy<2, false, A...>(); -} - -// Formatted Member Global Function Resolver -template SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(T, A...)) noexcept { - return SqGlobalFmt::template GetProxy<1, false, T, A...>(); -} - -// Formatted Member Global Function Resolver -template SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(T, A...)) noexcept { - return SqGlobalFmt::template GetProxy<1, false, T, A...>(); -} - /// @endcond } diff --git a/include/sqrat/sqratMemberMethods.h b/include/sqrat/sqratMemberMethods.h index 89e8e0b7..a842ca0d 100644 --- a/include/sqrat/sqratMemberMethods.h +++ b/include/sqrat/sqratMemberMethods.h @@ -42,6437 +42,39 @@ namespace Sqrat { /// @cond DEV // -// Squirrel Global Functions +// Squirrel Member Functions // - -template -class SqMember { -public: - - // Arg Count 0 - template - static SQInteger Func0(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - - typedef R (C::*M)(); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - R ret = (ptr->*method)(); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func0C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)() const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - R ret = (ptr->*method)(); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 1 - template - static SQInteger Func1(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func1C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 2 - template - static SQInteger Func2(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func2C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 3 - template - static SQInteger Func3(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func3C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 4 - template - static SQInteger Func4(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func4C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 5 - template - static SQInteger Func5(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func5C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 6 - template - static SQInteger Func6(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func6C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 7 - template - static SQInteger Func7(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func7C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 8 - template - static SQInteger Func8(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func8C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 9 - template - static SQInteger Func9(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 11) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func9C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 11) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - - // Arg Count 10 - template - static SQInteger Func10(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 12) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func10C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 12) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - - // Arg Count 11 - template - static SQInteger Func11(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 13) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func11C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 13) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - - // Arg Count 12 - template - static SQInteger Func12(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 14) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value, - a12.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func12C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 14) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value, - a12.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 13 - template - static SQInteger Func13(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 15) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func13C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 15) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 14 - template - static SQInteger Func14(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 16) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - Var a14(vm, 15); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func14C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 16) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - Var a14(vm, 15); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } -}; - - -// -// reference return specialization -// - -template -class SqMember { -public: - - // Arg Count 0 - template - static SQInteger Func0(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - R& ret = (ptr->*method)(); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func0C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)() const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - R& ret = (ptr->*method)(); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 1 - template - static SQInteger Func1(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func1C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 2 - template - static SQInteger Func2(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func2C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 3 - template - static SQInteger Func3(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func3C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 4 - template - static SQInteger Func4(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func4C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 5 - template - static SQInteger Func5(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func5C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 6 - template - static SQInteger Func6(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func6C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 7 - template - static SQInteger Func7(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func7C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 8 - template - static SQInteger Func8(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func8C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 9 - template - static SQInteger Func9(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 11) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func9C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 11) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - - // Arg Count 10 - template - static SQInteger Func10(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 12) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func10C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 12) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - - // Arg Count 11 - template - static SQInteger Func11(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 13) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func11C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 13) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - - // Arg Count 12 - template - static SQInteger Func12(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 14) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value, - a12.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func12C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 14) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value, - a12.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 13 - template - static SQInteger Func13(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 15) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R&(C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func13C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 15) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 14 - template - static SQInteger Func14(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 16) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - Var a14(vm, 15); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func14C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 16) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - Var a14(vm, 15); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - R& ret = (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - -}; - - -// -// void return specialization -// - -template -class SqMember { -public: - - // Arg Count 0 - template - static SQInteger Func0(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - (ptr->*method)(); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func0C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)() const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - (ptr->*method)(); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 1 - template - static SQInteger Func1(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func1C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 2 - template - static SQInteger Func2(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func2C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 3 - template - static SQInteger Func3(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func3C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 4 - template - static SQInteger Func4(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func4C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 5 - template - static SQInteger Func5(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func5C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 6 - template - static SQInteger Func6(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func6C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 7 - template - static SQInteger Func7(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func7C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 8 - template - static SQInteger Func8(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func8C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 9 - template - static SQInteger Func9(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 11) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func9C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 11) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 10 - template - static SQInteger Func10(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 12) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func10C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 12) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 11 - template - static SQInteger Func11(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 13) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func11C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 13) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 12 - template - static SQInteger Func12(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 14) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value, - a12.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func12C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 14) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - a9.value, - a10.value, - a11.value, - a12.value - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 13 - template - static SQInteger Func13(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 15) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func13C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 15) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 14 - template - static SQInteger Func14(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 16) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - Var a14(vm, 15); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func14C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) != 16) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - Var a9(vm, 10); - Var a10(vm, 11); - Var a11(vm, 12); - Var a12(vm, 13); - Var a13(vm, 14); - Var a14(vm, 15); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - (ptr->*method)( - 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 - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - -}; - - -// -// Member Function Resolvers -// - -// Arg Count 0 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)()) { - return &SqMember::template Func0; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)() const) { - return &SqMember::template Func0C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)()) { - return &SqMember::template Func0; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)() const) { - return &SqMember::template Func0C; -} - -// Arg Count 1 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1)) { - return &SqMember::template Func1; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1) const) { - return &SqMember::template Func1C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1)) { - return &SqMember::template Func1; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1) const) { - return &SqMember::template Func1C; -} - -// Arg Count 2 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2)) { - return &SqMember::template Func2; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2) const) { - return &SqMember::template Func2C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2)) { - return &SqMember::template Func2; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2) const) { - return &SqMember::template Func2C; -} - -// Arg Count 3 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3)) { - return &SqMember::template Func3; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3) const) { - return &SqMember::template Func3C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3)) { - return &SqMember::template Func3; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3) const) { - return &SqMember::template Func3C; -} - -// Arg Count 4 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4)) { - return &SqMember::template Func4; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4) const) { - return &SqMember::template Func4C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4)) { - return &SqMember::template Func4; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4) const) { - return &SqMember::template Func4C; -} - -// Arg Count 5 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5)) { - return &SqMember::template Func5; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5) const) { - return &SqMember::template Func5C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5)) { - return &SqMember::template Func5; -} - -template -inline SQFUNCTION SqMemberFunc(R&(C::* /*method*/)(A1, A2, A3, A4, A5) const) { - return &SqMember::template Func5C; -} - -// Arg Count 6 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6)) { - return &SqMember::template Func6; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6) const) { - return &SqMember::template Func6C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6)) { - return &SqMember::template Func6; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6) const) { - return &SqMember::template Func6C; -} - -// Arg Count 7 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7)) { - return &SqMember::template Func7; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7) const) { - return &SqMember::template Func7C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7)) { - return &SqMember::template Func7; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7) const) { - return &SqMember::template Func7C; -} - -// Arg Count 8 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8)) { - return &SqMember::template Func8; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8) const) { - return &SqMember::template Func8C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8)) { - return &SqMember::template Func8; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8) const) { - return &SqMember::template Func8C; -} - -// Arg Count 9 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9)) { - return &SqMember::template Func9; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const) { - return &SqMember::template Func9C; -} - -template -inline SQFUNCTION SqMemberFunc(R&(C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9)) { - return &SqMember::template Func9; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const) { - return &SqMember::template Func9C; -} - -// Arg Count 10 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)) { - return &SqMember::template Func10; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const) { - return &SqMember::template Func10C; -} -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)) { - return &SqMember::template Func10; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const) { - return &SqMember::template Func10C; -} - -// Arg Count 11 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)) { - return &SqMember::template Func11; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const) { - return &SqMember::template Func11C; -} -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)) { - return &SqMember::template Func11; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const) { - return &SqMember::template Func11C; -} - -// Arg Count 12 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)) { - return &SqMember::template Func12; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const) { - return &SqMember::template Func12C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)) { - return &SqMember::template Func12; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const) { - return &SqMember::template Func12C; -} - -// Arg Count 13 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)) { - return &SqMember::template Func13; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const) { - return &SqMember::template Func13C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)) { - return &SqMember::template Func13; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const) { - return &SqMember::template Func13C; -} - -// Arg Count 14 -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)) { - return &SqMember::template Func14; -} - -template -inline SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const) { - return &SqMember::template Func14C; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)) { - return &SqMember::template Func14; -} - -template -inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const) { - return &SqMember::template Func14C; -} - -template -class SqMemberFmt { -public: - - // Arg Count 0 - template - static SQInteger Func0(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - - typedef R (C::*M)(const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - - const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)(fmt); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func0C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - - const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)(fmt); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 1 - template - static SQInteger Func1(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 3, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func1C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 3, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 2 - template - static SQInteger Func2(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 4, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func2C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 4, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 3 - template - static SQInteger Func3(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 5, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func3C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 5, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 4 - template - static SQInteger Func4(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 6, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func4C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 6, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 5 - template - static SQInteger Func5(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 7, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func5C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 7, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 6 - template - static SQInteger Func6(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 8, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func6C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 8, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 7 - template - static SQInteger Func7(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 9, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func7C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 9, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 8 - template - static SQInteger Func8(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 10, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func8C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 10, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVar(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } +template struct SqMemberProxy { + template static SQInteger Run(HSQUIRRELVM vm) noexcept { + ArgPop a(vm, 2); + if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef R(C::*M)(A...); + C* inst = Var(vm, 1).value; + M* methodPtr; + sq_getuserdata(vm, -1, reinterpret_cast(&methodPtr), NULL); + M method = *methodPtr; + R ret = (inst->*method)(a...); + PushVar(vm, ret); + }); + return 1; + } + template static SQInteger RunC(HSQUIRRELVM vm) noexcept { + ArgPop a(vm, 2); + if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef R(C::*M)(A...) const; + C* inst = Var(vm, 1).value; + M* methodPtr; + sq_getuserdata(vm, -1, reinterpret_cast(&methodPtr), NULL); + M method = *methodPtr; + R ret = (inst->*method)(a...); + PushVar(vm, ret); + }); return 1; } }; @@ -6481,1050 +83,37 @@ public: // reference return specialization // -template -class SqMemberFmt { -public: - - // Arg Count 0 - template - static SQInteger Func0(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - - const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)(fmt); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); +template struct SqMemberProxy { + template static SQInteger Run(HSQUIRRELVM vm) noexcept { + ArgPop a(vm, 2); + if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) { + return a.ProcRes(); } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef R&(C::*M)(A...); + C* inst = Var(vm, 1).value; + M* methodPtr; + sq_getuserdata(vm, -1, reinterpret_cast(&methodPtr), NULL); + M method = *methodPtr; + R& ret = (inst->*method)(a...); + PushVarR(vm, ret); + }); return 1; } - - template - static SQInteger Func0C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - - const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)(fmt); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 1 - template - static SQInteger Func1(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 3, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func1C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 3, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 2 - template - static SQInteger Func2(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 4, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func2C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 4, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 3 - template - static SQInteger Func3(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 5, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func3C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 5, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 4 - template - static SQInteger Func4(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 6, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func4C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 6, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 5 - template - static SQInteger Func5(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 7, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func5C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 7, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 6 - template - static SQInteger Func6(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 8, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func6C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 8, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 7 - template - static SQInteger Func7(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 9, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func7C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 9, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - // Arg Count 8 - template - static SQInteger Func8(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 10, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 1; - } - - template - static SQInteger Func8C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef R& (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 10, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - R& ret = (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - PushVarR(vm, ret); - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } + template static SQInteger RunC(HSQUIRRELVM vm) noexcept { + ArgPop a(vm, 2); + if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef R&(C::*M)(A...) const; + C* inst = Var(vm, 1).value; + M* methodPtr; + sq_getuserdata(vm, -1, reinterpret_cast(&methodPtr), NULL); + M method = *methodPtr; + R& ret = (inst->*method)(a...); + PushVarR(vm, ret); + }); return 1; } }; @@ -7533,1230 +122,193 @@ public: // void return specialization // -template -class SqMemberFmt { -public: - - // Arg Count 0 - template - static SQInteger Func0(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - - const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)(fmt); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); +template struct SqMemberProxy { + template static SQInteger Run(HSQUIRRELVM vm) noexcept { + ArgPop a(vm, 2); + if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) { + return a.ProcRes(); } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef void(C::*M)(A...); + C* inst = Var(vm, 1).value; + M* methodPtr; + sq_getuserdata(vm, -1, reinterpret_cast(&methodPtr), NULL); + M method = *methodPtr; + (inst->*method)(a...); + }); return 0; } - - template - static SQInteger Func0C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 2) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - - const StackStrF fmt(vm, 2, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)(fmt); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 1 - template - static SQInteger Func1(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 3, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func1C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 3) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 3, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 2 - template - static SQInteger Func2(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 4, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func2C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 4) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 4, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 3 - template - static SQInteger Func3(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 5, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func3C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 5) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 5, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 4 - template - static SQInteger Func4(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 6, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func4C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 6) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 6, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 5 - template - static SQInteger Func5(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 7, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func5C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 7) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 7, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 6 - template - static SQInteger Func6(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 8, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func6C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 8) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 8, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 7 - template - static SQInteger Func7(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 9, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func7C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 9) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 9, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - // Arg Count 8 - template - static SQInteger Func8(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &); - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 10, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } - return 0; - } - - template - static SQInteger Func8C(HSQUIRRELVM vm) { - -#if !defined (SCRAT_NO_ERROR_CHECKING) - if (!SQRAT_CONST_CONDITION(overloaded) && sq_gettop(vm) < 10) { - return sq_throwerror(vm, _SC("wrong number of parameters")); - } -#endif - typedef void (C::*M)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &) const; - M* methodPtr; - sq_getuserdata(vm, -1, (SQUserPointer*)&methodPtr, NULL); - M method = *methodPtr; - - C* ptr; - SQTRY() - ptr = Var(vm, 1).value; - SQCATCH_NOEXCEPT(vm) { - SQCLEAR(vm); // clear the previous error - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - assert(0); // may fail because C is not a type bound in the VM - return sq_throwerror(vm, SQWHAT(vm)); - } - - SQTRY() - Var a1(vm, 2); - Var a2(vm, 3); - Var a3(vm, 4); - Var a4(vm, 5); - Var a5(vm, 6); - Var a6(vm, 7); - Var a7(vm, 8); - Var a8(vm, 9); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - - const StackStrF fmt(vm, 10, true); - // Validate the format - if (SQ_FAILED(fmt.mRes)) { - return fmt.mRes; - } - - (ptr->*method)( - a1.value, - a2.value, - a3.value, - a4.value, - a5.value, - a6.value, - a7.value, - a8.value, - fmt - ); - SQCATCH_NOEXCEPT(vm) { - return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); - } - SQCATCH(vm) { - return sq_throwerror(vm, SQWHAT(vm)); - } + template static SQInteger RunC(HSQUIRRELVM vm) noexcept { + ArgPop a(vm, 2); + if (SQ_FAILED(a.Proc(sizeof...(A) == 0 && sq_gettop(vm) == 2))) { + return a.ProcRes(); + } + a.Call(vm, [](HSQUIRRELVM vm, A... a) { + typedef void(C::*M)(A...) const; + C* inst = Var(vm, 1).value; + M* methodPtr; + sq_getuserdata(vm, -1, reinterpret_cast(&methodPtr), NULL); + M method = *methodPtr; + (inst->*method)(a...); + }); return 0; } }; +template struct SqMemberParamCheck { + static inline bool Invalid(SQInteger top, SQInteger count) { + return top != count; + } +}; +template<> struct SqMemberParamCheck { + static inline bool Invalid(SQInteger top, SQInteger count) { + return top < count; + } +}; + // -// Formatted Member Function Resolvers +// Squirrel Member Functions +// +template struct SqMember { + // Function proxy + template static SQFUNCTION GetProxy() noexcept { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { +#if !defined (SCRAT_NO_ERROR_CHECKING) + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + try { + return SqMemberProxy::Run(vm); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; + } + // Function proxy + template static SQFUNCTION GetProxyC() noexcept { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { +#if !defined (SCRAT_NO_ERROR_CHECKING) + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + try { + return SqMemberProxy::RunC(vm); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; + } +}; + +// +// reference return specialization // -// Arg Count 0 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(const StackStrF &)) { - return &SqMemberFmt::template Func0; +template struct SqMember { + // Function proxy + template static SQFUNCTION GetProxy() noexcept { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { +#if !defined (SCRAT_NO_ERROR_CHECKING) + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + try { + return SqMemberProxy::Run(vm); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; + } + // Function proxy + template static SQFUNCTION GetProxyC() noexcept { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { +#if !defined (SCRAT_NO_ERROR_CHECKING) + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + try { + return SqMemberProxy::RunC(vm); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; + } +}; + + +// +// void return specialization +// + +template struct SqMember { + // Function proxy + template static SQFUNCTION GetProxy() noexcept { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { +#if !defined (SCRAT_NO_ERROR_CHECKING) + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + try { + return SqMemberProxy::Run(vm); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; + } + // Function proxy + template static SQFUNCTION GetProxyC() noexcept { + return +[](HSQUIRRELVM vm) noexcept -> SQInteger { +#if !defined (SCRAT_NO_ERROR_CHECKING) + if (!SQRAT_CONST_CONDITION(overloaded) && + SqGlobalParamCheck< ArgPop::HASFMT >::Invalid(sq_gettop(vm), 2 + sizeof...(A))) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + try { + return SqMemberProxy::RunC(vm); + } catch (const Exception& e) { + return sq_throwerror(vm, e.what()); + } + SQ_UNREACHABLE + }; + } +}; + +// Member Function Resolver +template SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A...)) noexcept { + return SqMember::template GetProxy(); } -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(const StackStrF &) const) { - return &SqMemberFmt::template Func0C; +// Member Function Resolver +template SQFUNCTION SqMemberFunc(R (C::* /*method*/)(A...) const) noexcept { + return SqMember::template GetProxyC(); } -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(const StackStrF &)) { - return &SqMemberFmt::template Func0; +// Member Function Resolver +template SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A...)) noexcept { + return SqMember::template GetProxy(); } -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(const StackStrF &) const) { - return &SqMemberFmt::template Func0C; +// Member Function Resolver +template SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A...) const) noexcept { + return SqMember::template GetProxyC(); } -// Arg Count 1 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, const StackStrF &)) { - return &SqMemberFmt::template Func1; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, const StackStrF &) const) { - return &SqMemberFmt::template Func1C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, const StackStrF &)) { - return &SqMemberFmt::template Func1; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, const StackStrF &) const) { - return &SqMemberFmt::template Func1C; -} - -// Arg Count 2 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, const StackStrF &)) { - return &SqMemberFmt::template Func2; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, const StackStrF &) const) { - return &SqMemberFmt::template Func2C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, const StackStrF &)) { - return &SqMemberFmt::template Func2; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, const StackStrF &) const) { - return &SqMemberFmt::template Func2C; -} - -// Arg Count 3 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, const StackStrF &)) { - return &SqMemberFmt::template Func3; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, const StackStrF &) const) { - return &SqMemberFmt::template Func3C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, const StackStrF &)) { - return &SqMemberFmt::template Func3; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, const StackStrF &) const) { - return &SqMemberFmt::template Func3C; -} - -// Arg Count 4 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, const StackStrF &)) { - return &SqMemberFmt::template Func4; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, const StackStrF &) const) { - return &SqMemberFmt::template Func4C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, const StackStrF &)) { - return &SqMemberFmt::template Func4; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, const StackStrF &) const) { - return &SqMemberFmt::template Func4C; -} - -// Arg Count 5 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, const StackStrF &)) { - return &SqMemberFmt::template Func5; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, const StackStrF &) const) { - return &SqMemberFmt::template Func5C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, const StackStrF &)) { - return &SqMemberFmt::template Func5; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R&(C::* /*method*/)(A1, A2, A3, A4, A5, const StackStrF &) const) { - return &SqMemberFmt::template Func5C; -} - -// Arg Count 6 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, const StackStrF &)) { - return &SqMemberFmt::template Func6; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, const StackStrF &) const) { - return &SqMemberFmt::template Func6C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, const StackStrF &)) { - return &SqMemberFmt::template Func6; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, const StackStrF &) const) { - return &SqMemberFmt::template Func6C; -} - -// Arg Count 7 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &)) { - return &SqMemberFmt::template Func7; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &) const) { - return &SqMemberFmt::template Func7C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &)) { - return &SqMemberFmt::template Func7; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, const StackStrF &) const) { - return &SqMemberFmt::template Func7C; -} - -// Arg Count 8 -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &)) { - return &SqMemberFmt::template Func8; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &) const) { - return &SqMemberFmt::template Func8C; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &)) { - return &SqMemberFmt::template Func8; -} - -template -inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, const StackStrF &) const) { - return &SqMemberFmt::template Func8C; -} - - // // Variable Get // diff --git a/include/sqrat/sqratOverloadMethods.h b/include/sqrat/sqratOverloadMethods.h index 182facb7..7809a869 100644 --- a/include/sqrat/sqratOverloadMethods.h +++ b/include/sqrat/sqratOverloadMethods.h @@ -171,324 +171,26 @@ template SQFUNCTION SqMemberGlobalOverloadedFunc(R& return SqGlobal::template GetProxy<1, true, T, A...>(); } -// -// Member Overloaded Function Resolvers -// - -// Arg Count 0 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)()) { - return &SqMember::template Func0; +// Member Overloaded Function Resolver +template SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A...)) noexcept { + return SqMember::template GetProxy(); } -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)() const) { - return &SqMember::template Func0C; +// Member Overloaded Function Resolver +template SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A...) const) noexcept { + return SqMember::template GetProxyC(); } -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)()) { - return &SqMember::template Func0; -} -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)() const) { - return &SqMember::template Func0C; +// Member Overloaded Function Resolver +template SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A...)) noexcept { + return SqMember::template GetProxy(); } -// Arg Count 1 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1)) { - return &SqMember::template Func1; +// Member Overloaded Function Resolver +template SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A...) const) noexcept { + return SqMember::template GetProxyC(); } -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1) const) { - return &SqMember::template Func1C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1)) { - return &SqMember::template Func1; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1) const) { - return &SqMember::template Func1C; -} - -// Arg Count 2 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2)) { - return &SqMember::template Func2; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2) const) { - return &SqMember::template Func2C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2)) { - return &SqMember::template Func2; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2) const) { - return &SqMember::template Func2C; -} - -// Arg Count 3 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3)) { - return &SqMember::template Func3; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3) const) { - return &SqMember::template Func3C; -} -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3)) { - return &SqMember::template Func3; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3) const) { - return &SqMember::template Func3C; -} - -// Arg Count 4 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4)) { - return &SqMember::template Func4; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4) const) { - return &SqMember::template Func4C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4)) { - return &SqMember::template Func4; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4) const) { - return &SqMember::template Func4C; -} - -// Arg Count 5 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5)) { - return &SqMember::template Func5; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5) const) { - return &SqMember::template Func5C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5)) { - return &SqMember::template Func5; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5) const) { - return &SqMember::template Func5C; -} - -// Arg Count 6 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6)) { - return &SqMember::template Func6; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6) const) { - return &SqMember::template Func6C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6)) { - return &SqMember::template Func6; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6) const) { - return &SqMember::template Func6C; -} - -// Arg Count 7 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7)) { - return &SqMember::template Func7; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7) const) { - return &SqMember::template Func7C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7)) { - return &SqMember::template Func7; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7) const) { - return &SqMember::template Func7C; -} - -// Arg Count 8 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8)) { - return &SqMember::template Func8; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8) const) { - return &SqMember::template Func8C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8)) { - return &SqMember::template Func8; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8) const) { - return &SqMember::template Func8C; -} - -// Arg Count 9 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9)) { - return &SqMember::template Func9; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const) { - return &SqMember::template Func9C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9)) { - return &SqMember::template Func9; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const) { - return &SqMember::template Func9C; -} - -// Arg Count 10 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)) { - return &SqMember::template Func10; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const) { - return &SqMember::template Func10C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)) { - return &SqMember::template Func10; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) const) { - return &SqMember::template Func10C; -} - -// Arg Count 11 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)) { - return &SqMember::template Func11; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const) { - return &SqMember::template Func11C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)) { - return &SqMember::template Func11; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) const) { - return &SqMember::template Func11C; -} - -// Arg Count 12 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)) { - return &SqMember::template Func12; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const) { - return &SqMember::template Func12C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)) { - return &SqMember::template Func12; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) const) { - return &SqMember::template Func12C; -} - -// Arg Count 13 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)) { - return &SqMember::template Func13; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const) { - return &SqMember::template Func13C; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)) { - return &SqMember::template Func13; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) const) { - return &SqMember::template Func13C; -} - - -// Arg Count 14 -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)) { - return &SqMember::template Func14; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const) { - return &SqMember::template Func14C; -} -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)) { - return &SqMember::template Func14; -} - -template -inline SQFUNCTION SqMemberOverloadedFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) const) { - return &SqMember::template Func14C; -} - - // // Overload handler resolver // diff --git a/include/sqrat/sqratTable.h b/include/sqrat/sqratTable.h index 65e58b50..1307fe7c 100644 --- a/include/sqrat/sqratTable.h +++ b/include/sqrat/sqratTable.h @@ -281,7 +281,7 @@ public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template TableBase& FmtFunc(const SQChar* name, F method) { - BindFunc(name, &method, sizeof(method), SqGlobalFmtFunc(method)); + BindFunc(name, &method, sizeof(method), SqGlobalFunc(method)); return *this; } diff --git a/include/sqrat/sqratTypes.h b/include/sqrat/sqratTypes.h index 7a8ed520..d0918659 100644 --- a/include/sqrat/sqratTypes.h +++ b/include/sqrat/sqratTypes.h @@ -1017,7 +1017,7 @@ struct Var { /// This function MUST have its Error handled if it occurred. /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - Var(HSQUIRRELVM vm, SQInteger idx, bool fmt = false) : value(vm, idx, fmt) { + Var(HSQUIRRELVM vm, SQInteger idx) : value(vm, idx) { } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1040,13 +1040,13 @@ struct Var { /// Used to get and push StackStrF instances to and from the stack as references (StackStrF should not be a reference) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template<> -struct Var : Var {Var(HSQUIRRELVM vm, SQInteger idx, bool fmt = false) : Var(vm, idx, fmt) {}}; +struct Var : Var {Var(HSQUIRRELVM vm, SQInteger idx) : Var(vm, idx) {}}; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Used to get and push StackStrF instances to and from the stack as references (StackStrF should not be a reference) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template<> -struct Var : Var {Var(HSQUIRRELVM vm, SQInteger idx, bool fmt = false) : Var(vm, idx, fmt) {}}; +struct Var : Var {Var(HSQUIRRELVM vm, SQInteger idx) : Var(vm, idx) {}}; // Non-referencable type definitions template struct is_referencable {static const bool value = true;}; @@ -1167,13 +1167,39 @@ struct PushVarR_helper { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template inline void PushVarR(HSQUIRRELVM vm, T& value) { - if (!is_pointer::value && is_referencable::type>::value) { + if (!std::is_pointer::value && is_referencable::type>::value) { Var::push(vm, value); } else { - PushVarR_helper::value>::push(vm, value); + PushVarR_helper::value>::push(vm, value); } } +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Helper used to process formatted arguments when necessary. +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +template struct ArgPopHasFmt { static constexpr bool value = false; }; +template<> struct ArgPopHasFmt { static constexpr bool value = true; }; +template<> struct ArgPopHasFmt { static constexpr bool value = true; }; +template<> struct ArgPopHasFmt { static constexpr bool value = true; }; +template<> struct ArgPopHasFmt { static constexpr bool value = true; }; + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Helper used to process formatted arguments when necessary. +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +template struct ArgPopFmt { + static inline SQInteger Proc(StackStrF &, bool) { + return SQ_OK; + } +}; +template<> struct ArgPopFmt { + static inline SQInteger Proc(StackStrF & s, bool dummy = false) { + return s.Proc(true, dummy); + } + static inline SQInteger Get(StackStrF & s) { + return s.mRes; + } +}; + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Helper used to pop multiple variables from the stack and forward them to a functor. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1184,15 +1210,17 @@ template struct ArgPop; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template<> struct ArgPop<> { + // 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*/) { } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { (void)(dummy); return SQ_OK; } + SQInteger ProcRes() { return SQ_OK; } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm); } }; @@ -1201,78 +1229,84 @@ struct ArgPop<> { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template struct ArgPop { + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; + // Implement ours Var V1; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) - : V1(vm, idx, a...) + ArgPop(HSQUIRRELVM vm, SQInteger idx) + : V1(vm, idx) { } // Retrieve the last popped variable Var & Last() { return V1; } const Var & Last() const { return V1; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V1.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V1.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; // Implement ours Var V2; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V2(vm, idx+1, a...) + , V2(vm, idx+1) { } // Retrieve the last popped variable Var & Last() { return V2; } const Var & Last() const { return V2; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V2.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V2.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value,V2.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; // Implement ours Var V3; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V3(vm, idx+2, a...) + , V3(vm, idx+2) { } // Retrieve the last popped variable Var & Last() { return V3; } const Var & Last() const { return V3; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V3.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V3.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value,V2.value,V3.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1280,26 +1314,27 @@ struct ArgPop : public ArgPop { // Implement ours Var V4; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V4(vm, idx+3, a...) + , V4(vm, idx+3) { } // Retrieve the last popped variable Var & Last() { return V4; } const Var & Last() const { return V4; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V4.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V4.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value,V2.value,V3.value,V4.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1308,26 +1343,27 @@ struct ArgPop : public ArgPop { // Implement ours Var V5; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V5(vm, idx+4, a...) + , V5(vm, idx+4) { } // Retrieve the last popped variable Var & Last() { return V5; } const Var & Last() const { return V5; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V5.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V5.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value,V2.value,V3.value,V4.value,V5.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1337,26 +1373,27 @@ struct ArgPop : public ArgPop { // Implement ours Var V6; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V6(vm, idx+5, a...) + , V6(vm, idx+5) { } // Retrieve the last popped variable Var & Last() { return V6; } const Var & Last() const { return V6; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V6.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V6.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1367,26 +1404,27 @@ struct ArgPop : public ArgPop { // Implement ours Var V7; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V7(vm, idx+6, a...) + , V7(vm, idx+6) { } // Retrieve the last popped variable Var & Last() { return V7; } const Var & Last() const { return V7; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V7.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V7.value); } + // Forward the arguments to a function object + template void Call(HSQUIRRELVM vm, F f) { + f(vm,V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value); } }; template struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1398,26 +1436,27 @@ struct ArgPop : public ArgPop { // Implement ours Var V8; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V8(vm, idx+7, a...) + , V8(vm, idx+7) { } // Retrieve the last popped variable Var & Last() { return V8; } const Var & Last() const { return V8; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V8.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V8.value); } + // Forward the arguments to a function object + template 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 struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1430,26 +1469,27 @@ struct ArgPop : public ArgPop V9; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V9(vm, idx+8, a...) + , V9(vm, idx+8) { } // Retrieve the last popped variable Var & Last() { return V9; } const Var & Last() const { return V9; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V9.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V9.value); } + // Forward the arguments to a function object + template 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 struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1463,26 +1503,27 @@ struct ArgPop : public ArgPop V10; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V10(vm, idx+9, a...) + , V10(vm, idx+9) { } // Retrieve the last popped variable Var & Last() { return V10; } const Var & Last() const { return V10; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V10.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V10.value); } + // Forward the arguments to a function object + template 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 struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1497,26 +1538,27 @@ struct ArgPop : public ArgPop V11; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V11(vm, idx+10, a...) + , V11(vm, idx+10) { } // Retrieve the last popped variable Var & Last() { return V11; } const Var & Last() const { return V11; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V11.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V11.value); } + // Forward the arguments to a function object + template 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 struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1532,26 +1574,27 @@ struct ArgPop : public ArgPop V12; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V12(vm, idx+11, a...) + , V12(vm, idx+11) { } // Retrieve the last popped variable Var & Last() { return V12; } const Var & Last() const { return V12; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value,V12.value); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(V1.value,V2.value,V3.value,V4.value,V5.value,V6.value,V7.value,V8.value,V9.value,V10.value,V11.value,V12.value); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V12.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V12.value); } + // Forward the arguments to a function object + template 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 struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1568,26 +1611,27 @@ struct ArgPop : public ArgPop V13; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V13(vm, idx+12, a...) + , V13(vm, idx+12) { } // Retrieve the last popped variable Var & Last() { return V13; } const Var & Last() const { return V13; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(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); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(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); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V13.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V13.value); } + // Forward the arguments to a function object + template 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 struct ArgPop : public ArgPop { using Base = ArgPop; + // Used to tell whether the last template parameter is a StackStrF type + static constexpr bool HASFMT = ArgPopHasFmt::value; // Import from base classes using Base::V1; using Base::V2; @@ -1605,20 +1649,19 @@ struct ArgPop : public ArgPop V14; // Base constructor. Can also pass extra parameters to the last popped argument. - template ArgPop(HSQUIRRELVM vm, SQInteger idx, A&&... a) + ArgPop(HSQUIRRELVM vm, SQInteger idx) : ArgPop(vm, idx) - , V14(vm, idx+13, a...) + , V14(vm, idx+13) { } // Retrieve the last popped variable Var & Last() { return V14; } const Var & Last() const { return V14; } - // Forward the arguments to a functor that doesn't return anything - template void Exec(F f) { - f(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); - } - // Forward the arguments to a functor that returns a value - template R Eval(F f) { - return f(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); + // Process formatted arguments if necessary + SQInteger Proc(bool dummy = false) { return ArgPopFmt::Proc(V14.value, dummy); } + SQInteger ProcRes() { return ArgPopFmt::Get(V14.value); } + // Forward the arguments to a function object + template 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); } }; diff --git a/include/sqrat/sqratUtil.h b/include/sqrat/sqratUtil.h index b8735120..cda6e281 100644 --- a/include/sqrat/sqratUtil.h +++ b/include/sqrat/sqratUtil.h @@ -45,6 +45,15 @@ namespace Sqrat { +#if defined(__GNUC__) + #define SQ_UNREACHABLE __builtin_unreachable(); +#elif defined(_MSVC) +static _Noreturn void unreachable() { return; } + #define SQ_UNREACHABLE unreachable(); +#else + #define SQ_UNREACHABLE assert(0); +#endif + /// @cond DEV #if defined(SCRAT_USE_CXX11_OPTIMIZATIONS) @@ -1531,7 +1540,7 @@ struct StackGuard { sq_pop(m_VM, top - m_Top); // Trim the stack } - } + } private: @@ -1549,6 +1558,7 @@ struct StackStrF SQRESULT mRes; ///< The result of the retrieval attempts. HSQOBJECT mObj; ///< Strong reference to the string object. HSQUIRRELVM mVM; ///< The associated virtual machine. + SQInteger mIdx; ///< The index where the string should be retrieved from. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Default constructor. @@ -1559,9 +1569,9 @@ struct StackStrF , mRes(SQ_OK) , mObj() , mVM(DefaultVM::Get()) + , mIdx(-1) { - // Reset the converted value object - sq_resetobject(&mObj); + sq_resetobject(&mObj); // Reset the converted value object } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1573,102 +1583,22 @@ struct StackStrF , mRes(SQ_OK) , mObj() , mVM(DefaultVM::Get()) + , mIdx(-1) { - // Reset the converted value object - sq_resetobject(&mObj); + sq_resetobject(&mObj); // Reset the converted value object } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Base constructor. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - StackStrF(HSQUIRRELVM vm, SQInteger idx, bool fmt = false, bool dummy = false) + StackStrF(HSQUIRRELVM vm, SQInteger idx) : mPtr(nullptr) , mLen(-1) , mRes(SQ_OK) , mObj() , mVM(vm) + , mIdx(idx) { - // Reset the converted value object - sq_resetobject(&mObj); - // is this a dummy request? - if (dummy) - { - // Since this is a dummy then avoid making it look like a failure - mPtr = _SC(""); - mLen = 0; - // We're not supposed to proceed with this! - return; - } - // Grab the top of the stack - const SQInteger top = sq_gettop(vm); - // Was the string or value specified? - if (top <= (idx - 1)) - { - mRes = sq_throwerror(vm, "Missing string or value"); - } - // Do we have enough values to call the format function and are we allowed to? - else if (fmt && (top - 1) >= idx) - { - // Pointer to the generated string - SQChar * str = nullptr; - // Attempt to generate the specified string format - mRes = sqstd_format(vm, idx, &mLen, &str); - // Did the format succeeded but ended up with a null string pointer? - if (SQ_SUCCEEDED(mRes) && !str) - { - mRes = sq_throwerror(vm, "Unable to generate the string"); - } - else - { - mPtr = const_cast< const SQChar * >(str); - } - } - // Is the value on the stack an actual string? - else if (sq_gettype(vm, idx) == OT_STRING) - { - // Obtain a reference to the string object - mRes = sq_getstackobj(vm, idx, &mObj); - // Could we retrieve the object from the stack? - if (SQ_SUCCEEDED(mRes)) - { - // Keep a strong reference to the object - sq_addref(vm, &mObj); - // Attempt to retrieve the string value from the stack - mRes = sq_getstringandsize(vm, idx, &mPtr, &mLen); - } - // Did the retrieval succeeded but ended up with a null string pointer? - if (SQ_SUCCEEDED(mRes) && !mPtr) - { - mRes = sq_throwerror(vm, "Unable to retrieve the string"); - } - } - // We have to try and convert it to string - else - { - // Attempt to convert the value from the stack to a string - mRes = sq_tostring(vm, idx); - // Could we convert the specified value to string? - if (SQ_SUCCEEDED(mRes)) - { - // Obtain a reference to the resulted object - mRes = sq_getstackobj(vm, -1, &mObj); - // Could we retrieve the object from the stack? - if (SQ_SUCCEEDED(mRes)) - { - // Keep a strong reference to the object - sq_addref(vm, &mObj); - // Attempt to obtain the string pointer - mRes = sq_getstringandsize(vm, -1, &mPtr, &mLen); - } - } - // Pop a value from the stack regardless of the result - sq_pop(vm, 1); - // Did the retrieval succeeded but ended up with a null string pointer? - if (SQ_SUCCEEDED(mRes) && !mPtr) - { - mRes = sq_throwerror(vm, "Unable to retrieve the value"); - } - } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1685,11 +1615,13 @@ struct StackStrF , mRes(o.mRes) , mObj(o.mObj) , mVM(o.mVM) + , mIdx(o.mIdx) { o.mPtr = nullptr; o.mLen = 0; o.mRes = SQ_OK; o.mVM = nullptr; + o.mIdx = -1; sq_resetobject(&o.mObj); } @@ -1713,6 +1645,95 @@ struct StackStrF /// Move assignment operator. (disabled) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// StackStrF & operator = (StackStrF && o) = delete; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Actual implementation. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + SQRESULT Proc(bool fmt = false, bool dummy = false) noexcept + { + // Reset the converted value object + sq_resetobject(&mObj); + // is this a dummy request? + if (dummy) + { + // Since this is a dummy then avoid making it look like a failure + mPtr = _SC(""); + mLen = 0; + // We're not supposed to proceed with this! + return mRes; + } + // Grab the top of the stack + const SQInteger top = sq_gettop(mVM); + // Was the string or value specified? + if (top <= (mIdx - 1)) + { + mRes = sq_throwerror(mVM, "Missing string or value"); + } + // Do we have enough values to call the format function and are we allowed to? + else if (fmt && (top - 1) >= mIdx) + { + // Pointer to the generated string + SQChar * str = nullptr; + // Attempt to generate the specified string format + mRes = sqstd_format(mVM, mIdx, &mLen, &str); + // Did the format succeeded but ended up with a null string pointer? + if (SQ_SUCCEEDED(mRes) && !str) + { + mRes = sq_throwerror(mVM, "Unable to generate the string"); + } + else + { + mPtr = const_cast< const SQChar * >(str); + } + } + // Is the value on the stack an actual string? + else if (sq_gettype(mVM, mIdx) == OT_STRING) + { + // Obtain a reference to the string object + mRes = sq_getstackobj(mVM, mIdx, &mObj); + // Could we retrieve the object from the stack? + if (SQ_SUCCEEDED(mRes)) + { + // Keep a strong reference to the object + sq_addref(mVM, &mObj); + // Attempt to retrieve the string value from the stack + mRes = sq_getstringandsize(mVM, mIdx, &mPtr, &mLen); + } + // Did the retrieval succeeded but ended up with a null string pointer? + if (SQ_SUCCEEDED(mRes) && !mPtr) + { + mRes = sq_throwerror(mVM, "Unable to retrieve the string"); + } + } + // We have to try and convert it to string + else + { + // Attempt to convert the value from the stack to a string + mRes = sq_tostring(mVM, mIdx); + // Could we convert the specified value to string? + if (SQ_SUCCEEDED(mRes)) + { + // Obtain a reference to the resulted object + mRes = sq_getstackobj(mVM, -1, &mObj); + // Could we retrieve the object from the stack? + if (SQ_SUCCEEDED(mRes)) + { + // Keep a strong reference to the object + sq_addref(mVM, &mObj); + // Attempt to obtain the string pointer + mRes = sq_getstringandsize(mVM, -1, &mPtr, &mLen); + } + } + // Pop a value from the stack regardless of the result + sq_pop(mVM, 1); + // Did the retrieval succeeded but ended up with a null string pointer? + if (SQ_SUCCEEDED(mRes) && !mPtr) + { + mRes = sq_throwerror(mVM, "Unable to retrieve the value"); + } + } + return mRes; + } }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/shared/Base/Utility.inl b/shared/Base/Utility.inl index c12e095a..c1381cbc 100644 --- a/shared/Base/Utility.inl +++ b/shared/Base/Utility.inl @@ -627,9 +627,9 @@ String SqTypeName(HSQUIRRELVM vm, SQInteger idx) return _SC("unknown"); } // Attempt to convert the obtained value to a string - StackStrF val(vm, -1, false); + StackStrF val(vm, -1); // Did the conversion failed? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(false))) { return _SC("unknown"); } diff --git a/source/Base/Shared.cpp b/source/Base/Shared.cpp index 71f687e8..f37fdab1 100644 --- a/source/Base/Shared.cpp +++ b/source/Base/Shared.cpp @@ -1024,16 +1024,16 @@ static SQInteger SqNameFilterCheck(HSQUIRRELVM vm) return sq_throwerror(vm, "Missing name string"); } // Attempt to generate the string value - StackStrF filter(vm, 2, false); + StackStrF filter(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(filter.mRes)) + if (SQ_FAILED(filter.Proc(false))) { return filter.mRes; // Propagate the error! } // Attempt to generate the string value - StackStrF name(vm, 3, true); + StackStrF name(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(name.mRes)) + if (SQ_FAILED(name.Proc(true))) { return name.mRes; // Propagate the error! } @@ -1058,16 +1058,16 @@ static SQInteger SqNameFilterCheckInsensitive(HSQUIRRELVM vm) return sq_throwerror(vm, "Missing name string"); } // Attempt to generate the string value - StackStrF filter(vm, 2, false); + StackStrF filter(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(filter.mRes)) + if (SQ_FAILED(filter.Proc(false))) { return filter.mRes; // Propagate the error! } // Attempt to generate the string value - StackStrF name(vm, 3, true); + StackStrF name(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(name.mRes)) + if (SQ_FAILED(name.Proc(true))) { return name.mRes; // Propagate the error! } diff --git a/source/Core/Funcs.inc b/source/Core/Funcs.inc index 3a762ea7..be132485 100644 --- a/source/Core/Funcs.inc +++ b/source/Core/Funcs.inc @@ -25,9 +25,9 @@ static SQInteger SqLoadScript(HSQUIRRELVM vm) // Whether the script execution is delayed SQBool delay = SQFalse; // Attempt to generate the string value - StackStrF val(vm, 3, true); + StackStrF val(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Entity/Player.cpp b/source/Entity/Player.cpp index 70029f6e..12d55ee6 100644 --- a/source/Entity/Player.cpp +++ b/source/Entity/Player.cpp @@ -2008,9 +2008,9 @@ SQInteger CPlayer::Msg(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, msgidx, true); + StackStrF val(vm, msgidx); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -2089,9 +2089,9 @@ SQInteger CPlayer::MsgP(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 3, true); + StackStrF val(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -2195,9 +2195,9 @@ SQInteger CPlayer::MsgEx(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, msgidx, true); + StackStrF val(vm, msgidx); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -2260,9 +2260,9 @@ SQInteger CPlayer::Message(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -2317,9 +2317,9 @@ SQInteger CPlayer::Announce(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -2387,9 +2387,9 @@ SQInteger CPlayer::AnnounceEx(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 3, true); + StackStrF val(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -2472,9 +2472,9 @@ SQInteger Player_FindAuto(HSQUIRRELVM vm) case OT_STRING: default: { // Attempt to convert the obtained value to a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Did the conversion failed? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error } @@ -2558,9 +2558,9 @@ SQInteger Player_ExistsAuto(HSQUIRRELVM vm) case OT_STRING: default: { // Attempt to convert the obtained value to a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Did the conversion failed? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error } diff --git a/source/Library/Crypt/Hash.cpp b/source/Library/Crypt/Hash.cpp index ebbd5f6c..f379e6a1 100644 --- a/source/Library/Crypt/Hash.cpp +++ b/source/Library/Crypt/Hash.cpp @@ -36,9 +36,9 @@ template < class T > T BaseHash< T >::Algo; template < class T > static SQInteger HashF(HSQUIRRELVM vm) { // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -56,9 +56,9 @@ template < class T > static SQInteger HashF(HSQUIRRELVM vm) static SQInteger WhirlpoolF(HSQUIRRELVM vm) { // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -94,9 +94,9 @@ static SQInteger WhirlpoolF(HSQUIRRELVM vm) static SQInteger EncodeBase64F(HSQUIRRELVM vm) { // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -122,9 +122,9 @@ static SQInteger EncodeBase64F(HSQUIRRELVM vm) static SQInteger DecodeBase64F(HSQUIRRELVM vm) { // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Library/Numeric/Math.cpp b/source/Library/Numeric/Math.cpp index 816a0505..7f10985d 100644 --- a/source/Library/Numeric/Math.cpp +++ b/source/Library/Numeric/Math.cpp @@ -153,9 +153,9 @@ static SQInteger SqNan(HSQUIRRELVM vm) return sq_throwerror(vm, "Wrong number of arguments"); } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -178,9 +178,9 @@ static SQInteger SqNanL(HSQUIRRELVM vm) return sq_throwerror(vm, "Wrong number of arguments"); } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Library/String.cpp b/source/Library/String.cpp index 7b1deb80..1f8649ce 100644 --- a/source/Library/String.cpp +++ b/source/Library/String.cpp @@ -490,9 +490,9 @@ static SQInteger SplitWhereCharImpl(HSQUIRRELVM vm, int(*fn)(int), bool neg) } // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -612,9 +612,9 @@ static SQInteger SqStrExplode(HSQUIRRELVM vm) return sq_throwerror(vm, _SC("Missing string value")); } // Attempt to generate the string value - StackStrF val(vm, 4, true); + StackStrF val(vm, 4); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -812,9 +812,9 @@ static CSStr FromArray(Array & arr) static SQInteger StdPrintF(HSQUIRRELVM vm) { // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Library/System.cpp b/source/Library/System.cpp index f952d595..0ac8080d 100644 --- a/source/Library/System.cpp +++ b/source/Library/System.cpp @@ -21,9 +21,9 @@ extern void Register_SysPath(HSQUIRRELVM vm); static SQInteger SqSysExec(HSQUIRRELVM vm) { // Attempt to retrieve the value from the stack as a string - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Library/Utils.cpp b/source/Library/Utils.cpp index ec4385e0..e43e507e 100644 --- a/source/Library/Utils.cpp +++ b/source/Library/Utils.cpp @@ -22,9 +22,9 @@ static SQInteger SqExtractIPv4(HSQUIRRELVM vm) return sq_throwerror(vm, "Missing IP address string"); } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Logger.cpp b/source/Logger.cpp index dd7dbfba..70a450da 100644 --- a/source/Logger.cpp +++ b/source/Logger.cpp @@ -539,9 +539,9 @@ template < Uint8 L, bool S > static SQInteger LogBasicMessage(HSQUIRRELVM vm) return sq_throwerror(vm, "Missing message value"); } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Misc/Broadcast.cpp b/source/Misc/Broadcast.cpp index 7db45c0c..1652f623 100644 --- a/source/Misc/Broadcast.cpp +++ b/source/Misc/Broadcast.cpp @@ -259,9 +259,9 @@ static SQInteger SqBroadcastMsg(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, msgidx, true); + StackStrF val(vm, msgidx); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -339,9 +339,9 @@ static SQInteger SqBroadcastMsgP(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 3, true); + StackStrF val(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -444,9 +444,9 @@ static SQInteger SqBroadcastMsgEx(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, msgidx, true); + StackStrF val(vm, msgidx); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -508,9 +508,9 @@ static SQInteger SqBroadcastMessage(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -564,9 +564,9 @@ static SQInteger SqBroadcastAnnounce(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 2, true); + StackStrF val(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } @@ -641,9 +641,9 @@ static SQInteger SqBroadcastAnnounceEx(HSQUIRRELVM vm) } // Attempt to generate the string value - StackStrF val(vm, 3, true); + StackStrF val(vm, 3); // Have we failed to retrieve the string? - if (SQ_FAILED(val.mRes)) + if (SQ_FAILED(val.Proc(true))) { return val.mRes; // Propagate the error! } diff --git a/source/Misc/Tasks.hpp b/source/Misc/Tasks.hpp index d5841595..42331078 100644 --- a/source/Misc/Tasks.hpp +++ b/source/Misc/Tasks.hpp @@ -499,9 +499,9 @@ public: return sq_throwerror(vm, e.what()); } // Attempt to generate the string value - const StackStrF tag(vm, 2, true); + StackStrF tag(vm, 2); // Have we failed to retrieve the string? - if (SQ_FAILED(tag.mRes)) + if (SQ_FAILED(tag.Proc(true))) { return tag.mRes; // Propagate the error! }