/*---------------------------------------------------------------------------*/ /* Action table functions and macros for intelligence engine*/ /* author : 22/12/96 Olivier Couvreur*/ /* modify : 07/11/96 Olivier Couvreur */ /* modify : 03/02/97 Olivier Couvreur Lint 0 warnings */ /* modify : 26/02/97 Olivier Couvreur added Schedule support + Lint 0 warnings*/ /* modify : 05/03/97 Olivier Couvreur added Schedule function + Lint 0 warnings*/ /* modify : 25/03/97 Olivier Couvreur added REVERSE_RULES support + optimizations (not yet activated)*/ /*---------------------------------------------------------------------------*/ #if !defined(__ACTTABLE_H__) #define __ACTTABLE_H__ #define DEFAULT_ACTION_TABLE_NB_ENTRIES 3 #define MIN_ACTION_TABLE_NB_ENTRIES 2 #define MAX_ACTION_TABLE_NB_ENTRIES 5 #if defined(U64) #include "AIUseCPA.h" #include "StrIntel.h" #endif #include "ActParam.h" typedef struct tdstActionTableEntry_ { /* action parameter*/ struct tdstActionParam_ stActionParam; /* action node pointer*/ struct tdstNodeInterpret_ *p_stNode; /* 1 if entry is used*/ unsigned char bUsed; /* rule number*/ unsigned char ucNumRule; unsigned char bUseDefaultActionReturn; unsigned char ucNewActionReturn; } tdstActionTableEntry; typedef struct tdstActionTable_ { struct tdstActionTableEntry_ *p_stEntry; /* nb possible actions*/ unsigned char ucNbEntries; /* nb actions not immediate*/ unsigned char ucNbEntriesUsed; /* for parameter acces : cf actparam.cpp*/ unsigned char ucCurrentEntry; } tdstActionTable; #define M_ActionTable(p_stInt) ((p_stInt)->p_stActionTable) #define M_ActionTableCurrentEntry(p_stInt) (M_ActionTable(p_stInt)->ucCurrentEntry) #define M_ActionTableNbEntriesUsed(p_stInt) (M_ActionTable(p_stInt)->ucNbEntriesUsed) #define M_TableNbEntries(p_stTable) ((p_stTable)->ucNbEntries) #define M_ActionTableNbEntries(p_stInt) (M_TableNbEntries(M_ActionTable(p_stInt))) #define M_IsActionTableUsed(p_stInt) ((M_ActionTableNbEntriesUsed(p_stInt)!=0)?TRUE:FALSE) #define M_TableEntry(p_stTable) ((p_stTable)->p_stEntry) #define M_ActionTableEntry(p_stInt) (M_TableEntry(M_ActionTable(p_stInt))) #define M_ActionTableEntryN(p_stInt, N) (M_TableEntry(M_ActionTable(p_stInt))[(N)]) #define M_ActionTableNumRule(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).ucNumRule) #define M_ActionTableNumNode(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).p_stNode) #define M_ActionTableUseFlag(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).bUsed) #define M_ActionTableParam(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).stActionParam) #define M_ActionTableUseActionReturn(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).bUseDefaultActionReturn) #define M_ActionTableNewActionReturn(p_stInt, N) (M_ActionTableEntryN(p_stInt, N).ucNewActionReturn) unsigned char fn_ucIsRuleInActionTable(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule); unsigned char fn_ucIsRuleAndNodeInActionTable(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule,struct tdstNodeInterpret_ *p_stNode); unsigned char fn_ucFindPlaceInActionTable(struct tdstIntelligence_ *p_stIntelligence); void fn_vUseCurrentActionTableEntry(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNRule,struct tdstNodeInterpret_ *p_stNode); void fn_vUnuseCurrentActionTableEntry(struct tdstIntelligence_ *p_stIntelligence); void fn_vUnuseAllRulesWhichHaveGreaterNumRule(struct tdstIntelligence_ *p_stIntelligence,unsigned char ucNumRule); void fn_vUnuseAllRulesFromSchedule(struct tdstIntelligence_ *p_stIntelligence); struct tdstNodeInterpret_ *fn_p_stGetScheduleFromActionTableAndClearIt(struct tdstIntelligence_ *p_stIntelligence); struct tdstNodeInterpret_ *fn_p_stGetTableAction(struct tdstIntelligence_ *p_stIntelligence, unsigned char ucNEntry); /**************************************/ #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 /***********************************************************************/ EXTERN_AI_DLL CPA_EXPORT void fn_vInitActionTable(struct tdstIntelligence_ *p_stIntelligence); /*******************************************************************************/ #undef EXTERN_AI_DLL #endif