#if !defined(__ErmCMP_h__)
#define __ErmCMP_h__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "CMP_Ver.h"
 
/***************************************/
/**** Error macros (using ACPerror) ****/
/***************************************/
#define M_CMPFatalError(ErrorNum) \
{ \
 if (ErrorNum>E_uwCMPFatalErr&&ErrorNum<E_uwCMPStartOfWarning) \
 { \
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
  Erm_M_UpdateLastError(CMP,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
 else \
 { \
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
  Erm_M_UpdateLastError(CMP,C_ucErmDefaultChannel,E_uwCMPFatalErrorNotAFatalError,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
}
 
#define M_CMPInformationError(ErrorNum) \
{ \
 if (ErrorNum>E_uwCMPStartOfInformationWarning&&ErrorNum<E_uwCMPErrNumber) \
 { \
  Erm_M_UpdateLastError(CMP,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmNoOpenInfoWindow,C_ucNeverStopForDebug, NULL);\
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
 } \
 else \
 { \
  M_CMPFatalError(E_uwCMPInformationErrorIsNotAInformationError); \
 } \
}
 
#define M_CMPWarningError(ErrorNum) \
{ \
 if (ErrorNum>E_uwCMPStartOfWarning&&ErrorNum<E_uwCMPStartOfInformationWarning) \
 { \
  Erm_M_UpdateLastError(CMP,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
 else \
 { \
  M_CMPFatalError(E_uwCMPWarningErrorIsNotAWarningError); \
 } \
}
 
#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_uwCMPErrNumber
{
 E_uwCMPFatalErr,
 #if defined(__FATAL_ERR_INPUT__)
 /**** Error's errors ****/
 E_uwCMPFatalErrorNotAFatalError,
 E_uwCMPInformationErrorIsNotAInformationError,
 E_uwCMPWarningErrorIsNotAWarningError,
 E_uwCMPCloseFileError,
 E_uwCMPOutputBitError,
 E_uwCMPOutputBitsError,
 E_uwCMPInputBitError,
 E_uwCMPInputBitsError,
 E_uwCMPCheckSum,
 E_uwCMPFileCorrupted,
 #endif /*__FATAL_ERR_INPUT__*/
 
 E_uwCMPStartOfWarning,
 
 #if defined(__WARNING_ERR_INPUT__)
 #endif /*__WARNING_ERR_INPUT__*/
 
 E_uwCMPStartOfInformationWarning,
 
 #if defined(__INFORMATION_ERR_INPUT__)
 #endif /*__INFORMATION_ERR_INPUT__*/
 
	E_uwCMPErrNumber,
};
 
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef EXTERN
#undef extern
#undef LOCAL
#if !defined(D_CMP_Input_VariableDefine)
#define EXTERN extern /*external declaration*/
#define LOCAL /*replace by nothing : we have to declare*/
#else /* D_CMP_Input_VariableDefine */
#define EXTERN /*replace by nothing : we have to declare*/
#define LOCAL /*replace by nothing : we have to declare*/
#endif /* D_CMP_Input_VariableDefine */
 
EXTERN unsigned char g_ucCMPModuleId /* number of identification of the Game module*/
#if defined(D_CMP_Input_VariableDefine)
= C_ucModuleNotInitialized
#endif /* D_CMP_Input_VariableDefine */
;
 
#if defined(__ERROR_STRINGS__)
 
EXTERN CPA_EXPORT char * g_a_szCMPInformationModule []
#if defined(D_CMP_Input_VariableDefine) && !defined(CPA_WANTS_IMPORT)
= {C_szCMPVersion, C_szCMPFullName, C_szCMPDate}
#endif /* D_CMP_Input_VariableDefine &&  CPA_WANTS_IMPORT */
;
 
EXTERN char * g_szCMPModuleName /* Obliged syntax 'sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#if defined(D_CMP_Input_VariableDefine)
= {"CMP"}
#endif /* D_CMP_Input_VariableDefine */
;
 
EXTERN tdstErrorMsg g_a_stCMPTabErr[] /* Obliged syntax 'a_sz'+[Abbreviation of ModuleName]+'TabErr'*/
#if defined(D_CMP_Input_VariableDefine)
=
{
 #if defined(__FATAL_ERR_INPUT__)
 /**** Error's errors ****/
 E_uwCMPFatalErrorNotAFatalError,"M_CMPFatalError : try to raise a warning or an information",
 E_uwCMPInformationErrorIsNotAInformationError,"M_CMPInformationError : try to raise a fatal or a warning",
 E_uwCMPWarningErrorIsNotAWarningError,"M_CMPWarningError : try to raise a fatal or a information",
 E_uwCMPCloseFileError,"Can not close the file",
 E_uwCMPOutputBitError,"fn_vOutputBit : Error",
 E_uwCMPOutputBitsError,"fn_vOutputBits : Error",
 E_uwCMPInputBitError,"fn_lInputBit : Error",
 E_uwCMPInputBitsError,"fn_ulInputBit : Error",
 E_uwCMPCheckSum,"Bad CheckSum",
 E_uwCMPFileCorrupted,"File corrupted",
 #endif /*__FATAL_ERR_INPUT__*/
 
 #ifdef __WARNING_ERR_INPUT__
 #endif /*__WARNING_ERR_INPUT__*/
 
 #ifdef __INFORMATION_ERR_INPUT__
 #endif /*__INFORMATION_ERR_INPUT__*/
 
	0xffff,"\0"/*fin*/
}
#endif /* D_CMP_Input_VariableDefine */
;
#endif /* __ERROR_STRINGS__ */
 
#undef EXTERN
#undef extern
 
#endif /* !__ErmCMP_h__ */
