Exiting From A Routine; Figure 3-11. Processing File Name Arguments - HP TACL Programming Manual

Tandem advanced command language
Table of Contents

Advertisement

Exiting From a Routine

Use the routine in Figure 3-11, argrec, to process one or more file names, checking
for syntax but not for file existence. File names can be separated by spaces or commas.
After processing each file name, the routine scans ahead and skips over commas. It
calls itself to process each additional file name.

Figure 3-11. Processing File Name Arguments

?SECTION argrec ROUTINE
#FRAME
#PUSH fn nextfn rslt
#SET rslt [#ARGUMENT /TEXT fn/ FILENAME /SYNTAX/ OTHERWISE]
[#IF [rslt] = 2 |THEN|
#OUTPUT *** Invalid filename ***
#RETURN
]
== Process the first argument
#OUTPUT current argument = [fn]
== Check for another file name
#SET rslt [#ARGUMENT /TEXT nextfn/ FILENAME /SYNTAX/ &
COMMA END OTHERWISE]
[#CASE [rslt]
|1|
|2 3|
== Next argument is a comma or end; ignore it
#SET nextfn
|OTHERWISE|
#OUTPUT *** Invalid argument ***
#RETURN
]
== If nextfn contains a file name or there are additional
== unprocessed arguments, call self, appending the results.
[#IF NOT [#EMPTY [nextfn] [#REST]] |THEN|
#RESULT [#ROUTINENAME] [nextfn] [#REST]
]
#UNFRAME
To exit from a routine, use the #RETURN built-in function. #RETURN exits
immediately and does not reset any frames unless you specify #UNFRAME or
#RESET FRAMES prior to #RETURN.
You can use #RETURN to define several exit points within a routine. For examples of
the use of #RETURN, see the next subsection, "Writing an Exception Handler."
107365 Tandem Computers Incorporated
Developing TACL Routines
Exiting From a Routine
3–17

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents