TAL Reference Manual
TAL Reference Manual—526371-001
5-1
5 LITERALs and DEFINEs
This section describes LITERAL and DEFINE declarations. A LITERAL declaration
associates identifiers with constant values.
A DEFINE declaration associates identifiers (and parameters if any) with text. (DEFINE
declarations differ from TACL DEFINE commands, which are described in Appendix E,
“File Names and TACL Commands,” in the
TAL Programmer’s Guide.)
You can declare LITERALs and DEFINEs once in a program, and then refer to them by
identifier many times throughout the program. They allow you to make significant
changes in the source code efficiently. You only need to change the declaration, not
every reference to it in the program.
LITERAL Declaration
A LITERAL declaration specifies one or more identifiers and associates each with a
constant. Each identifier in a LITERAL declaration is known as a LITERAL.
identifier
is the identifier of a LITERAL.
constant
is either:
•
An INT, INT(32), FIXED, REAL, or REAL(64) numeric constant expression that
evaluates to any value except the address of a global variable. (All global
variables are relocatable during binding.)
•
A character string of one to four characters.
If you omit any constants, the compiler supplies the omitted numeric constants.
The compiler uses unsigned arithmetic to compute the constants it supplies:
•
If you omit the first constant in the declaration, the compiler supplies a zero.
•
If you omit a constant that follows an INT constant, the compiler supplies an
INT constant that is one greater than the preceding constant. If you omit a
constant that follows a constant of any data type except INT, an error message
results.
;
constant
identifier
LITERAL
=
,
VST0501.vsd