pTAL Reference Manual (H06.03+)
Procedures, Subprocedures, and Procedure
Pointers
HP pTAL Reference Manual—523746-005
14-31
Declaring PROCPTR in Structures
previous-identifier
The identifier of a field at the same level as procptr in the same structure.
Example 14-13 on page 14-31 declares a REAL PROCPTR as a field in a structure
array of 10 elements. Use an index to reference elements of array s1:
CALL s1[3].f(3.0e1);
Example 14-14 on page 14-31 declares a template structure s2 with three
components. When s2 is the referent of a referral structure, pTAL allocates space for
PROCPTR f. pTAL does not allocate space for PROCPTRs g or h because they
redefine PROCPTR f. PROCPTRs f, g, and h are the same except for the type of the
parameter passed to the procedure.
The code in Example 14-15 on page 14-31 uses the structure s2 in Example 14-14 on
page 14-31.
Example 14-13. PROCPTR in a Structure
STRUCT s1 [0:9];
BEGIN
REAL PROCPTR f(x); REAL x; END PROCPTR;
END;
Example 14-14. PROCPTRs in Structure
STRUCT s2 (*);
BEGIN
REAL PROCPTR f(x);
REAL x;
END PROCPTR;
REAL PROCPTR g(x);
INT x;
END PROCPTR = f;
REAL PROCPTR h(x);
FIXED x;
END PROCPTR = g;
END;
Example 14-15. Code That Uses the Structure in Example 14-14 on page 14-31
STRUCT s(s2);
REAL my_real;
INT my_index := type_int;
CASE my_index OF
BEGIN
type_real -> my_real := s.f(3.0E1);
type_int -> my_real := s.g(3);
type_fixed -> my_real := s.h(3F);
END;










