next up previous
Next: STATISTICS Up: DECLARATIONS Previous: DBTABLES

PROCEDURES

The user can program functions and procedures as in the base Pascal languagegif. Procedure and function declarations must be placed under the heading PROCEDURES of the DECL section.

In these functions and procedures, instructions of the base Pascal language as well as GLIDER functions can be used. In addition to the instructions STOPSCAN and BEGINSCAN, the following (all but IT, NT, DEACT, DOEVENT, DONODE) common GLIDER instructions and procedures, enumerated in Chapters 6 and 7, may be used. They are:

ACT, BLOCK, ASSI, CLRSTAT, DEBLOCK, DBUPDATE, ENDSIMUL, EXTFEL, EXTR, FILE, FREE, GRAPH, INTI, LOAD, MENU, OUTG, PAUSE, PUTFEL, REL, REPORT, SCAN, SORT, STAT, TAB, TITLE, TRACE, TRANS, TSIM, UNLOAD, UNTRACE, UPDATE. USE.

However names of nodes, lists, GFUNCTIONS and database tables cannot be used as formal parameters in the present version. This restricts the usefulness of these instructions in procedures.

Type declarations, procedure declarations and function declarations within a function or procedure are not allowed.

Examples:

    PROCEDURES
     PROCEDURE CountActBar(VAR n: INTEGER);
                BEGIN
                   ACT(Bar,0); n := n + 1;
                   WRITELN('Bar activated', n, ' times!!!');
                END;

     FUNCTION CubicRoot(z: REAL): REAL;
               BEGIN CubicRoot := EXP(LN(z) / 3 END;

     PROCEDURE FirstTrue(VAR Count: BoolArray; i: INTEGER);
                VAR j: INTEGER;
                BEGIN
                  j := 1;
                 WHILE (j <= 4) AND NOT Count[j] do j := j + 1;
                 IF j = 5 THEN i := 0 ELSE i := j
                END;
Calls to these procedures may be:
    CountActBar(N);
    CubicRoot(1728.0);
    FirstTrue(CON, k);
    (It was defined:  TYPE BoolArray = ARRAY[1 . .4] OF BOOLEAN;)


domingo c
Mon Mar 20 11:09:25 PST 2000