author | truelight |
Sun, 25 Mar 2007 16:32:02 +0000 | |
branch | noai |
changeset 9530 | 5b93bc87cc5e |
parent 9529 | 5f26f4bc574b |
child 9531 | 6a2e35738593 |
permissions | -rw-r--r-- |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
2 |
|
9424
90e9aa6326f3
(svn r9226) [NoAI] -Change: moved some ai/squirrel files to root
truelight
parents:
9387
diff
changeset
|
3 |
/** @file squirrel_helper.hpp declarations and parts of the implementation of the class for convert code */ |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
4 |
|
9424
90e9aa6326f3
(svn r9226) [NoAI] -Change: moved some ai/squirrel files to root
truelight
parents:
9387
diff
changeset
|
5 |
#ifndef SQUIRREL_HELPER_HPP |
90e9aa6326f3
(svn r9226) [NoAI] -Change: moved some ai/squirrel files to root
truelight
parents:
9387
diff
changeset
|
6 |
#define SQUIRREL_HELPER_HPP |
90e9aa6326f3
(svn r9226) [NoAI] -Change: moved some ai/squirrel files to root
truelight
parents:
9387
diff
changeset
|
7 |
|
90e9aa6326f3
(svn r9226) [NoAI] -Change: moved some ai/squirrel files to root
truelight
parents:
9387
diff
changeset
|
8 |
#include <squirrel.h> |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
9 |
|
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
10 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
11 |
* The Squirrel convert routines |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
12 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
13 |
namespace SQConvert { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
14 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
15 |
template <bool Y> struct YesT { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
16 |
static const bool Yes = Y; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
17 |
static const bool No = !Y; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
18 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
19 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
20 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
21 |
* Helper class to recognize if the given type is void. Usage: 'IsVoidT<T>::Yes' |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
22 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
23 |
template <typename T> struct IsVoidT : YesT<false> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
24 |
template <> struct IsVoidT<void> : YesT<true> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
25 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
26 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
27 |
* Helper class to recognize if the function/method return type is void. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
28 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
29 |
template <typename Tfunc> struct HasVoidReturnT; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
30 |
/* functions */ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
31 |
template <typename Tretval> struct HasVoidReturnT<Tretval (*)()> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
32 |
template <typename Tretval, typename Targ1> struct HasVoidReturnT<Tretval (*)(Targ1)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
33 |
template <typename Tretval, typename Targ1, typename Targ2> struct HasVoidReturnT<Tretval (*)(Targ1, Targ2)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
34 |
template <typename Tretval, typename Targ1, typename Targ2, typename Targ3> struct HasVoidReturnT<Tretval (*)(Targ1, Targ2, Targ3)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
35 |
template <typename Tretval, typename Targ1, typename Targ2, typename Targ3, typename Targ4> struct HasVoidReturnT<Tretval (*)(Targ1, Targ2, Targ3, Targ4)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
36 |
/* methods */ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
37 |
template <class Tcls, typename Tretval> struct HasVoidReturnT<Tretval (Tcls::*)()> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
38 |
template <class Tcls, typename Tretval, typename Targ1> struct HasVoidReturnT<Tretval (Tcls::*)(Targ1)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
39 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2> struct HasVoidReturnT<Tretval (Tcls::*)(Targ1, Targ2)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
40 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2, typename Targ3> struct HasVoidReturnT<Tretval (Tcls::*)(Targ1, Targ2, Targ3)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
41 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2, typename Targ3, typename Targ4> struct HasVoidReturnT<Tretval (Tcls::*)(Targ1, Targ2, Targ3, Targ4)> : IsVoidT<Tretval> {}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
42 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
43 |
|
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
44 |
/** |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
45 |
* Special class to make it possible for the compiler to pick the correct GetParam(). |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
46 |
*/ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
47 |
template <typename T> class ForceType { }; |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
48 |
|
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
49 |
/** |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
50 |
* To return a value to squirrel, we call this function. It converts to the right format. |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
51 |
*/ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
52 |
template <typename T> static int Return(HSQUIRRELVM vm, T t); |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
53 |
|
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
54 |
template <> inline int Return<uint8> (HSQUIRRELVM vm, uint8 res) { sq_pushinteger(vm, (int32)res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
55 |
template <> inline int Return<uint16>(HSQUIRRELVM vm, uint16 res) { sq_pushinteger(vm, (int32)res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
56 |
template <> inline int Return<uint32>(HSQUIRRELVM vm, uint32 res) { sq_pushinteger(vm, (int32)res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
57 |
template <> inline int Return<int8> (HSQUIRRELVM vm, int8 res) { sq_pushinteger(vm, res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
58 |
template <> inline int Return<int16> (HSQUIRRELVM vm, int16 res) { sq_pushinteger(vm, res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
59 |
template <> inline int Return<int32> (HSQUIRRELVM vm, int32 res) { sq_pushinteger(vm, res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
60 |
template <> inline int Return<bool> (HSQUIRRELVM vm, bool res) { sq_pushbool (vm, res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
61 |
template <> inline int Return<char *>(HSQUIRRELVM vm, char *res) { if (res == NULL) sq_pushnull(vm); else sq_pushstring (vm, OTTD2FS(res), strlen(res)); free(res); return 1; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
62 |
|
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
63 |
/** |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
64 |
* To get a param from squirrel, we call this function. It converts to the right format. |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
65 |
*/ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
66 |
template <typename T> static T GetParam(ForceType<T>, HSQUIRRELVM vm, int index); |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
67 |
|
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
68 |
template <> inline uint8 GetParam(ForceType<uint8> , HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return tmp; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
69 |
template <> inline uint16 GetParam(ForceType<uint16> , HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return tmp; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
70 |
template <> inline uint32 GetParam(ForceType<uint32> , HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return tmp; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
71 |
template <> inline int8 GetParam(ForceType<int8> , HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return tmp; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
72 |
template <> inline int16 GetParam(ForceType<int16> , HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return tmp; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
73 |
template <> inline int32 GetParam(ForceType<int32> , HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return tmp; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
74 |
template <> inline bool GetParam(ForceType<bool> , HSQUIRRELVM vm, int index) { SQBool tmp; sq_getbool (vm, index, &tmp); return tmp != 0; } |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
75 |
template <> inline const char *GetParam(ForceType<const char *>, HSQUIRRELVM vm, int index) { const SQChar *tmp; sq_getstring (vm, index, &tmp); return FS2OTTD(tmp); } |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
76 |
|
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
77 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
78 |
* Helper class to recognize the function type (retval type, args) and use the proper specialization |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
79 |
* for SQ callback. The partial specializations for the second arg (Tis_void_retval) are not possible |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
80 |
* on the function. Therefore the class is used instead. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
81 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
82 |
template <typename Tfunc, bool Tis_void_retval = HasVoidReturnT<Tfunc>::Yes> struct HelperT; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
83 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
84 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
85 |
* The real C++ caller for function with return value and 0 params. |
9437
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
86 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
87 |
template <typename Tretval> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
88 |
struct HelperT<Tretval (*)(), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
89 |
static int SQCall(void *instance, Tretval (*func)(), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
90 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
91 |
return Return(vm, (*func)()); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
92 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
93 |
}; |
9437
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
94 |
|
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
95 |
/** |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
96 |
* The real C++ caller for function with no return value and 0 params. |
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
97 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
98 |
template <typename Tretval> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
99 |
struct HelperT<Tretval (*)(), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
100 |
static int SQCall(void *instance, Tretval (*func)(), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
101 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
102 |
(*func)(); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
103 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
104 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
105 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
106 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
107 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
108 |
* The real C++ caller for method with return value and 0 params. |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
109 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
110 |
template <class Tcls, typename Tretval> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
111 |
struct HelperT<Tretval (Tcls::*)(), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
112 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
113 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
114 |
return Return(vm, (instance->*func)()); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
115 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
116 |
}; |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
117 |
|
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
118 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
119 |
* The real C++ caller for method with no return value and 0 params. |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
120 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
121 |
template <class Tcls, typename Tretval> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
122 |
struct HelperT<Tretval (Tcls::*)(), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
123 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
124 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
125 |
(instance->*func)(); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
126 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
127 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
128 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
129 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
130 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
131 |
* The real C++ caller for function with return value and 1 param. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
132 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
133 |
template <typename Tretval, typename Targ1> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
134 |
struct HelperT<Tretval (*)(Targ1), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
135 |
static int SQCall(void *instance, Tretval (*func)(Targ1), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
136 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
137 |
return Return(vm, (*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
138 |
GetParam(ForceType<Targ1>(), vm, 2) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
139 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
140 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
141 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
142 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
143 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
144 |
* The real C++ caller for function with no return value and 1 param. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
145 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
146 |
template <typename Tretval, typename Targ1> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
147 |
struct HelperT<Tretval (*)(Targ1), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
148 |
static int SQCall(void *instance, Tretval (*func)(Targ1), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
149 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
150 |
(*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
151 |
GetParam(ForceType<Targ1>(), vm, 2) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
152 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
153 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
154 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
155 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
156 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
157 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
158 |
* The real C++ caller for method with return value and 1 param. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
159 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
160 |
template <class Tcls, typename Tretval, typename Targ1> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
161 |
struct HelperT<Tretval (Tcls::*)(Targ1), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
162 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
163 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
164 |
return Return(vm, (instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
165 |
GetParam(ForceType<Targ1>(), vm, 2) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
166 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
167 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
168 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
169 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
170 |
/** |
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
171 |
* The real C++ caller for method with no return value and 1 param. |
9437
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
172 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
173 |
template <class Tcls, typename Tretval, typename Targ1> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
174 |
struct HelperT<Tretval (Tcls::*)(Targ1), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
175 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
176 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
177 |
(instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
178 |
GetParam(ForceType<Targ1>(), vm, 2) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
179 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
180 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
181 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
182 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
183 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
184 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
185 |
* The real C++ caller for function with return value and 2 params. |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
186 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
187 |
template <typename Tretval, typename Targ1, typename Targ2> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
188 |
struct HelperT<Tretval (*)(Targ1, Targ2), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
189 |
static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
190 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
191 |
return Return(vm, (*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
192 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
193 |
GetParam(ForceType<Targ2>(), vm, 3) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
194 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
195 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
196 |
}; |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
197 |
|
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
198 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
199 |
* The real C++ caller for function with no return value and 2 params. |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
200 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
201 |
template <typename Tretval, typename Targ1, typename Targ2> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
202 |
struct HelperT<Tretval (*)(Targ1, Targ2), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
203 |
static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
204 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
205 |
(*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
206 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
207 |
GetParam(ForceType<Targ2>(), vm, 3) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
208 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
209 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
210 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
211 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
212 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
213 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
214 |
* The real C++ caller for method with return value and 2 params. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
215 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
216 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
217 |
struct HelperT<Tretval (Tcls::*)(Targ1, Targ2), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
218 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
219 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
220 |
return Return(vm, (instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
221 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
222 |
GetParam(ForceType<Targ2>(), vm, 3) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
223 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
224 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
225 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
226 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
227 |
/** |
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
228 |
* The real C++ caller for method with no return value and 2 params. |
9437
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
229 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
230 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
231 |
struct HelperT<Tretval (Tcls::*)(Targ1, Targ2), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
232 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
233 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
234 |
(instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
235 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
236 |
GetParam(ForceType<Targ2>(), vm, 3) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
237 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
238 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
239 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
240 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
241 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
242 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
243 |
* The real C++ caller for function with return value and 3 params. |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
244 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
245 |
template <typename Tretval, typename Targ1, typename Targ2, typename Targ3> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
246 |
struct HelperT<Tretval (*)(Targ1, Targ2, Targ3), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
247 |
static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
248 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
249 |
return Return(vm, (*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
250 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
251 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
252 |
GetParam(ForceType<Targ3>(), vm, 4) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
253 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
254 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
255 |
}; |
9437
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
256 |
|
28e0105114a4
(svn r9248) [NoAI] -Add: added templates for void func() to SQ functions
truelight
parents:
9434
diff
changeset
|
257 |
/** |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
258 |
* The real C++ caller for function with no return value and 3 params. |
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
259 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
260 |
template <typename Tretval, typename Targ1, typename Targ2, typename Targ3> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
261 |
struct HelperT<Tretval (*)(Targ1, Targ2, Targ3), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
262 |
static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
263 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
264 |
(*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
265 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
266 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
267 |
GetParam(ForceType<Targ3>(), vm, 4) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
268 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
269 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
270 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
271 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
272 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
273 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
274 |
* The real C++ caller for method with return value and 3 params. |
9480
d071f885f918
(svn r9329) [NoAI] -Fix: add AIRoad() for Squirrel
truelight
parents:
9437
diff
changeset
|
275 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
276 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2, typename Targ3> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
277 |
struct HelperT<Tretval (Tcls::*)(Targ1, Targ2, Targ3), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
278 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
279 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
280 |
return Return(vm, (instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
281 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
282 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
283 |
GetParam(ForceType<Targ3>(), vm, 4) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
284 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
285 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
286 |
}; |
9480
d071f885f918
(svn r9329) [NoAI] -Fix: add AIRoad() for Squirrel
truelight
parents:
9437
diff
changeset
|
287 |
|
d071f885f918
(svn r9329) [NoAI] -Fix: add AIRoad() for Squirrel
truelight
parents:
9437
diff
changeset
|
288 |
/** |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
289 |
* The real C++ caller for method with no return value and 3 params. |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
290 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
291 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2, typename Targ3> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
292 |
struct HelperT<Tretval (Tcls::*)(Targ1, Targ2, Targ3), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
293 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
294 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
295 |
(instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
296 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
297 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
298 |
GetParam(ForceType<Targ3>(), vm, 4) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
299 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
300 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
301 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
302 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
303 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
304 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
305 |
* The real C++ caller for function with return value and 4 params. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
306 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
307 |
template <typename Tretval, typename Targ1, typename Targ2, typename Targ3, typename Targ4> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
308 |
struct HelperT<Tretval (*)(Targ1, Targ2, Targ3, Targ4), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
309 |
static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
310 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
311 |
return Return(vm, (*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
312 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
313 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
314 |
GetParam(ForceType<Targ3>(), vm, 4), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
315 |
GetParam(ForceType<Targ4>(), vm, 5) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
316 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
317 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
318 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
319 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
320 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
321 |
* The real C++ caller for function with no return value and 4 params. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
322 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
323 |
template <typename Tretval, typename Targ1, typename Targ2, typename Targ3, typename Targ4> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
324 |
struct HelperT<Tretval (*)(Targ1, Targ2, Targ3, Targ4), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
325 |
static int SQCall(void *instance, Tretval (*func)(Targ1, Targ2, Targ3, Targ4), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
326 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
327 |
(*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
328 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
329 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
330 |
GetParam(ForceType<Targ3>(), vm, 4), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
331 |
GetParam(ForceType<Targ4>(), vm, 5) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
332 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
333 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
334 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
335 |
}; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
336 |
|
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
337 |
/** |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
338 |
* The real C++ caller for method with return value and 4 params. |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
339 |
*/ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
340 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2, typename Targ3, typename Targ4> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
341 |
struct HelperT<Tretval (Tcls::*)(Targ1, Targ2, Targ3, Targ4), false> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
342 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
343 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
344 |
return Return(vm, (instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
345 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
346 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
347 |
GetParam(ForceType<Targ3>(), vm, 4), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
348 |
GetParam(ForceType<Targ4>(), vm, 5) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
349 |
)); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
350 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
351 |
}; |
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
352 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
353 |
/** |
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
354 |
* The real C++ caller for method with no return value and 4 params. |
9480
d071f885f918
(svn r9329) [NoAI] -Fix: add AIRoad() for Squirrel
truelight
parents:
9437
diff
changeset
|
355 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
356 |
template <class Tcls, typename Tretval, typename Targ1, typename Targ2, typename Targ3, typename Targ4> |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
357 |
struct HelperT<Tretval (Tcls::*)(Targ1, Targ2, Targ3, Targ4), true> { |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
358 |
static int SQCall(Tcls *instance, Tretval (Tcls::*func)(Targ1, Targ2, Targ3, Targ4), HSQUIRRELVM vm) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
359 |
{ |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
360 |
(instance->*func)( |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
361 |
GetParam(ForceType<Targ1>(), vm, 2), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
362 |
GetParam(ForceType<Targ2>(), vm, 3), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
363 |
GetParam(ForceType<Targ3>(), vm, 4), |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
364 |
GetParam(ForceType<Targ4>(), vm, 5) |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
365 |
); |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
366 |
return 0; |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
367 |
} |
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
368 |
}; |
9480
d071f885f918
(svn r9329) [NoAI] -Fix: add AIRoad() for Squirrel
truelight
parents:
9437
diff
changeset
|
369 |
|
9490
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
370 |
|
999eb7531205
(svn r9360) [NoAI] -Add: class-functions can now be static and still be added to SQ. There they behave as they are non-static, which is fine for that level of coding.
truelight
parents:
9480
diff
changeset
|
371 |
/** |
9530
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
372 |
* A general template for all non-static method callbacks from Squirrel. |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
373 |
* In here the function_proc is recovered, and the SQCall is called that |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
374 |
* can handle this exact amount of params. |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
375 |
*/ |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
376 |
template <typename Tcls, typename Tmethod> |
9530
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
377 |
inline SQInteger DefSQNonStaticCallback(HSQUIRRELVM vm) |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
378 |
{ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
379 |
/* Find the amount of params we got */ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
380 |
int nparam = sq_gettop(vm); |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
381 |
SQUserPointer ptr = NULL; |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
382 |
SQUserPointer real_instance = NULL; |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
383 |
HSQOBJECT instance; |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
384 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
385 |
/* Get the 'SQ' instance of this class */ |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
386 |
Squirrel::GetInstance(vm, &instance); |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
387 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
388 |
/* Protect against calls to a non-static method in a static way */ |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
389 |
sq_pushroottable(vm); |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
390 |
sq_pushstring(vm, Tcls::GetClassName(), -1); |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
391 |
sq_get(vm, -2); |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
392 |
sq_pushobject(vm, instance); |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
393 |
if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static"); |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
394 |
sq_settop(vm, nparam); |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
395 |
|
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
396 |
/* Get the 'real' instance of this class */ |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
397 |
sq_getinstanceup(vm, 1, &real_instance, 0); |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
398 |
/* Get the real function pointer */ |
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
399 |
sq_getuserdata(vm, nparam, &ptr, 0); |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
400 |
|
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
401 |
/* Delegate it to a template that can handle this specific function */ |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9510
diff
changeset
|
402 |
return HelperT<Tmethod>::SQCall((Tcls *)real_instance, *(Tmethod *)ptr, vm); |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
403 |
} |
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
404 |
|
9530
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
405 |
/** |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
406 |
* A general template for all function/static method callbacks from Squirrel. |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
407 |
* In here the function_proc is recovered, and the SQCall is called that |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
408 |
* can handle this exact amount of params. |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
409 |
*/ |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
410 |
template <typename Tcls, typename Tmethod> |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
411 |
inline SQInteger DefSQStaticCallback(HSQUIRRELVM vm) |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
412 |
{ |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
413 |
/* Find the amount of params we got */ |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
414 |
int nparam = sq_gettop(vm); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
415 |
SQUserPointer ptr = NULL; |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
416 |
|
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
417 |
/* Get the real function pointer */ |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
418 |
sq_getuserdata(vm, nparam, &ptr, 0); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
419 |
|
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
420 |
/* Delegate it to a template that can handle this specific function */ |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
421 |
return HelperT<Tmethod>::SQCall((Tcls *)NULL, *(Tmethod *)ptr, vm); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
422 |
} |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
423 |
|
9510
261d33fbabb8
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents:
9499
diff
changeset
|
424 |
}; // namespace SQConvert |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
diff
changeset
|
425 |
|
9424
90e9aa6326f3
(svn r9226) [NoAI] -Change: moved some ai/squirrel files to root
truelight
parents:
9387
diff
changeset
|
426 |
#endif /* SQUIRREL_HELPER_HPP */ |