TAL Reference Manual

Procedures
TAL Reference Manual526371-001
13-20
Examples of Entry-Point Declarations
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 invoke 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.
To obtain the code address of a subprocedure entry-point identifier, preface the
identifier with @.
You can specify FORWARD subprocedure entry-point declarations, which look like
FORWARD subprocedure declarations.
Examples of Entry-Point Declarations
1. This example illustrates use of procedure entry-point identifiers:
INT to_this := 314; !Declare global data
PROC add_3 (g2);
INT .g2;
BEGIN
ENTRY add_2; !Declare entry-point
ENTRY add_1; ! identifiers
INT m2 := 1;
g2 := g2 + m2;
add_2: !Location of entry-point
g2 := g2 + m2; ! identifier ADD_2
add_1: !Location of entry-point
g2 := g2 + m2; ! identifier ADD_1
END;
PROC mymain MAIN; !Main procedure
BEGIN
CALL add_1 (to_this); !Call entry point ADD_1
END;