TAL Reference Manual
Privileged Procedures
TAL Reference Manual—526371-001
15-12
$BOUNDS Function
$BOUNDS Function
The $BOUNDS function checks the location of a parameter passed to a system
procedure to prevent a pointer that contains an incorrect address from overlaying the
stack (S) register with data.
param
is the identifier of an INT reference parameter of the procedure from which the
$BOUNDS function is called.
param must be declared at the global level. If you
specify a value parameter or a subprocedure parameter, an error results.
count
is an INT value that represents the word count.
Usage Considerations
$BOUNDS checks to see whether the stack space—represented by a starting address
and word count—causes the S register to overflow.
$BOUNDS returns an INT result. If no bounds error occurs, $BOUNDS returns a 0
(false). If a bounds error occurs, $BOUNDS returns a –1 (true).
$BOUNDS is not portable to future software platforms; it is described here only to
support existing programs. Instead, use the XBNDSTEST or XSTACKTEST system
procedure as described in the
Guardian Procedure Calls Reference Manual.
Example of $BOUNDS Function
This example checks the location of the parameter BUF. Before writing three words of
information to the location pointed to by BUF, the example calls $BOUNDS to make
sure that the new information does not accidentally overwrite existing information in the
system data segment:
PROC example (buf) PRIV;
INT .SG buf;
BEGIN
!Lots of code
IF $BOUNDS (buf, 3) THEN
CALL error
ELSE buf ':=' [1, 2, 3];
!More code
END;
VST1508.vsd
,
param
$BOUNDS
(
)
count