TAL Programmer's Guide
TAL and C Guidelines
Mixed-Language Programming
096254 Tandem Computers Incorporated 17–27
Enumeration Variables
Using C enumeration constants, you can associate a group of named constant values
with an int variable. A C enumeration variable occupies 16 bits of memory. You
define all integer operations on them. The C compiler provides no range checking, so
an enumeration variable can hold a value not represented in the enumeration.
A C routine can share an enumeration variable with TAL routines. A TAL routine
cannot access the enumeration constants, but can declare LITERALs for readability.
For example:
TAL Code C Code
LITERAL no = 0, enum choice {no = 0,
yes = 3, yes = 3,
maybe = 4; maybe = 4 };
BLOCK answer; enum choice ANSWER;
INT answer_var;
END BLOCK;
A C routine can pass enumeration parameters to TAL routines, placing the actual
value in a TAL INT variable. For example:
TAL Code C Code
LITERAL no = 0, enum choice {no = 0,
yes = 3, yes = 3,
maybe = 4; maybe = 4 };
enum choice answer;
PROC tal_proc (n);
INT n; _tal void TAL_PROC (short);
BEGIN
!Lots of code main ()
IF n = yes THEN ... ; {
!Lots of code answer = yes;
END; TAL_PROC (answer);
/* lots of code */
}