Up: The Glish Client Library
Previous: The Value Class
The Glish system comes with a very modest number of clients. Source code for these clients resides in
the clients/ subdirectory of the Glish source tree; installing
Glish (see § 14.7, page , below) includes installing these clients,
so they are generally available for use.
The available clients will grow with time and contributions are welcome.
The clients presently available:
simply copies its arguments to stdout
and then reports to stderr the name and value (string representation)
of any events it receives.
``echoes" back any event it receives,
using the same name and value. It also generates an initial echo_args
event listing the arguments with which it was invoked (if any).
generates events at periodic intervals. timer
is invoked with two optional arguments, the flag -oneshot and a
floating-point value indicating how long the initial timeout should last.
timer waits this many seconds and generates a ready event whose
value is the number of seconds it waited. If -oneshot was not
specified then timer ``rearms" itself and goes off again after the
same number of seconds elapse.
Anytime timer receives an interval event it interprets the
event's value as a double value indicating the new timeout period.
It then resets its timer and begins waiting for this new period of time.
The original setting of -oneshot remains in effect.
If no initial time is specified when timer begins executing then
it simply waits until it receives an interval event.
For example, the following generates a ready event approximately
every 1.5 seconds:
t := client( "timer", 1.5 )
whenever t->ready do
print "timer went off after", $value, "seconds"
Thu Nov 13 16:44:05 EST 1997