Writing an Exception Handler
Developing TACL Routines
107365 Tandem Computers Incorporated
3–31
For this example, the keep handler terminates if you enter an EXIT command.
Usually, a keep handler does not provide an exit mechanism.
Figure 3-17. Using Nested Keep and Release Handlers (Page 1 of 2)
?SECTION restricted_caller ROUTINE
[#CASE [#EXCEPTION]
|_CALL|
#FRAME
#PUSH cmd exceptionlist
#SET exceptionlist _BREAK _ERROR EXIT
|_BREAK|
#OUTPUT BREAK key pressed.
|_ERROR|
#OUTPUT TACL error occurred.
| EXIT | == for demonstration purposes
#RESET FRAMES RESULTS
#RETURN
|OTHERWISE|
#OUTPUT Unknown exception occurred.
] == End CASE
== Filter for predefined exceptions only
#FILTER [exceptionlist]
[#LOOP |DO|
#SET cmd [#INPUT Enter cmd: ] == Get value from terminal
[#CASE [cmd]
|ADD|
protected_code do_add
|SUB|
protected_code do_sub
|EXIT| == For demonstration purposes
#RAISE EXIT
|OTHERWISE|
#OUTPUT Invalid command
#RAISE _ERROR
] == End CASE
|UNTIL| 0 = 1 == (do forever)
] == End LOOP
#UNFRAME