Added test for an void (int, double, int) function (in case doubles are aligned on an 8-byte boundary and we don't know about it) hookman_autogen
Added test for an void (int, double, int) function (in case doubles are aligned on an 8-byte boundary and we don't know about it)
Added tests for vafmt functions with non-void return types (basic, float, object)
1.1 --- a/sourcehook/test/testhookmangen.cpp Sun Nov 18 15:08:03 2007 +0000
1.2 +++ b/sourcehook/test/testhookmangen.cpp Mon Nov 19 13:39:44 2007 +0000
1.3 @@ -422,6 +422,12 @@
1.4 SourceHook::PassInfo::PassFlag_CCtor | SourceHook::PassInfo::PassFlag_AssignOp);
1.5
1.6
1.7 + THGM_MAKE_TEST3_void(150, int, double, int);
1.8 + THGM_SETUP_PI3(150,
1.9 + int, SourceHook::PassInfo::PassType_Basic, SourceHook::PassInfo::PassFlag_ByVal,
1.10 + double, SourceHook::PassInfo::PassType_Float, SourceHook::PassInfo::PassFlag_ByVal,
1.11 + int, SourceHook::PassInfo::PassType_Basic, SourceHook::PassInfo::PassFlag_ByVal);
1.12 +
1.13 // vafmt tests
1.14 THGM_MAKE_TEST0_vafmt_void(200);
1.15 THGM_SETUP_PI0(200);
1.16 @@ -453,6 +459,25 @@
1.17 THGM_MAKE_TEST1_vafmt_void(210, POD<600> &);
1.18 THGM_SETUP_PI1(210, POD<600> &, SourceHook::PassInfo::PassType_Object, SourceHook::PassInfo::PassFlag_ByRef)
1.19
1.20 + THGM_MAKE_TEST1_vafmt(211, int, int);
1.21 + THGM_SETUP_PI1(211,
1.22 + int, SourceHook::PassInfo::PassType_Basic, SourceHook::PassInfo::PassFlag_ByVal
1.23 + );
1.24 + THGM_SETUP_RI(211, int, SourceHook::PassInfo::PassType_Basic, SourceHook::PassInfo::PassFlag_ByVal);
1.25 +
1.26 + THGM_MAKE_TEST1_vafmt(212, double, int);
1.27 + THGM_SETUP_PI1(212,
1.28 + int, SourceHook::PassInfo::PassType_Basic, SourceHook::PassInfo::PassFlag_ByVal
1.29 + );
1.30 + THGM_SETUP_RI(212, float, SourceHook::PassInfo::PassType_Float, SourceHook::PassInfo::PassFlag_ByVal);
1.31 +
1.32 + THGM_MAKE_TEST1_vafmt(213, PodRet8, int);
1.33 + THGM_SETUP_PI1(213,
1.34 + int, SourceHook::PassInfo::PassType_Basic, SourceHook::PassInfo::PassFlag_ByVal
1.35 + );
1.36 + THGM_SETUP_RI(213, PodRet8, SourceHook::PassInfo::PassType_Object, SourceHook::PassInfo::PassFlag_ByVal);
1.37 +
1.38 +
1.39 MAKE_STATE(State_Hello_Func4_Called);
1.40 MAKE_STATE(State_Hello_Func79_Called);
1.41
1.42 @@ -971,6 +996,9 @@
1.43 new State_ObjODtor_Called(13),
1.44 NULL), "Test110 Part100");
1.45
1.46 +
1.47 + THGM_DO_TEST_void(150, (5, 5.5, 6));
1.48 +
1.49 return true;
1.50 }
1.51
1.52 @@ -999,6 +1027,12 @@
1.53 POD<600> pod600 = MakeRet< POD<600> >::Do(34);
1.54 THGM_DO_TEST_void(210, (pod600, "Hello %s%d%s", "BA", 1, "L!"));
1.55
1.56 +
1.57 + THGM_DO_TEST(211, (5, "Hello %s%d%s", "BA", 1, "L!"));
1.58 + THGM_DO_TEST(212, (5, "Hello %s%d%s", "BA", 1, "L!"));
1.59 + THGM_DO_TEST(213, (5, "Hello %s%d%s", "BA", 1, "L!"));
1.60 +
1.61 +
1.62 // Test for lange vtable indices
1.63 Hello *pHello = new Hello;
1.64 SourceHook::CProtoInfoBuilder helloPi(SourceHook::ProtoInfo::CallConv_ThisCall);
2.1 --- a/sourcehook/test/testhookmangen.h Sun Nov 18 15:08:03 2007 +0000
2.2 +++ b/sourcehook/test/testhookmangen.h Mon Nov 19 13:39:44 2007 +0000
2.3 @@ -638,6 +638,57 @@
2.4 bool TestClass##id::ms_DoRecall = false; \
2.5 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.6
2.7 +#define THGM_MAKE_TEST0_vafmt(id, ret_type) \
2.8 + struct TestClass##id; \
2.9 + typedef ret_type RetType##id; \
2.10 + typedef ParamState1<0, std::string > ParamState_m##id; \
2.11 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.12 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.13 + \
2.14 + struct TestClass##id \
2.15 + { \
2.16 + static bool ms_DoRecall; \
2.17 + \
2.18 + virtual ret_type Func(const char *fmt, ...) \
2.19 + { \
2.20 + g_Inside_LeafFunc = true; \
2.21 + \
2.22 + char buf[9999]; \
2.23 + va_list ap; \
2.24 + va_start(ap, fmt); \
2.25 + vsnprintf(buf, 9998, fmt, ap); \
2.26 + buf[9998] = 0; \
2.27 + va_end(ap); \
2.28 + \
2.29 + ADD_STATE(State_Func##id(this, ParamState_m##id(std::string(buf)))); \
2.30 + \
2.31 + return MakeRet< ret_type >::Do(0); \
2.32 + } \
2.33 + \
2.34 + struct Delegate : public MyDelegate \
2.35 + { \
2.36 + int m_DelegNumber; \
2.37 + Delegate(int num) : m_DelegNumber(num) { } \
2.38 + \
2.39 + virtual ret_type Call(const char *buf) \
2.40 + { \
2.41 + g_Inside_LeafFunc = true; \
2.42 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(buf))); \
2.43 + g_Inside_LeafFunc = false; \
2.44 + if (ms_DoRecall) \
2.45 + { \
2.46 + \
2.47 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, ("%s!", buf)); \
2.48 + } \
2.49 + else \
2.50 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.51 + } \
2.52 + }; \
2.53 + }; \
2.54 + \
2.55 + bool TestClass##id::ms_DoRecall = false; \
2.56 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.57 +
2.58 #define THGM_SETUP_PI0(id) \
2.59 void setuppi_##id() \
2.60 { \
2.61 @@ -781,6 +832,57 @@
2.62 bool TestClass##id::ms_DoRecall = false; \
2.63 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.64
2.65 +#define THGM_MAKE_TEST1_vafmt(id, ret_type, param1) \
2.66 + struct TestClass##id; \
2.67 + typedef ret_type RetType##id; \
2.68 + typedef ParamState2<0, param1, std::string > ParamState_m##id; \
2.69 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.70 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.71 + \
2.72 + struct TestClass##id \
2.73 + { \
2.74 + static bool ms_DoRecall; \
2.75 + \
2.76 + virtual ret_type Func(param1 p1, const char *fmt, ...) \
2.77 + { \
2.78 + g_Inside_LeafFunc = true; \
2.79 + \
2.80 + char buf[9999]; \
2.81 + va_list ap; \
2.82 + va_start(ap, fmt); \
2.83 + vsnprintf(buf, 9998, fmt, ap); \
2.84 + buf[9998] = 0; \
2.85 + va_end(ap); \
2.86 + \
2.87 + ADD_STATE(State_Func##id(this, ParamState_m##id(p1, std::string(buf)))); \
2.88 + \
2.89 + return MakeRet< ret_type >::Do(0); \
2.90 + } \
2.91 + \
2.92 + struct Delegate : public MyDelegate \
2.93 + { \
2.94 + int m_DelegNumber; \
2.95 + Delegate(int num) : m_DelegNumber(num) { } \
2.96 + \
2.97 + virtual ret_type Call(param1 p1, const char *buf) \
2.98 + { \
2.99 + g_Inside_LeafFunc = true; \
2.100 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, buf))); \
2.101 + g_Inside_LeafFunc = false; \
2.102 + if (ms_DoRecall) \
2.103 + { \
2.104 + Increment<StripRef< param1 >::type>::Incr(p1); \
2.105 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, "%s!", buf)); \
2.106 + } \
2.107 + else \
2.108 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.109 + } \
2.110 + }; \
2.111 + }; \
2.112 + \
2.113 + bool TestClass##id::ms_DoRecall = false; \
2.114 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.115 +
2.116 #define THGM_SETUP_PI1(id, p1_type, p1_passtype, p1_flags) \
2.117 void setuppi_##id() \
2.118 { \
2.119 @@ -931,6 +1033,57 @@
2.120 bool TestClass##id::ms_DoRecall = false; \
2.121 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.122
2.123 +#define THGM_MAKE_TEST2_vafmt(id, ret_type, param1, param2) \
2.124 + struct TestClass##id; \
2.125 + typedef ret_type RetType##id; \
2.126 + typedef ParamState3<0, param1, param2, std::string > ParamState_m##id; \
2.127 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.128 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.129 + \
2.130 + struct TestClass##id \
2.131 + { \
2.132 + static bool ms_DoRecall; \
2.133 + \
2.134 + virtual ret_type Func(param1 p1, param2 p2, const char *fmt, ...) \
2.135 + { \
2.136 + g_Inside_LeafFunc = true; \
2.137 + \
2.138 + char buf[9999]; \
2.139 + va_list ap; \
2.140 + va_start(ap, fmt); \
2.141 + vsnprintf(buf, 9998, fmt, ap); \
2.142 + buf[9998] = 0; \
2.143 + va_end(ap); \
2.144 + \
2.145 + ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, std::string(buf)))); \
2.146 + \
2.147 + return MakeRet< ret_type >::Do(0); \
2.148 + } \
2.149 + \
2.150 + struct Delegate : public MyDelegate \
2.151 + { \
2.152 + int m_DelegNumber; \
2.153 + Delegate(int num) : m_DelegNumber(num) { } \
2.154 + \
2.155 + virtual ret_type Call(param1 p1, param2 p2, const char *buf) \
2.156 + { \
2.157 + g_Inside_LeafFunc = true; \
2.158 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, buf))); \
2.159 + g_Inside_LeafFunc = false; \
2.160 + if (ms_DoRecall) \
2.161 + { \
2.162 + Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
2.163 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, "%s!", buf)); \
2.164 + } \
2.165 + else \
2.166 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.167 + } \
2.168 + }; \
2.169 + }; \
2.170 + \
2.171 + bool TestClass##id::ms_DoRecall = false; \
2.172 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.173 +
2.174 #define THGM_SETUP_PI2(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags) \
2.175 void setuppi_##id() \
2.176 { \
2.177 @@ -1088,6 +1241,57 @@
2.178 bool TestClass##id::ms_DoRecall = false; \
2.179 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.180
2.181 +#define THGM_MAKE_TEST3_vafmt(id, ret_type, param1, param2, param3) \
2.182 + struct TestClass##id; \
2.183 + typedef ret_type RetType##id; \
2.184 + typedef ParamState4<0, param1, param2, param3, std::string > ParamState_m##id; \
2.185 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.186 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.187 + \
2.188 + struct TestClass##id \
2.189 + { \
2.190 + static bool ms_DoRecall; \
2.191 + \
2.192 + virtual ret_type Func(param1 p1, param2 p2, param3 p3, const char *fmt, ...) \
2.193 + { \
2.194 + g_Inside_LeafFunc = true; \
2.195 + \
2.196 + char buf[9999]; \
2.197 + va_list ap; \
2.198 + va_start(ap, fmt); \
2.199 + vsnprintf(buf, 9998, fmt, ap); \
2.200 + buf[9998] = 0; \
2.201 + va_end(ap); \
2.202 + \
2.203 + ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, std::string(buf)))); \
2.204 + \
2.205 + return MakeRet< ret_type >::Do(0); \
2.206 + } \
2.207 + \
2.208 + struct Delegate : public MyDelegate \
2.209 + { \
2.210 + int m_DelegNumber; \
2.211 + Delegate(int num) : m_DelegNumber(num) { } \
2.212 + \
2.213 + virtual ret_type Call(param1 p1, param2 p2, param3 p3, const char *buf) \
2.214 + { \
2.215 + g_Inside_LeafFunc = true; \
2.216 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, buf))); \
2.217 + g_Inside_LeafFunc = false; \
2.218 + if (ms_DoRecall) \
2.219 + { \
2.220 + Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
2.221 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, "%s!", buf)); \
2.222 + } \
2.223 + else \
2.224 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.225 + } \
2.226 + }; \
2.227 + }; \
2.228 + \
2.229 + bool TestClass##id::ms_DoRecall = false; \
2.230 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.231 +
2.232 #define THGM_SETUP_PI3(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags) \
2.233 void setuppi_##id() \
2.234 { \
2.235 @@ -1252,6 +1456,57 @@
2.236 bool TestClass##id::ms_DoRecall = false; \
2.237 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.238
2.239 +#define THGM_MAKE_TEST4_vafmt(id, ret_type, param1, param2, param3, param4) \
2.240 + struct TestClass##id; \
2.241 + typedef ret_type RetType##id; \
2.242 + typedef ParamState5<0, param1, param2, param3, param4, std::string > ParamState_m##id; \
2.243 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.244 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.245 + \
2.246 + struct TestClass##id \
2.247 + { \
2.248 + static bool ms_DoRecall; \
2.249 + \
2.250 + virtual ret_type Func(param1 p1, param2 p2, param3 p3, param4 p4, const char *fmt, ...) \
2.251 + { \
2.252 + g_Inside_LeafFunc = true; \
2.253 + \
2.254 + char buf[9999]; \
2.255 + va_list ap; \
2.256 + va_start(ap, fmt); \
2.257 + vsnprintf(buf, 9998, fmt, ap); \
2.258 + buf[9998] = 0; \
2.259 + va_end(ap); \
2.260 + \
2.261 + ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, p4, std::string(buf)))); \
2.262 + \
2.263 + return MakeRet< ret_type >::Do(0); \
2.264 + } \
2.265 + \
2.266 + struct Delegate : public MyDelegate \
2.267 + { \
2.268 + int m_DelegNumber; \
2.269 + Delegate(int num) : m_DelegNumber(num) { } \
2.270 + \
2.271 + virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, const char *buf) \
2.272 + { \
2.273 + g_Inside_LeafFunc = true; \
2.274 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, buf))); \
2.275 + g_Inside_LeafFunc = false; \
2.276 + if (ms_DoRecall) \
2.277 + { \
2.278 + Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
2.279 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, p4, "%s!", buf)); \
2.280 + } \
2.281 + else \
2.282 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.283 + } \
2.284 + }; \
2.285 + }; \
2.286 + \
2.287 + bool TestClass##id::ms_DoRecall = false; \
2.288 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.289 +
2.290 #define THGM_SETUP_PI4(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags) \
2.291 void setuppi_##id() \
2.292 { \
2.293 @@ -1423,6 +1678,57 @@
2.294 bool TestClass##id::ms_DoRecall = false; \
2.295 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.296
2.297 +#define THGM_MAKE_TEST5_vafmt(id, ret_type, param1, param2, param3, param4, param5) \
2.298 + struct TestClass##id; \
2.299 + typedef ret_type RetType##id; \
2.300 + typedef ParamState6<0, param1, param2, param3, param4, param5, std::string > ParamState_m##id; \
2.301 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.302 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.303 + \
2.304 + struct TestClass##id \
2.305 + { \
2.306 + static bool ms_DoRecall; \
2.307 + \
2.308 + virtual ret_type Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *fmt, ...) \
2.309 + { \
2.310 + g_Inside_LeafFunc = true; \
2.311 + \
2.312 + char buf[9999]; \
2.313 + va_list ap; \
2.314 + va_start(ap, fmt); \
2.315 + vsnprintf(buf, 9998, fmt, ap); \
2.316 + buf[9998] = 0; \
2.317 + va_end(ap); \
2.318 + \
2.319 + ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, p4, p5, std::string(buf)))); \
2.320 + \
2.321 + return MakeRet< ret_type >::Do(0); \
2.322 + } \
2.323 + \
2.324 + struct Delegate : public MyDelegate \
2.325 + { \
2.326 + int m_DelegNumber; \
2.327 + Delegate(int num) : m_DelegNumber(num) { } \
2.328 + \
2.329 + virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *buf) \
2.330 + { \
2.331 + g_Inside_LeafFunc = true; \
2.332 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, buf))); \
2.333 + g_Inside_LeafFunc = false; \
2.334 + if (ms_DoRecall) \
2.335 + { \
2.336 + Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
2.337 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, p4, p5, "%s!", buf)); \
2.338 + } \
2.339 + else \
2.340 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.341 + } \
2.342 + }; \
2.343 + }; \
2.344 + \
2.345 + bool TestClass##id::ms_DoRecall = false; \
2.346 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.347 +
2.348 #define THGM_SETUP_PI5(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags) \
2.349 void setuppi_##id() \
2.350 { \
2.351 @@ -1601,6 +1907,57 @@
2.352 bool TestClass##id::ms_DoRecall = false; \
2.353 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
2.354
2.355 +#define THGM_MAKE_TEST6_vafmt(id, ret_type, param1, param2, param3, param4, param5, param6) \
2.356 + struct TestClass##id; \
2.357 + typedef ret_type RetType##id; \
2.358 + typedef ParamState7<0, param1, param2, param3, param4, param5, param6, std::string > ParamState_m##id; \
2.359 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
2.360 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
2.361 + \
2.362 + struct TestClass##id \
2.363 + { \
2.364 + static bool ms_DoRecall; \
2.365 + \
2.366 + virtual ret_type Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *fmt, ...) \
2.367 + { \
2.368 + g_Inside_LeafFunc = true; \
2.369 + \
2.370 + char buf[9999]; \
2.371 + va_list ap; \
2.372 + va_start(ap, fmt); \
2.373 + vsnprintf(buf, 9998, fmt, ap); \
2.374 + buf[9998] = 0; \
2.375 + va_end(ap); \
2.376 + \
2.377 + ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, p4, p5, p6, std::string(buf)))); \
2.378 + \
2.379 + return MakeRet< ret_type >::Do(0); \
2.380 + } \
2.381 + \
2.382 + struct Delegate : public MyDelegate \
2.383 + { \
2.384 + int m_DelegNumber; \
2.385 + Delegate(int num) : m_DelegNumber(num) { } \
2.386 + \
2.387 + virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *buf) \
2.388 + { \
2.389 + g_Inside_LeafFunc = true; \
2.390 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6, buf))); \
2.391 + g_Inside_LeafFunc = false; \
2.392 + if (ms_DoRecall) \
2.393 + { \
2.394 + Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
2.395 + RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6, "%s!", buf)); \
2.396 + } \
2.397 + else \
2.398 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
2.399 + } \
2.400 + }; \
2.401 + }; \
2.402 + \
2.403 + bool TestClass##id::ms_DoRecall = false; \
2.404 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
2.405 +
2.406 #define THGM_SETUP_PI6(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags, p6_type, p6_passtype, p6_flags) \
2.407 void setuppi_##id() \
2.408 { \
3.1 --- a/sourcehook/test/testhookmangen.hxx Sun Nov 18 15:08:03 2007 +0000
3.2 +++ b/sourcehook/test/testhookmangen.hxx Mon Nov 19 13:39:44 2007 +0000
3.3 @@ -334,6 +334,57 @@
3.4 bool TestClass##id::ms_DoRecall = false; \
3.5 SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
3.6
3.7 +#define THGM_MAKE_TEST$1_vafmt(id, ret_type@[$2,1,$1:, param$2@]) \
3.8 + struct TestClass##id; \
3.9 + typedef ret_type RetType##id; \
3.10 + typedef ParamState@($1+1)<0@[$2,1,$1:, param$2@], std::string > ParamState_m##id; \
3.11 + MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
3.12 + MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
3.13 + \
3.14 + struct TestClass##id \
3.15 + { \
3.16 + static bool ms_DoRecall; \
3.17 + \
3.18 + virtual ret_type Func(@[$2,1,$1:param$2 p$2, @]const char *fmt, ...) \
3.19 + { \
3.20 + g_Inside_LeafFunc = true; \
3.21 + \
3.22 + char buf[9999]; \
3.23 + va_list ap; \
3.24 + va_start(ap, fmt); \
3.25 + vsnprintf(buf, 9998, fmt, ap); \
3.26 + buf[9998] = 0; \
3.27 + va_end(ap); \
3.28 + \
3.29 + ADD_STATE(State_Func##id(this, ParamState_m##id(@[$2,1,$1:p$2, @]std::string(buf)))); \
3.30 + \
3.31 + return MakeRet< ret_type >::Do(0); \
3.32 + } \
3.33 + \
3.34 + struct Delegate : public MyDelegate \
3.35 + { \
3.36 + int m_DelegNumber; \
3.37 + Delegate(int num) : m_DelegNumber(num) { } \
3.38 + \
3.39 + virtual ret_type Call(@[$2,1,$1:param$2 p$2, @]const char *buf) \
3.40 + { \
3.41 + g_Inside_LeafFunc = true; \
3.42 + ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
3.43 + g_Inside_LeafFunc = false; \
3.44 + if (ms_DoRecall) \
3.45 + { \
3.46 + @[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
3.47 + 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, @]"%s!", buf)); \
3.48 + } \
3.49 + else \
3.50 + RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
3.51 + } \
3.52 + }; \
3.53 + }; \
3.54 + \
3.55 + bool TestClass##id::ms_DoRecall = false; \
3.56 + SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
3.57 +
3.58 #define THGM_SETUP_PI$1(id@[$2,1,$1:, p$2_type, p$2_passtype, p$2_flags@]) \
3.59 void setuppi_##id() \
3.60 { \