Make your own free website on
4.2.1 Information Regarding Conditions (data structures)

There are mainly five conceptual data structures involved in

[Event queue.]
     There is one interpreter-wide queue of pending conditions.
     Raising a condition is identical to adding information about
     the condition to this queue (FIFO).  The order of the queue
     is the same order in which the conditions are to be handled.

     Every entry in the queue of pending conditions contains some
     information about the event: the line number of the REXX
     script when the condition was raised, a descriptive text and
     the condition type.

     To each, there exists information about the default-action to
     take if this condition is raised but the trap is in state
     OFF.  This is called the “default-action”. The standard
     default-action is to ignore the condition, while some
     conditions may abort the execution.

     Each condition will also have delay-action, which tells what
     to do if the condition is raised when condition trap is in
     state DELAY. The standard delay-action is to queue the
     condition in the queue of pending conditions, while some
     conditions may ignore it.

[Condition traps.]
     For each condition there is a trap which contains three
     pieces of status information: the state; the handler; and the
     method. The state can be ON, OFF or DELAY.

     The handler names the REXX label in the start of the REXX
     code to handle the event. The method can be either SIGNAL or
     CALL, and denotes the method in which the condition is to be
     handled. If the state is OFF, then neither handler nor method
     is defined.

[Current Trapped Condition.]
     This is the most recently handled condition, and is set
     whenever a trap is triggered. It contains information about
     method, which condition, and a context-dependent description.
     In fact, the information in the current trapped condition is
     the same information that was originally put into the pending
     event queue.

Note that the event queue is a data structure connected to the
interpreter itself. You operate on the same event queue,
independent of subroutines, even external ones. On the other hand,
the condition traps and the current trapped condition are data
structures connected to each single routine. When a new routine is
called, it will get its own condition traps and a current trapped
condition. For internal routines, the initial values will be the
same values as those of the caller. For external routines, the
values are the defaults.

The initial value for the event queue is to be empty.  The default-
action and the delay-action are static information, and will
always retain their values during execution. The initial values
for the condition traps are that they are all in state OFF. The
initial value for the current trapped condition is that all
information is set to the nullstring to signalize that no
condition is currently being trapped.