Processing Arguments
Developing TACL Routines
3–8
107365 Tandem Computers Incorporated
The following routine expects both a file name and a properly formatted variable
name, but accepts them in either sequence. To run this routine, type the name of the
file that contains this code:
?TACL ROUTINE
#FRAME
#PUSH fname vname
[#CASE [#ARGUMENT /VALUE fname/ FILENAME VARIABLE /SYNTAX/]
|1| #IF [#ARGUMENT /VALUE vname/ VARIABLE /SYNTAX/]
|2| #SETV vname fname == fname contains the variable name;
== move the variable name into vname.
#IF [#ARGUMENT /VALUE fname/ FILENAME]
]
#OUTPUT vname = [vname]
#OUTPUT fname = [fname]
#UNFRAME
Processing Variables as Arguments
The following routine accepts any type of existing variable except a STRUCT or a
STRUCT item:
?TACL ROUTINE
#PUSH vname
#IF [#ARGUMENT /VALUE vname/ VARIABLE /FORBID STRUCT ITEM/]
#OUTPUT [vname]
#POP vname
Processing a Space-Separated List of Words
The following routine accepts a space-separated list of words and returns it as a
comma-separated list.
?SECTION wordlist ROUTINE
#FRAME
#PUSH wurd
[#LOOP |WHILE| [#MORE] |DO|
#IF [#ARGUMENT /VALUE wurd/ WORD /SPACE/]
#RESULT [wurd][#IF [#MORE] |THEN|,]
]
#UNFRAME
If you run
wordlist
interactively, load the file that defines
wordlist
and use
#OUTPUT(V) to display the result:
15> #OUTPUT [wordlist a b c]
a, b, c
16>
For information about #RESULT, see “Returning Results,” later in this section.