A timer is defined with a boolean state property flag. At each
activation, Tick or Tock is displayed and the state is updated.
When running this example, the timer state can be inspected by submitting:
.timerStore.timer.flag
This is a simple illustration of how to query application data.
-------------------------------------------------------------------------------
--
-- Name: clock.is
--
-------------------------------------------------------------------------------
--
-- Description:
--
-- Demonstration IvoryScript configuration file
--
-- This script functions as a simple clock, alternately displaying
-- "Tick" and "Tock" on the standard output stream.
--
-------------------------------------------------------------------------------
def {
.timerStore =.ADS [
ruleList: !RefList[]];
.timerStore.timer =
.timerStore.Timer[
period: 1000 / 2,
flag: False,
proc: (\timer::Timer -> {
show ((if not timer.flag then "Tick" else "Tock") ++ "\n");
timer.flag := not (timer.flag)})];
.timerRule = .Rule [
method: monitorTimer];
.startADSGroup = !RefList [.timerStore];
.start = mapProcRefs (raiseEvent (StartEvent 0)) (.startADSGroup)
};
addRef (.timerRule) (.timerStore) #ruleList;
Last update: 11 October, 2005