diff --git a/include/sqrat/sqratFunction.h b/include/sqrat/sqratFunction.h index fd35cdaa..e190416e 100644 --- a/include/sqrat/sqratFunction.h +++ b/include/sqrat/sqratFunction.h @@ -272,16 +272,16 @@ public: ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Runs the Function and returns its value as a SharedPtr /// - /// \tparam R Type of return value (fails if return value is not of this type) - /// /// \return SharedPtr containing the return value (or null if failed) /// /// \remarks /// This function MUST have its Error handled if it occurred. /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate() { + template + SharedPtr Evaluate(Args &&... args) { + static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment + SQInteger top = sq_gettop(vm); sq_pushobject(vm, obj); @@ -290,14 +290,17 @@ public: #if !defined (SCRAT_NO_ERROR_CHECKING) SQUnsignedInteger nparams; SQUnsignedInteger nfreevars; - - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 1)) { + if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != ARGC)) { sq_pop(vm, 2); SQTHROW(vm, _SC("wrong number of parameters")); return SharedPtr(); } +#endif - SQRESULT result = sq_call(vm, 1, true, ErrorHandling::IsEnabled()); + PushVars(vm, std::forward< Args >(args)...); + +#if !defined (SCRAT_NO_ERROR_CHECKING) + SQRESULT result = sq_call(vm, ARGC, true, ErrorHandling::IsEnabled()); //handle an error: pop the stack and throw the exception if (SQ_FAILED(result)) { @@ -306,997 +309,7 @@ public: return SharedPtr(); } #else - sq_call(vm, 1, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 2)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 2, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 2, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 3)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 3, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 3, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 4)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 4, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 4, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 5)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 5, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 5, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 6)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 6, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 6, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 7)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 7, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 7, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 8)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 8, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 8, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 9)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 9, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 9, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 10)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 10, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 10, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 11)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 11, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 11, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 12)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 12, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 12, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 13)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - PushVar(vm, a12); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 13, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 13, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// \param a13 Argument 13 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A13 Type of argument 13 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 14)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - PushVar(vm, a12); - PushVar(vm, a13); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 14, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 14, true, ErrorHandling::IsEnabled()); -#endif - - SharedPtr ret = Var >(vm, -1).value; - sq_settop(vm, top); - return ret; - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function and returns its value as a SharedPtr - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// \param a13 Argument 13 of the Function - /// \param a14 Argument 14 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A13 Type of argument 13 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A14 Type of argument 14 of the Function (usually doesnt need to be defined explicitly) - /// \tparam R Type of return value (fails if return value is not of this type) - /// - /// \return SharedPtr containing the return value (or null if failed) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - SharedPtr Evaluate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13, A14 a14) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 15)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return SharedPtr(); - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - PushVar(vm, a12); - PushVar(vm, a13); - PushVar(vm, a14); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 15, true, ErrorHandling::IsEnabled()); - - //handle an error: pop the stack and throw the exception - if (SQ_FAILED(result)) { - sq_settop(vm, top); - SQTHROW(vm, LastErrorString(vm)); - return SharedPtr(); - } -#else - sq_call(vm, 15, true, ErrorHandling::IsEnabled()); + sq_call(vm, ARGC, true, ErrorHandling::IsEnabled()); #endif SharedPtr ret = Var >(vm, -1).value; @@ -1311,7 +324,10 @@ public: /// This function MUST have its Error handled if it occurred. /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void Execute() { + template < class... Args > + void Execute(Args &&... args) { + static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment + SQInteger top = sq_gettop(vm); sq_pushobject(vm, obj); @@ -1320,13 +336,17 @@ public: #if !defined (SCRAT_NO_ERROR_CHECKING) SQUnsignedInteger nparams; SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 1)) { + if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != ARGC)) { sq_pop(vm, 2); SQTHROW(vm, _SC("wrong number of parameters")); return; } +#endif - SQRESULT result = sq_call(vm, 1, false, ErrorHandling::IsEnabled()); + PushVars(vm, std::forward< Args >(args)...); + +#if !defined (SCRAT_NO_ERROR_CHECKING) + SQRESULT result = sq_call(vm, ARGC, false, ErrorHandling::IsEnabled()); sq_settop(vm, top); //handle an error: throw the exception @@ -1335,911 +355,7 @@ public: return; } #else - sq_call(vm, 1, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 2)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 2, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 2, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 3)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 3, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 3, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 4)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 4, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 4, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 5)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 5, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 5, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 6)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 6, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 6, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 7)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 7, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 7, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 8)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 8, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 8, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 9)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 9, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 9, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 10)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 10, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 10, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 11)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 11, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 11, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 12)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 12, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 12, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 13)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - PushVar(vm, a12); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 13, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 13, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// \param a13 Argument 13 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A13 Type of argument 13 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 14)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - PushVar(vm, a12); - PushVar(vm, a13); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 14, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 14, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); -#endif - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// \param a13 Argument 13 of the Function - /// \param a14 Argument 14 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A13 Type of argument 13 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A14 Type of argument 14 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void Execute(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13, A14 a14) { - SQInteger top = sq_gettop(vm); - - sq_pushobject(vm, obj); - sq_pushobject(vm, env); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQUnsignedInteger nparams; - SQUnsignedInteger nfreevars; - if (SQ_SUCCEEDED(sq_getclosureinfo(vm, -2, &nparams, &nfreevars)) && (nparams != 15)) { - sq_pop(vm, 2); - SQTHROW(vm, _SC("wrong number of parameters")); - return; - } -#endif - - PushVar(vm, a1); - PushVar(vm, a2); - PushVar(vm, a3); - PushVar(vm, a4); - PushVar(vm, a5); - PushVar(vm, a6); - PushVar(vm, a7); - PushVar(vm, a8); - PushVar(vm, a9); - PushVar(vm, a10); - PushVar(vm, a11); - PushVar(vm, a12); - PushVar(vm, a13); - PushVar(vm, a14); - -#if !defined (SCRAT_NO_ERROR_CHECKING) - SQRESULT result = sq_call(vm, 15, false, ErrorHandling::IsEnabled()); - sq_settop(vm, top); - - //handle an error: throw the exception - if (SQ_FAILED(result)) { - SQTHROW(vm, LastErrorString(vm)); - return; - } -#else - sq_call(vm, 15, false, ErrorHandling::IsEnabled()); + sq_call(vm, ARGC, false, ErrorHandling::IsEnabled()); sq_settop(vm, top); #endif } @@ -2251,414 +367,8 @@ public: /// This function MUST have its Error handled if it occurred. /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void operator()() { - Execute(); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1) { - Execute(a1); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2) { - Execute(a1, a2); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3) { - Execute(a1, a2, a3); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4) { - Execute(a1, a2, a3, a4); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - Execute(a1, a2, a3, a4, a5); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - Execute(a1, a2, a3, a4, a5, a6); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - Execute(a1, a2, a3, a4, a5, a6, a7); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// \param a13 Argument 13 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A13 Type of argument 13 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /// Runs the Function - /// - /// \param a1 Argument 1 of the Function - /// \param a2 Argument 2 of the Function - /// \param a3 Argument 3 of the Function - /// \param a4 Argument 4 of the Function - /// \param a5 Argument 5 of the Function - /// \param a6 Argument 6 of the Function - /// \param a7 Argument 7 of the Function - /// \param a8 Argument 8 of the Function - /// \param a9 Argument 9 of the Function - /// \param a10 Argument 10 of the Function - /// \param a11 Argument 11 of the Function - /// \param a12 Argument 12 of the Function - /// \param a13 Argument 13 of the Function - /// \param a14 Argument 14 of the Function - /// - /// \tparam A1 Type of argument 1 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A2 Type of argument 2 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A3 Type of argument 3 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A4 Type of argument 4 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A5 Type of argument 5 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A6 Type of argument 6 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A7 Type of argument 7 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A8 Type of argument 8 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A9 Type of argument 9 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A10 Type of argument 10 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A11 Type of argument 11 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A12 Type of argument 12 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A13 Type of argument 13 of the Function (usually doesnt need to be defined explicitly) - /// \tparam A14 Type of argument 14 of the Function (usually doesnt need to be defined explicitly) - /// - /// \remarks - /// This function MUST have its Error handled if it occurred. - /// - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - template - void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13, A14 a14) { - Execute(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + template < class... Args > void operator()(Args &&... args) { + Execute(std::forward< Args >(args)...); } }; diff --git a/source/Misc/Command.hpp b/source/Misc/Command.hpp index acab84c1..6454a64d 100644 --- a/source/Misc/Command.hpp +++ b/source/Misc/Command.hpp @@ -409,7 +409,7 @@ protected: // Attempt to forward the error to that callback try { - m_OnFail.Execute< Int32, CSStr, T >(type, msg, data); + m_OnFail.Execute(type, msg, data); } catch (const Sqrat::Exception & e) {