Defining Program Structure
Developing TACL Programs
107365 Tandem Computers Incorporated
2–7
Nesting TACL Code
To run another TACL program from within a TACL program, invoke the file name or
variable name, as appropriate.
Certain built-in functions can be used only within one type of program (macro or
routine). To determine the use of such functions in a nested program, see individual
function descriptions in the TACL Reference Manual. For example, #ARGUMENT must
be used within a routine, but can be used in a macro if the macro is nested within a
routine.
To call a program recursively, use %0% (for a macro) or #ROUTINENAME (for a
routine) to specify the name of the program. You cannot call a text variable
recursively.
The following macro calls itself to display each of its arguments on a separate line:
?TACL MACRO
#OUTPUT %1%
== Display current argument
[#IF NOT [#EMPTY %2%] |THEN|
== Test for additional arguments
%0% %2 TO *%
== Call self without current
]
== argument.
To run this macro, type the file name from the TACL prompt and supply one or more
arguments. The macro displays the arguments you supply. In the following example,
the file name that contains the macro is called ARGS:
12> args a b c d
a
b
c
d
13>
Section 3, “Developing TACL Routines,” contains a macro that calls a nested routine.