sourcehook/test/testhookmangen.hxx
branchhookman_autogen
changeset 466 c733f5be0e5d
parent 465 c86a55fbcd88
child 467 7b0d972632af
     1.1 --- a/sourcehook/test/testhookmangen.hxx	Sun Nov 18 15:08:03 2007 +0000
     1.2 +++ b/sourcehook/test/testhookmangen.hxx	Mon Nov 19 13:39:44 2007 +0000
     1.3 @@ -334,6 +334,57 @@
     1.4  	bool TestClass##id::ms_DoRecall = false; \
     1.5  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
     1.6  
     1.7 +#define THGM_MAKE_TEST$1_vafmt(id, ret_type@[$2,1,$1:, param$2@]) \
     1.8 +	struct TestClass##id; \
     1.9 +	typedef ret_type RetType##id; \
    1.10 +	typedef ParamState@($1+1)<0@[$2,1,$1:, param$2@], std::string > ParamState_m##id; \
    1.11 +	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
    1.12 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
    1.13 +	\
    1.14 +	struct TestClass##id \
    1.15 +	{ \
    1.16 +		static bool ms_DoRecall; \
    1.17 +		\
    1.18 +		virtual ret_type Func(@[$2,1,$1:param$2 p$2, @]const char *fmt, ...) \
    1.19 +		{ \
    1.20 +			g_Inside_LeafFunc = true; \
    1.21 +			\
    1.22 +			char buf[9999]; \
    1.23 +			va_list ap; \
    1.24 +			va_start(ap, fmt); \
    1.25 +			vsnprintf(buf, 9998, fmt, ap); \
    1.26 +			buf[9998] = 0; \
    1.27 +			va_end(ap); \
    1.28 +			\
    1.29 +			ADD_STATE(State_Func##id(this, ParamState_m##id(@[$2,1,$1:p$2, @]std::string(buf)))); \
    1.30 +			\
    1.31 +			return MakeRet< ret_type >::Do(0); \
    1.32 +		} \
    1.33 +		\
    1.34 +		struct Delegate : public MyDelegate \
    1.35 +		{ \
    1.36 +			int m_DelegNumber; \
    1.37 +			Delegate(int num) : m_DelegNumber(num) { } \
    1.38 +			\
    1.39 +			virtual ret_type Call(@[$2,1,$1:param$2 p$2, @]const char *buf) \
    1.40 +			{ \
    1.41 +				g_Inside_LeafFunc = true; \
    1.42 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(@[$2,1,$1:p$2, @]buf))); \
    1.43 +				g_Inside_LeafFunc = false; \
    1.44 +				if (ms_DoRecall) \
    1.45 +				{ \
    1.46 +					@[$2,1,$1:Increment<StripRef< param$2 >::type>::Incr(p$2);@] \
    1.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)); \
    1.48 +				} \
    1.49 +				else \
    1.50 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
    1.51 +			} \
    1.52 +		}; \
    1.53 +	}; \
    1.54 +	\
    1.55 +	bool TestClass##id::ms_DoRecall = false; \
    1.56 +	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall);
    1.57 +
    1.58  #define THGM_SETUP_PI$1(id@[$2,1,$1:, p$2_type, p$2_passtype, p$2_flags@]) \
    1.59  	void setuppi_##id() \
    1.60  	{ \