Note
The examples in this subsection include an EXIT case for testing purposes, which allows you to exit the
routines. To prohibit exits, delete the EXIT case from the #FILTER statement and from the exception
handler and main loop.
To invoke restricted_cmd_processor, load the file and enter:
restricted_cmd_processor
Figure 3-15. Sample Keep Exception Handler
?SECTION restricted_cmd_processor ROUTINE
[#CASE [#EXCEPTION]
|_CALL |
#FRAME
#PUSH cmd
|_BREAK|
#OUTPUT BREAK key pressed.
|_ERROR|
#OUTPUT TACL error occurred.
|EXIT|
#RESET FRAMES RESULTS
#RETURN
|OTHERWISE|
#OUTPUT Unknown exception occurred.
]
== End #CASE
== Filters predefined exceptions only
#FILTER _BREAK _ERROR EXIT
== After you enter this loop, control stays here unless the
== routine is processing an exception.
[#LOOP |DO|
#SET cmd [#INPUT Enter cmd: ]
[#CASE [cmd]
|ADD|
#OUTPUT ADD
|SUB|
#OUTPUT SUB
|EXIT|
#RAISE EXIT
|OTHERWISE|
#OUTPUT Invalid command
#RAISE _ERROR
]
== End CASE
|UNTIL| 0
]
== End LOOP
#UNFRAME
107365 Tandem Computers Incorporated
== For demo only
Developing TACL Routines
Writing an Exception Handler
== Get value from terminal
== For demo only
== Always false
3–25