32 lines
33 KiB
Plaintext
32 lines
33 KiB
Plaintext
1
|
||
|
||
Medley for the Novice, Release 2.0
|
||
1
|
||
|
||
Medley for the Novice, Release 2.0
|
||
10. BREAKPACKAGE
|
||
1
|
||
|
||
10. BREAKPACKAGE
|
||
1
|
||
|
||
|
||
"10"10. BREAKPACKAGE
|
||
6
|
||
|
||
|
||
The Break Package(BREAK% PACKAGE NIL Break% Package NIL NIL 1) is a part of Interlisp that makes debugging your programs much easier.
|
||
Break Windows(WINDOWS NIL Windows NIL NIL 1 SUBNAME BREAK SUBTEXT break)
|
||
1
|
||
|
||
A break is a function either called by the programmer or by the system when an error has occurred. A separate window opens for each break. This window works much like the Executive Window, except for extra menus unique to a break window. Inside a break window, you can examine variables, look at the call stack at the time of the break, or call the editor. Each successive break opens a new window, where you can execute functions without disturbing the original system stack. These windows disappear when you resolve the break and return to a higher level.
|
||
Break Package(BREAK% PACKAGE NIL Break% Package NIL NIL 1 SUBNAME EXAMPLE SUBTEXT example) Example
|
||
1
|
||
|
||
|
||
This example illustrates the basic break package functions. A more complete explanation of the breaking functions, and the break package will follow.
|
||
The correct definition of FACTORIAL is:
|
||
(defun factorial (x)
|
||
(if (zerop x)
|
||
1
|
||
(* x (factorial (1- x)))))
|
||
|
||
To demonstrate the break package, we have edited in an error: DUMMY in the IF statement is an unbound atom, it lacks a value.
|
||
((defun factorial (x)
|
||
(if (zerop x)
|
||
dummy
|
||
(* x (factorial (1- x)))))
|
||
The evaluated function
|
||
(FACTORIAL 4)
|
||
should return 24, but the above function has an error. DUMMY is an unbound atom, an atom without an assigned value, so Lisp will "break". A break window appears (Figure 10-1), that has all the functionality of the typing lisp expressions into the Executive Window (The top level), in addition to the break menu functions. Each consecutive break will move to another level "down".
|
||
|
||
|