Figure 3-1. Processing Arguments - HP TACL Programming Manual

Tandem advanced command language
Table of Contents

Advertisement

To process several types of arguments entered in any order, use a #CASE statement.
Use the routine in Figure 3-1 to process zero or more of the following:
File attribute names (defined in ALL)
Numbers

Figure 3-1. Processing Arguments

?SECTION mult_args ROUTINE
#FRAME
#PUSH stat count end
#SET count 0
#SET end 0
[#DEF attributes TEXT |BODY|
Type Size Age Owner Security
]
#OUTPUT Entered arguments were:
[#LOOP |DO|
#SET count [#COMPUTE [count] + 1]
[#CASE [#ARGUMENT/VALUE stat/
KEYWORD/WORDLIST [attributes]/ NUMBER END OTHERWISE]
|1|
#OUTPUT Argument [count] is the keyword [stat].
|2|
#OUTPUT Argument [count] is the number [stat].
|3|
#SET end 1
|4|
#OUTPUT *** Invalid argument ***
#SET end 1
]
|UNTIL| (NOT [#MORE]) OR end
]
#UNFRAME
Using #ARGUMENT for Data Within a Program
TACL itself does not provide data type declarations and functions, but you can write a
function that uses #ARGUMENT to determine the type and return the information.
The following routine returns TRUE (not zero) if you pass it a number; otherwise, it
returns FALSE:
?SECTION anumber ROUTINE
#RESULT [#COMPUTE NOT ([#ARGUMENT NUMBER OTHERWISE] - 1)]
Variations on this routine could return TRUE for text or special characters, a number
that reflects a group of argument types, or an index into the entire set of
#ARGUMENT alternatives.
107365 Tandem Computers Incorporated
Developing TACL Routines
Processing Arguments
[#REST]
3–5

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents