Chapter 3. XRESs
TokenValue structure is used to contain a result token from a scripting language evaluation. Its use is documented in "11.3.2 Token Values"; here we will provide a brief explanation.
A TokenValue variable has the following structure:
typedef struct TokenValue {
union {
char *string;
EntryRef *ref;
float number;
} result;
char shouldFree;
char flags;
TokAddrRec *address; /* For internal use only */
TokInfo info;
} TokenValue;
The most important fields are flags and result. The value of flags will be one of string_tok_info, reference_tok_info, or number_tok_info; the token value will then be found in result.string, result.ref, or result.number, respectively. It is the responsibility of a XRES message-handler to verify that its parameters are of the correct type.
If the XRES has to dispose of the input TokenValue array, it should do so with the FreeToks() utility.
A result TokenValue array can be built up using ExpandTokenValueList() and its variants; the array may not be allocated and filled in directly by the XRES. Usually, *disp will be set to TRUE so that the array will be properly disposed by the XRES manager; if, however, *disp is FALSE on exit, the XRES must itself free the token value array sometime before the XRES is purged.
Generated with CERN WebMaker