#if !defined(__ErmSAI_h__)
#define __ErmSAI_h__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "SAI_Ver.h"
 
/***************************************/
/**** Error macros (using ACPerror) ****/
/***************************************/
#define M_SAIFatalError(ErrorNum) \
{ \
 if (ErrorNum>E_uwSAIFatalErr&&ErrorNum<E_uwSAIStartOfWarning) \
 { \
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
  Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
 else \
 { \
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
  Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,E_uwSAIFatalErrorNotAFatalError,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
}
 
#define M_SAIInformationError(ErrorNum) \
{ \
 if (ErrorNum>E_uwSAIStartOfInformationWarning&&ErrorNum<E_uwSAIErrNumber) \
 { \
  Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmNoOpenInfoWindow,C_ucNeverStopForDebug, NULL);\
  Erm_M_ClearLastError(C_ucErmDefaultChannel);\
 } \
 else \
 { \
  M_SAIFatalError(E_uwSAIInformationErrorIsNotAInformationError); \
 } \
}
 
#define M_SAIWarningError(ErrorNum) \
{ \
 if (ErrorNum>E_uwSAIStartOfWarning&&ErrorNum<E_uwSAIStartOfInformationWarning) \
 { \
  Erm_M_UpdateLastError(SAI,C_ucErmDefaultChannel,ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
 } \
 else \
 { \
  M_SAIFatalError(E_uwSAIWarningErrorIsNotAWarningError); \
 } \
}
 
#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_uwSAIErrNumber
{
 E_uwSAIFatalErr,
 #if defined(__FATAL_ERR_INPUT__)
 /**** Error's errors ****/
 E_uwSAIFatalErrorNotAFatalError,
 E_uwSAIInformationErrorIsNotAInformationError,
 E_uwSAIWarningErrorIsNotAWarningError,
 E_uwSAI_CreateAListEntry,
 E_uwSAI_SaveTableAndCurrentValue,
 E_uwSAI_ArrayCantChangeSize,
 E_uwSAI_InvalidSaveMode,
 #endif /*__FATAL_ERR_INPUT__*/
 
 E_uwSAIStartOfWarning,
 
 #if defined(__WARNING_ERR_INPUT__)
 E_uwSAI_SaveCurrentAndInitOther,
 E_uwSAI_SaveDynamicPointer,
 E_uwSAI_LoadDynamicPointer,
 #endif /*__WARNING_ERR_INPUT__*/
 
 E_uwSAIStartOfInformationWarning,
 
 #if defined(__INFORMATION_ERR_INPUT__)
 #endif /*__INFORMATION_ERR_INPUT__*/
 
	E_uwSAIErrNumber,
};
 
/*------------------*/
/* Global Variables*/
/*------------------*/
#undef EXTERN
#undef extern
#undef LOCAL
#if !defined(D_SAI_Input_VariableDefine)
#define EXTERN extern /*external declaration*/
#define LOCAL /*replace by nothing : we have to declare*/
#else /* D_SAI_Input_VariableDefine */
#define EXTERN /*replace by nothing : we have to declare*/
#define LOCAL /*replace by nothing : we have to declare*/
#endif /* D_SAI_Input_VariableDefine */
 
EXTERN unsigned char g_ucSAIModuleId /* number of identification of the Game module*/
#if defined(D_SAI_Input_VariableDefine)
= C_ucModuleNotInitialized
#endif /* D_SAI_Input_VariableDefine */
;
 
#if defined(__ERROR_STRINGS__)
 
EXTERN CPA_EXPORT char * g_a_szSAIInformationModule []
#if defined(D_SAI_Input_VariableDefine) && !defined(CPA_WANTS_IMPORT)
= {C_szSAIVersion, C_szSAIFullName, C_szSAIDate}
#endif /* D_SAI_Input_VariableDefine &&  CPA_WANTS_IMPORT */
;
 
EXTERN char * g_szSAIModuleName /* Obliged syntax 'sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#if defined(D_SAI_Input_VariableDefine)
= {"SAI"}
#endif /* D_SAI_Input_VariableDefine */
;
 
EXTERN tdstErrorMsg g_a_stSAITabErr[] /* Obliged syntax 'a_sz'+[Abbreviation of ModuleName]+'TabErr'*/
#if defined(D_SAI_Input_VariableDefine)
=
{
 #if defined(__FATAL_ERR_INPUT__)
 /**** Error's errors ****/
 E_uwSAIFatalErrorNotAFatalError,"M_SAIFatalError : try to raise a warning or an information",
 E_uwSAIInformationErrorIsNotAInformationError,"M_SAIInformationError : try to raise a fatal or a warning",
 E_uwSAIWarningErrorIsNotAWarningError,"M_SAIWarningError : try to raise a fatal or a information",
 E_uwSAI_CreateAListEntry,"SAI_fn_hCreateAListEntry : not enough memory.",
 E_uwSAI_SaveTableAndCurrentValue,"SAI_fn_eVerifyFlags : can't used SAI_eSaveTableValue and SAI_eSaveCurrentValue in the same time.",
 E_uwSAI_ArrayCantChangeSize,"A array entry can not change its size.",
 E_uwSAI_InvalidSaveMode,"Invalid save mode.",
 #endif /*__FATAL_ERR_INPUT__*/
 
 #ifdef __WARNING_ERR_INPUT__
 E_uwSAI_SaveCurrentAndInitOther,"SAI_fn_eVerifyFlags : use SAI_eSaveCurrentValue and SAI_eInitWhenMapLoaded or SAI_eInitWhenReinitTheMap or SAI_eInitWhenPlayerDead can not run correctly.",
 E_uwSAI_SaveDynamicPointer,"Save dynamic pointer (can not run correctly)",
 E_uwSAI_LoadDynamicPointer,"Load dynamic pointer (can not run correctly)",
 #endif /*__WARNING_ERR_INPUT__*/
 
 #ifdef __INFORMATION_ERR_INPUT__
 #endif /*__INFORMATION_ERR_INPUT__*/
 
	0xffff,"\0"/*fin*/
}
#endif /* D_SAI_Input_VariableDefine */
;
#endif /* __ERROR_STRINGS__ */
 
#undef EXTERN
#undef extern
 
#endif /* !__ErmSAI_h__ */
