Using SPI
Using Programmatic Interfaces
7–8
107365 Tandem Computers Incorporated
Token Codes
In TACL, a token code is an integer, a numeric variable, or a two-word STRUCT.
Token code definitions, as generated by DDL, are included in the TACL versions of the
SPI and subsystem definition files. You can refer to the individual fields of a token
code by using a STRUCT that is defined as follows:
[#DEF token STRUCT
BEGIN
INT2 code;
STRUCT fields REDEFINES int32;
BEGIN
BYTE datatype;
BYTE bytelength;
INT number;
END;
END;
]
Token codes cannot be composed or decomposed by simple arithmetic, because the
token number is signed and simple arithmetic would extend the sign.
Token Maps
In TACL, a token map is stored in a STRUCT variable. The definition of the STRUCT
is irrelevant to TACL.
Token map definitions, as generated by DDL, are included in the TACL definition files
for subsystems that define extensible structured tokens.
When using a token map, TACL verifies that the contents of the token map are
consistent with the size of the STRUCT in which it is stored.
External Representation of Token Values
Use text (instead of binary bits) when storing and retrieving token values. Legal text
characters come from the ISO 8859.1 character set. The following lists conditions of
data representation:
If the token-length of a token is 255, the token value is of variable length. TACL
represents such a token value as a number indicating the one-word byte length of
the token, followed by a space, followed by the token value or values.
If the data type of a token is ZSPI^TDT^CHAR, its token value is represented by a
number of contiguous characters; that number is equal to the actual length of the
token. (This is the value of the token-length field if that value is less than 255, or
the actual length in bytes if the token-length field is 255.)
If the data type of a token is ZSPI^TDT^STRUCT or ZSPI^TDT^MAP, you must
handle the token with #SSGETV and #SSPUTV so that the binary data can be
moved to and from STRUCT variables whose definitions provide the appropriate
conversions to and from external representations.