TAL Reference Manual

Standard Functions
TAL Reference Manual526371-001
14-25
Examples of $LEN Function
Examples of $LEN Function
1. In this example, $LEN returns the number of bytes in an array element:
INT b; !Declare variables
INT a [0:11];
b := $LEN (a); !Return 2
2. In this example, $LEN returns the number of bytes in one occurrence of a
structure:
INT s_len;
STRUCT .s[0:99]; !Declare 100 occurrences of
BEGIN ! a structure
INT(32) array[0:2];
END;
s_len := $LEN (s); !Return 12
3. In this example, $OCCURS returns the number of elements in an array, and $LEN
returns the number of bytes in each element. This example multiplies 3 times 4
(the values returned by $OCCURS and $LEN) and yields the number of bytes in
the entire array:
INT array_length; !Declare variables
INT(32) array[0:2];
array_length := $LEN (array) * $OCCURS (array);
!Return 12, the length of the
! entire array in bytes
$LFIX Function
The $LFIX function returns a FIXED(fpoint) expression from an unsigned INT
expression.
int-expression
is an unsigned INT expression.
fpoint
is a value in the range –19 through +19 that specifies the position of the implied
decimal point in the result. A positive
fpoint specifies the number of decimal places
$LFIX
(
fpoint )
int-expression
,
VST1426.vsd