PS TEXT FORMAT Reference Manual

Appendix G Examples of Function
and Macro Constructs
11387 Tandem Computers Incorporated G-1
A FUNCTION
Construct
You use a function to evaluate an expression and determine its value. It
can also accept and process arguments, but a function cannot produce any
lines of text. A function can only return a single value.
TFORM has a set of system-supplied functions available for your use that
produce such things as the absolute value of a numeric expression, a string
in all lowercase or uppercase letters, a justified string, or the width of a
string in decipoints. If you enter, for example, the ROMAN TFORM
function (which returns the roman equivalent of an integer value) like this:
The Roman equivalent of 2001 is \(roman(2001)\).
The printed results would look like this:
The Roman equivalent of 2001 is mmi.
You can supplement the system-supplied functions by using the
FUNCTION command to write functions of your own.
The lines between the FUNCTION BEGIN and ENDFUNCTION
commands define the actions of the function.