ack/lang/m2/libm2/CSP.def

52 lines
1.4 KiB
Modula-2

DEFINITION MODULE CSP;
(* From
"A Modula-2 Implementation of CSP",
M. Collado, R. Morales, J.J. Moreno,
SIGPlan Notices, Volume 22, Number 6, June 1987.
See this article for an explanation of the use of this module.
*)
FROM SYSTEM IMPORT BYTE;
TYPE Channel;
PROCEDURE COBEGIN;
(* Beginning of a COBEGIN .. COEND structure *)
PROCEDURE COEND;
(* End of a COBEGIN .. COEND structure *)
PROCEDURE StartProcess(P: PROC);
(* Start an anonimous process that executes the procedure P *)
PROCEDURE StopProcess;
(* Terminate a Process (itself) *)
PROCEDURE InitChannel(VAR ch: Channel);
(* Initialize the channel ch *)
PROCEDURE GetChannel(ch: Channel);
(* Assign the channel ch to the process that gets it *)
PROCEDURE Send(data: ARRAY OF BYTE; VAR ch: Channel);
(* Send a message with the data to the cvhannel ch *)
PROCEDURE Receive(VAR ch: Channel; VAR dest: ARRAY OF BYTE);
(* Receive a message from the channel ch into the dest variable *)
PROCEDURE SELECT(n: CARDINAL);
(* Beginning of a SELECT structure with n guards *)
PROCEDURE NEXTGUARD(): CARDINAL;
(* Returns an index to the next guard to be evaluated in a SELECT *)
PROCEDURE GUARD(cond: BOOLEAN; ch: Channel;
VAR dest: ARRAY OF BYTE): BOOLEAN;
(* Evaluates a guard, including reception management *)
PROCEDURE ENDSELECT(): BOOLEAN;
(* End of a SELECT structure *)
END CSP.