--- a/src/squirrel_helper.hpp Fri Mar 16 09:44:13 2007 +0000
+++ b/src/squirrel_helper.hpp Fri Mar 16 09:57:39 2007 +0000
@@ -37,6 +37,16 @@
}
/**
+ * The real C++ caller for function with no return value and 0 params.
+ */
+ template <typename CL>
+ static int SQCall(CL *instance, void (CL::*func)(), HSQUIRRELVM vm)
+ {
+ (instance->*func)();
+ return 0;
+ }
+
+ /**
* The real C++ caller for function with a return value and 1 param.
*/
template <typename CL, typename RT, typename P1>
@@ -48,6 +58,18 @@
}
/**
+ * The real C++ caller for function with no return value and 1 param.
+ */
+ template <typename CL, typename P1>
+ static int SQCall(CL *instance, void (CL::*func)(P1), HSQUIRRELVM vm)
+ {
+ (instance->*func)(
+ GetParam(ForceType<P1>(), vm, 2)
+ );
+ return 0;
+ }
+
+ /**
* The real C++ caller for function with a return value and 2 params.
*/
template <typename CL, typename RT, typename P1, typename P2>
@@ -60,6 +82,19 @@
}
/**
+ * The real C++ caller for function with no return value and 2 params.
+ */
+ template <typename CL, typename P1, typename P2>
+ static int SQCall(CL *instance, void (CL::*func)(P1, P2), HSQUIRRELVM vm)
+ {
+ (instance->*func)(
+ GetParam(ForceType<P1>(), vm, 2),
+ GetParam(ForceType<P2>(), vm, 3)
+ );
+ return 0;
+ }
+
+ /**
* The real C++ caller for function with a return value and 3 params.
*/
template <typename CL, typename RT, typename P1, typename P2, typename P3>
@@ -73,6 +108,20 @@
}
/**
+ * The real C++ caller for function with no return value and 3 params.
+ */
+ template <typename CL, typename P1, typename P2, typename P3>
+ static int SQCall(CL *instance, void (CL::*func)(P1, P2, P3), HSQUIRRELVM vm)
+ {
+ (instance->*func)(
+ GetParam(ForceType<P1>(), vm, 2),
+ GetParam(ForceType<P2>(), vm, 3),
+ GetParam(ForceType<P3>(), vm, 4)
+ );
+ return 0;
+ }
+
+ /**
* A general template for all callback functions from Squirrel.
* In here the function_proc is recovered, and the SQCall is called that
* can handle this exact amount of params.