#if !defined(_CFAST_H_)
#define _CFAST_H_
 
#include "..\AiBase\Specif\AiOption.h"
 
#include "GSParam.h"
#include "StrIntel.h"
#include "EnumType.h"
#include "AI\AIGame\TypePtr.h"
#include "AI\AIGame\ConvCst.h"
 
#define CFast_lMaxTreeDepth 20
 
#ifdef __cplusplus
/*extern "C" {*/
#endif
 
/**************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/**************************************/
#undef extern
#define EXTERN_AI_DLL extern
 
/*
 * Array for all C functions.
 */
typedef struct CFast_tdst_ArrayFunctions_
{
/*	char						*mpsz_Name;*/
	void						(*mfnv_Function)(HIE_tdxHandleToSuperObject);
#ifdef U64
	//long						ml_SizeOfCode;
	long						ml_SizeOfTree;
	struct tdstNodeInterpret_	*mp_stPseudoTree;
#endif
} CFast_tdst_ArrayFunctions;
 
typedef void (*CFast_EvalFunc)(void);
 
/*
 * functions 
 */ 
#define C_MAX_SIZE_FUNCTION_EDITOR_NAME 50
#define C_MAX_SIZE_FUNCTION_SCRIPT_NAME 41
#define C_MAX_FUNCTION_NB_IN_PARAM 6 
#define C_MAX_FUNCTION_NB_OUT_PARAM 1
typedef struct tdstFunctionEntry_
{
#if defined(ACTIVE_EDITOR)
    /* Function string used in editor*/
    char szFunctionEditorName[C_MAX_SIZE_FUNCTION_EDITOR_NAME+1]; 
    char szFunctionEditorName_En[C_MAX_SIZE_FUNCTION_EDITOR_NAME+1]; 
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
    /* Function string used in script*/
    char szFunctionScriptName[C_MAX_SIZE_FUNCTION_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
    /* pointer on Function function*/
    tdp_fn_p_stFunctionFunctionPtr p_fn_p_stFunctionFunction;
#endif /* _AI_LIB_*/
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
	/* list of Function parameters (taken from szAutorizedTypeParam) in parameter*/
	char szFunctionTypeInParam[C_MAX_FUNCTION_NB_IN_PARAM+1];
    /* out parameter*/
	char szFunctionTypeOutParam[C_MAX_FUNCTION_NB_OUT_PARAM+1];
#endif /* AI_USE_SCRIPT */
	unsigned char bUltraFunctionFlag;
 
#ifdef PROFILE_IA
	unsigned long ulCallCtr;
	unsigned long ulTimeCtr;
	unsigned long ulOwnTimeCtr;
#endif /* PROFILE_IA*/
} tdstFunctionEntry;
extern tdstFunctionEntry a_stFunctionTable[] ;
 
/*
 * Keyword
 */
#define C_MAX_SIZE_KEYWORD_EDITOR_NAME 17
#define C_MAX_SIZE_KEYWORD_SCRIPT_NAME 14
#define C_MAX_KEYWORD_NB_IN_PARAM  3
#define C_MAX_KEYWORD_NB_OUT_PARAM 1
 
#if defined(ACTIVE_EDITOR) || defined(AI_USE_SCRIPT) || defined(_AI_LIB_)
 
typedef struct tdstKeyWordEntry_
{
 
#if defined(ACTIVE_EDITOR)
    /* KeyWord string used in editor*/
    char szKeyWordEditorName[C_MAX_SIZE_KEYWORD_EDITOR_NAME+1]; 
    char szKeyWordEditorName_En[C_MAX_SIZE_KEYWORD_EDITOR_NAME+1]; 
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
	/* KeyWord string used in script*/
    char szKeyWordScriptName[C_MAX_SIZE_KEYWORD_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
	/* pointer on KeyWord function*/
    tdp_fn_p_stKeyWordFunctionPtr p_fn_p_stKeyWordFunction;
#endif /* _AI_LIB_*/
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
	/* list of KeyWord parameters (taken from szAutorizedTypeParam) in parameter*/
	char szKeyWordTypeInParam[C_MAX_KEYWORD_NB_IN_PARAM+1];
    /* list of KeyWord parameters (taken from szAutorizedTypeParam) out parameter*/
	char szKeyWordTypeOutParam[C_MAX_KEYWORD_NB_OUT_PARAM+1];
#endif /* AI_USE_SCRIPT */
} tdstKeyWordEntry;
 
extern tdstKeyWordEntry a_stKeyWordTable[] ;
 
#endif
 
/*
 * conditions
 */
#define C_MAX_SIZE_CONDITION_EDITOR_NAME 50
#define C_MAX_SIZE_CONDITION_SCRIPT_NAME 40
#define C_MAX_CONDITION_NB_PARAM 4
 
typedef struct tdstConditionEntry_
{
#if defined(ACTIVE_EDITOR)
    /* Condition string used in editor*/
    char szConditionEditorName[C_MAX_SIZE_CONDITION_EDITOR_NAME+1]; 
    char szConditionEditorName_En[C_MAX_SIZE_CONDITION_EDITOR_NAME+1]; 
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
    /* Condition string used in script*/
    char szConditionScriptName[C_MAX_SIZE_CONDITION_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
    /* pointer on Condition function*/
    tdp_fn_p_stConditionFunctionPtr p_fn_p_stConditionFunction;
#endif /* _AI_LIB_*/
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
	/* list of Condition parameters (taken from szAutorizedTypeParam) in parameter*/
	char szConditionTypeInParam[C_MAX_CONDITION_NB_PARAM+1];
#endif /* AI_USE_SCRIPT */
 
	unsigned char bUltraCondtionFlag;
 
#ifdef PROFILE_IA
	unsigned long ulCallCtr;
	unsigned long ulTimeCtr;
	unsigned long ulOwnTimeCtr;
#endif /* PROFILE_IA*/
} tdstConditionEntry;
 
extern tdstConditionEntry a_stConditionTable[] ;
 
/*
 * Meta-Action
 */
#define C_MAX_SIZE_META_ACTION_SCRIPT_NAME 37
#define C_MAX_SIZE_META_ACTION_EDITOR_NAME 80
#define C_MAX_NB_META_ACTION_PARAM		   C_MAX_NB_PARAM
 
typedef struct tdstMetaActionEntry_
{
#if defined(ACTIVE_EDITOR)
    /* metaaction string used in editor*/
    char szMetaActionEditorName[C_MAX_SIZE_META_ACTION_EDITOR_NAME+1]; 
    char szMetaActionEditorName_En[C_MAX_SIZE_META_ACTION_EDITOR_NAME+1]; 
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
    /* metaaction string used in script*/
    char szMetaActionScriptName[C_MAX_SIZE_META_ACTION_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
	/* pointer on metaaction INIT function*/
    tdp_fn_p_stMetaActionInitFunctionPtr p_fn_p_stMetaActionInitFunction;
    /* pointer on metaaction NEXT function*/
    tdp_fn_ucMetaActionFunctionPtr p_fn_ucMetaActionFunction;
#endif /* _AI_LIB_*/
 
    /* list of metaaction parameters (taken from szAutorizedTypeParam)*/
    char szMetaActionTypeParam[C_MAX_NB_META_ACTION_PARAM+1];
} tdstMetaActionEntry;
 
extern tdstMetaActionEntry a_stMetaActionTable[] ;
 
/*
 * procedures
 */
#define C_MAX_SIZE_PROCEDURE_EDITOR_NAME 50
#define C_MAX_SIZE_PROCEDURE_SCRIPT_NAME 40
 
#define C_MAX_PROCEDURE_NB_PARAM 8 /*ANNECY YLT Passage de 6 à 8 arguments (note: ceci ne prend pas plus de place en release binarise)*/
 
typedef struct tdstProcedureEntry_
{
#if defined(ACTIVE_EDITOR)
    /* Procedure string used in editor*/
    char szProcedureEditorName[C_MAX_SIZE_PROCEDURE_EDITOR_NAME+1]; 
    char szProcedureEditorName_En[C_MAX_SIZE_PROCEDURE_EDITOR_NAME+1]; 
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
    /* Procedure string used in script*/
    char szProcedureScriptName[C_MAX_SIZE_PROCEDURE_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
    /* pointer on Procedure function*/
    tdp_fn_p_stProcedureFunctionPtr p_fn_p_stProcedureFunction;
#endif
#if defined (AI_USE_SCRIPT) || defined (U64_AIDEBUG)
	/* list of Procedure parameters (taken from szAutorizedTypeParam) in parameter*/
	char szProcedureTypeParam[C_MAX_PROCEDURE_NB_PARAM+1];
#endif /* AI_USE_SCRIPT */
	unsigned char bUltraProcedureFlag;
 
#ifdef PROFILE_IA
	unsigned long ulCallCtr;
	unsigned long ulTimeCtr;
	unsigned long ulOwnTimeCtr;
#endif /* PROFILE_IA*/
} tdstProcedureEntry;
 
extern tdstProcedureEntry a_stProcedureTable[] ;
 
/*
 * Operators
 */
#define C_MAX_SIZE_OPERATOR_EDITOR_NAME 4
#define C_MAX_SIZE_OPERATOR_SCRIPT_NAME 26
#define C_MAX_OPERATOR_NB_IN_PARAM 2
#define C_MAX_OPERATOR_NB_OUT_PARAM 1
 
#if defined(ACTIVE_EDITOR) || defined(AI_USE_SCRIPT) || defined(_AI_LIB_)
 
typedef struct tdstOperatorEntry_
{
#if defined(ACTIVE_EDITOR)
    /* Operator string used in editor*/
    char szOperatorEditorName[C_MAX_SIZE_OPERATOR_EDITOR_NAME+1]; 
#endif /* ACTIVE_EDITOR*/
#if defined (AI_USE_SCRIPT)
    /* Operator string used in script*/
    char szOperatorScriptName[C_MAX_SIZE_OPERATOR_SCRIPT_NAME+1];
#endif /* AI_USE_SCRIPT */
#if defined(_AI_LIB_)
    /* pointer on Operator function*/
    tdp_fn_p_stOperatorFunctionPtr p_fn_p_stOperatorFunction;
#endif /* _AI_LIB_*/
#if defined(ACTIVE_EDITOR)
	/* list of Operator parameters (taken from szAutorizedTypeParam) in parameter*/
	char szOperatorTypeInParam[C_MAX_OPERATOR_NB_IN_PARAM+1];
    /* out parameter*/
	char szOperatorTypeOutParam[C_MAX_OPERATOR_NB_OUT_PARAM+1];
#endif /* ACTIVE_EDITOR*/
} tdstOperatorEntry;
 
extern tdstOperatorEntry a_stOperatorTable[] ;
 
#endif
 
/*
 * type (vector, ... )
 */
typedef struct tdstTypeEntry_
{
  tdp_fn_p_stEvalTypePtr p_fn_p_stEvalTypePtr;
} tdstTypeEntry;
 
extern tdstTypeEntry a_stTypeTable[] ;
 
EXTERN_AI_DLL CPA_EXPORT tdp_fn_p_stConditionFunctionPtr      CFast_g_p_fn_CondPtr ;
EXTERN_AI_DLL CPA_EXPORT tdp_fn_p_stOperatorFunctionPtr       CFast_g_p_fn_OpPtr ;
EXTERN_AI_DLL CPA_EXPORT tdp_fn_p_stProcedureFunctionPtr      CFast_g_p_fn_ProcPtr ;
EXTERN_AI_DLL CPA_EXPORT tdp_fn_p_stFunctionFunctionPtr       CFast_g_p_fn_FuncPtr ;
EXTERN_AI_DLL CPA_EXPORT tdp_fn_p_stKeyWordFunctionPtr        CFast_g_p_fn_KeyWordPtr ;
EXTERN_AI_DLL CPA_EXPORT tdp_fn_p_stMetaActionInitFunctionPtr CFast_g_p_fn_MetaInitPtr ;
EXTERN_AI_DLL CPA_EXPORT tdp_fn_ucMetaActionFunctionPtr       CFast_g_p_fn_MetaPtr ;
 
EXTERN_AI_DLL CPA_EXPORT tdstGetSetParam                      CFast_g_a_stParam[CFast_lMaxTreeDepth] ;
EXTERN_AI_DLL CPA_EXPORT tdstNodeInterpret                    CFast_g_a_stPseudoTree[7][CFast_lMaxTreeDepth] ;
EXTERN_AI_DLL CPA_EXPORT long                                 CFast_g_a_lLong[CFast_lMaxTreeDepth] ;
EXTERN_AI_DLL CPA_EXPORT tdeTypeInterpret                     CFast_g_aEvt2Eti[] ;
EXTERN_AI_DLL CPA_EXPORT ACP_tdxBool                          CFast_g_bProcessReflex ;
EXTERN_AI_DLL CPA_EXPORT ACP_tdxBool                          CFast_g_bMetaActionInRfx ;
/*extern tdstNodeInterpret *M_CFast_GetReferenceNodeN(HIE_tdxHandleToSuperObject hSuperObjectPerso, long indice) ;*/
#ifdef __cplusplus
/*}*/
#endif
 
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_AI_DLL char gcGlobAleat;
EXTERN_AI_DLL CPA_EXPORT CFast_tdst_ArrayFunctions CFast_gast_ArrayFunctions[];
tdstNodeInterpret *fn_p_stEvalVector(HIE_tdxHandleToSuperObject p_SuperObjPerso, tdstNodeInterpret *p_stTree, tdstGetSetParam *p_stValue) ;
#ifdef __cplusplus
}
#endif
 
 
 
#endif /* _CFAST_H_ */
