📄 clipsmfc_old.h
字号:
void* agendaPtr;
FILE* fastLoad;
FILE* fastSave;
bool m_fClipsInit;
char m_buf[MBUFSIZE];
// Operations
public:
//this is our public interface to the rest of the CPP world
void SetMsgLoopCount(int ct) { Defcount = ct; }
void SetMsgLoopCBfn(void far (*func_ptr)(bool));
//all of the member pointer accessors are now inline
void SetFactPtr(void *ptr = NULL) { factPtr = (struct fact *)ptr; }
void SetRulePtr(void *ptr = NULL) { rulePtr = (struct defrule*)ptr; }
void SetModulePtr(void *ptr = NULL) { modulePtr = (struct defmodule*)ptr; }
void SetGlobalPtr(void *ptr = NULL) { globalPtr = (struct defglobal*)ptr; }
void SetInstancePtr(void *ptr = NULL) { instancePtr = (struct instance*)ptr; }
void SetClassPtr(void *ptr = NULL) { classPtr = (struct defclass*)ptr; }
void SetAgendaPtr(void *ptr = NULL) { agendaPtr = ptr; }
void SetTemplatePtr(void *ptr = NULL) { templatePtr = (struct deftemplate*)ptr; }
void SetActivationPtr(void *ptr = NULL) { activationPtr = (struct activation*)ptr; }
void SetErrorLog(CString & filename);
void* GetFactPtr(void) { return (void *)factPtr; }
void* GetRulePtr(void) { return (void *)rulePtr; }
void* GetModulePtr(void) { return (void *)modulePtr; }
void* GetGlobalPtr(void) { return (void *)globalPtr; }
void* GetInstancePtr(void) { return (void *)instancePtr; }
void* GetClassPtr(void) { return (void *)classPtr; }
void* GetAgendaPtr(void) { return agendaPtr; }
void* GetActivationPtr(void) { return (void *)activationPtr; }
void* GetTemplatePtr(void) { return (void *)templatePtr; }
//defglobal functions
bool CLIPSGetNextDefglobal(void);
bool CLIPSFindDefglobal(CString & theVar);
bool CLIPSUndefglobal(void* Defglobal = NULL);
bool SetConstruct(CString &theVar);
float GetDefglobalFloat(CString &name);
int GetDefglobalInt(CString &name);
long int GetDefglobalLong(CString &name);
const char far* GetDefglobalString(CString &name);
void* GetDefglobalAddress(CString &name);
void GetFactIdentifier(CString &name, void* fct);
bool CLIPSParseDefglobal(CString &Source);
//fact functions
bool CLIPSFindDeftemplate(CString &name);
bool GetAllFacts(CStringArray &buffer);
bool CLIPSNextFactString(CString &FactString);
long int CLIPSGetNumberOfFacts(void);
bool CLIPSNextFact(void);
bool CLIPSFactString(CString &Data);
int CLIPSSetFactDup(int value = 0);
bool CLIPSGetFactDup(void);
bool CLIPSAssert(CString &String);
bool CLIPSAssert(void* Fact = NULL);
bool CLIPSIncrementFactCtr(void* Fact = NULL);
bool CLIPSDecrementFactCtr(void* Fact = NULL);
bool CLIPSGetFactListChanged(void);
bool CLIPSSetFactListChanged(bool Value = false);
bool AddFactArray(CStringArray& List, int NumFacts = 0);
bool CLIPSCreateFact(void* tPtr = NULL);
bool CLIPSAssignFactSlotDefaults(void *theFact = NULL);
//misc
CStringArray *SetRouteBuffer(CStringArray* pBuffer, CString &Route, bool remove = false);
CStringArray *SetRouteBuffer(CStringArray* pBuffer, const char *pRoute, bool remove = false);
bool SetRouteFile(CString& RouteName, CString& FileName);
bool SetRouteFile(CString& RouteName, const char far* FileName);
bool CLIPSAgenda(CString& Routename);
bool CLIPSInit(void);
bool CLIPSReset(void);
void CLIPSExit(int retVal = 1);
long int CLIPSRun(long int numIterations = -1);
bool CLIPSClear(void);
bool CLIPSRetract(void *Fact = NULL);
bool CLIPSWatch(CString &Item);
bool CLIPSUnWatch(CString &Item);
bool CLIPSMatches(void *Rule = NULL);
bool CLIPSGetCurrentModule(void);
//file functions
int CLIPSLoad(CString &scriptFile);
int CLIPSSave(CString &Filename);
int CLIPSBSave(CString &BinName);
int CLIPSBLoad(CString &BinName);
int CLIPSSaveFacts(CString &FileName, bool Visable = TRUE);
int CLIPSLoadFacts(CString &FileName);
bool CLIPSDribble(CString &FileName, bool Switch = FALSE);
FILE* CLIPSSetFastSave(FILE* fp = NULL);
FILE* CLIPSGetFastSave(void);
FILE* CLIPSSetFastLoad(FILE* fp = NULL);
FILE* CLIPSGetFastLoad(void);
//instance functions
bool CLIPSGetNextInstance(int Which = 0,void* Class = NULL);
bool CLIPSMakeInstance(CString &Data);
void* GetNamedInstance(CString &Name, bool SearchImports);
bool CLIPSFindInstance(CString &Name, bool SearchImports = FALSE);
bool CLIPSDeleteInstance(void* Instance = NULL);
bool DeleteAllInstances(void);
bool CLIPSQuashInstance(void *pIn = NULL);
bool CLIPSGetInstanceClass(void* Instance = NULL);
bool CLIPSGetNextInstanceInClass(void *pClass = NULL);
bool CLIPSGetInstanceName(CString &Data, void* Instance = NULL);
bool CLIPSGetInstanceData(CString &Data, void* Instance = NULL);
bool CLIPSGetInstancePPForm(CString &Data);
bool CLIPSCreateRawInstance(CString &Name);
bool CLIPSValidInstance(void* Instance = NULL);
bool CLIPSDirectGetSlot(CString &Class, CString &Slot, CString &Value);
bool CLIPSDirectPutSlot(CString &Class, CString &Slot, CString &Value, int type = -1);
unsigned long int CLIPSGetGlobalNumberOfInstances(void);
long int CLIPSLoadInstances(CString &FileName);
long int CLIPSSaveInstances(CString &FileName, bool Visable = FALSE);
bool SetSlotValue(CString &Class, CString &Slot, CString &Value);
bool GetSlotValue(CString &Class, CString &Slot, CString &Value);
bool ReadFactSlot(CString &Slot, CString &Data);
bool WriteFactSlot(CString&Slot, CString &Data, int type, void *pFact = NULL);
bool CLIPSRouteCommand(CString &Command, CString &route, int do_print = 1);
bool DoCLIPSFunctionCall(CString &name, CString &args, CString &result);
long int CLIPSGetStrategy(void);
long int CLIPSSetStrategy(long int data = 0);
void* CLIPSAddSymbol(CString &Symbol);
void* CLIPSAddLong(long int lValue);
void* CLIPSAddDouble(double dValue);
long int CLIPSMemoryUsed(void);
long int CLIPSMemoryRequests(void);
bool CLIPSGetFocus(void);
bool CLIPSRemoveAllFacts(void);
long int CLIPSMemUsed(void);
bool CLIPSBatch(CString &FileName);
bool CLIPSBatchStar(CString &FileName);
void CLIPSFreeMem(void);
void CLIPSSetHaltExecution(bool);
bool CLIPSGetHaltExecution(void);
int Version(void);
bool CLIPSGetNextDefclass(void* pClass = NULL);
bool CLIPSGetNextActivation(void* pAct = NULL);
bool CLIPSSend(CString &Msg, CString &Args, CString &InsName, CString &RetStr);
bool CLIPSSend(CString &Msg, CString &Args, void *InsP, CString &RetStr);
bool CLIPSBuild(CString& Command);
bool CLIPSAddResetFunction(const char *szCLIPSFunctionName, void(*pFunction)(void), int iPriorityValue);
#if USE_ODBC
int CLIPSODBCQuery(CString& Query, CString& Credentials, CString& DeftemplateName, bool bImplode);
BOOL CLIPSODBCQuery(CString& Query, CString& Credentials, CString& DeftemplateName, bool bImplode, CString& strError);
BOOL CLIPSODBCQuery(CString& Query, CDatabase& DataSource, CString& DeftemplateName, bool bImplode, CString& strError);
#endif
bool AddFunction(const char *szCLIPSFunctionName, char cReturnType, int (*pFunction)(void), const char *szFunctionName, const char *szParameterTypes);
int CLIPSRtnArgCount(void);
int CLIPSArgCountCheck(CString& FunctionName, int iRestriction, int iCount);
bool CLIPSArgTypeCheck(CString& FunctionName, int iPos, int iType, void *pDataObject);
char *CLIPSRtnLexeme(int iPos);
double CLIPSRtnDouble(int iPos);
long int CLIPSRtnLong(int iPos);
void *CLIPSRtnUnknown(int iPos, void *DataObject);
void *CLIPSCreateMultifield(int iSize);
void CLIPSSetMultifieldErrorValue(void *pMultifield);
bool CLIPSExecutingConstruct(void);
bool CLIPSPopFocus(void);
bool CLIPSLoadFactsFromString(CString &theString);
bool CLIPSFactRelation(CString &Name, void *pFact);
bool CLIPSFactSlotNames(CString &Names, void *pFact);
void *GetFactByIndex(long Idx);
long int GetSlotCount(void *pFact, bool IsFact = true);
bool IsDribbleOn(void);
bool IsBatchActive(void);
bool CLIPSOpenStringBatch(CString &Name, CString &theStr);
long int CLIPSRestoreInstancesFromString(CString &theStr);
long int CLIPSLoadInstancesFromString(CString &theStr);
bool CLIPSGetIncrementalReset(void);
bool CLIPSSetIncrementalReset(bool value);
bool CLIPSGetInstancesChanged(void);
bool CLIPSSetInstancesChanged(bool value);
long int LineCount(void);
bool CLIPSSetGlobalsChanged(bool value);
bool CLIPSGetGlobalsChanged(void);
long int ModuleItemCount(void);
long int CLIPSListFocusStack(CString &theString);
long int GetFactIndex(void *pFact = NULL);
//developer functions
long int GetFactCount(void *pFact = NULL);
long int GetSymbolTblCount(void);
long int GetIntegerTblCount(void);
long int GetFloatTblCount(void);
long int GetBitmapTblCount(void);
bool FactIsGarbage(void *pFact = NULL);
long int GetTimeTag(void *pIn = NULL, int Typ = FACT_ADDRESS);
bool GetItemModuleName(CString &theStr, int Typ = FACT_ADDRESS, void *pIn = NULL);
long int GetFactDepth(void *pFact = NULL);
long int GetAgendaString(CString &theString);
const char * GetClassName(void *pClass = NULL);
const char * GetModuleName(void *pModule = NULL);
long GetInstanceDepth(void *pInstance = NULL);
long GetInstanceBusyCnt(void *pInstance = NULL);
bool IsInstanceSync(void *pInstance = NULL);
bool InstanceInitInProg(void *pInstance = NULL);
bool InstanceSlotsInit(void *pInstance = NULL);
bool IsInstanceGarbage(void *pInstance = NULL);
bool IsInstanceInstalled(void *pInstance = NULL);
long GetClassBusy(void *pClass = NULL);
long GetClassHndlrCnt(void *pClass = NULL);
short GetClassID(void *pClass = NULL);
bool IsClassSystem(void *pClass = NULL);
bool IsClassInstalled(void *pClass = NULL);
bool IsClassReactive(void *pClass = NULL);
bool IsClassConcrete(void *pClass = NULL);
void * GetClass(CString &theClass);
bool FindClass(CString &theClass);
long GetClassSlotCount(void *pClass = NULL);
void * GetSlotAddress(int slotNum, bool isfact, void *factORinstance = NULL);
void * GetSlotAddress(CString &slotName, bool isfact, void *factORinstance = NULL);
long GetFactSlotCount(void *pFact = NULL);
void * FindFact(CString &theFact);
void * FindFactByIndex(long Idx);
bool GetFactSlotNames(CString &names, void *pFact = NULL);
bool FactSlotValue(CString &data, const char *slotName = NULL, void *pFact = NULL);
void * GetFactSlotName(CString &name, long slotNum, void *pFact = NULL);
void * FindFactSlot(CString &name, void *pFact = NULL);
bool GetDefglobalVariant(VARIANT &value, CString &name);
bool GetDefglobalVariant(VARIANT &value, void *pGlobal = NULL);
bool SetDefglobalVariant(const VARIANT &value, void *pGlobal = NULL);
int GetDefglobalType(CString &name);
int GetDefglobalType(void *pGlobal = NULL);
bool GetDefglobaName(CString &name, void *pGlobal = NULL);
bool FactSlotVariant(VARIANT &data, const char *slotName = NULL, void *pFact = NULL);
long GetInstanceSlotConstraints(void *pSlot);
void * GetInstanceSlot(CString &name, void *pInstance = NULL);
void * GetInstanceSlot(long SlotNum, void *pInstance = NULL);
bool GetInstanceSlotName(CString &name, void *pSlot = NULL);
long GetInstanceSlotType(void *pSlot = NULL);
bool GetTemplateName(CString &Name, void *pTemplate = NULL);
bool GetTemplateModuleName(CString &Name, void *pTemplate = NULL);
long CLIPSNumberOfDefmodules(long num = -1);
bool SetModuleFocus(CString &ModName);
bool GetMatches(void *rule, CString &RouteName);
bool GetInstanceSlotValue(VARIANT &va, CString &SlotName, void *pInst = NULL);
bool SetInstanceSlotValue(const VARIANT &va, CString &SlotName, void *pInst = NULL);
bool GetInstanceSlotShared(void *pSlot = NULL);
bool GetInstanceSlotComposite(void *pSlot = NULL);
bool GetInstanceSlotInheritable(void *pSlot = NULL);
bool GetInstanceSlotReadOnly(void *pSlot = NULL);
bool GetInstanceSlotReactive(void *pSlot = NULL);
bool GetInstanceSlotPublic(void *pSlot = NULL);
bool GetInstanceSlotNoDefault(void *pSlot = NULL);
bool GetInstanceSlotMultiple(void *pSlot = NULL);
bool GetInstanceSlotInitOnly(void *pSlot = NULL);
long GetTemplateSlotConstraints(void *pSlot = NULL);
long GetTemplateSlotCount(void *pTemplate = NULL);
bool GetTemplateImplied(void *pTemplate = NULL);
bool GetTemplateInScope(void *pTemplate);
bool GetTemplateSlotMulti(void *pSlot);
bool GetTemplateSlotNoDefault(void *pSlot);
struct deftemplate *GetFactTemplate(void *pFact = NULL);
bool IsSuperClass(void *superClass, void *baseClass = NULL);
bool IsSuperClass(CString &superClass, CString &baseClass);
bool IsSubClass(void *subClass, void *baseClass = NULL);
bool IsSubClass(CString &subClass, CString &baseClass);
void AddMessageBox(void);
private:
char * GetGlobal(CString & name);
bool LoadDllReferences(void);
void GetFactName(void* fct);
//!!! - remove this pragma when VC++ supports this syntax
#pragma warning( disable : 4290 )
struct instance *ValidateInstancePtr(void *pIns) throw (CLIPSException);
struct slotDescriptor *ValidateInstanceSlotDescriptor(void *pSlot) throw (CLIPSException);
struct deftemplate *ValidateTemplatePtr(void *pTemplate) throw (CLIPSException);
struct defglobal *ValidateGlobalPtr(void *pGlobal) throw (CLIPSException);
struct defrule *ValidateRulePtr(void *rule) throw (CLIPSException);
struct templateSlot *ValidateTemplateSlot(void *pSlot) throw (CLIPSException);
struct fact *ValidateFactPtr(void *pFact) throw (CLIPSException);
struct defclass *ValidateClassPtr(void *pClass) throw (CLIPSException);
#if USE_ODBC
bool IssueODBCQuery(CVarRecordset& rsODBC, CString& strDeftemplateName, CString& strFact, bool bImplode);
#endif
};
/////////////////////////////////////////////////////////////////////////////
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -