PS TEXT FORMAT Reference Manual
Examples of Function and Macro Constructs
G-6 11387 Tandem Computers Incorporated
Refer to Section 3 under “TFORM Commands” for more information about
these macros.
The lines between the MACRO BEGIN and ENDMACRO commands
define the actions of the macro. A macro must be entered on a line by itself
beginning in column one.
The following examples demonstrate how you can design macros to
accomplish almost any task (subject to the rules of TFORM).
MACRO Example 1
This example creates a macro named point that tells TFORM to increment
the value of point by 1 each successive time it is called. The macro is used
here to build a simple numbered list. The beginning of the input file
contains the MACRO construct:
\MACRO point DELETE
\MACRO point BEGIN
\ IF !DEFINE(POINT_NUMBER)
\ ASSIGN point_number 1
\ ENDIF
\ BREAK
Item \(point_number\):
\ ASSIGN point_number point_number+1
\ENDMACRO point
1
3
2
1 - If the variable point_number is undefined (or not true), then assign it
the value of 1.
2 - The BREAK command tells TFORM to start a new line. Insert the
word “Item,” the result of the point macro, and a colon.
3 - Increment the variable point_number by 1.