fixed location of testrefret.cpp and added forgotten typename keywords
authorPavol Marko <pavolmarko@gmail.com>
Wed Aug 09 07:25:48 2006 +0000 (2006-08-09)
changeset 234f7526d407359
parent 233 6d19421c552c
child 235 df7d7d108475
fixed location of testrefret.cpp and added forgotten typename keywords
sourcehook/generate/sourcehook.hxx
sourcehook/test/msvc8/test.vcproj
sourcehook/test/msvc8/testrefret.cpp
sourcehook/test/testrefret.cpp
     1.1 --- a/sourcehook/generate/sourcehook.hxx	Wed Aug 09 06:46:11 2006 +0000
     1.2 +++ b/sourcehook/generate/sourcehook.hxx	Wed Aug 09 07:25:48 2006 +0000
     1.3 @@ -501,12 +501,12 @@
     1.4  	{
     1.5  		inline static T* GetOrigRet(ISourceHook *shptr)
     1.6  		{
     1.7 -			T &ref = *reinterpret_cast<const ReferenceCarrier<T&>::type *>(shptr->GetOrigRet());
     1.8 +			T &ref = *reinterpret_cast<const typename ReferenceCarrier<T&>::type *>(shptr->GetOrigRet());
     1.9  			return &ref;
    1.10  		}
    1.11  		inline static T* GetOverrideRet(ISourceHook *shptr)
    1.12  		{
    1.13 -			T &ref = *reinterpret_cast<const ReferenceCarrier<T&>::type *>(shptr->GetOverrideRet());
    1.14 +			T &ref = *reinterpret_cast<const typename ReferenceCarrier<T&>::type *>(shptr->GetOverrideRet());
    1.15  			return &ref;
    1.16  		}
    1.17  	};
    1.18 @@ -1348,7 +1348,7 @@
    1.19  		void operator()(ISourceHook *shptr, T &res)
    1.20  		{
    1.21  			// overrideretptr points to ReferenceCarrier<T&>
    1.22 -			*reinterpret_cast<ReferenceCarrier<T&>::type *>(shptr->GetOverrideRetPtr()) = res;
    1.23 +			*reinterpret_cast<typename ReferenceCarrier<T&>::type *>(shptr->GetOverrideRetPtr()) = res;
    1.24  		}
    1.25  	};
    1.26  @[$1,0,$a:
     2.1 --- a/sourcehook/test/msvc8/test.vcproj	Wed Aug 09 06:46:11 2006 +0000
     2.2 +++ b/sourcehook/test/msvc8/test.vcproj	Wed Aug 09 07:25:48 2006 +0000
     2.3 @@ -428,7 +428,7 @@
     2.4  				>
     2.5  			</File>
     2.6  			<File
     2.7 -				RelativePath=".\testrefret.cpp"
     2.8 +				RelativePath="..\testrefret.cpp"
     2.9  				>
    2.10  			</File>
    2.11  		</Filter>
    2.12 @@ -495,7 +495,7 @@
    2.13  						>
    2.14  						<Tool
    2.15  							Name="VCCustomBuildTool"
    2.16 -							CommandLine="echo on&#x0D;&#x0A;pushd ..\..\generate&#x0D;&#x0A;shworker.exe iter sourcehook.hxx sourcehook.h 16&#x0D;&#x0A;copy sourcehook.h ..\sourcehook.h&#x0D;&#x0A;popd&#x0D;&#x0A;"
    2.17 +							CommandLine="echo on&#x0D;&#x0A;pushd ..\..\generate&#x0D;&#x0A;shworker.exe iter sourcehook.hxx sourcehook.h 20&#x0D;&#x0A;copy sourcehook.h ..\sourcehook.h&#x0D;&#x0A;popd&#x0D;&#x0A;"
    2.18  							Outputs="..\..\sourcehook.h"
    2.19  						/>
    2.20  					</FileConfiguration>
     3.1 --- a/sourcehook/test/msvc8/testrefret.cpp	Wed Aug 09 06:46:11 2006 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,200 +0,0 @@
     3.4 -#include "testevents.h"
     3.5 -#include "sourcehook_test.h"
     3.6 -
     3.7 -// Tests support for functions which return references
     3.8 -
     3.9 -namespace
    3.10 -{
    3.11 -	StateList g_States;
    3.12 -	SourceHook::ISourceHook *g_SHPtr;
    3.13 -	SourceHook::Plugin g_PLID;
    3.14 -
    3.15 -	MAKE_STATE_1(State_Func1_Pre1, int*);			// p1: the ref Func1_Pre1 is going to return
    3.16 -	MAKE_STATE_3(State_Func1_Pre2, META_RES, int*, int*);	// p1: current status
    3.17 -															// p2: override ret
    3.18 -															// p3: what this handler is going to supercede with
    3.19 -	MAKE_STATE_1(State_Func1, int*);				// p1: the ref Func1 is going to return
    3.20 -	MAKE_STATE_2(State_Func1_Post1, int*, int*);	// p1: orig_ret; p2: override_ret
    3.21 -	MAKE_STATE_1(State_Func1_Post2, int*);			// p1: what it's going to return
    3.22 -	MAKE_STATE_1(State_Func1_Ret, int*);			// p1: the ref it returned
    3.23 -
    3.24 -
    3.25 -	MAKE_STATE_2(State_Func2_Pre1, int, const int*);				// p1: func's p1; p2: what it's going to ret
    3.26 -	MAKE_STATE_2(State_Func2, int, const int*);						// p1: func's p1; p2: what it's going to ret
    3.27 -	MAKE_STATE_3(State_Func2_Post1, int, const int*, const int*);	// p1: func's p1; p2: orig ret; p3: override ret
    3.28 -	MAKE_STATE_1(State_Func2_Ret, const int*);						// p1: ret
    3.29 -
    3.30 -	int g_Var;
    3.31 -
    3.32 -	class Test
    3.33 -	{
    3.34 -	public:
    3.35 -		int m_Var1;
    3.36 -		int m_Var2;
    3.37 -
    3.38 -		Test() : m_Var1(87)
    3.39 -		{
    3.40 -		}
    3.41 -
    3.42 -		virtual int& Func1()
    3.43 -		{
    3.44 -			ADD_STATE(State_Func1(&m_Var1));
    3.45 -			return m_Var1;
    3.46 -		}
    3.47 -		virtual const int& Func2(int p1)
    3.48 -		{
    3.49 -			ADD_STATE(State_Func2(p1, &m_Var2));
    3.50 -			m_Var2 = p1;
    3.51 -			return m_Var2;
    3.52 -		}
    3.53 -	};
    3.54 -
    3.55 -	class CHook
    3.56 -	{
    3.57 -	public:
    3.58 -		int m_Var;
    3.59 -		virtual int& Func1_Pre1()
    3.60 -		{
    3.61 -			ADD_STATE(State_Func1_Pre1(&m_Var));
    3.62 -			RETURN_META_VALUE(MRES_OVERRIDE, m_Var);
    3.63 -		}
    3.64 -		virtual int &Func1_Pre2()
    3.65 -		{
    3.66 -			int &overrideret = META_RESULT_OVERRIDE_RET(int&);
    3.67 -			overrideret = 1337;
    3.68 -			ADD_STATE(State_Func1_Pre2(META_RESULT_STATUS, &overrideret, &g_Var));
    3.69 -			RETURN_META_VALUE(MRES_SUPERCEDE, g_Var);
    3.70 -		}
    3.71 -		virtual int& Func1_Post1()
    3.72 -		{
    3.73 -			ADD_STATE(State_Func1_Post1(&META_RESULT_ORIG_RET(int&), &META_RESULT_OVERRIDE_RET(int&)));
    3.74 -			RETURN_META_NOREF(MRES_IGNORED, int&);
    3.75 -		}
    3.76 -		virtual int& Func1_Post2()
    3.77 -		{
    3.78 -			ADD_STATE(State_Func1_Post2(&m_Var));
    3.79 -			RETURN_META_VALUE(MRES_OVERRIDE, m_Var);
    3.80 -		}
    3.81 -
    3.82 -		virtual const int& Func2_Pre1(int p1)
    3.83 -		{
    3.84 -			ADD_STATE(State_Func2_Pre1(p1, &m_Var));
    3.85 -			RETURN_META_VALUE_NEWPARAMS(MRES_OVERRIDE, m_Var, static_cast<const int& (Test::*)(int)>(&Test::Func2), (1337));
    3.86 -		}
    3.87 -
    3.88 -		virtual const int& Func2_Post1(int p1)
    3.89 -		{
    3.90 -			ADD_STATE(State_Func2_Post1(p1, &META_RESULT_ORIG_RET(int&), &META_RESULT_OVERRIDE_RET(int&)));
    3.91 -			RETURN_META_NOREF(MRES_IGNORED, const int&);
    3.92 -		}
    3.93 -	};
    3.94 -
    3.95 -	SH_DECL_HOOK0(Test, Func1, SH_NOATTRIB, 0, int&);
    3.96 -	SH_DECL_HOOK1(Test, Func2, SH_NOATTRIB, 0, const int&, int);
    3.97 -}
    3.98 -
    3.99 -bool TestRefRet(std::string &error)
   3.100 -{
   3.101 -	GET_SHPTR(g_SHPtr);
   3.102 -	g_PLID = 1;
   3.103 -
   3.104 -	Test test;
   3.105 -	Test *pTest = &test;
   3.106 -	CHook hook;
   3.107 -
   3.108 -	int &ret1 = pTest->Func1();
   3.109 -	ADD_STATE(State_Func1_Ret(&ret1));
   3.110 -
   3.111 -	CHECK_STATES((&g_States,
   3.112 -		new State_Func1(&test.m_Var1),
   3.113 -		new State_Func1_Ret(&test.m_Var1),
   3.114 -		NULL), "Part 1");
   3.115 -
   3.116 -	// Now add Func1_Pre1, which supercedes and returns hook.m_Var
   3.117 -	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Pre1, false);
   3.118 -
   3.119 -	int &ret2 = pTest->Func1();
   3.120 -	ADD_STATE(State_Func1_Ret(&ret2));
   3.121 -	
   3.122 -	CHECK_STATES((&g_States,
   3.123 -		new State_Func1_Pre1(&hook.m_Var),		// Pre1 says that it's going to override with hook.m_Var
   3.124 -		new State_Func1(&test.m_Var1),			// Function says that it's going to return test.m_Var1
   3.125 -		new State_Func1_Ret(&hook.m_Var),		// hook.m_Var is returned
   3.126 -		NULL), "Part 2");
   3.127 -
   3.128 -	// Now add Func1_Post1, which only reports orig ret and override ret
   3.129 -	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Post1, true);
   3.130 -
   3.131 -	int &ret3 = pTest->Func1();
   3.132 -	ADD_STATE(State_Func1_Ret(&ret3));
   3.133 -	
   3.134 -	CHECK_STATES((&g_States,
   3.135 -		new State_Func1_Pre1(&hook.m_Var),		// Pre1 says that it's going to override with hook.m_Var
   3.136 -		new State_Func1(&test.m_Var1),			// Function says that it's going to return test.m_Var1
   3.137 -		new State_Func1_Post1(&test.m_Var1, &hook.m_Var),	// origret(=p1) is what it wanted to
   3.138 -															// return, overrideret(=p2) is pre1's var
   3.139 -		new State_Func1_Ret(&hook.m_Var),		// hook.m_Var is returned
   3.140 -		NULL), "Part 3");
   3.141 -
   3.142 -	// Now add Func1_Pre2, which supercedes and returns g_Var (it also sets the override ret from pre1 to 1337)
   3.143 -	// and add Func1_Post2, which overrides and returns hook.m_Var again.
   3.144 -
   3.145 -	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Pre2, false);
   3.146 -	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Post2, true);
   3.147 -
   3.148 -	int &ret4 = pTest->Func1();
   3.149 -	ADD_STATE(State_Func1_Ret(&ret4));
   3.150 -
   3.151 -	CHECK_STATES((&g_States,
   3.152 -		new State_Func1_Pre1(&hook.m_Var),		// Pre1 says that it's going to override with hook.m_Var
   3.153 -		new State_Func1_Pre2(MRES_OVERRIDE,			// current status
   3.154 -							&hook.m_Var,			// override ret (which it set to 1337)
   3.155 -							&g_Var),				// what it's going to ret, AND supercede with
   3.156 -
   3.157 -		new State_Func1_Post1(&g_Var, &g_Var),	// origret(=p1) is what pre2 superceded with,
   3.158 -												//  so  overrideret(=p2) has to be the same
   3.159 -		new State_Func1_Post2(&hook.m_Var),			// post2 is going to override with hook.m_Var again
   3.160 -		new State_Func1_Ret(&hook.m_Var),		// ==>>> hook.m_Var is returned
   3.161 -		NULL), "Part 4");
   3.162 -
   3.163 -	CHECK_COND(hook.m_Var == 1337, "Part 4.1");
   3.164 -	
   3.165 -	// Through a callclass
   3.166 -	SourceHook::CallClass<Test> *cc1 = SH_GET_CALLCLASS(&test);
   3.167 -	int &ret5 = SH_CALL(cc1, &Test::Func1)();
   3.168 -	ADD_STATE(State_Func1_Ret(&ret5));
   3.169 -
   3.170 -	CHECK_STATES((&g_States,
   3.171 -		new State_Func1(&test.m_Var1),
   3.172 -		new State_Func1_Ret(&test.m_Var1),
   3.173 -		NULL), "Part 5");
   3.174 -
   3.175 -	SH_RELEASE_CALLCLASS(cc1);
   3.176 -
   3.177 -	////////////////////////////////////////////////////////////////////////////////////////
   3.178 -	// Func2 tests
   3.179 -	const int &ret21 = pTest->Func2(500);
   3.180 -	ADD_STATE(State_Func2_Ret(&ret21));
   3.181 -
   3.182 -	CHECK_STATES((&g_States,
   3.183 -		new State_Func2(500, &test.m_Var2),
   3.184 -		new State_Func2_Ret(&test.m_Var2),
   3.185 -		NULL), "Part 6");
   3.186 -
   3.187 -	SH_ADD_HOOK_MEMFUNC(Test, Func2, &test, &hook, &CHook::Func2_Pre1, false);
   3.188 -	SH_ADD_HOOK_MEMFUNC(Test, Func2, &test, &hook, &CHook::Func2_Post1, true);
   3.189 -
   3.190 -	const int &ret22 = pTest->Func2(500);
   3.191 -	ADD_STATE(State_Func2_Ret(&ret22));
   3.192 -
   3.193 -	CHECK_STATES((&g_States,
   3.194 -		new State_Func2_Pre1(500, &hook.m_Var),		// p1 was 500; it's going to override with hook.m_Var; and also change p1 to 1337
   3.195 -		new State_Func2(1337, &test.m_Var2),		// p1 was 1337; it's going to ret test.m_Var2
   3.196 -		new State_Func2_Post1(1337,					// p1 was 1337
   3.197 -			&test.m_Var2,							// orig ret was test.m_Var2
   3.198 -			&hook.m_Var),							// override ret was hook.m_Var
   3.199 -		new State_Func2_Ret(&hook.m_Var),			// really returned hook.m_Var
   3.200 -		NULL), "Part 7");
   3.201 -	
   3.202 -   	return true;
   3.203 -}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/sourcehook/test/testrefret.cpp	Wed Aug 09 07:25:48 2006 +0000
     4.3 @@ -0,0 +1,200 @@
     4.4 +#include "testevents.h"
     4.5 +#include "sourcehook_test.h"
     4.6 +
     4.7 +// Tests support for functions which return references
     4.8 +
     4.9 +namespace
    4.10 +{
    4.11 +	StateList g_States;
    4.12 +	SourceHook::ISourceHook *g_SHPtr;
    4.13 +	SourceHook::Plugin g_PLID;
    4.14 +
    4.15 +	MAKE_STATE_1(State_Func1_Pre1, int*);			// p1: the ref Func1_Pre1 is going to return
    4.16 +	MAKE_STATE_3(State_Func1_Pre2, META_RES, int*, int*);	// p1: current status
    4.17 +															// p2: override ret
    4.18 +															// p3: what this handler is going to supercede with
    4.19 +	MAKE_STATE_1(State_Func1, int*);				// p1: the ref Func1 is going to return
    4.20 +	MAKE_STATE_2(State_Func1_Post1, int*, int*);	// p1: orig_ret; p2: override_ret
    4.21 +	MAKE_STATE_1(State_Func1_Post2, int*);			// p1: what it's going to return
    4.22 +	MAKE_STATE_1(State_Func1_Ret, int*);			// p1: the ref it returned
    4.23 +
    4.24 +
    4.25 +	MAKE_STATE_2(State_Func2_Pre1, int, const int*);				// p1: func's p1; p2: what it's going to ret
    4.26 +	MAKE_STATE_2(State_Func2, int, const int*);						// p1: func's p1; p2: what it's going to ret
    4.27 +	MAKE_STATE_3(State_Func2_Post1, int, const int*, const int*);	// p1: func's p1; p2: orig ret; p3: override ret
    4.28 +	MAKE_STATE_1(State_Func2_Ret, const int*);						// p1: ret
    4.29 +
    4.30 +	int g_Var;
    4.31 +
    4.32 +	class Test
    4.33 +	{
    4.34 +	public:
    4.35 +		int m_Var1;
    4.36 +		int m_Var2;
    4.37 +
    4.38 +		Test() : m_Var1(87)
    4.39 +		{
    4.40 +		}
    4.41 +
    4.42 +		virtual int& Func1()
    4.43 +		{
    4.44 +			ADD_STATE(State_Func1(&m_Var1));
    4.45 +			return m_Var1;
    4.46 +		}
    4.47 +		virtual const int& Func2(int p1)
    4.48 +		{
    4.49 +			ADD_STATE(State_Func2(p1, &m_Var2));
    4.50 +			m_Var2 = p1;
    4.51 +			return m_Var2;
    4.52 +		}
    4.53 +	};
    4.54 +
    4.55 +	class CHook
    4.56 +	{
    4.57 +	public:
    4.58 +		int m_Var;
    4.59 +		virtual int& Func1_Pre1()
    4.60 +		{
    4.61 +			ADD_STATE(State_Func1_Pre1(&m_Var));
    4.62 +			RETURN_META_VALUE(MRES_OVERRIDE, m_Var);
    4.63 +		}
    4.64 +		virtual int &Func1_Pre2()
    4.65 +		{
    4.66 +			int &overrideret = META_RESULT_OVERRIDE_RET(int&);
    4.67 +			overrideret = 1337;
    4.68 +			ADD_STATE(State_Func1_Pre2(META_RESULT_STATUS, &overrideret, &g_Var));
    4.69 +			RETURN_META_VALUE(MRES_SUPERCEDE, g_Var);
    4.70 +		}
    4.71 +		virtual int& Func1_Post1()
    4.72 +		{
    4.73 +			ADD_STATE(State_Func1_Post1(&META_RESULT_ORIG_RET(int&), &META_RESULT_OVERRIDE_RET(int&)));
    4.74 +			RETURN_META_NOREF(MRES_IGNORED, int&);
    4.75 +		}
    4.76 +		virtual int& Func1_Post2()
    4.77 +		{
    4.78 +			ADD_STATE(State_Func1_Post2(&m_Var));
    4.79 +			RETURN_META_VALUE(MRES_OVERRIDE, m_Var);
    4.80 +		}
    4.81 +
    4.82 +		virtual const int& Func2_Pre1(int p1)
    4.83 +		{
    4.84 +			ADD_STATE(State_Func2_Pre1(p1, &m_Var));
    4.85 +			RETURN_META_VALUE_NEWPARAMS(MRES_OVERRIDE, m_Var, static_cast<const int& (Test::*)(int)>(&Test::Func2), (1337));
    4.86 +		}
    4.87 +
    4.88 +		virtual const int& Func2_Post1(int p1)
    4.89 +		{
    4.90 +			ADD_STATE(State_Func2_Post1(p1, &META_RESULT_ORIG_RET(int&), &META_RESULT_OVERRIDE_RET(int&)));
    4.91 +			RETURN_META_NOREF(MRES_IGNORED, const int&);
    4.92 +		}
    4.93 +	};
    4.94 +
    4.95 +	SH_DECL_HOOK0(Test, Func1, SH_NOATTRIB, 0, int&);
    4.96 +	SH_DECL_HOOK1(Test, Func2, SH_NOATTRIB, 0, const int&, int);
    4.97 +}
    4.98 +
    4.99 +bool TestRefRet(std::string &error)
   4.100 +{
   4.101 +	GET_SHPTR(g_SHPtr);
   4.102 +	g_PLID = 1;
   4.103 +
   4.104 +	Test test;
   4.105 +	Test *pTest = &test;
   4.106 +	CHook hook;
   4.107 +
   4.108 +	int &ret1 = pTest->Func1();
   4.109 +	ADD_STATE(State_Func1_Ret(&ret1));
   4.110 +
   4.111 +	CHECK_STATES((&g_States,
   4.112 +		new State_Func1(&test.m_Var1),
   4.113 +		new State_Func1_Ret(&test.m_Var1),
   4.114 +		NULL), "Part 1");
   4.115 +
   4.116 +	// Now add Func1_Pre1, which supercedes and returns hook.m_Var
   4.117 +	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Pre1, false);
   4.118 +
   4.119 +	int &ret2 = pTest->Func1();
   4.120 +	ADD_STATE(State_Func1_Ret(&ret2));
   4.121 +	
   4.122 +	CHECK_STATES((&g_States,
   4.123 +		new State_Func1_Pre1(&hook.m_Var),		// Pre1 says that it's going to override with hook.m_Var
   4.124 +		new State_Func1(&test.m_Var1),			// Function says that it's going to return test.m_Var1
   4.125 +		new State_Func1_Ret(&hook.m_Var),		// hook.m_Var is returned
   4.126 +		NULL), "Part 2");
   4.127 +
   4.128 +	// Now add Func1_Post1, which only reports orig ret and override ret
   4.129 +	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Post1, true);
   4.130 +
   4.131 +	int &ret3 = pTest->Func1();
   4.132 +	ADD_STATE(State_Func1_Ret(&ret3));
   4.133 +	
   4.134 +	CHECK_STATES((&g_States,
   4.135 +		new State_Func1_Pre1(&hook.m_Var),		// Pre1 says that it's going to override with hook.m_Var
   4.136 +		new State_Func1(&test.m_Var1),			// Function says that it's going to return test.m_Var1
   4.137 +		new State_Func1_Post1(&test.m_Var1, &hook.m_Var),	// origret(=p1) is what it wanted to
   4.138 +															// return, overrideret(=p2) is pre1's var
   4.139 +		new State_Func1_Ret(&hook.m_Var),		// hook.m_Var is returned
   4.140 +		NULL), "Part 3");
   4.141 +
   4.142 +	// Now add Func1_Pre2, which supercedes and returns g_Var (it also sets the override ret from pre1 to 1337)
   4.143 +	// and add Func1_Post2, which overrides and returns hook.m_Var again.
   4.144 +
   4.145 +	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Pre2, false);
   4.146 +	SH_ADD_HOOK_MEMFUNC(Test, Func1, &test, &hook, &CHook::Func1_Post2, true);
   4.147 +
   4.148 +	int &ret4 = pTest->Func1();
   4.149 +	ADD_STATE(State_Func1_Ret(&ret4));
   4.150 +
   4.151 +	CHECK_STATES((&g_States,
   4.152 +		new State_Func1_Pre1(&hook.m_Var),		// Pre1 says that it's going to override with hook.m_Var
   4.153 +		new State_Func1_Pre2(MRES_OVERRIDE,			// current status
   4.154 +							&hook.m_Var,			// override ret (which it set to 1337)
   4.155 +							&g_Var),				// what it's going to ret, AND supercede with
   4.156 +
   4.157 +		new State_Func1_Post1(&g_Var, &g_Var),	// origret(=p1) is what pre2 superceded with,
   4.158 +												//  so  overrideret(=p2) has to be the same
   4.159 +		new State_Func1_Post2(&hook.m_Var),			// post2 is going to override with hook.m_Var again
   4.160 +		new State_Func1_Ret(&hook.m_Var),		// ==>>> hook.m_Var is returned
   4.161 +		NULL), "Part 4");
   4.162 +
   4.163 +	CHECK_COND(hook.m_Var == 1337, "Part 4.1");
   4.164 +	
   4.165 +	// Through a callclass
   4.166 +	SourceHook::CallClass<Test> *cc1 = SH_GET_CALLCLASS(&test);
   4.167 +	int &ret5 = SH_CALL(cc1, &Test::Func1)();
   4.168 +	ADD_STATE(State_Func1_Ret(&ret5));
   4.169 +
   4.170 +	CHECK_STATES((&g_States,
   4.171 +		new State_Func1(&test.m_Var1),
   4.172 +		new State_Func1_Ret(&test.m_Var1),
   4.173 +		NULL), "Part 5");
   4.174 +
   4.175 +	SH_RELEASE_CALLCLASS(cc1);
   4.176 +
   4.177 +	////////////////////////////////////////////////////////////////////////////////////////
   4.178 +	// Func2 tests
   4.179 +	const int &ret21 = pTest->Func2(500);
   4.180 +	ADD_STATE(State_Func2_Ret(&ret21));
   4.181 +
   4.182 +	CHECK_STATES((&g_States,
   4.183 +		new State_Func2(500, &test.m_Var2),
   4.184 +		new State_Func2_Ret(&test.m_Var2),
   4.185 +		NULL), "Part 6");
   4.186 +
   4.187 +	SH_ADD_HOOK_MEMFUNC(Test, Func2, &test, &hook, &CHook::Func2_Pre1, false);
   4.188 +	SH_ADD_HOOK_MEMFUNC(Test, Func2, &test, &hook, &CHook::Func2_Post1, true);
   4.189 +
   4.190 +	const int &ret22 = pTest->Func2(500);
   4.191 +	ADD_STATE(State_Func2_Ret(&ret22));
   4.192 +
   4.193 +	CHECK_STATES((&g_States,
   4.194 +		new State_Func2_Pre1(500, &hook.m_Var),		// p1 was 500; it's going to override with hook.m_Var; and also change p1 to 1337
   4.195 +		new State_Func2(1337, &test.m_Var2),		// p1 was 1337; it's going to ret test.m_Var2
   4.196 +		new State_Func2_Post1(1337,					// p1 was 1337
   4.197 +			&test.m_Var2,							// orig ret was test.m_Var2
   4.198 +			&hook.m_Var),							// override ret was hook.m_Var
   4.199 +		new State_Func2_Ret(&hook.m_Var),			// really returned hook.m_Var
   4.200 +		NULL), "Part 7");
   4.201 +	
   4.202 +   	return true;
   4.203 +}