HP Pascal/iX Programmer's Guide (31502-90023)
8- 9
UNRESOLVED
The UNRESOLVED procedure option prevents the compiler/linker/loader from
resolving a routine until the program calls it. The routine must be at
level one.
To
resolve
a routine is to associate it with its system name. Calling an
OPTION UNRESOLVED routine implicitly resolves it at run-time, before it
is called. The routine must be resolvable.
Alternatively, an OPTION UNRESOLVED routine can be explicitly resolved by
calling the predefined function
addr
with the routine name as its
parameter. Then
addr
returns a routine reference that can be assigned to
a routine variable and called with the predefined procedure
call
or
fcall
. If the routine cannot be resolved,
addr
returns
nil
.
Example
PROGRAM p (output);
VAR
pv : PROCEDURE;
PROCEDURE p
OPTION UNRESOLVED;
EXTERNAL;
BEGIN {p}
p; {This ...}
call(addr(p)); {is equivalent to this ...}
pv := addr(p); {and this}
call(pv);
END. {p}
NOTE On the HP-UX operating system, the UNRESOLVED option causes the
addr
function to return
nil
whether or not the specified routine is
resolved.
INLINE
The INLINE procedure option duplicates a routine wherever the program
calls it. It makes your program bigger, but faster. It is worthwhile
for short routines and when speed is more important than size.
Example
The program:
$STANDARD_LEVEL 'EXT_MODCAL'$
PROGRAM prog;
VAR
i,j,k : integer;
PROCEDURE max (l1,l2: integer;
VAR l3 : integer)
OPTION INLINE;
BEGIN
IF l1 > l2 THEN
l3 := l1
ELSE
l3 := l2 ;
END;