SPLAT documentation - chapter 4
The define-behavior syntax form

define-behavior is a special form for defining continuous behaviors that are enabled and disabled by splats. Behaviors are generally closed-loop control laws that do not have discrete action semantics.

4.1 (name . args)

The (name . args) binding form operates like the equivalent part of the define-splat special form. name is bound to a function of arguments args which returns an object of type <splat-behavior>. In order to enable the behavior, the method (enable behavior) must be called. To stop the behavior, use the method (disable behavior).

The variables listed in the args list are in scope throughout the body of the define-behavior form, as is the variable self, which refers to the <splat-behavior> object returned by the function bound to name


4.2 (local-vars (arg val) ...)

The local-vars form operates identically to the define-behavior form of the same name.

4.3 (enable . body)

The body of this form is invoked each time the enable method is called on the behavior. The thread running the control function is guaranteed not to start until after the enable function completes.

4.4 (disable . body)

The body of this form is invoked each time the disable method is called on the behavior. The control function is guaranteed not to run after the disable function is called.

4.5 (control . body)

The body of this form is invoked as the thread function of a thread controlling the behavior after it is enabled. It should contain some sort of looping construct which calls the method (check-for-disable self) at each iteration. If the disable method has been called, check-for-disable will not return and the thread controlling the behavior will be terminated. The thunk defined in the disable form will be called immediately before the thread exits, after check-for-disable has been invoked. Local variables defined in the local-vars form keep their values.
SPLAT documentation - Copyright 1996-1997 Bill Gribble.
Contents; next; back.
2 September 1997
Bill Gribble grib@cs.utexas.edu