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

10: 12
program, omitting the result type. To use an intrinsic function as both
a function and a procedure, declare it both ways, giving the routine
different names in your program. Use the ALIAS compiler option to
associate the intrinsic's system name with the names you have given it.
If you declare an intrinsic function as a procedure only, you cannot call
it as a function.
Example
The intrinsic file defines the intrinsic Pascal functions f1 and f2 this
way:
FUNCTION f1 (i1 : integer) : integer;
FUNCTION f2 (i1,i2 : integer) : Boolean;
The Pascal program prog declares the function f1 as a procedure. It
cannot call it as a function. It declares the function f2 as a function
(which it calls ffunc) and as a procedure (which it calls fproc), using
the compiler option ALIAS to associate them with the system name f2. The
program cannot call fproc as a function.
PROGRAM prog;
VAR
x : Boolean;
y,z : integer;
PROCEDURE f1 (a : integer) INTRINSIC;
FUNCTION $ALIAS 'f2'$ ffunc : Boolean; INTRINSIC;
PROCEDURE $ALIAS 'f2'$ fproc; INTRINSIC;
BEGIN
f1(y);
x := ffunc(y,z);
fproc(y,z);
z := f1(y); {illegal -- declared as a procedure}
END.
Defining Intrinsics
Syntactically, an intrinsic is defined in the same way as any other
routine. (Refer to the
HP Pascal/iX Reference Manual
or the
HP
Pascal/HP-UX Reference Manual
for details.) Because an intrinsic can be
called by a program written in any language that the operating system
supports, its intrinsic parameters must be of types that have
counterparts in the other supported languages.
These HP Pascal types are acceptable for intrinsic parameters and
function returns:
Array
Boolean
Char
Function
Integer
Longreal
Procedure
Real
Record
Set
Shortint
Subrange m..n except where m>=0 and n<=255
These HP Pascal types are
not
acceptable for intrinsic parameters or