static void ResetDefrules() { struct defmodule *theModule; CurrentEntityTimeTag = 0L; ClearFocusStack(); theModule = (struct defmodule *) FindDefmodule("MAIN"); Focus((void *) theModule); }
static int ClearDefrulesReady() { if (ExecutingRule != NULL) return(FALSE); ClearFocusStack(); if (GetCurrentModule() == NULL) return(FALSE); CurrentEntityTimeTag = 0L; return(TRUE); }
static void ClearBload() { unsigned long int space; long i; struct patternParser *theParser = NULL; struct patternEntity *theEntity = NULL; void *theModule; /*===========================================*/ /* Delete all known entities before removing */ /* the defrule data structures. */ /*===========================================*/ GetNextPatternEntity(&theParser,&theEntity); while (theEntity != NULL) { (*theEntity->theInfo->base.deleteFunction)(theEntity); theEntity = NULL; GetNextPatternEntity(&theParser,&theEntity); } /*=========================================*/ /* Remove all activations from the agenda. */ /*=========================================*/ SaveCurrentModule(); for (theModule = GetNextDefmodule(NULL); theModule != NULL; theModule = GetNextDefmodule(theModule)) { SetCurrentModule(theModule); RemoveAllActivations(); } RestoreCurrentModule(); ClearFocusStack(); /*==========================================================*/ /* Remove all partial matches from the beta memories in the */ /* join network. Alpha memories do not need to be examined */ /* since all pattern entities have been deleted by now. */ /*==========================================================*/ for (i = 0; i < NumberOfJoins; i++) { FlushAlphaBetaMemory(JoinArray[i].beta); } /*================================================*/ /* Decrement the symbol count for each rule name. */ /*================================================*/ for (i = 0; i < NumberOfDefrules; i++) { UnmarkConstructHeader(&DefruleArray[i].header); } /*==================================================*/ /* Return the space allocated for the bload arrays. */ /*==================================================*/ space = NumberOfDefruleModules * sizeof(struct defruleModule); if (space != 0) genlongfree((void *) ModuleArray,space); space = NumberOfDefrules * sizeof(struct defrule); if (space != 0) genlongfree((void *) DefruleArray,space); #if FUZZY_DEFTEMPLATES space = NumberOfPatternFuzzyValues * sizeof(struct fzSlotLocator); if (space != 0) genlongfree((void *) PatternFuzzyValueArray,space); #endif space = NumberOfJoins * sizeof(struct joinNode); if (space != 0) genlongfree((void *) JoinArray,space); }