TAL Programmer's Guide
TAL and C Guidelines
Mixed-Language Programming
17–22 096254 Tandem Computers Incorporated
You can ensure compatible layouts between TAL and C substructures as follows:
Declare TAL referral substructures rather than definition substructures. Referral
substructures are always word-aligned.
If you must declare TAL definition substructures, either:
Use FILLER declarations as needed to begin and end TAL definition
substructures on word boundaries, as shown in TAL structure REC4 in the
example that follows.
Declare C structures that emulate the layout of a byte-aligned TAL
substructure, as shown in C structure REC5 in the second example that
follows.
In TAL structure REC4, each FILLER declaration inserts a pad byte before and after
the definition substructure TSUB2 so it begins and ends on a word boundary. Thus,
the following TAL and C structures have compatible layouts and can be shared:
TAL Code C Code
STRUCT rec4 (
*
); struct rec4
BEGIN {
INT x; short x;
STRING a; char a;
FILLER 1;
STRUCT tsub2; struct
BEGIN {
STRING b,c,d; char b,c,d;
END; } csub2;
FILLER 1;
STRING e; char e;
END; };
In C structure REC5, three variables (not a substructure) emulate the byte-aligned
layout of TAL substructure ST. Thus, the following TAL and C structures have
compatible layouts and can be shared:
TAL Code C Code
STRUCT rec5 (
*
); struct rec5
BEGIN {
INT x; short x;
STRING a; char a;
STRUCT st;
BEGIN
STRING b; char stb;
STRING c; char stc;
STRING d; char std;
END;
STRING e; char e;
END; };
STRUCT .EXT match (rec5); struct rec5 match;