From 280312399d5ccd58255d9afc9561ca6901c10430 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Wed, 21 Jun 2017 10:39:25 -0400 Subject: [PATCH] Fix compile errors on Linux with new VScript param limit. --- public/vscript/ivscript.h | 57 ------------------------------ public/vscript/vscript_templates.h | 25 +++++++++---- 2 files changed, 19 insertions(+), 63 deletions(-) diff --git a/public/vscript/ivscript.h b/public/vscript/ivscript.h index 15209109..8e26d62b 100644 --- a/public/vscript/ivscript.h +++ b/public/vscript/ivscript.h @@ -929,21 +929,6 @@ public: ScriptVariant_t args[12]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; return ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, hScope, bWait ); } - - template - ScriptStatus_t Call( HSCRIPT hFunction, HSCRIPT hScope, bool bWait, ScriptVariant_t *pReturn, ARG_TYPE_1 arg1, ARG_TYPE_2 arg2, ARG_TYPE_3 arg3, ARG_TYPE_4 arg4, ARG_TYPE_5 arg5, ARG_TYPE_6 arg6, ARG_TYPE_7 arg7, ARG_TYPE_8 arg8, ARG_TYPE_9 arg9, ARG_TYPE_10 arg10, ARG_TYPE_11 arg11, ARG_TYPE_12 arg12, ARG_TYPE_13 arg13 ) - { - ScriptVariant_t args[13]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; args[12] = arg13; - return ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, hScope, bWait ); - } - - template - ScriptStatus_t Call( HSCRIPT hFunction, HSCRIPT hScope, bool bWait, ScriptVariant_t *pReturn, ARG_TYPE_1 arg1, ARG_TYPE_2 arg2, ARG_TYPE_3 arg3, ARG_TYPE_4 arg4, ARG_TYPE_5 arg5, ARG_TYPE_6 arg6, ARG_TYPE_7 arg7, ARG_TYPE_8 arg8, ARG_TYPE_9 arg9, ARG_TYPE_10 arg10, ARG_TYPE_11 arg11, ARG_TYPE_12 arg12, ARG_TYPE_13 arg13, ARG_TYPE_14 arg14 ) - { - ScriptVariant_t args[14]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; args[12] = arg13; args[13] = arg14; - return ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, hScope, bWait ); - } - }; @@ -1188,20 +1173,6 @@ public: return GetVM()->ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, m_hScope, true ); } - template - ScriptStatus_t Call( HSCRIPT hFunction, ScriptVariant_t *pReturn, ARG_TYPE_1 arg1, ARG_TYPE_2 arg2, ARG_TYPE_3 arg3, ARG_TYPE_4 arg4, ARG_TYPE_5 arg5, ARG_TYPE_6 arg6, ARG_TYPE_7 arg7, ARG_TYPE_8 arg8, ARG_TYPE_9 arg9, ARG_TYPE_10 arg10, ARG_TYPE_11 arg11, ARG_TYPE_12 arg12, ARG_TYPE_13 arg13 ) - { - ScriptVariant_t args[13]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; args[12] = arg13; - return GetVM()->ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, m_hScope, true ); - } - - template - ScriptStatus_t Call( HSCRIPT hFunction, ScriptVariant_t *pReturn, ARG_TYPE_1 arg1, ARG_TYPE_2 arg2, ARG_TYPE_3 arg3, ARG_TYPE_4 arg4, ARG_TYPE_5 arg5, ARG_TYPE_6 arg6, ARG_TYPE_7 arg7, ARG_TYPE_8 arg8, ARG_TYPE_9 arg9, ARG_TYPE_10 arg10, ARG_TYPE_11 arg11, ARG_TYPE_12 arg12, ARG_TYPE_13 arg13, ARG_TYPE_14 arg14 ) - { - ScriptVariant_t args[14]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; args[12] = arg13; args[13] = arg14; - return GetVM()->ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, m_hScope, true ); - } - ScriptStatus_t Call( const char *pszFunction, ScriptVariant_t *pReturn = NULL ) { HSCRIPT hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); @@ -1356,30 +1327,6 @@ public: return status; } - template - ScriptStatus_t Call( const char *pszFunction, ScriptVariant_t *pReturn, ARG_TYPE_1 arg1, ARG_TYPE_2 arg2, ARG_TYPE_3 arg3, ARG_TYPE_4 arg4, ARG_TYPE_5 arg5, ARG_TYPE_6 arg6, ARG_TYPE_7 arg7, ARG_TYPE_8 arg8, ARG_TYPE_9 arg9, ARG_TYPE_10 arg10, ARG_TYPE_11 arg11, ARG_TYPE_12 arg12, ARG_TYPE_13 arg13 ) - { - ScriptVariant_t args[13]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; args[12] = arg13; - HSCRIPT hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); - if ( !hFunction ) - return SCRIPT_ERROR; - ScriptStatus_t status = GetVM()->ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, m_hScope, true ); - GetVM()->ReleaseFunction( hFunction ); - return status; - } - - template - ScriptStatus_t Call( const char *pszFunction, ScriptVariant_t *pReturn, ARG_TYPE_1 arg1, ARG_TYPE_2 arg2, ARG_TYPE_3 arg3, ARG_TYPE_4 arg4, ARG_TYPE_5 arg5, ARG_TYPE_6 arg6, ARG_TYPE_7 arg7, ARG_TYPE_8 arg8, ARG_TYPE_9 arg9, ARG_TYPE_10 arg10, ARG_TYPE_11 arg11, ARG_TYPE_12 arg12, ARG_TYPE_13 arg13, ARG_TYPE_14 arg14 ) - { - ScriptVariant_t args[14]; args[0] = arg1; args[1] = arg2; args[2] = arg3; args[3] = arg4; args[4] = arg5; args[5] = arg6; args[6] = arg7; args[7] = arg8; args[8] = arg9; args[9] = arg10; args[10] = arg11; args[11] = arg12; args[12] = arg13; args[13] = arg14; - HSCRIPT hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); - if ( !hFunction ) - return SCRIPT_ERROR; - ScriptStatus_t status = GetVM()->ExecuteFunction( hFunction, args, ARRAYSIZE(args), pReturn, m_hScope, true ); - GetVM()->ReleaseFunction( hFunction ); - return status; - } - protected: HSCRIPT m_hScope; int m_flags; @@ -1487,8 +1434,6 @@ public: #define DEFINE_SCRIPT_PROXY_10( FuncName ) DEFINE_SCRIPT_PROXY_GUTS( FuncName, 10 ) #define DEFINE_SCRIPT_PROXY_11( FuncName ) DEFINE_SCRIPT_PROXY_GUTS( FuncName, 11 ) #define DEFINE_SCRIPT_PROXY_12( FuncName ) DEFINE_SCRIPT_PROXY_GUTS( FuncName, 12 ) -#define DEFINE_SCRIPT_PROXY_13( FuncName ) DEFINE_SCRIPT_PROXY_GUTS( FuncName, 13 ) -#define DEFINE_SCRIPT_PROXY_14( FuncName ) DEFINE_SCRIPT_PROXY_GUTS( FuncName, 14 ) #define DEFINE_SCRIPT_PROXY_1V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 1 ) #define DEFINE_SCRIPT_PROXY_2V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 2 ) @@ -1502,8 +1447,6 @@ public: #define DEFINE_SCRIPT_PROXY_10V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 10 ) #define DEFINE_SCRIPT_PROXY_11V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 11 ) #define DEFINE_SCRIPT_PROXY_12V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 12 ) -#define DEFINE_SCRIPT_PROXY_13V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 13 ) -#define DEFINE_SCRIPT_PROXY_14V( FuncName ) DEFINE_SCRIPT_PROXY_GUTS_NO_RETVAL( FuncName, 14 ) //----------------------------------------------------------------------------- diff --git a/public/vscript/vscript_templates.h b/public/vscript/vscript_templates.h index 95cf3d58..85375f18 100644 --- a/public/vscript/vscript_templates.h +++ b/public/vscript/vscript_templates.h @@ -26,8 +26,6 @@ #define FUNC_APPEND_PARAMS_10 pDesc->m_iParamCount = 10; pDesc->m_Parameters[0] = ScriptDeduceType( FUNC_ARG_TYPE_1 ); pDesc->m_Parameters[1] = ScriptDeduceType( FUNC_ARG_TYPE_2 ); pDesc->m_Parameters[2] = ScriptDeduceType( FUNC_ARG_TYPE_3 ); pDesc->m_Parameters[3] = ScriptDeduceType( FUNC_ARG_TYPE_4 ); pDesc->m_Parameters[4] = ScriptDeduceType( FUNC_ARG_TYPE_5 ); pDesc->m_Parameters[5] = ScriptDeduceType( FUNC_ARG_TYPE_6 ); pDesc->m_Parameters[6] = ScriptDeduceType( FUNC_ARG_TYPE_7 ); pDesc->m_Parameters[7] = ScriptDeduceType( FUNC_ARG_TYPE_8 ); pDesc->m_Parameters[8] = ScriptDeduceType( FUNC_ARG_TYPE_9 ); pDesc->m_Parameters[9] = ScriptDeduceType( FUNC_ARG_TYPE_10 ); #define FUNC_APPEND_PARAMS_11 pDesc->m_iParamCount = 11; pDesc->m_Parameters[0] = ScriptDeduceType( FUNC_ARG_TYPE_1 ); pDesc->m_Parameters[1] = ScriptDeduceType( FUNC_ARG_TYPE_2 ); pDesc->m_Parameters[2] = ScriptDeduceType( FUNC_ARG_TYPE_3 ); pDesc->m_Parameters[3] = ScriptDeduceType( FUNC_ARG_TYPE_4 ); pDesc->m_Parameters[4] = ScriptDeduceType( FUNC_ARG_TYPE_5 ); pDesc->m_Parameters[5] = ScriptDeduceType( FUNC_ARG_TYPE_6 ); pDesc->m_Parameters[6] = ScriptDeduceType( FUNC_ARG_TYPE_7 ); pDesc->m_Parameters[7] = ScriptDeduceType( FUNC_ARG_TYPE_8 ); pDesc->m_Parameters[8] = ScriptDeduceType( FUNC_ARG_TYPE_9 ); pDesc->m_Parameters[9] = ScriptDeduceType( FUNC_ARG_TYPE_10 ); pDesc->m_Parameters[10] = ScriptDeduceType( FUNC_ARG_TYPE_11 ); #define FUNC_APPEND_PARAMS_12 pDesc->m_iParamCount = 12; pDesc->m_Parameters[0] = ScriptDeduceType( FUNC_ARG_TYPE_1 ); pDesc->m_Parameters[1] = ScriptDeduceType( FUNC_ARG_TYPE_2 ); pDesc->m_Parameters[2] = ScriptDeduceType( FUNC_ARG_TYPE_3 ); pDesc->m_Parameters[3] = ScriptDeduceType( FUNC_ARG_TYPE_4 ); pDesc->m_Parameters[4] = ScriptDeduceType( FUNC_ARG_TYPE_5 ); pDesc->m_Parameters[5] = ScriptDeduceType( FUNC_ARG_TYPE_6 ); pDesc->m_Parameters[6] = ScriptDeduceType( FUNC_ARG_TYPE_7 ); pDesc->m_Parameters[7] = ScriptDeduceType( FUNC_ARG_TYPE_8 ); pDesc->m_Parameters[8] = ScriptDeduceType( FUNC_ARG_TYPE_9 ); pDesc->m_Parameters[9] = ScriptDeduceType( FUNC_ARG_TYPE_10 ); pDesc->m_Parameters[10] = ScriptDeduceType( FUNC_ARG_TYPE_11 ); pDesc->m_Parameters[11] = ScriptDeduceType( FUNC_ARG_TYPE_12 ); -#define FUNC_APPEND_PARAMS_13 static_assert(0, "Too many params"); -#define FUNC_APPEND_PARAMS_14 static_assert(0, "Too many params"); #define DEFINE_NONMEMBER_FUNC_TYPE_DEDUCER(N) \ template \ @@ -40,7 +38,22 @@ ++pDesc->m_iVariantCount; \ } -FUNC_GENERATE_ALL(DEFINE_NONMEMBER_FUNC_TYPE_DEDUCER); +#define VSCRIPT_FUNC_GENERATE_ALL(INNERMACRONAME) \ + INNERMACRONAME(0); \ + INNERMACRONAME(1); \ + INNERMACRONAME(2); \ + INNERMACRONAME(3); \ + INNERMACRONAME(4); \ + INNERMACRONAME(5); \ + INNERMACRONAME(6); \ + INNERMACRONAME(7); \ + INNERMACRONAME(8); \ + INNERMACRONAME(9); \ + INNERMACRONAME(10);\ + INNERMACRONAME(11);\ + INNERMACRONAME(12); + +VSCRIPT_FUNC_GENERATE_ALL(DEFINE_NONMEMBER_FUNC_TYPE_DEDUCER); #define DEFINE_MEMBER_FUNC_TYPE_DEDUCER(N) \ template \ @@ -53,7 +66,7 @@ FUNC_GENERATE_ALL(DEFINE_NONMEMBER_FUNC_TYPE_DEDUCER); ++pDesc->m_iVariantCount; \ } -FUNC_GENERATE_ALL( DEFINE_MEMBER_FUNC_TYPE_DEDUCER ); +VSCRIPT_FUNC_GENERATE_ALL( DEFINE_MEMBER_FUNC_TYPE_DEDUCER ); //------------------------------------- @@ -68,7 +81,7 @@ FUNC_GENERATE_ALL( DEFINE_MEMBER_FUNC_TYPE_DEDUCER ); ++pDesc->m_iVariantCount; \ } -FUNC_GENERATE_ALL( DEFINE_CONST_MEMBER_FUNC_TYPE_DEDUCER ); +VSCRIPT_FUNC_GENERATE_ALL( DEFINE_CONST_MEMBER_FUNC_TYPE_DEDUCER ); #define ScriptInitMemberFuncDescriptor_( pDesc, class, func, scriptName ) if ( 0 ) {} else { (pDesc)->m_pszScriptName = scriptName; (pDesc)->m_pszFunction = #func; ScriptDeduceFunctionSignature( pDesc, (class *)(0), &class::func ); } @@ -414,7 +427,7 @@ inline FUNCPTR_TYPE ScriptConvertFuncPtrFromVoid( void *p ) return &CMemberScriptBinding##N::Call; \ } -FUNC_GENERATE_ALL( DEFINE_SCRIPT_BINDINGS ); +VSCRIPT_FUNC_GENERATE_ALL( DEFINE_SCRIPT_BINDINGS ); //----------------------------------------------------------------------------- //