pTAL Conversion Guide

TAL Standard Routines
pTAL Conversion Guide527302-002
17-10
$OFFSET
$OFFSET
$OFFSET is a TAL routine for which pTAL has a built-in routine with the same name
but slightly different behavior.
$OFFSET returns the byte offset of a structure field from the beginning of the structure.
variable
is the fully qualified identifier of a structure field.
Table 17-3. $OCCURS for Structure Arrays and Arrays Within Structures
$OCCURS
Argument Example
$OCCURS Returns
In TAL In pTAL
Unindexed structure
array or
substructure array
or
an element of a
structure array or
substructure array
or
an array that is a
field within a
structure or
substructure
STRUCT s[0:9];
BEGIN
STRUCT t[0:7];
BEGIN
INT i[0:4];
END;
END;
$OCCURS(s);
$OCCURS(s[7]);
$OCCURS(s[7.t]);
$OCCURS(s[7].t[3]);
$OCCURS(s[7].t[3].i);
$OCCURS(s[7].t[3].i[v]);
10
10
8
8
5
5
10
1*
8
1*
5
1*
Entire structure
or
nonarray field of a
structure or
substructure
STRUCT s;
BEGIN
INT f;
END;
$OCCURS(s);
$OCCURS(s.f);
1
1
1
1
Structure template STRUCT s(*);
BEGIN
INT f[0:9];
END;
$OCCURS(s);
$OCCURS(s.f);
$OCCURS(s.f[5]);
Comp.-time err.
10
10
Comp.-time err
10
1*
* The native compiler reports a warning that $OCCURS returns a different value than TAL.
( )$OFFSET
VST104.vsd
variable