next up previous

13.2.3 Enabling Watch Items

This function causes messages to be displayed when certain CLIPS operations take place.

Syntax

(watch <watch-item>)
<watch-item> ::= all |
                 compilations |
                 statistics |
                 focus |
                 messages |
                 deffunctions <deffunction-name>* |
                 globals <global-name>* |
                 rules <rule-name>* |
                 activations <rule-name>* |
                 facts <deftemplate-name>* |
                 instances <class-name>* |
                 slots <class-name>* |
                 message-handlers <handler-spec-1>*
                                 [<handler-spec-2>]) |
                 generic-functions <generic-name>* |
                 methods <method-spec-1>* [<method-spec-2>]
<handler-spec-1> ::= <class-name>
                                <handler-name> <handler-type>
<handler-spec-2> ::= <class-name>
                              [<handler-name> [<handler-type>]]
<method-spec-1> ::= <generic-name> <method-index>
<method-spec-2> ::= <generic-name> [<method-index>]

If compilations are watched, the progress of construct definitions will be displayed.

If facts are watched, all fact assertions and retractions will be displayed. Optionally, facts associated with individual deftemplates can be watched by specifying one or more deftemplate names.

If rules are watched, all rule firings will be displayed. If activations are watched, all rule activations and deactivations will be displayed. Optionally, rule firings and activations associated with individual defrules can be watched by specifying one or more defrule names. If statistics are watched, timing information along with other information (average number of facts, average number of activations, etc.) will be displayed after a run. Note that the number of rules fired and timing information is not printed unless this item is being watch. If focus is watched, then changes to the current focus will be displayed.

If globals are watched, variable assignments to globals variables will be displayed. Optionally, variable assignments associated with individual defglobals can be watched by specifying one or more defglobal names. If deffunctions are watched, the start and finish of deffunctions will be displayed. Optionally, the start and end display associated with individual deffunctions can be watched by specifying one or more deffunction names.

If generic-functions are watched, the start and finish of generic functions will be displayed. Optionally, the start and end display associated with individual defgenerics can be watched by specifying one or more defgeneric names. If methods are watched, the start and finish of individual methods within a generic function will be displayed. Optionally, individual methods can be watched by specifying one or more methods using a defgeneric name and a method index. When the method index is not specified, then all methods of the specified defgeneric will be watched.

If instances are watched, creation and deletion of instances will be displayed. If slots are watched, changes to any instance slot values will be displayed. Optionally, instances and slots associated with individual concrete defclasses can be watched by specifying one or more concrete defclass names. If message-handlers are watched, the start and finish of individual message-handlers within a message will be displayed. Optionally, individual message-handlers can be watched by specifying one or more message-handlers using a defclass name, a message-handler name, and a message-handler type. When the message-handler name and message-handler type are not specified, then all message-handlers for the specified class will be watched. When the message-handler type is not specified, then all message-handlers for the specified class with the specified message-handler name will be watched. If messages are watched, the start and finish of messages will be displayed.

For the watch items that allow individual constructs to be watched, if no constructs are specified, then all constructs of that type will be watched. If all constructs associated with a watch item are being watched, then newly defined constructs of the same type will also be watched. A construct retains its old watch state if it is redefined. If all is watched, then all other watch items will be watched. By default, only compilations are watched. The watch function has no return value.

Example

CLIPS> (watch rules)
CLIPS>


next up previous