1.1 --- a/sourcehook/test/testhookmangen.hxx Sun Nov 18 13:12:51 2007 +0000
1.2 +++ b/sourcehook/test/testhookmangen.hxx Sun Nov 18 15:08:03 2007 +0000
1.3 @@ -203,10 +203,7 @@
1.4 struct TestClass##id; \
1.5 typedef ParamState$1<0@[$2,1,$1:, param$2@] > ParamState_m##id; \
1.6 MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
1.7 - MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.8 - MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.9 - MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.10 - MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.11 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.12 \
1.13 struct TestClass##id \
1.14 { \
1.15 @@ -219,70 +216,25 @@
1.16 g_Inside_LeafFunc = false; \
1.17 } \
1.18 \
1.19 - struct Delegate1 : public MyDelegate \
1.20 + struct Delegate : public MyDelegate \
1.21 { \
1.22 + int m_DelegNumber; \
1.23 + Delegate(int num) : m_DelegNumber(num) { } \
1.24 + \
1.25 virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
1.26 { \
1.27 g_Inside_LeafFunc = true; \
1.28 - ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.29 - g_Inside_LeafFunc = false; \
1.30 - if (ms_DoRecall) \
1.31 - { \
1.32 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.33 - RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.34 - } \
1.35 - else \
1.36 - RETURN_META(MRES_IGNORED); \
1.37 - } \
1.38 - }; \
1.39 - struct Delegate2 : public MyDelegate \
1.40 - { \
1.41 - virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
1.42 - { \
1.43 - g_Inside_LeafFunc = true; \
1.44 - ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.45 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.46 g_Inside_LeafFunc = false; \
1.47 if (ms_DoRecall) \
1.48 { \
1.49 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.50 - RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.51 - } \
1.52 - else \
1.53 - RETURN_META(MRES_SUPERCEDE); \
1.54 - } \
1.55 - }; \
1.56 - struct Delegate3 : public MyDelegate \
1.57 - { \
1.58 - virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
1.59 - { \
1.60 - g_Inside_LeafFunc = true; \
1.61 - ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.62 - g_Inside_LeafFunc = false; \
1.63 - if (ms_DoRecall) \
1.64 - { \
1.65 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.66 - RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.67 + RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.68 } \
1.69 else \
1.70 - RETURN_META(MRES_IGNORED); \
1.71 + RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
1.72 } \
1.73 }; \
1.74 - struct Delegate4 : public MyDelegate \
1.75 - { \
1.76 - virtual void Call(@[$2,1,$1|, :param$2 p$2@]) \
1.77 - { \
1.78 - g_Inside_LeafFunc = true; \
1.79 - ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.80 - g_Inside_LeafFunc = false; \
1.81 - if (ms_DoRecall) \
1.82 - { \
1.83 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.84 - RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.85 - } \
1.86 - else \
1.87 - RETURN_META(MRES_SUPERCEDE); \
1.88 - }; \
1.89 - }; \
1.90 }; \
1.91 \
1.92 bool TestClass##id::ms_DoRecall = false; \
1.93 @@ -294,10 +246,7 @@
1.94 typedef ret_type RetType##id; \
1.95 typedef ParamState$1<0@[$2,1,$1:, param$2@] > ParamState_m##id; \
1.96 MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
1.97 - MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.98 - MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.99 - MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.100 - MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.101 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.102 \
1.103 struct TestClass##id \
1.104 { \
1.105 @@ -312,70 +261,25 @@
1.106 return MakeRet< ret_type >::Do(0); \
1.107 } \
1.108 \
1.109 - struct Delegate1 : public MyDelegate \
1.110 + struct Delegate : public MyDelegate \
1.111 { \
1.112 + int m_DelegNumber; \
1.113 + Delegate(int num) : m_DelegNumber(num) { } \
1.114 + \
1.115 virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.116 { \
1.117 g_Inside_LeafFunc = true; \
1.118 - ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.119 - g_Inside_LeafFunc = false; \
1.120 - if (ms_DoRecall) \
1.121 - { \
1.122 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.123 - RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.124 - } \
1.125 - else \
1.126 - RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
1.127 - } \
1.128 - }; \
1.129 - struct Delegate2 : public MyDelegate \
1.130 - { \
1.131 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.132 - { \
1.133 - g_Inside_LeafFunc = true; \
1.134 - ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.135 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.136 g_Inside_LeafFunc = false; \
1.137 if (ms_DoRecall) \
1.138 { \
1.139 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.140 - RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.141 - } \
1.142 - else \
1.143 - RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
1.144 - } \
1.145 - }; \
1.146 - struct Delegate3 : public MyDelegate \
1.147 - { \
1.148 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.149 - { \
1.150 - g_Inside_LeafFunc = true; \
1.151 - ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.152 - g_Inside_LeafFunc = false; \
1.153 - if (ms_DoRecall) \
1.154 - { \
1.155 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.156 - RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.157 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.158 } \
1.159 else \
1.160 - RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
1.161 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
1.162 } \
1.163 }; \
1.164 - struct Delegate4 : public MyDelegate \
1.165 - { \
1.166 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.167 - { \
1.168 - g_Inside_LeafFunc = true; \
1.169 - ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.170 - g_Inside_LeafFunc = false; \
1.171 - if (ms_DoRecall) \
1.172 - { \
1.173 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.174 - RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.175 - } \
1.176 - else \
1.177 - RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
1.178 - }; \
1.179 - }; \
1.180 }; \
1.181 \
1.182 bool TestClass##id::ms_DoRecall = false; \
1.183 @@ -385,10 +289,7 @@
1.184 struct TestClass##id; \
1.185 typedef ParamState@($1+1)<0@[$2,1,$1:, param$2@], std::string > ParamState_m##id; \
1.186 MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
1.187 - MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.188 - MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.189 - MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.190 - MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.191 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.192 \
1.193 struct TestClass##id \
1.194 { \
1.195 @@ -409,169 +310,30 @@
1.196 g_Inside_LeafFunc = false; \
1.197 } \
1.198 \
1.199 - struct Delegate1 : public MyDelegate \
1.200 + struct Delegate : public MyDelegate \
1.201 { \
1.202 + int m_DelegNumber; \
1.203 + Delegate(int num) : m_DelegNumber(num) { } \
1.204 + \
1.205 virtual void Call(@[$2,1,$1:param$2 p$2, @]const char *buf) \
1.206 { \
1.207 g_Inside_LeafFunc = true; \
1.208 - ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
1.209 - g_Inside_LeafFunc = false; \
1.210 - if (ms_DoRecall) \
1.211 - { \
1.212 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.213 - RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1:p$2, @]"%s!", buf)); \
1.214 - } \
1.215 - else \
1.216 - RETURN_META(MRES_IGNORED); \
1.217 - } \
1.218 - }; \
1.219 - struct Delegate2 : public MyDelegate \
1.220 - { \
1.221 - virtual void Call(@[$2,1,$1:param$2 p$2, @]const char *buf) \
1.222 - { \
1.223 - g_Inside_LeafFunc = true; \
1.224 - ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
1.225 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
1.226 g_Inside_LeafFunc = false; \
1.227 if (ms_DoRecall) \
1.228 { \
1.229 @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.230 - RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1:p$2, @]"%s!", buf)); \
1.231 - } \
1.232 - else \
1.233 - RETURN_META(MRES_SUPERCEDE); \
1.234 - } \
1.235 - }; \
1.236 - struct Delegate3 : public MyDelegate \
1.237 - { \
1.238 - virtual void Call(@[$2,1,$1:param$2 p$2, @]const char *buf) \
1.239 - { \
1.240 - g_Inside_LeafFunc = true; \
1.241 - ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
1.242 - g_Inside_LeafFunc = false; \
1.243 - if (ms_DoRecall) \
1.244 - { \
1.245 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.246 - RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1:p$2, @]"%s!", buf)); \
1.247 + RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (@[$2,1,$1:p$2, @]"%s!", buf)); \
1.248 } \
1.249 else \
1.250 - RETURN_META(MRES_IGNORED); \
1.251 + RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
1.252 } \
1.253 }; \
1.254 - struct Delegate4 : public MyDelegate \
1.255 - { \
1.256 - virtual void Call(@[$2,1,$1:param$2 p$2, @]const char *buf) \
1.257 - { \
1.258 - g_Inside_LeafFunc = true; \
1.259 - ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
1.260 - g_Inside_LeafFunc = false; \
1.261 - if (ms_DoRecall) \
1.262 - { \
1.263 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.264 - RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (@[$2,1,$1:p$2, @]"%s!", buf)); \
1.265 - } \
1.266 - else \
1.267 - RETURN_META(MRES_SUPERCEDE); \
1.268 - }; \
1.269 - }; \
1.270 }; \
1.271 \
1.272 bool TestClass##id::ms_DoRecall = false; \
1.273 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
1.274
1.275 -
1.276 -#define THGM_MAKE_TEST$1_vafmt(id, ret_type@[$2,1,$1:, param$2@]) \
1.277 - struct TestClass##id; \
1.278 - typedef ret_type RetType##id; \
1.279 - typedef ParamState$1<0@[$2,1,$1:, param$2@] > ParamState_m##id; \
1.280 - MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
1.281 - MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.282 - MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.283 - MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.284 - MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
1.285 - \
1.286 - struct TestClass##id \
1.287 - { \
1.288 - static bool ms_DoRecall; \
1.289 - \
1.290 - virtual ret_type Func(@[$2,1,$1|, :param$2 p$2@]) \
1.291 - { \
1.292 - g_Inside_LeafFunc = true; \
1.293 - ADD_STATE(State_Func##id(this, ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.294 - g_Inside_LeafFunc = false; \
1.295 - \
1.296 - return MakeRet< ret_type >::Do(0); \
1.297 - } \
1.298 - \
1.299 - struct Delegate1 : public MyDelegate \
1.300 - { \
1.301 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.302 - { \
1.303 - g_Inside_LeafFunc = true; \
1.304 - ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.305 - g_Inside_LeafFunc = false; \
1.306 - if (ms_DoRecall) \
1.307 - { \
1.308 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.309 - RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.310 - } \
1.311 - else \
1.312 - RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
1.313 - } \
1.314 - }; \
1.315 - struct Delegate2 : public MyDelegate \
1.316 - { \
1.317 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.318 - { \
1.319 - g_Inside_LeafFunc = true; \
1.320 - ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.321 - g_Inside_LeafFunc = false; \
1.322 - if (ms_DoRecall) \
1.323 - { \
1.324 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.325 - RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.326 - } \
1.327 - else \
1.328 - RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
1.329 - } \
1.330 - }; \
1.331 - struct Delegate3 : public MyDelegate \
1.332 - { \
1.333 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.334 - { \
1.335 - g_Inside_LeafFunc = true; \
1.336 - ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.337 - g_Inside_LeafFunc = false; \
1.338 - if (ms_DoRecall) \
1.339 - { \
1.340 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.341 - RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.342 - } \
1.343 - else \
1.344 - RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
1.345 - } \
1.346 - }; \
1.347 - struct Delegate4 : public MyDelegate \
1.348 - { \
1.349 - virtual ret_type Call(@[$2,1,$1|, :param$2 p$2@]) \
1.350 - { \
1.351 - g_Inside_LeafFunc = true; \
1.352 - ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1|, :p$2@]))); \
1.353 - g_Inside_LeafFunc = false; \
1.354 - if (ms_DoRecall) \
1.355 - { \
1.356 - @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
1.357 - RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (@[$2,1,$1|, :p$2@])); \
1.358 - } \
1.359 - else \
1.360 - RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
1.361 - }; \
1.362 - }; \
1.363 - }; \
1.364 - \
1.365 - bool TestClass##id::ms_DoRecall = false; \
1.366 - SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
1.367 -
1.368 -
1.369 #define THGM_SETUP_PI$1(id@[$2,1,$1:, p$2_type, p$2_passtype, p$2_flags@]) \
1.370 void setuppi_##id() \
1.371 { \
1.372 @@ -600,7 +362,7 @@
1.373
1.374 #define THGM_ADD_HOOK(id, num) \
1.375 CAT4(hook, num, _, id) = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pTest##id), \
1.376 - 0, myhookman##id, PtrBufPtr(new TestClass##id::Delegate##num), num >= 3);
1.377 + 0, myhookman##id, PtrBufPtr(new TestClass##id::Delegate(num)), num >= 3);
1.378
1.379 #define THGM_REMOVE_HOOK(id, num) \
1.380 g_SHPtr->RemoveHookByID(CAT4(hook, num, _, id));
1.381 @@ -627,37 +389,15 @@
1.382 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.383 NULL), "Test" #id " Part1"); \
1.384 \
1.385 - /* hook1 - no hooks */ \
1.386 - PtrBuf_Clear(); \
1.387 - THGM_ADD_HOOK(id, 1); \
1.388 - THGM_CALLS_void(id, call_params); \
1.389 - CHECK_STATES((&g_States, \
1.390 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.391 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.392 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.393 - NULL), "Test" #id " Part2"); \
1.394 - THGM_REMOVE_HOOK(id, 1); \
1.395 - \
1.396 - /* no hooks - hook3 */ \
1.397 - PtrBuf_Clear(); \
1.398 - THGM_ADD_HOOK(id, 3); \
1.399 - THGM_CALLS_void(id, call_params); \
1.400 - CHECK_STATES((&g_States, \
1.401 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.402 - new State_Deleg3_##id(pTest##id, 0, ParamState_m##id call_params), \
1.403 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.404 - NULL), "Test" #id " Part3"); \
1.405 - THGM_REMOVE_HOOK(id, 3); \
1.406 - \
1.407 /* hook1 - hook3 */ \
1.408 PtrBuf_Clear(); \
1.409 THGM_ADD_HOOK(id, 1); \
1.410 THGM_ADD_HOOK(id, 3); \
1.411 THGM_CALLS_void(id, call_params); \
1.412 CHECK_STATES((&g_States, \
1.413 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.414 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
1.415 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.416 - new State_Deleg3_##id(pTest##id, 1, ParamState_m##id call_params), \
1.417 + new State_Deleg_##id(3, pTest##id, 1, ParamState_m##id call_params), \
1.418 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.419 NULL), "Test" #id " Part4"); \
1.420 THGM_REMOVE_HOOK(id, 1); \
1.421 @@ -670,26 +410,19 @@
1.422 THGM_ADD_HOOK(id, 3); \
1.423 THGM_CALLS_void(id, call_params); \
1.424 CHECK_STATES((&g_States, \
1.425 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.426 - new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
1.427 - new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
1.428 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
1.429 + new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
1.430 + new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
1.431 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.432 NULL), "Test" #id " Part5"); \
1.433 - THGM_REMOVE_HOOK(id, 1); \
1.434 - THGM_REMOVE_HOOK(id, 2); \
1.435 - THGM_REMOVE_HOOK(id, 3); \
1.436 /* hook1, hook2 - hook3, hook4 */ \
1.437 - PtrBuf_Clear(); \
1.438 - THGM_ADD_HOOK(id, 1); \
1.439 - THGM_ADD_HOOK(id, 2); \
1.440 - THGM_ADD_HOOK(id, 3); \
1.441 THGM_ADD_HOOK(id, 4); \
1.442 THGM_CALLS_void(id, call_params); \
1.443 CHECK_STATES((&g_States, \
1.444 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.445 - new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
1.446 - new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
1.447 - new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params), \
1.448 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
1.449 + new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
1.450 + new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
1.451 + new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params), \
1.452 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.453 NULL), "Test" #id " Part6"); \
1.454 \
1.455 @@ -699,10 +432,10 @@
1.456 THGM_REMOVE_HOOK(id, 2); \
1.457 THGM_CALLS_void(id, call_params); \
1.458 CHECK_STATES((&g_States, \
1.459 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params(0)), \
1.460 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params(0)), \
1.461 new State_Func##id(pTest##id, ParamState_m##id call_params(1)), \
1.462 - new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params(1)), \
1.463 - new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params(2)), \
1.464 + new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params(1)), \
1.465 + new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params(2)), \
1.466 /* sh_call one */ \
1.467 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.468 NULL), "Test" #id " Part7"); \
1.469 @@ -745,37 +478,15 @@
1.470 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.471 NULL), "Test" #id " Part1"); \
1.472 \
1.473 - /* hook1 - no hooks */ \
1.474 - PtrBuf_Clear(); \
1.475 - THGM_ADD_HOOK(id, 1); \
1.476 - THGM_CALLS(id, call_params, 0, 0, "Part2"); \
1.477 - CHECK_STATES((&g_States, \
1.478 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.479 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.480 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.481 - NULL), "Test" #id " Part2"); \
1.482 - THGM_REMOVE_HOOK(id, 1); \
1.483 - \
1.484 - /* no hooks - hook3 */ \
1.485 - PtrBuf_Clear(); \
1.486 - THGM_ADD_HOOK(id, 3); \
1.487 - THGM_CALLS(id, call_params, 0, 0, "Part3"); \
1.488 - CHECK_STATES((&g_States, \
1.489 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.490 - new State_Deleg3_##id(pTest##id, 0, ParamState_m##id call_params), \
1.491 - new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.492 - NULL), "Test" #id " Part3"); \
1.493 - THGM_REMOVE_HOOK(id, 3); \
1.494 - \
1.495 /* hook1 - hook3 */ \
1.496 PtrBuf_Clear(); \
1.497 THGM_ADD_HOOK(id, 1); \
1.498 THGM_ADD_HOOK(id, 3); \
1.499 THGM_CALLS(id, call_params, 0, 0, "Part4"); \
1.500 CHECK_STATES((&g_States, \
1.501 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.502 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
1.503 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.504 - new State_Deleg3_##id(pTest##id, 1, ParamState_m##id call_params), \
1.505 + new State_Deleg_##id(3, pTest##id, 1, ParamState_m##id call_params), \
1.506 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.507 NULL), "Test" #id " Part4"); \
1.508 THGM_REMOVE_HOOK(id, 1); \
1.509 @@ -788,26 +499,19 @@
1.510 THGM_ADD_HOOK(id, 3); \
1.511 THGM_CALLS(id, call_params, 2, 0, "Part5"); \
1.512 CHECK_STATES((&g_States, \
1.513 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.514 - new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
1.515 - new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
1.516 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
1.517 + new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
1.518 + new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
1.519 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.520 NULL), "Test" #id " Part5"); \
1.521 - THGM_REMOVE_HOOK(id, 1); \
1.522 - THGM_REMOVE_HOOK(id, 2); \
1.523 - THGM_REMOVE_HOOK(id, 3); \
1.524 /* hook1, hook2 - hook3, hook4 */ \
1.525 - PtrBuf_Clear(); \
1.526 - THGM_ADD_HOOK(id, 1); \
1.527 - THGM_ADD_HOOK(id, 2); \
1.528 - THGM_ADD_HOOK(id, 3); \
1.529 THGM_ADD_HOOK(id, 4); \
1.530 THGM_CALLS(id, call_params, 4, 0, "Part6"); \
1.531 CHECK_STATES((&g_States, \
1.532 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
1.533 - new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
1.534 - new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
1.535 - new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params), \
1.536 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
1.537 + new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
1.538 + new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
1.539 + new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params), \
1.540 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.541 NULL), "Test" #id " Part6"); \
1.542 \
1.543 @@ -817,10 +521,10 @@
1.544 THGM_REMOVE_HOOK(id, 2); \
1.545 THGM_CALLS(id, call_params, 4, 0, "Part7"); \
1.546 CHECK_STATES((&g_States, \
1.547 - new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params(0)), \
1.548 + new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params(0)), \
1.549 new State_Func##id(pTest##id, ParamState_m##id call_params(1)), \
1.550 - new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params(1)), \
1.551 - new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params(2)), \
1.552 + new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params(1)), \
1.553 + new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params(2)), \
1.554 /* sh_call one */ \
1.555 new State_Func##id(pTest##id, ParamState_m##id call_params), \
1.556 NULL), "Test" #id " Part7"); \