pTAL Reference Manual (H06.03+)
Procedures, Subprocedures, and Procedure
Pointers
HP pTAL Reference Manual—523746-005
14-24
Subprocedure Entry-Point Identifiers
Subprocedure Entry-Point Identifiers
Here are guidelines for using subprocedure entry-point identifiers:
•
Declare all entry-point identifiers for a subprocedure within the subprocedure.
•
Place each entry-point identifier and a colon (:) at a point in the subprocedure at
which execution is to start.
•
You call a subprocedure entry-point identifier from anywhere in the encompassing
procedure, including from within the same subprocedure. (For functions, use the
entry-point identifier in an expression; for other subprocedures, use a CALL
statement.)
•
Pass actual parameters as if you were calling the subprocedure identifier.
•
You cannot use a GOTO statement to branch to a subprocedure entry-point
identifier.
Example 14-10. FORWARD Declarations for Entry Points
INT to_this := 314;
PROC add_1 (g2); ! FORWARD entry-point identifier
INT .g2; ! declaration
FORWARD;
PROC add_2 (g2); ! FORWARD entry-point identifier
INT .g2; ! declaration
FORWARD;
PROC add_3 (g2); ! FORWARD procedure declaration
INT .g2;
FORWARD;
PROC mymain MAIN; ! Main procedure declaration
BEGIN
CALL add_1 (to_this); ! Call entry-point identifier
END;
PROC add_3 (g2); ! Body for FORWARD procedure
INT .g2;
BEGIN
ENTRY add_2; ! Declare entry-point identifiers
ENTRY add_1;
INT m2 := 1;
g2 := g2 + m2;
add_2: ! Location of entry-point identifier
g2 := g2 + m2; ! add_2
add_1: ! Location of entry-point identifier
g2 := g2 + m2; ! add_1
END;










