Processing Arguments
Developing TACL Routines
107365 Tandem Computers Incorporated
3–7
You could call this routine from your program:
?SECTION caller ROUTINE
#FRAME
== call getnumber with the starting position
== and the line of text
#PUSH pfree position line
#SET line This is a test number: 53
#SET position 23
#SET pfree [getnumber [position] [line]]
#OUTPUT [pfree]
#UNFRAME
The routine performs more checking than #CHARGET and is more flexible with the
length of a space-separated number. The routine, however, takes longer to write,
making it most useful if you plan to perform this action many times in your program.
Processing File Name Arguments
The following routine parses an OUT option enclosed in slashes. The routine first
checks for a slash (/). If present, the routine checks for the word OUT, followed by a
file name and an ending slash. The routine then sets the TACL OUT file to the file
specified in the argument list. If the user does not specify an OUT option, this routine
displays the current setting of the OUT file. To run the routine, type the name of the
file that contains the code:
?TACL ROUTINE
#FRAME
#PUSH out outfile
[#CASE [#ARGUMENT SLASH END OTHERWISE]
|1| == Found the first slash character
SINK [#ARGUMENT KEYWORD /WORDLIST out/]
SINK [#ARGUMENT /VALUE outfile/ FILENAME /SYNTAX/]
#OUTPUT [outfile]
SINK [#ARGUMENT SLASH]
SINK [#ARGUMENT END]
#PUSH #OUT
#SET #OUT [outfile]
|2| == No arguments; display the current OUT file
#OUTPUT The current OUT file is [#OUT]
|OTHERWISE| == Unknown argument
#OUTPUT Invalid argument
]
#OUTPUT [outfile]
#UNFRAME