status = alarm ( seconds ) ;
int seconds
- The number of seconds before the alarm is triggered.
boolean status
- 1
The alarm was set.
The STATUS variable is set to $ACKNOWLEDGE
- 0
Invalid alarm seconds, not between 0 and 86400 seconds (1 day).
The STATUS variable is set to %BOUNDS
%BOUNDS : Invalid alarm seconds, not between 0 and 86400 seconds (1 day).
%ARGUMENT : Invalid arguments. Usage: status = alarm ( seconds ) ;
When an alarm is triggered, the STATUS variable is set to "%ALARM". Depending on the state of the program and whether an alarm handler was specified with the on_alarm statement, the program will take the additional actions as follows:
State of HypersScript prior to alarm No handler, STATUS set to %ALARM Handler sets STATUS to TRUE condition(*) Handler sets STATUS to FALSE condition(*) EXECUTE HyperScript terminates. HyperScript continues to execute. HyperScript terminates. IDLE HyperScript terminates. HyperScript continues to idle. HyperScript aborts idle state, value of idle() function equals STATUS. QUERY HyperScript terminates. HyperScript continues to wait for reply. HyperScript aborts query, value of query*() function equals STATUS. (*) The handler must set the STATUS variable just before it exits. A handler can set a TRUE or FALSE condition in the STATUS variable such as in the following examples:
on_alarm STATUS = "$ACK" ; H() { return "%BAD" ; } ; on_alarm return H() ; on_alarm continue ; //STATUS;is $ACK on_alarm ; /* STATUS will be "%ALARM" */ alarm 2 ; stat = idle() ; puts stat ;