globle void ClearFocusStackCommand( void *theEnv) { if (EnvArgCountCheck(theEnv,"list-focus-stack",EXACTLY,0) == -1) return; EnvClearFocusStack(theEnv); }
static void ResetDefrules( void *theEnv) { struct defmodule *theModule; DefruleData(theEnv)->CurrentEntityTimeTag = 0L; EnvClearFocusStack(theEnv); theModule = (struct defmodule *) EnvFindDefmodule(theEnv,"MAIN"); EnvFocus(theEnv,(void *) theModule); }
static int ClearDefrulesReady( void *theEnv) { if (EngineData(theEnv)->ExecutingRule != NULL) return(FALSE); EnvClearFocusStack(theEnv); if (EnvGetCurrentModule(theEnv) == NULL) return(FALSE); DefruleData(theEnv)->CurrentEntityTimeTag = 0L; return(TRUE); }
static bool ClearDefrulesReady( void *theEnv) { if (EngineData(theEnv)->ExecutingRule != NULL) return(false); if (EngineData(theEnv)->JoinOperationInProgress) return(false); EnvClearFocusStack(theEnv); if (EnvGetCurrentModule(theEnv) == NULL) return(false); DefruleData(theEnv)->CurrentEntityTimeTag = 1L; return(true); }
static void ResetDefrules( void *theEnv, EXEC_STATUS) { struct defmodule *theModule; struct joinLink *theLink; struct partialMatch *notParent; DefruleData(theEnv,execStatus)->CurrentEntityTimeTag = 1L; EnvClearFocusStack(theEnv,execStatus); theModule = (struct defmodule *) EnvFindDefmodule(theEnv,execStatus,"MAIN"); EnvFocus(theEnv,execStatus,(void *) theModule); for (theLink = DefruleData(theEnv,execStatus)->RightPrimeJoins; theLink != NULL; theLink = theLink->next) { PosEntryRetractAlpha(theEnv,execStatus,theLink->join->rightMemory->beta[0]); } for (theLink = DefruleData(theEnv,execStatus)->LeftPrimeJoins; theLink != NULL; theLink = theLink->next) { if ((theLink->join->patternIsNegated || theLink->join->joinFromTheRight) && (! theLink->join->patternIsExists)) { notParent = theLink->join->leftMemory->beta[0]; if (notParent->marker) { RemoveBlockedLink(notParent); } /*==========================================================*/ /* Prevent any retractions from generating partial matches. */ /*==========================================================*/ notParent->marker = notParent; if (notParent->children != NULL) { PosEntryRetractBeta(theEnv,execStatus,notParent,notParent->children); } /* if (notParent->dependents != NULL) { RemoveLogicalSupport(theEnv,execStatus,notParent); } */ } } }
static void ClearBload( void *theEnv) { 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(theEnv,&theParser,&theEntity); while (theEntity != NULL) { (*theEntity->theInfo->base.deleteFunction)(theEnv,theEntity); theEntity = NULL; GetNextPatternEntity(theEnv,&theParser,&theEntity); } /*=========================================*/ /* Remove all activations from the agenda. */ /*=========================================*/ SaveCurrentModule(theEnv); for (theModule = EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,theModule); RemoveAllActivations(theEnv); } RestoreCurrentModule(theEnv); EnvClearFocusStack(theEnv); /*==========================================================*/ /* 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 < DefruleBinaryData(theEnv)->NumberOfJoins; i++) { FlushAlphaBetaMemory(theEnv,DefruleBinaryData(theEnv)->JoinArray[i].beta); } /*================================================*/ /* Decrement the symbol count for each rule name. */ /*================================================*/ for (i = 0; i < DefruleBinaryData(theEnv)->NumberOfDefrules; i++) { UnmarkConstructHeader(theEnv,&DefruleBinaryData(theEnv)->DefruleArray[i].header); } /*==================================================*/ /* Return the space allocated for the bload arrays. */ /*==================================================*/ space = DefruleBinaryData(theEnv)->NumberOfDefruleModules * sizeof(struct defruleModule); if (space != 0) genlongfree(theEnv,(void *) DefruleBinaryData(theEnv)->ModuleArray,space); DefruleBinaryData(theEnv)->NumberOfDefruleModules = 0; space = DefruleBinaryData(theEnv)->NumberOfDefrules * sizeof(struct defrule); if (space != 0) genlongfree(theEnv,(void *) DefruleBinaryData(theEnv)->DefruleArray,space); DefruleBinaryData(theEnv)->NumberOfDefrules = 0; space = DefruleBinaryData(theEnv)->NumberOfJoins * sizeof(struct joinNode); if (space != 0) genlongfree(theEnv,(void *) DefruleBinaryData(theEnv)->JoinArray,space); DefruleBinaryData(theEnv)->NumberOfJoins = 0; }