globle void RefreshCommand( void *theEnv) { char *ruleName; void *rulePtr; /*===========================*/ /* Get the name of the rule. */ /*===========================*/ ruleName = GetConstructName(theEnv,(char*)"refresh",(char*)"rule name"); if (ruleName == NULL) return; /*===============================*/ /* Determine if the rule exists. */ /*===============================*/ rulePtr = EnvFindDefrule(theEnv,ruleName); if (rulePtr == NULL) { CantFindItemErrorMessage(theEnv,(char*)"defrule",ruleName); return; } /*===================*/ /* Refresh the rule. */ /*===================*/ EnvRefresh(theEnv,rulePtr); }
globle void ShowFactPatternNetwork( void *theEnv) { struct factPatternNode *patternPtr; struct deftemplate *theDeftemplate; char *theName; int depth = 0, i; theName = GetConstructName(theEnv,(char*)"show-fpn",(char*)"template name"); if (theName == NULL) return; theDeftemplate = (struct deftemplate *) EnvFindDeftemplate(theEnv,theName); if (theDeftemplate == NULL) return; patternPtr = theDeftemplate->patternNetwork; while (patternPtr != NULL) { for (i = 0; i < depth; i++) EnvPrintRouter(theEnv,WDISPLAY,(char*)" "); if (patternPtr->header.singlefieldNode) EnvPrintRouter(theEnv,WDISPLAY,(char*)"SF "); else if (patternPtr->header.multifieldNode) { EnvPrintRouter(theEnv,WDISPLAY,(char*)"MF"); if (patternPtr->header.endSlot) EnvPrintRouter(theEnv,WDISPLAY,(char*)")"); else EnvPrintRouter(theEnv,WDISPLAY,(char*)"*"); PrintLongInteger(theEnv,WDISPLAY,(long long) patternPtr->leaveFields); EnvPrintRouter(theEnv,WDISPLAY,(char*)" "); } EnvPrintRouter(theEnv,WDISPLAY,(char*)"Slot: "); PrintLongInteger(theEnv,WDISPLAY,(long long) patternPtr->whichSlot); EnvPrintRouter(theEnv,WDISPLAY,(char*)" Field: "); PrintLongInteger(theEnv,WDISPLAY,(long long) patternPtr->whichField); EnvPrintRouter(theEnv,WDISPLAY,(char*)" Expression: "); if (patternPtr->networkTest == NULL) EnvPrintRouter(theEnv,WDISPLAY,(char*)"None"); else PrintExpression(theEnv,WDISPLAY,patternPtr->networkTest); EnvPrintRouter(theEnv,WDISPLAY,(char*)" RightHash: "); if (patternPtr->header.rightHash == NULL) EnvPrintRouter(theEnv,WDISPLAY,(char*)"None"); else PrintExpression(theEnv,WDISPLAY,patternPtr->header.rightHash); EnvPrintRouter(theEnv,WDISPLAY,(char*)"\n"); if (patternPtr->nextLevel == NULL) { while (patternPtr->rightNode == NULL) { patternPtr = patternPtr->lastLevel; depth--; if (patternPtr == NULL) return; } patternPtr = patternPtr->rightNode; } else { patternPtr = patternPtr->nextLevel; depth++; } } }
globle void PPDefmoduleCommand( void *theEnv) { char *defmoduleName; defmoduleName = GetConstructName(theEnv,"ppdefmodule","defmodule name"); if (defmoduleName == NULL) return; PPDefmodule(theEnv,defmoduleName,WDISPLAY); return; }
void PPDefmoduleCommand( UDFContext *context, CLIPSValue *returnValue) { const char *defmoduleName; void *theEnv = UDFContextEnvironment(context); defmoduleName = GetConstructName(context,"ppdefmodule","defmodule name"); if (defmoduleName == NULL) return; PPDefmodule(theEnv,defmoduleName,WDISPLAY); return; }
globle long RuleComplexityCommand( void *theEnv) { char *ruleName; struct defrule *rulePtr; ruleName = GetConstructName(theEnv,"rule-complexity","rule name"); if (ruleName == NULL) return(-1); rulePtr = (struct defrule *) EnvFindDefrule(theEnv,ruleName); if (rulePtr == NULL) { CantFindItemErrorMessage(theEnv,"defrule",ruleName); return(-1); } return(rulePtr->complexity); }
globle void MatchesCountCommand( void *theEnv) { char *ruleName; void *rulePtr; ruleName = GetConstructName(theEnv,"matches-count","rule name"); if (ruleName == NULL) return; rulePtr = EnvFindDefrule(theEnv,ruleName); if (rulePtr == NULL) { CantFindItemErrorMessage(theEnv,"defrule",ruleName); return; } EnvMatchesCount(theEnv,rulePtr); }
globle long long JoinActivityCommand( void *theEnv) { char *ruleName; void *rulePtr; ruleName = GetConstructName(theEnv,"join-activity","rule name"); if (ruleName == NULL) return(0); rulePtr = EnvFindDefrule(theEnv,ruleName); if (rulePtr == NULL) { CantFindItemErrorMessage(theEnv,"defrule",ruleName); return(0); } return EnvJoinActivity(theEnv,rulePtr,0); }
globle void ShowJoinsCommand( void *theEnv) { char *ruleName; void *rulePtr; ruleName = GetConstructName(theEnv,"show-joins","rule name"); if (ruleName == NULL) return; rulePtr = EnvFindDefrule(theEnv,ruleName); if (rulePtr == NULL) { CantFindItemErrorMessage(theEnv,"defrule",ruleName); return; } ShowJoins(theEnv,rulePtr); return; }