; *** ENROLLMENT CONTROL SYSTEM *** ; Module: IP2.CAM 92.10.27 ; -------------------------------------------------------------------- ; Sorts ; -------------------------------------------------------------------- TYPE ; Shared Types Mess = T:Mtype O:PId D:PId; Mtype = STR | INT | iM | mM | CId | pM; iM = N:SId Co:CId; mM = N:SId Co:CId M:Mark; pM = M:Mark Co:CId; PId = STR; CId = STR; SId = STR; Mark = INT; ENDTYPE ; -------------------------------------------------------------------- ; Functions ; -------------------------------------------------------------------- FUNC InsStu (n:SId,c:CId) : RETURNS let ( x = send(bf,Mess(iM(n,c),"ip2","es"))) in "Successful Communication"; FUNC InsMark (n:SId,c:CId,p:Mark) : RETURNS let ( x = send(bf,Mess(mM(n,c,p),"ip2","es"))) in "Successful Communication"; FUNC Vacancies (c:CId) : INT RETURNS let ( x = send(bf,Mess(c,"ip2","es"))) in "Successful Communication"; FUNC DidBetter (m:Mark,c:CId) : SId-set RETURNS let ( x = send(bf,Mess(pM(m,c),"ip2","es"))) in "Successful Communication"; ; -------------------------------------------------------------------- ; Communication Services ; -------------------------------------------------------------------- ip2 <- channel("ip2"); es <- channel("es"); bf <- channel("bf"); FUNC proc () : STR RETURNS let ( r = send(bf,Mess("ready","ip2"," "))) in proc1(); FUNC proc1 () : STR RETURNS let ( x = receive(ip2) ) in if T(x)=="end" then "No more messages" else let ( y = princ("M = ",x,"\n") ) in proc1();