HP Pascal/iX Programmer's Guide (31502-90023)

8- 7
Table 8-2. Values Returned by Haveoptvarparm(x)
------------------------------------------------------------------------------------------------
| Type of Parameter | Actual | Position of
x
in formal parameter list
p(..,n,..)
|
| | Parameter | where
n
is the last actual parameter specified in |
| | for
x
is | the actual parameter list
p(..,n)
|
| | Specified | |
------------------------------------------------------------------------------------------------
|||
x
is before
n
:|
x
is
n
:|
x
is after
n
:|
|||
p(.x.,n,..)
|
p(..,x,..)
|
p(..,n,.x.)
|
------------------------------------------------------------------------------------------------
| Nonextension | Yes | true | true | Impossiblex>n |
| Parameter | | | | |
------------------------------------------------------------------------------------------------
| Nonextension | No | false | Impossible, | false |
| Parameter | | | because
x=n
||
------------------------------------------------------------------------------------------------
- Extension Parameter - Yes - true - true - Impossible, x > n -
------------------------------------------------------------------------------------------------
| Extension Parameter | No | false | Impossible, | false |
| | | | because
x=n
||
------------------------------------------------------------------------------------------------
Haveextension Function
With the DEFAULT_PARMS procedure option, the predefined function
haveextension
returns
true
and
false
under these conditions:
-------------------------------------------------------------------------------------
- Function - Returns true - Returns false -
-------------------------------------------------------------------------------------
|
haveextension(x)
where
x
| If the routine was passed | If the routine was not |
| is a formal parameter of | an actual parameter for | passed an actual |
| the routine that called |
x
, or if DEFAULT_PARMS | parameter for
x
, and no |
|
haveextension
. | specified a default for | default was specified for |
| |
x
. |
x
with DEFAULT_PARMS. |
-------------------------------------------------------------------------------------
Example
PROGRAM prog;
$STANDARD_LEVEL 'EXT_MODCAL'$
PROCEDURE p (a,b,c : integer)
OPTION EXTENSIBLE 2
DEFAULT_PARMS (b:=2);
BEGIN
END;
BEGIN {haveextension(b)} {haveextension(c)}
p(10,20); {true} {false}
p(10,20,30); {true} {true}
p(10); {true} {false}
END.
Table 8-3 tells the value of
haveextension(x)
when the formal
parameter
x
is:
* Nonextension or extension.
* Its actual parameter is specified or not specified.
* It is before, the same as, or after the parameter
n
, where
n
is
the last parameter for which an actual parameter is specified.