-- SmallExample.mesa --Last edit: 14 July 1981 1:58 pm PDT (Tuesday) SmallExample: MONITOR = BEGIN speaker: DEVICE[n:CARDINAL] = { OUT out:Boolean CONTROL FOR i IN [1..n] DO out ← TRUE; out ← FALSE ENDLOOP } ; listener: DEVICE = { IN in: Boolean CONTROL DO WHEN in UP: writestring[ " up "]; WHEN in DOWN: writestring[ " down "]; ENDLOOP }; CIRCUIT { COMPONENTS s: speaker[10], l:listener NODES c: Boolean CONNECTIONS s[out: c], l[in: c] } END. SmallExample: MONITOR = BEGIN speaker: PROCEDURE[n:CARDINAL, out:BoolConnector.BooleanConnector] = {FOR i IN [1..n] DO BoolConnector.put[out , TRUE]; BoolConnector.put[out , FALSE] ENDLOOP}; listener: PROCEDURE[in: BooleanConnector] = { DO BoolConnector.GetNew[in, TRUE]; writestring[ " up "]; BoolConnector.GetNew[in, FALSE]; writestring[ " down "]; ENDLOOP }; c: BoolConnector.BooleanConnector ← BoolConnector.Create[]; s: PROCESS ← FORK speaker[10,c]; l: PROCESS ← FORK listener[c]; [] ← JOIN s; [] ← JOIN l; END. <DEVICE, ParameterList, <DEVICEBODY, CompList/1, Complist/2, Block, VarList, DataFlow, Block>> > <PROCEDURE, ParameterList@ModifyTypes[CompList/1]@ModifyTypes[Complist/2], ... Block ...> otherwise > PROCEDURE [ParameterList@CompList/1@Complist/2] = Block