/*////////////////////*/
/* macro for Memory //*/
/*////////////////////*/
 
#ifndef _MacroINO_
#define _MacroINO_
 
 
#ifdef INO_USE_CPA
 
#define M_INOInitMem() Mmg_M_SetModeAlloc4Ch(INO, E_ucDynamic, C_ucMmgDefaultChannel)
 
 
#define M_INOAlloc(Var, cast, ulSize)\
{\
	M_INOInitMem();\
	Var = (cast) Mmg_fn_p_vAlloc(ulSize);\
	if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
		Erm_M_ClearLastError(C_ucErmDefaultChannel);\
		Erm_M_UpdateLastError(INO, C_ucErmDefaultChannel, E_uwINO_FatalFailedAllocationMem, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
	}\
}
 
#define M_INOAllocWithoutInitMem(Var, cast, ulSize)\
{\
	Var = (cast) Mmg_fn_p_vAlloc(ulSize);\
	if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
		Erm_M_ClearLastError(C_ucErmDefaultChannel);\
		Erm_M_UpdateLastError(INO, C_ucErmDefaultChannel, E_uwINO_FatalFailedAllocationMem, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
	}\
}
 
#define M_INORealloc(Var, AdrSrc, cast, ulSize)\
{\
	M_INOInitMem();\
	Var = (cast) Mmg_fn_p_vRealloc(AdrSrc, ulSize);\
	if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
		Erm_M_ClearLastError(C_ucErmDefaultChannel);\
		Erm_M_UpdateLastError(INO, C_ucErmDefaultChannel, E_uwINO_FatalFailedAllocationMem, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
	}\
}
 
#define M_INOReallocWithoutInitMem(Var, AdrSrc, cast, ulSize)\
{\
	Var = (cast) Mmg_fn_p_vRealloc(AdrSrc, ulSize);\
	if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel)){\
		Erm_M_ClearLastError(C_ucErmDefaultChannel);\
		Erm_M_UpdateLastError(INO, C_ucErmDefaultChannel, E_uwINO_FatalFailedAllocationMem, C_lErmNoDebugData, C_ucErmOpenInfoWindow, C_ucAllowStopForDebug, NULL);\
	}\
}
 
 
#define M_INOFree(p_cAdr) \
{\
	M_INOInitMem();\
	Mmg_fn_vFree(p_cAdr);\
	if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel))\
		Erm_M_ClearLastError(C_ucErmDefaultChannel);\
}
 
#define M_INOFreeWithoutInitMem(p_cAdr) \
{\
	Mmg_fn_vFree(p_cAdr);\
	if (Erm_M_uwCheckError(Mmg, C_ucErmDefaultChannel))\
		Erm_M_ClearLastError(C_ucErmDefaultChannel);\
}
 
#else
 
#define M_INOAlloc(Var, cast, ulSize)		Var = (cast) GlobalAlloc(GPTR,ulSize)
 
#define M_INOFree(p_cAdr)					GlobalFree(p_cAdr)
 
#endif
 
#endif /* __INOMACROS_H__*/
