Before updating GetWatchItemCommand
as described at the end of this post in watch.c
:
CLIPS> (get-watch-item all)
FALSE
CLIPS> (watch all)
CLIPS> (get-watch-item all)
FALSE
After:
CLIPS> (get-watch-item all)
FALSE
CLIPS> (watch all)
CLIPS> (get-watch-item all)
TRUE
CLIPS> (unwatch all)
CLIPS> (get-watch-item all)
FALSE
CLIPS> (watch all)
CLIPS> (get-watch-item all)
TRUE
CLIPS> (unwatch rules)
CLIPS> (get-watch-item all)
FALSE
Updated GetWatchItemCommand
:
/*******************************************/
/* GetWatchItemCommand: H/L access routine */
/* for the get-watch-item command. */
/*******************************************/
void GetWatchItemCommand(
Environment *theEnv,
UDFContext *context,
UDFValue *returnValue)
{
UDFValue theValue;
const char *argument;
bool recognized;
/*========================================*/
/* Determine which item is to be watched. */
/*========================================*/
if (! UDFFirstArgument(context,SYMBOL_BIT,&theValue))
{ return; }
/*===================================================*/
/* If the name of the watch item to set is all, then */
/* return true if all watch items are set to true. */
/* Otherwise, false is returned. */
/*===================================================*/
argument = theValue.lexemeValue->contents;
if (strcmp(argument,"all") == 0)
{
WatchItemRecord *wPtr;
for (wPtr = WatchData(theEnv)->ListOfWatchItems; wPtr != NULL; wPtr = wPtr->next)
{
if (!(*(wPtr->flag)))
{
returnValue->lexemeValue = FalseSymbol(theEnv);
return;
}
}
returnValue->lexemeValue = TrueSymbol(theEnv);
return;
}
ValidWatchItem(theEnv,argument,&recognized);
if (recognized == false)
{
SetEvaluationError(theEnv,true);
ExpectedTypeError1(theEnv,"get-watch-item",1,"'watchable symbol'");
returnValue->lexemeValue = FalseSymbol(theEnv);
return;
}
/*===========================*/
/* Get the watch item value. */
/*===========================*/
if (GetWatchItem(theEnv,argument) == 1)
{ returnValue->lexemeValue = TrueSymbol(theEnv); }
else
{ returnValue->lexemeValue = FalseSymbol(theEnv); }
}
Added fix to svn repository for both the CLIPS get-watch-item function and the corresponding C function GetWatchItem.