pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Example 211 Subprocedure Entry-Point Identifiers
literal write_op,
read_op,
writeread_op,
readwrite_op;
int proc io (op, buf);
int op;
int .ext buf;
begin
int subproc do_read_op (buf);
int .ext buf;
forward;
int subproc do_write_op (buf);
int .ext buf;
forward;
int subproc do_writeread_op (buf);
int .ext buf;
begin
entry do_read_op;
call do_write_op (buf);
do_read_op:
! Perform read operation
end;
int subproc do_readwrite_op (buf);
int .ext buf
begin
entry do_write_op;
call do_read_op (buf);
do_write_op:
! Perform write operation
end;
case op of
begin
! write_op ! call do_write_op (buf);
! read_op ! call do_read_op (buf);
! writeread_op ! call writeread_op (buf);
! readwrite_op ! call readwrite_op (buf);
end;
end;
Procedure Pointers
Procedure pointers allow a program to call a variable dynamically or to call an EXTENSIBLE
procedure.
The syntax of procedure pointers is similar to the syntax of forward procedures; however, instead
of the keyword PROC, you declare a procedure pointer using the keywords PROCPTR, PROC32PTR,
or PROC64PTR. As with a forward procedure, a procedure pointer fully specifies the procedure’s
attributes and formal parameters but has no body—a procedure pointer does not include executable
statements.
The size of PROCPTRs and PROC32PTRs is 32-bits in length. The size of PROC64PTRs is 64-bits
in length.
You can declare procedure pointers as:
Variables
Formal parameters
Structure fields
Procedure Pointers 263