next up previous
Next: BLOCK blocks future events Up: PROCEDURES Previous: ACT schedules a future

BEGINSCAN repeats the scanning of a list

Syntax:

    BEGINSCAN;
It is used to re-start the scanning of the list being processed, usually after the list has been altered. When this instruction is executed the scanning of the list starts again from the beginning.

The user should be careful in using this procedure, lest a loop may happen. If the BEGINSCAN is executed continually during the scan of a non vanishing list, a loop will result.

This procedure can be used in nodes of G type and in the associated instruction of SCAN .

Example:

  Ent (I) :: COPYMESS(10) BEGIN Age := UNIFI(1,100); SENDTO(CheckAge) END;
                SENDTO(CheckAge);
  CheckAge (G) Egress :: A := 0;
                SCAN(EL_CheckAge,Points)
                IF O_Age > A THEN BEGIN PointOld := Points; A := O_Age END;
                TRANS(EL_CheckAge, PointOld, A, EL_Egress, LAST);
                BEGINSCAN;
  ------------------------------------------------------------
  INIT  ACT(Ent, 0);
  ------------------------------------------------------------
  DECL VAR A: INTEGER;
           Points, PointOld: POINTER;
           MESSAGES  Ent(Age: INTEGER);
Messages (persons) that arrive to CheckAge are sent to Egress by decreasing order of the field value Age.



domingo c
Mon Mar 20 17:37:52 PST 2000