pTAL Reference Manual (H06.03+)

Built-In Routines
HP pTAL Reference Manual523746-005
15-77
$PARAM
For more information about overflow, see Section 13, Hardware Indicators.
$PARAM
$PARAM checks for the presence or absence of an actual parameter in the call that
called the current procedure or subprocedure.
formal-param
is the identifier of a formal parameter as specified in the procedure or
subprocedure declaration.
If the actual parameter corresponding to formal-param is present in the CALL
statement, $PARAM returns 1 (not -1 as other Boolean operations do). If the actual
parameter is absent from the CALL statement, $PARAM returns 0.
Only a VARIABLE procedure or subprocedure or an EXTENSIBLE procedure can use
$PARAM. If such a procedure or subprocedure has required parameters, it must check
for the presence or absence of each required parameter in CALL statements. The
procedure or subprocedure can also use $PARAM to check for optional parameters.
Example 15-72. $OVERFLOW Routine
i := i + 1;
IF $OVERFLOW THEN ...
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW No
Example 15-73. $PARAM Routine
PROC var_proc (buffer,length,key) VARIABLE;
INT .buffer, length, ! Required parameters
key; ! Optional parameter
BEGIN
...
IF NOT $PARAM (buffer) OR NOT $PARAM (length) THEN RETURN;
! Return 1 or 0 for each required parameter
IF $PARAM (key) THEN ... ;
! Return 1 if optional parameter is present
END;
( )
VST106.vsd
$PARAM formal-param