diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index 6a3ba6125b..d5db92c74e 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -56,6 +56,10 @@ namespace SQConvert { template struct HasVoidReturnT : IsVoidT {}; template struct HasVoidReturnT : IsVoidT {}; template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; template struct HasVoidReturnT : IsVoidT {}; /* methods */ template struct HasVoidReturnT : IsVoidT {}; @@ -64,6 +68,10 @@ namespace SQConvert { template struct HasVoidReturnT : IsVoidT {}; template struct HasVoidReturnT : IsVoidT {}; template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; + template struct HasVoidReturnT : IsVoidT {}; template struct HasVoidReturnT : IsVoidT {}; @@ -611,6 +619,416 @@ namespace SQConvert { } }; + /** + * The real C++ caller for function with return value and 6 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for function with no return value and 6 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr) + ); + return 0; + } + }; + + /** + * The real C++ caller for method with return value and 6 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for method with no return value and 6 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr) + ); + return 0; + } + + static Tcls *SQConstruct(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tcls *inst = new Tcls( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr) + ); + + return inst; + } + }; + + /** + * The real C++ caller for function with return value and 7 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for function with no return value and 7 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr) + ); + return 0; + } + }; + + /** + * The real C++ caller for method with return value and 7 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for method with no return value and 7 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr) + ); + return 0; + } + + static Tcls *SQConstruct(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tcls *inst = new Tcls( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr) + ); + + return inst; + } + }; + + /** + * The real C++ caller for function with return value and 8 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for function with no return value and 8 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr) + ); + return 0; + } + }; + + /** + * The real C++ caller for method with return value and 8 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for method with no return value and 8 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr) + ); + return 0; + } + + static Tcls *SQConstruct(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tcls *inst = new Tcls( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr) + ); + + return inst; + } + }; + + /** + * The real C++ caller for function with return value and 9 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr), + GetParam(ForceType(), vm, 10, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for function with no return value and 9 params. + */ + template + struct HelperT { + static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr), + GetParam(ForceType(), vm, 10, &ptr) + ); + return 0; + } + }; + + /** + * The real C++ caller for method with return value and 9 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tretval ret = (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr), + GetParam(ForceType(), vm, 10, &ptr) + ); + return Return(vm, ret); + } + }; + + /** + * The real C++ caller for method with no return value and 9 params. + */ + template + struct HelperT { + static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + (instance->*func)( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr), + GetParam(ForceType(), vm, 10, &ptr) + ); + return 0; + } + + static Tcls *SQConstruct(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9), HSQUIRRELVM vm) + { + SQAutoFreePointers ptr; + Tcls *inst = new Tcls( + GetParam(ForceType(), vm, 2, &ptr), + GetParam(ForceType(), vm, 3, &ptr), + GetParam(ForceType(), vm, 4, &ptr), + GetParam(ForceType(), vm, 5, &ptr), + GetParam(ForceType(), vm, 6, &ptr), + GetParam(ForceType(), vm, 7, &ptr), + GetParam(ForceType(), vm, 8, &ptr), + GetParam(ForceType(), vm, 9, &ptr), + GetParam(ForceType(), vm, 10, &ptr) + ); + + return inst; + } + }; + /** * The real C++ caller for function with return value and 10 params. */