
3 Developing TACL Routines
107365 Tandem Computers Incorporated
3–1
TACL routines provide features that you cannot obtain from any other type of TACL
variable. In a routine, you can:
Use #ARGUMENT to check the syntax and validity of several types of arguments
or to parse data within your program
Use #RESULT to return a specific result (instead of an expansion of text)
Use #ROUTINENAME to obtain the name of the active routine, for issuing
recursive calls
Use #RETURN to exit from any location in the routine
Create an exception handler that processes events or errors
The following subsections describe how to use these features.
Processing Arguments
When you invoke a routine, you can include a list of arguments after the routine name.
A routine does not, however, access these arguments in the same manner as macro
arguments (%n%). Instead, in your routine, you specify an #ARGUMENT function
with a list of argument alternatives. The #ARGUMENT function steps through the list
and checks to see if the current argument matches a specified alternative. If the
argument matches, #ARGUMENT returns an index to the alternative and optionally
stores the argument in a variable for use within the routine.
The following statement checks to see if the next argument is a valid subvolume name
(SUBVOL alternative) or system name (SYSTEMNAME alternative):
#SET num [#ARGUMENT /VALUE name/ SUBVOL SYSTEMNAME]
If the argument is a valid subvolume name, #ARGUMENT assigns 1 to
num
, indicating
that the argument is a subvolume name, and stores the qualified argument in
name
.
(The VALUE option affects how the #ARGUMENT built-in function stores the
argument. For more information, see the TACL Reference Manual.)
The following examples show differences between argument processing in macros and
routines. The programs support the following syntax:
process_argm
file-name
process_argr
file-name