diff --git a/include/sqrat/sqratClass.h b/include/sqrat/sqratClass.h index 5c479be7..e013f6f5 100644 --- a/include/sqrat/sqratClass.h +++ b/include/sqrat/sqratClass.h @@ -394,6 +394,23 @@ public: return *this; } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Binds a class function with formatting support + /// + /// \param name Name of the function as it will appear in Squirrel + /// \param method Function to bind + /// + /// \tparam F Type of function (usually doesnt need to be defined explicitly) + /// + /// \return The Class itself so the call can be chained + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + Class& FmtFunc(const SQChar* name, F method) { + BindFunc(name, &method, sizeof(method), SqMemberFuncFmt(method)); + return *this; + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Binds a class function with overloading enabled /// @@ -432,6 +449,23 @@ public: return *this; } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Binds a global function as a class function with formatting support + /// + /// \param name Name of the function as it will appear in Squirrel + /// \param method Function to bind + /// + /// \tparam F Type of function (usually doesnt need to be defined explicitly) + /// + /// \return The Class itself so the call can be chained + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + Class& GlobalFmtFunc(const SQChar* name, F method) { + BindFunc(name, &method, sizeof(method), SqMemberGlobalFmtFunc(method)); + return *this; + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Binds a static class function /// @@ -449,6 +483,23 @@ public: return *this; } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Binds a static class function with formatting support + /// + /// \param name Name of the function as it will appear in Squirrel + /// \param method Function to bind + /// + /// \tparam F Type of function (usually doesnt need to be defined explicitly) + /// + /// \return The Class itself so the call can be chained + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + Class& StaticFmtFunc(const SQChar* name, F method) { + BindFunc(name, &method, sizeof(method), SqGlobalFmtFunc(method)); + return *this; + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Binds a global function as a class function with overloading enabled /// diff --git a/include/sqrat/sqratGlobalMethods.h b/include/sqrat/sqratGlobalMethods.h index 7d429ba6..c47c59e0 100644 --- a/include/sqrat/sqratGlobalMethods.h +++ b/include/sqrat/sqratGlobalMethods.h @@ -2380,6 +2380,1465 @@ SQFUNCTION SqMemberGlobalFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, return &SqGlobal::template Func14; } +// +// Squirrel Global Functions +// +template +class SqGlobalFmt { +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 (*M)(StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + + StackStrF fmt(vm, 2, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 1)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 1, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 2)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 2, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 3)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, A3, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 3, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 4)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, A3, A4, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 4, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 5)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, A3, A4, A5, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 5, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 6)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, A3, A4, A5, A6, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 6, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 7)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, A3, A4, A5, A6, A7, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + Var a7(vm, startIdx + 6); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 7, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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) < (startIdx + 8)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R (*M)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + Var a7(vm, startIdx + 6); + Var a8(vm, startIdx + 7); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 8, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R ret = (*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; + } +}; + + +// +// reference return specialization +// + +template +class SqGlobalFmt { +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& (*M)(StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + + StackStrF fmt(vm, 2, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 1)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 1, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 2)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 2, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 3)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, A3, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 3, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 4)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, A3, A4, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 4, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 5)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, A3, A4, A5, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 5, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 6)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, A3, A4, A5, A6, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 6, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 7)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, A3, A4, A5, A6, A7, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + Var a7(vm, startIdx + 6); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 7, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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) < (startIdx + 8)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef R& (*M)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + Var a7(vm, startIdx + 6); + Var a8(vm, startIdx + 7); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 8, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + R& ret = (*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; + } +}; + + +// +// void return specialization +// + +template <> +class SqGlobalFmt { +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 (*M)(StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + + StackStrF fmt(vm, 2, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 1)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 1, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 2)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 2, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 3)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, A3, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 3, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 4)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, A3, A4, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 4, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 5)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, A3, A4, A5, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 5, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 6)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, A3, A4, A5, A6, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 6, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 7)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, A3, A4, A5, A6, A7, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + Var a7(vm, startIdx + 6); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 7, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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) < (startIdx + 8)) { + return sq_throwerror(vm, _SC("wrong number of parameters")); + } +#endif + + typedef void (*M)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &); + M* method; + sq_getuserdata(vm, -1, (SQUserPointer*)&method, NULL); + + SQTRY() + Var a1(vm, startIdx); + Var a2(vm, startIdx + 1); + Var a3(vm, startIdx + 2); + Var a4(vm, startIdx + 3); + Var a5(vm, startIdx + 4); + Var a6(vm, startIdx + 5); + Var a7(vm, startIdx + 6); + Var a8(vm, startIdx + 7); + SQCATCH_NOEXCEPT(vm) { + return sq_throwerror(vm, SQWHAT_NOEXCEPT(vm)); + } + + StackStrF fmt(vm, startIdx + 8, true); + // Validate the format + if (SQ_FAILED(fmt.mRes)) { + return fmt.mRes; + } + + (*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; + } +}; + + +// +// Formatted Global Function Resolvers +// + +// Arg Count 0 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(StackStrF &)) { + return &SqGlobalFmt::template Func0; +} + +// Arg Count 0 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(StackStrF &)) { + return &SqGlobalFmt::template Func0; +} + +// Arg Count 1 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, StackStrF &)) { + return &SqGlobalFmt::template Func1; +} + +// Arg Count 1 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, StackStrF &)) { + return &SqGlobalFmt::template Func1; +} + +// Arg Count 2 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, StackStrF &)) { + return &SqGlobalFmt::template Func2; +} + +// Arg Count 2 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, StackStrF &)) { + return &SqGlobalFmt::template Func2; +} + +// Arg Count 3 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, StackStrF &)) { + return &SqGlobalFmt::template Func3; +} + +// Arg Count 3 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, StackStrF &)) { + return &SqGlobalFmt::template Func3; +} + +// Arg Count 4 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, StackStrF &)) { + return &SqGlobalFmt::template Func4; +} + +// Arg Count 4 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, StackStrF &)) { + return &SqGlobalFmt::template Func4; +} + +// Arg Count 5 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, StackStrF &)) { + return &SqGlobalFmt::template Func5; +} + +// Arg Count 5 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, StackStrF &)) { + return &SqGlobalFmt::template Func5; +} + +// Arg Count 6 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &)) { + return &SqGlobalFmt::template Func6; +} + +// Arg Count 6 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &)) { + return &SqGlobalFmt::template Func6; +} + +// Arg Count 7 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &)) { + return &SqGlobalFmt::template Func7; +} + +// Arg Count 7 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &)) { + return &SqGlobalFmt::template Func7; +} + +// Arg Count 8 +template +SQFUNCTION SqGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &)) { + return &SqGlobalFmt::template Func8; +} + +// Arg Count 8 +template +SQFUNCTION SqGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &)) { + return &SqGlobalFmt::template Func8; +} + +// +// Formatted Member Global Function Resolvers +// + +// Arg Count 1 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, StackStrF &)) { + return &SqGlobalFmt::template Func1; +} + +// Arg Count 1 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, StackStrF &)) { + return &SqGlobalFmt::template Func1; +} + +// Arg Count 2 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, StackStrF &)) { + return &SqGlobalFmt::template Func2; +} + +// Arg Count 2 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, StackStrF &)) { + return &SqGlobalFmt::template Func2; +} + +// Arg Count 3 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, StackStrF &)) { + return &SqGlobalFmt::template Func3; +} + +// Arg Count 3 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, StackStrF &)) { + return &SqGlobalFmt::template Func3; +} + +// Arg Count 4 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, StackStrF &)) { + return &SqGlobalFmt::template Func4; +} + +// Arg Count 4 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, StackStrF &)) { + return &SqGlobalFmt::template Func4; +} + +// Arg Count 5 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, StackStrF &)) { + return &SqGlobalFmt::template Func5; +} + +// Arg Count 5 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, StackStrF &)) { + return &SqGlobalFmt::template Func5; +} + +// Arg Count 6 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &)) { + return &SqGlobalFmt::template Func6; +} + +// Arg Count 6 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &)) { + return &SqGlobalFmt::template Func6; +} + +// Arg Count 7 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &)) { + return &SqGlobalFmt::template Func7; +} + +// Arg Count 7 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &)) { + return &SqGlobalFmt::template Func7; +} + +// Arg Count 8 +template +SQFUNCTION SqMemberGlobalFmtFunc(R (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &)) { + return &SqGlobalFmt::template Func8; +} + +// Arg Count 8 +template +SQFUNCTION SqMemberGlobalFmtFunc(R& (* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &)) { + return &SqGlobalFmt::template Func8; +} + /// @endcond } diff --git a/include/sqrat/sqratMemberMethods.h b/include/sqrat/sqratMemberMethods.h index 97b9cf8a..98e8eb7e 100644 --- a/include/sqrat/sqratMemberMethods.h +++ b/include/sqrat/sqratMemberMethods.h @@ -5428,6 +5428,3334 @@ inline SQFUNCTION SqMemberFunc(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, 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)(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() + + StackStrF fmt(vm, 2, true); + // 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)(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() + + StackStrF fmt(vm, 2, true); + // 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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; + } +}; + +// +// 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)(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() + + StackStrF fmt(vm, 2, true); + // 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; + } + + 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)(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() + + StackStrF fmt(vm, 2, true); + // 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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; + } +}; + +// +// 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)(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() + + 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; + } + + 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)(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() + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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, 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)); + } + + 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; + } +}; + +// +// Formatted Member Function Resolvers +// + +// Arg Count 0 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(StackStrF &)) { + return &SqMemberFmt::template Func0; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(StackStrF &) const) { + return &SqMemberFmt::template Func0C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(StackStrF &)) { + return &SqMemberFmt::template Func0; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(StackStrF &) const) { + return &SqMemberFmt::template Func0C; +} + +// Arg Count 1 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, StackStrF &)) { + return &SqMemberFmt::template Func1; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, StackStrF &) const) { + return &SqMemberFmt::template Func1C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, StackStrF &)) { + return &SqMemberFmt::template Func1; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, StackStrF &) const) { + return &SqMemberFmt::template Func1C; +} + +// Arg Count 2 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, StackStrF &)) { + return &SqMemberFmt::template Func2; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, StackStrF &) const) { + return &SqMemberFmt::template Func2C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, StackStrF &)) { + return &SqMemberFmt::template Func2; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, StackStrF &) const) { + return &SqMemberFmt::template Func2C; +} + +// Arg Count 3 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, StackStrF &)) { + return &SqMemberFmt::template Func3; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, StackStrF &) const) { + return &SqMemberFmt::template Func3C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, StackStrF &)) { + return &SqMemberFmt::template Func3; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, StackStrF &) const) { + return &SqMemberFmt::template Func3C; +} + +// Arg Count 4 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, StackStrF &)) { + return &SqMemberFmt::template Func4; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, StackStrF &) const) { + return &SqMemberFmt::template Func4C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, StackStrF &)) { + return &SqMemberFmt::template Func4; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, StackStrF &) const) { + return &SqMemberFmt::template Func4C; +} + +// Arg Count 5 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, StackStrF &)) { + return &SqMemberFmt::template Func5; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, StackStrF &) const) { + return &SqMemberFmt::template Func5C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, StackStrF &)) { + return &SqMemberFmt::template Func5; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R&(C::* /*method*/)(A1, A2, A3, A4, A5, StackStrF &) const) { + return &SqMemberFmt::template Func5C; +} + +// Arg Count 6 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &)) { + return &SqMemberFmt::template Func6; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &) const) { + return &SqMemberFmt::template Func6C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &)) { + return &SqMemberFmt::template Func6; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, StackStrF &) const) { + return &SqMemberFmt::template Func6C; +} + +// Arg Count 7 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &)) { + return &SqMemberFmt::template Func7; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &) const) { + return &SqMemberFmt::template Func7C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &)) { + return &SqMemberFmt::template Func7; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, StackStrF &) const) { + return &SqMemberFmt::template Func7C; +} + +// Arg Count 8 +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &)) { + return &SqMemberFmt::template Func8; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &) const) { + return &SqMemberFmt::template Func8C; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &)) { + return &SqMemberFmt::template Func8; +} + +template +inline SQFUNCTION SqMemberFuncFmt(R& (C::* /*method*/)(A1, A2, A3, A4, A5, A6, A7, A8, StackStrF &) const) { + return &SqMemberFmt::template Func8C; +} + // // Variable Get diff --git a/include/sqrat/sqratTable.h b/include/sqrat/sqratTable.h index 9afba5ed..75feca7e 100644 --- a/include/sqrat/sqratTable.h +++ b/include/sqrat/sqratTable.h @@ -250,6 +250,23 @@ public: return *this; } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Sets a key in the Table to a specific function with formatting support + /// + /// \param name The key in the table being assigned a value + /// \param method Function that is being placed in the Table + /// + /// \tparam F Type of function (only define this if you need to choose a certain template specialization or overload) + /// + /// \return The Table itself so the call can be chained + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + template + TableBase& FmtFunc(const SQChar* name, F method) { + BindFunc(name, &method, sizeof(method), SqGlobalFmtFunc(method)); + return *this; + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Sets a key in the Table to a specific function and allows the key to be overloaded with functions of a different amount of arguments /// diff --git a/include/sqrat/sqratTypes.h b/include/sqrat/sqratTypes.h index b7ee815a..599980ad 100644 --- a/include/sqrat/sqratTypes.h +++ b/include/sqrat/sqratTypes.h @@ -1020,6 +1020,74 @@ public: }; #endif +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Used to get and push StackStrF types to and from the stack +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +template<> +struct Var { + + StackStrF value; ///< The actual value of get operations + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Attempts to get the value off the stack at idx as a string + /// + /// \param vm Target VM + /// \param idx Index trying to be read + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + Var(HSQUIRRELVM vm, SQInteger idx) : value(vm, idx, false) { + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Called by Sqrat::PushVar to put a string on the stack + /// + /// \param vm Target VM + /// \param value Value to push on to the VM's stack + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static void push(HSQUIRRELVM vm, const StackStrF& value) { + if (sq_isstring(value.mObj)) { + sq_pushobject(vm, value.mObj); + } else { + sq_pushstring(vm, value.mPtr, value.mLen); + } + } +}; + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Used to get and push StackStrF types to and from the stack +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +template<> +struct Var { + + StackStrF value; ///< The actual value of get operations + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Attempts to get the value off the stack at idx as a string + /// + /// \param vm Target VM + /// \param idx Index trying to be read + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + Var(HSQUIRRELVM vm, SQInteger idx) : value(vm, idx, false) { + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Called by Sqrat::PushVar to put a string on the stack + /// + /// \param vm Target VM + /// \param value Value to push on to the VM's stack + /// + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + static void push(HSQUIRRELVM vm, const StackStrF& value) { + if (sq_isstring(value.mObj)) { + sq_pushobject(vm, value.mObj); + } else { + sq_pushstring(vm, value.mPtr, value.mLen); + } + } +}; + // Non-referencable type definitions template struct is_referencable {static const bool value = true;}; diff --git a/include/sqrat/sqratUtil.h b/include/sqrat/sqratUtil.h index 0a09b222..2d0af45c 100644 --- a/include/sqrat/sqratUtil.h +++ b/include/sqrat/sqratUtil.h @@ -32,6 +32,7 @@ #include #else #include + #include #endif // SQMOD_PLUGIN_API #include @@ -1417,6 +1418,201 @@ public: } }; +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Implements RAII to restore the VM stack to it's initial size on function exit. +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct StackGuard +{ + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Default constructor. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackGuard() + : m_VM(DefaultVM::Get()), m_Top(sq_gettop(m_VM)) + { + /* ... */ + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Base constructor. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackGuard(HSQUIRRELVM vm) + : m_VM(vm), m_Top(sq_gettop(vm)) + { + /* ... */ + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Copy constructor. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackGuard(const StackGuard &) = delete; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Move constructor. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackGuard(StackGuard &&) = delete; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Destructor. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ~StackGuard() + { + sq_pop(m_VM, sq_gettop(m_VM) - m_Top); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Copy assignment operator. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackGuard & operator = (const StackGuard &) = delete; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Move assignment operator. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackGuard & operator = (StackGuard &&) = delete; + +private: + + HSQUIRRELVM m_VM; ///< The VM where the stack should be restored. + SQInteger m_Top; ///< The top of the stack when this instance was created. +}; + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/// Helper structure for retrieving a value from the stack as a string or a formatted string. +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +struct StackStrF +{ + const SQChar * mPtr; ///< Pointer to the C string that was retrieved. + SQInteger mLen; ///< The string length if it could be retrieved. + SQRESULT mRes; ///< The result of the retrieval attempts. + HSQOBJECT mObj; ///< Strong reference to the string object. + HSQUIRRELVM mVM; ///< The associated virtual machine. + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Base constructor. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackStrF(HSQUIRRELVM vm, SQInteger idx, bool fmt = true) + : mPtr(nullptr) + , mLen(-1) + , mRes(SQ_OK) + , mObj() + , mVM(vm) + { + const SQInteger top = sq_gettop(vm); + // Reset the converted value object + sq_resetobject(&mObj); + // 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 ((top - 1) > idx && fmt) + { + // 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"); + } + } + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Copy constructor. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackStrF(const StackStrF & o) = delete; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Copy constructor. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackStrF(StackStrF && o) + : mPtr(o.mPtr) + , mLen(o.mLen) + , mRes(o.mRes) + , mObj(o.mObj) + , mVM(o.mVM) + { + o.mPtr = nullptr; + o.mLen = 0; + o.mRes = SQ_OK; + o.mVM = nullptr; + sq_resetobject(&o.mObj); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Destructor. + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ~StackStrF() + { + if (mVM && !sq_isnull(mObj)) + { + sq_release(mVM, &mObj); + } + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Copy constructor. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackStrF & operator = (const StackStrF & o) = delete; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Move constructor. (disabled) + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + StackStrF & operator = (StackStrF && o) = delete; +}; + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// @cond DEV /// Used internally to get and manipulate the underlying type of variables - retrieved from cppreference.com diff --git a/shared/Base/Utility.hpp b/shared/Base/Utility.hpp index 5c4249e1..e631bc8a 100644 --- a/shared/Base/Utility.hpp +++ b/shared/Base/Utility.hpp @@ -1456,119 +1456,6 @@ public: } }; -/* ------------------------------------------------------------------------------------------------ - * Implements RAII to restore the VM stack to it's initial size on function exit. -*/ -struct StackGuard -{ - /* -------------------------------------------------------------------------------------------- - * Default constructor. - */ - StackGuard() - : m_VM(DefaultVM::Get()), m_Top(sq_gettop(m_VM)) - { - /* ... */ - } - - /* -------------------------------------------------------------------------------------------- - * Base constructor. - */ - StackGuard(HSQUIRRELVM vm) - : m_VM(vm), m_Top(sq_gettop(vm)) - { - /* ... */ - } - - /* -------------------------------------------------------------------------------------------- - * Copy constructor. (disabled) - */ - StackGuard(const StackGuard &) = delete; - - /* -------------------------------------------------------------------------------------------- - * Move constructor. (disabled) - */ - StackGuard(StackGuard &&) = delete; - - /* -------------------------------------------------------------------------------------------- - * Destructor. - */ - ~StackGuard() - { - sq_pop(m_VM, sq_gettop(m_VM) - m_Top); - } - - /* -------------------------------------------------------------------------------------------- - * Copy assignment operator. (disabled) - */ - StackGuard & operator = (const StackGuard &) = delete; - - /* -------------------------------------------------------------------------------------------- - * Move assignment operator. (disabled) - */ - StackGuard & operator = (StackGuard &&) = delete; - -private: - - // -------------------------------------------------------------------------------------------- - HSQUIRRELVM m_VM; // The VM where the stack should be restored. - Int32 m_Top; // The top of the stack when this instance was created. -}; - -/* ------------------------------------------------------------------------------------------------ - * Helper structure for retrieving a value from the stack as a string or a formatted string. -*/ -struct StackStrF -{ - // -------------------------------------------------------------------------------------------- - CSStr mPtr; // Pointer to the C string that was retrieved. - SQInteger mLen; // The string length if it could be retrieved. - SQRESULT mRes; // The result of the retrieval attempts. - HSQOBJECT mObj; // Strong reference to the string object. - HSQUIRRELVM mVM; // The associated virtual machine. - - /* -------------------------------------------------------------------------------------------- - * Base constructor. - */ - StackStrF(HSQUIRRELVM vm, SQInteger idx, bool fmt = true); - - /* -------------------------------------------------------------------------------------------- - * Copy constructor. (disabled) - */ - StackStrF(const StackStrF & o) = delete; - - /* -------------------------------------------------------------------------------------------- - * Copy constructor. - */ - StackStrF(StackStrF && o) - : mPtr(o.mPtr) - , mLen(o.mLen) - , mRes(o.mRes) - , mObj(o.mObj) - , mVM(o.mVM) - { - o.mPtr = nullptr; - o.mLen = 0; - o.mRes = SQ_OK; - o.mVM = nullptr; - sq_resetobject(&o.mObj); - } - - /* -------------------------------------------------------------------------------------------- - * Destructor. - */ - ~StackStrF(); - - /* -------------------------------------------------------------------------------------------- - * Copy constructor. (disabled) - */ - StackStrF & operator = (const StackStrF & o) = delete; - - /* -------------------------------------------------------------------------------------------- - * Copy constructor. (disabled) - */ - StackStrF & operator = (StackStrF && o) = delete; -}; - /* ------------------------------------------------------------------------------------------------ * Retrieve the string representation of a certain type. */ diff --git a/shared/Base/Utility.inl b/shared/Base/Utility.inl index c75f9826..7634d612 100644 --- a/shared/Base/Utility.inl +++ b/shared/Base/Utility.inl @@ -564,96 +564,6 @@ bool ConvNum< bool >::FromStr(CSStr s, Int32 /*base*/) return (std::strcmp(s, "true") == 0) ? true : false; } -// -------------------------------------------------------------------------------------------- -StackStrF::StackStrF(HSQUIRRELVM vm, SQInteger idx, bool fmt) - : mPtr(nullptr) - , mLen(-1) - , mRes(SQ_OK) - , mObj() - , mVM(vm) -{ - const Int32 top = sq_gettop(vm); - // Reset the converted value object - sq_resetobject(&mObj); - // 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 (top > idx && fmt) - { - // Pointer to the generated string - SStr 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< CSStr >(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"); - } - } -} - -// ------------------------------------------------------------------------------------------------ -StackStrF::~StackStrF() -{ - if (mVM && !sq_isnull(mObj)) - { - sq_release(mVM, &mObj); - } -} - // ------------------------------------------------------------------------------------------------ CSStr SqTypeName(SQObjectType type) {