quit_flag

quit_flag is a predefined variable set to TRUE when a quit signal is detected.

Syntax

quit_flag

Usage

quit_flag is set to TRUE when a quit signal is detected by the runtime system. The quit signal is raised when the user presses the quit signal key ([Ctrl]+[Backslash]) in TUI mode, or when another process sends the SIGQUIT signal to the fglrun 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 signal arrives during a procedural instruction (FOR loop) and DEFER QUIT is used, the runtime system sets quit_flag to TRUE and continues the program execution. It is up to the program to check the quit_flag variable.

When the quit signal arrives during an interactive instruction (INPUT, CONSTRUCT) and DEFER QUIT is used, 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.

Example

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