Syntax:
COPYMESS(<integer value>) <associated instruction>;This instruction produces a number of copies of the message that is being processed, equal to the value of
<integer value>
(that
must be greater than zero) and for each copy executes the
<associated
instruction>
.
All fields of the original are copied.
The <associated instruction>
must have a SENDTO instruction to
dispose of the copy. Before it, instructions can be used
to change the values of the fields. To do this the names of the
O_<fields>
must be used.
The original message must be processed through instructions
outside the <associated instruction>
before or after the COPYMESS.
If it is not sent to a node, it will be lost.
The global control variable ICOPY takes the value of the generated copy.
Its value is not recorded in the copied message. If the programmer
wants to keep it, a field must be defined in the message for this
purpose and the value of ICOPY must be passed to each copy in the
<associated instruction>
.
COPYMESS can be used only in G, I, D nodes and in the RELEASE instruction of an R node.
Examples:
COPYMESS(N_Offices) BEGIN Nc := ICOPY + 1; SENDTO(Office[nc]) END; SENDTO(Office[1])A number of copies equal to the actual value of
N_Offices
are
generated and sent (with an indication of its number plus one) to
the nodes Office[2]
, Office[3]
, etc. The original
is sent to Office[1]
.Bridge
with a negative generation
time.
Entrance(I) Bridge :: IT := EXPO(Tell); SENDTO(Bridge); FillSys (I) :: GT := -10; TIME := GT; SENDTO(Bridge); COPYMESS(5) BEGIN GT := -Ant[ICOPY]; TIME := GT; SENDTO(Bridge) END; Bridge (R) :: STAY := 1; --------------------- INIT ACT(FillSys, 0); ASSI Ant[1..5] := (9, 7, 3, 2, 0);The node
FillSys
creates a virtual past before TIME = 0 in which
it sends six messages to Bridge
. It finishes
its action when he puts TIME to zero ( Ant[5]
).