#if !defined(__ErmTMP_h__)
#define __ErmTMP_h__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "TMP_Ver.h"
 
/***************************************/
/**** Error macros (using ACPerror) ****/
/***************************************/
#define M_TMPFatalError(ErrorNum) \
{ \
 if (ErrorNum>E_uwTMPFatalErr&&ErrorNum<E_uwTMPStartOfWarning) \
 { \
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
  Erm_M_UpdateLastError(TMP,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
 else \
 { \
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
  Erm_M_UpdateLastError(TMP,C_ucErmDefaultChannel,E_uwTMPFatalErrorNotAFatalError,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
}
 
#define M_TMPInformationError(ErrorNum) \
{ \
 if (ErrorNum>E_uwTMPStartOfInformationWarning&&ErrorNum<E_uwTMPErrNumber) \
 { \
  Erm_M_UpdateLastError(TMP,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmNoOpenInfoWindow,C_ucNeverStopForDebug, NULL);\
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
 } \
 else \
 { \
  M_TMPFatalError(E_uwTMPInformationErrorIsNotAInformationError); \
 } \
}
 
#define M_TMPWarningError(ErrorNum) \
{ \
 if (ErrorNum>E_uwTMPStartOfWarning&&ErrorNum<E_uwTMPStartOfInformationWarning) \
 { \
  Erm_M_UpdateLastError(TMP,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
 else \
 { \
  M_TMPFatalError(E_uwTMPWarningErrorIsNotAWarningError); \
 } \
}
 
#define __FATAL_ERR_INPUT__
#define __INFORMATION_ERR_INPUT__ /**** Treat as a level 1 warning ****/
#define __WARNING_ERR_INPUT__     /**** Treat as a level 2 warning ****/
 
enum e_uwTMPErrNumber
{
 E_uwTMPFatalErr,
 #if defined(__FATAL_ERR_INPUT__)
 /**** Error's errors ****/
 E_uwTMPFatalErrorNotAFatalError,
 E_uwTMPInformationErrorIsNotAInformationError,
 E_uwTMPWarningErrorIsNotAWarningError,
 E_uwTMPBadMallocSize,
 #endif /*__FATAL_ERR_INPUT__*/
 
 E_uwTMPStartOfWarning,
 
 #if defined(__WARNING_ERR_INPUT__)
 E_uwTMPMallocFailed,
 E_uwTMPDebugDynamicAllocation,
 #endif /*__WARNING_ERR_INPUT__*/
 
 E_uwTMPStartOfInformationWarning,
 
 #if defined(__INFORMATION_ERR_INPUT__)
 E_uwTMPFreeNullPointer,
 #endif /*__INFORMATION_ERR_INPUT__*/
 
	E_uwTMPErrNumber,
};
 
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef EXTERN
#undef extern
#undef LOCAL
#if !defined(D_TMP_VariableDefine)
#define EXTERN extern /*external declaration*/
#define LOCAL /*replace by nothing : we have to declare*/
#else /* D_TMP_VariableDefine */
#define EXTERN /*replace by nothing : we have to declare*/
#define LOCAL /*replace by nothing : we have to declare*/
#endif /* D_TMP_VariableDefine */
 
EXTERN unsigned char g_ucTMPModuleId /* number of identification of the Game module*/
#if defined(D_TMP_VariableDefine)
= C_ucModuleNotInitialized
#endif /* D_TMP_VariableDefine */
;
 
#if defined(__ERROR_STRINGS__)
 
EXTERN CPA_EXPORT char * g_a_szTMPInformationModule []
#if defined(D_TMP_VariableDefine) && !defined(CPA_WANTS_IMPORT)
= {C_szTMPVersion, C_szTMPFullName, C_szTMPDate}
#endif /* D_TMP_VariableDefine &&  CPA_WANTS_IMPORT */
;
 
EXTERN char * g_szTMPModuleName /* Obliged syntax 'sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#if defined(D_TMP_VariableDefine)
= {"TMP"}
#endif /* D_TMP_VariableDefine */
;
 
EXTERN tdstErrorMsg g_a_stTMPTabErr[] /* Obliged syntax 'a_sz'+[Abbreviation of ModuleName]+'TabErr'*/
#if defined(D_TMP_VariableDefine)
=
{
 #if defined(__FATAL_ERR_INPUT__)
 /**** Error's errors ****/
 E_uwTMPFatalErrorNotAFatalError,"M_TMPFatalError : try to raise a warning or an information",
 E_uwTMPInformationErrorIsNotAInformationError,"M_TMPInformationError : try to raise a fatal or a warning",
 E_uwTMPWarningErrorIsNotAWarningError,"M_TMPWarningError : try to raise a fatal or a information",
 E_uwTMPBadMallocSize,"TMP_fnp_vRealMalloc : Bad malloc size (0)",
 #endif /*__FATAL_ERR_INPUT__*/
 
 #ifdef __WARNING_ERR_INPUT__
 E_uwTMPMallocFailed,"TMP_fnp_vRealMalloc : Malloc failed",
 E_uwTMPDebugDynamicAllocation,"Debug verion : dynamic allocation in bloc TMP (don't forget to increase the bloc)",
 #endif /*__WARNING_ERR_INPUT__*/
 
 #ifdef __INFORMATION_ERR_INPUT__
 E_uwTMPFreeNullPointer,"TMP_fn_vFree : Attempt to free a NULL pointer.",
 #endif /*__INFORMATION_ERR_INPUT__*/
 
	0xffff,"\0"/*fin*/
}
#endif /* D_TMP_VariableDefine */
;
#endif /* __ERROR_STRINGS__ */
 
#undef EXTERN
#undef extern
 
#endif /* !__ErmTMP_h__ */
