Programs / Program registers |
QUIT_FLAG is a predefined variable set to TRUE when a quit event is detected.
QUIT_FLAG
QUIT_FLAG is set to TRUE when a quit event is detected by the runtime system. The quit event is raised when the user presses the quit signal key ([Ctrl]+[Backslash]), or when another process sends the quit signal to the runtime system process.
QUIT_FLAG must be used with the DEFER QUIT configuration instruction. If the DEFER QUIT instruction is not specified, and quit signal will stop the program execution.
When the quit event arrives during a procedural instruction (FOR loop), the runtime system sets QUIT_FLAG to TRUEand continues the program execution. It is up to the program to check the QUIT_FLAG variable.
When the quit event arrives during an interactive instruction (INPUT, CONSTRUCT), the runtime system sets QUIT_FLAG to TRUE and continues with the execution of the interactive instruction.
Once QUIT_FLAG is set to TRUE, it must be reset to FALSE to detect a new quit event.
MAIN DEFINE n INTEGER DEFER QUIT LET QUIT_FLAG = FALSE FOR n = 1 TO 1000 IF QUIT_FLAG THEN EXIT FOR END IF ... END FOR END MAIN