Contents | Index | < Browse | Browse >
4.2. $exit
It is possible to change the normal flow of execution
by means of the $exit built-in routine. The programmer may
use ($exit 0) to halt execution of the current phase and
move on to the next phase. At any time, ($exit 1) may be
used to halt the execution of the current phase and skip to
the next Actor. Inside the Direct Object loop, ($exit 2)
may be used to skip the rest of the Object and Verb ACTIONs
and go on to the next Direct Object in the list. At any
time after the parsing phase, ($exit 3) will return the flow
of control to the Parsing phase without clearing the sen-
tence. This allows for incremental entry of sentences; for
example "The big door. Unlock. With the key".
The following is a diagram of the flow of execution:
START [0]
|
v
+--------------------------------->o
| |
| v
| Daemons [1]
| |
| v
| Get Actor <----------------------+
| | |
| v |
| +------------------> Clear Sentence |
| | | |
| | v |
| | ($exit 3)====> Get Input? --n---> Delete Actor |
| | | y | |
| | v | |
| o<---------------------- Parse? | |
| ^ | | |
| | v | |
| o<-------------fail----- DWIMI | |
| ^ | | |
| | v | |
| +--------------fail----- DWIMD | |
| | | |
| v | |
| Get Dobj <-------+ | |
| | | | |
| v | | |
| Actor ACTION [2] | | |
| Verb PREACT [3] | | |
| Iobj ACTION [4] | | |
| Dobj ACTION [5] | | |
| Verb ACTION [6] | | |
| | | | |
| v | | |
| ($exit 2)===> More Dobjs? -y----+ | |
| | n | |
| v | |
| Room ACTION [7] | |
| | | |
| v | |
| ($exit 1)=========>o<-------------------+ |
| | |
| v |
+--------------------------n- More Actors? -y-------------------+