HP Pascal/iX Reference Manual (31502-90022)

11- 13
BEGIN
...
anyp := ptr1;
anyp := ptr2;
...
ptr1 := anyp;
...
END;
The above example illustrates that a variable of type anyptr is
assignment compatible with any other pointer type.
Example
VAR
ptr1 : pointer_type_1;
ptr2 : pointer_type_2;
PROCEDURE proc( ptr : anyptr );
BEGIN
...
END;
BEGIN
proc( ptr1 );
proc( ptr2 );
END;
In the above example, the routine proc can accept any pointer as an
actual parameter because the type of the formal parameter is anyptr.
anyptr is assignment compatible with any pointer type.
Example
TYPE
pointer_type = ^record_type;
record_type = RECORD
int : integer;
END;
VAR
i : integer;
anyp : anyptr;
BEGIN
i := pointer_type( anyptr )^.int;
END;
In the above example, the pointer anyp is dereferenced to access a field
in a record. Since an anyptr is not bound to a base type, the pointer
must first be type-coerced to a pointer type corresponding to the
structure to which anyp is pointing.
PROCEDURE and FUNCTION Types
In Pascal, PROCEDURE and FUNCTION parameters allow dynamic reference to
procedures and functions where the exact instance of the procedure or
function is not known until run-time. The system programming extensions
extend this concept to allow variables as well as parameters that refer
to procedures and functions.
Syntax