reman3/Rayman_X/cpa/tempgrp/AI/AIDebug/AID_Main.h

179 lines
5.2 KiB
C

/*
//////////////////////////////////////////////////////////////////////
AI Debug main file
//////////////////////////////////////////////////////////////////////
File Name : AID_Main.h
Date : November 15, 1996
Author : Albert PAIS
//////////////////////////////////////////////////////////////////////
Purpose :
This file defines structures and prototypes used by differents
components of the AI debugger
//////////////////////////////////////////////////////////////////////
*/
#if !defined(__AIDMAIN_TYPES__)
#define __AIDMAIN_TYPES__
#if !defined(ONLY_TYPES)
#define AIDMAIN_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
#if defined(AIDMAIN_UNDEF)
#undef ONLY_TYPES
#undef AIDMAIN_UNDEF
#endif /* !AIDMAIN_UNDEF */
/*
------------------------------------------------------------------------------------------
TYPE DECLARATION :
------------------------------------------------------------------------------------------
*/
#endif /* !__AIDMAIN_TYPES__ */
#if !defined(ONLY_TYPES)
#if !defined(__AIDMAIN_VARS__)
#define __AIDMAIN_VARS__
#undef EXTERN
#undef extern
#if !defined(GLOBALS)
#define EXTERN extern
#else /* !GLOBALS */
#define EXTERN
#endif /* !GLOBALS */
/*
------------------------------------------------------------------------------------------
VARIABLES DEFINITION :
------------------------------------------------------------------------------------------
*/
#ifdef ACTIVE_AIDEBUG /* For AI debugger*/
#define AIDebug_C_ucIsReflex ((unsigned char)0)
#define AIDebug_C_ucIsAI ((unsigned char)1)
#endif /* ACTIVE_AIDEBUG For AI debugger*/
#endif /* !__AIDMAIN_VARS__ */
#if !defined (__AIDMAIN_PROTOS__)
#define __AIDMAIN_PROTOS__
/*
------------------------------------------------------------------------------------------
MACROS DECLARATION:
------------------------------------------------------------------------------------------
*/
#ifdef ACTIVE_AIDEBUG /* For AI debugger*/
/* getting a slot from a structure :*/
#define AIDebug_M_GetSlot(_p_stObject,_SlotName)\
((_p_stObject)->m_##_SlotName)
/* memory for AIDebug module :*/
#define AIDebug_M_xAlloc(_Var,_Type,_Size,_ErrorCode,_FailureDo)\
if(_Size)\
{\
Mmg_M_SetModeAlloc4Ch(AIDebug,E_ucDynamic,C_ucMmgDefaultChannel);\
_Var = (_Type)Mmg_fn_p_vAlloc4Ch(_Size,C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg,C_ucErmDefaultChannel)) /*** DR Mmg instead of Mem ***/ \
{/* An error occured : initialisation failure*/ \
Erm_M_ClearLastError(C_ucErmDefaultChannel); \
Erm_M_UpdateLastError \
( \
AIDebug, /* Module 's name*/ \
C_ucErmDefaultChannel, /*mutli-thread channel*/ \
_ErrorCode, /* error code */ \
C_lErmNoDebugData, /* long for debugging data */\
C_ucErmOpenInfoWindow, /* open window ?*/ \
C_ucAllowStopForDebug,/* wether to stop or not for debugging */\
NULL \
); \
/* error ::*/ \
(_Var) = (_Type)NULL;\
_FailureDo;\
}\
}
#define AIDebug_M_xReAlloc(_Var,_Type,_Size,_ErrorCode,_FailureDo)\
if(_Size)\
{\
Mmg_M_SetModeAlloc4Ch(AIDebug,E_ucDynamic,C_ucMmgDefaultChannel);\
_Var = (_Type)Mmg_fn_p_vRealloc4Ch((void*)(_Var),_Size,C_ucMmgDefaultChannel);\
if(Erm_M_uwCheckError(Mmg,C_ucErmDefaultChannel))\
{/* An error occured : initialisation failure*/ \
Erm_M_ClearLastError(C_ucErmDefaultChannel); \
Erm_M_UpdateLastError \
( \
AIDebug, /* Module 's name*/ \
C_ucErmDefaultChannel, /*mutli-thread channel*/ \
_ErrorCode, /* error code */ \
C_lErmNoDebugData, /* long for debugging data */\
C_ucErmOpenInfoWindow, /* open window ?*/ \
C_ucAllowStopForDebug,/* wether to stop or not for debugging */\
NULL \
); \
/* error ::*/ \
(_Var) = (_Type)NULL;\
_FailureDo;\
}\
}
#define AIDebug_M_xFree(_Var,_Type,_ErrorCode,_FailureDo)\
if(_Var)\
{\
Mmg_M_SetModeAlloc4Ch(AIDebug,E_ucDynamic,C_ucMmgDefaultChannel);\
Mmg_fn_vFree4Ch((void*)(_Var),C_ucMmgDefaultChannel);\
(_Var) = (_Type)NULL;\
if(Erm_M_uwCheckError(Mmg,C_ucErmDefaultChannel))/*** DR Mmg instead of Mem ***/\
{\
/* handle error :*/\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
Erm_M_UpdateLastError\
(\
AIDebug, /* Module 's name*/\
C_ucErmDefaultChannel, /*mutli-thread channel*/\
_ErrorCode, /* error code */\
C_lErmNoDebugData, /* long for debugging data */\
C_ucErmOpenInfoWindow, /* open window ?*/\
C_ucAllowStopForDebug,/* wether to stop or not for debugging */\
NULL \
);\
_FailureDo;\
}\
}
#define AIDebug_M_MainInitialisation()\
AIDebug_fnv_InitMain();\
if(Erm_M_uwCheckError(AIDebug,C_ucErmDefaultChannel))\
Erm_M_ClearLastError(C_ucErmDefaultChannel);
/*
------------------------------------------------------------------------------------------
FUNCTIONS PROTOTYPES :
------------------------------------------------------------------------------------------
*/
/* main initialisation function*/
void AIDebug_fnv_InitMain(void);
#else /* ACTIVE_AIDEBUG For AI debugger*/
#define AIDebug_M_MainInitialisation()
#endif /* ACTIVE_AIDEBUG For AI debugger*/
#endif /* !__AIDMAIN_PROTOS__ */
#endif /* !ONLY_TYPES */