HP 3000 Manuals

FORWARD Directive [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation


HP Pascal/iX Reference Manual

FORWARD Directive 

The FORWARD directive permits the full declaration of a procedure or
function to appear after a call to the procedure or function.  For
example, if procedures A and B are declared on the same level, you must
use the FORWARD directive if A and B will call each other.

Example 

     PROCEDURE A; FORWARD;

     PROCEDURE B;
     BEGIN
        .
        A;    { calls A }
        .
     END;

     PROCEDURE A;  { full declaration of A }

     BEGIN
        .
        B;    { calls B }
        .
     END;

The body of the function or procedure must be fully declared elsewhere in
the same block.  Formal parameters, if any, and the function result type
must appear with the FORWARD declaration.  These formal parameters and
the result type may be omitted when making the subsequent full
declaration.  However, if repeated, they all must be present and
identical with the original formal parameters or result type.

The FORWARD directive may appear with a procedure or function at any
level.

Example 

     FUNCTION exclusive_or (x,y: Boolean): Boolean;

     FORWARD;
        .
        .
     FUNCTION exclusive_or;        { Parameters not repeated. }

     BEGIN
        exclusive_or:= (x AND NOT y) OR (NOT x AND y);
     END;



MPE/iX 5.0 Documentation