MTS 8: LISP and SLIP in MTS
Page Revised January 1983 June 1976
(UNEVAL STACKID S) ____________________
UNEVAL allows the user to look back on the system stack and trace the
path that was followed by the system to get to its current position. It
may be used from an error form or break loop to restart from any given
point.
Each time EVAL is called internally, a block of information called an
EVAL block is stored on the stack. The EVAL block contains the form
which is to be EVALed, plus all relevant information needed to restart
at that level.
When the first argument to UNEVAL is a negative integer, it refers to
the Nth previous EVAL block on the stack. When the first argument to
UNEVAL is a positive integer, it refers to the Nth EVAL block on the
stack, beginning with the top-level form.
For example, if the program is in a break loop, and the user enters
| (UNEVAL -1), the last form sent to EVAL will be returned. This will be
(BREAK) if the program entered the break loop by calling BREAK directly,
or (DUMP N) if the break loop was entered as part of a dump operation.
(UNEVAL ignores its own EVAL block.)
If the first argument to UNEVAL is an expression S which is not an
integer, then the argument refers to the most recent call to EVAL for
which the CAR of the form to be evaluated was equal to S. For example,
if (UNEVAL ’ASSOC ) is evaluated, UNEVAL will return the most recent
outstanding EVAL-form which has ASSOC as its CAR.
If the first argument to UNEVAL is a number larger than the current
EVAL depth, or if it is a structure which is not equal to any function
specification on the stack, an error is generated.
Once UNEVAL identifies the correct EVAL block, the second argument
determines the action to be taken. If no second argument is given,
UNEVAL returns the form that was sent to EVAL at that level. Thus, a
call to UNEVAL with no second argument does not change the current level ___
of execution. If the second argument to UNEVAL is T, then execution is
restarted at that level. Thus, if (UNEVAL ’ASSOC T) is evaluated, the
system will exit from its current level, unbind all bindings back to the
point where ASSOC was called, and restart the call to ASSOC.
If the second argument to UNEVAL is anything other than T, then
execution is restarted at the indicated level, but the form given as the
second argument is substituted for the form which was originally sent to
EVAL. Thus, if the user evaluates (UNEVAL -4 ’(APPEND X Y)), the system
will unbind to the fourth previous EVAL block, and will then proceed to
evaluate (APPEND X Y) in place of the form which was originally given.
Note: The user should be aware that unbinding to a previous LISP
level restores only the values of variables bound in LAMBDA or PROG
60 LISP