TAL Programmer's Guide

TAL and C Guidelines
Mixed-Language Programming
17–20 096254 Tandem Computers Incorporated
The following are compatible arrays in TAL and C (large-memory model):
TAL Code C Code
INT .EXT robin[0:9]; short robin [10];
INT(32) .EXT gull[0:14]; long gull [15];
STRING .EXT grebe[0:9]; char grebe [10];
Structures
All TAL and C structures begin on a word boundary. Following are guidelines for
sharing TAL and C structures and passing them as parameters:
Specify the same layout for corresponding TAL and C structures.
Specify compatible data types for each item of both structures.
In TAL, pass structures by reference.
In C, use the & operator.
In TAL, a routine cannot return a structure as a return value.
The following TAL and C structures have compatible layouts:
TAL Code C Code
STRUCT rec (
*
); struct birdname
BEGIN {
INT x; short x;
STRING y[0:2]; char y[3];
END; } robin[10];
STRUCT .EXT robin(rec)[0:9];
The following TAL and C structures have compatible layouts:
TAL Code C Code
STRUCT rec1 (
*
); struct rec1
BEGIN {
STRING a, b, c; char a, b, c;
END; };
The following TAL and C structures also have compatible layouts:
TAL Code C Code
STRUCT rec2 (
*
); struct rec2
BEGIN {
STRING e; char e;
INT y; short y;
STRING g; char g;
END; };