-- occam masterclass demo 7: protocol inheritance -- Compile with: kroc -d -di q7.occ #INCLUDE "course.module" --* Protocol for controlling a radio. -- Don't change this protocol. PROTOCOL TUNER CASE tune.fm; REAL32 tune.mw; REAL32 : --* Generate occasional requests for stations. -- Don't change this PROC or its header. PROC client (SHARED CHAN TUNER tune!) SEQ CLAIM tune! tune ! tune.fm; 89.1 CLAIM tune! tune ! tune.fm; 93.5 CLAIM tune! tune ! tune.mw; 909.0 : --* The radio PROC radio (CHAN TUNER tune?, CHAN BYTE out!) WHILE TRUE REAL32 f: tune ? CASE tune.fm; f SEQ out.string ("Tuned to FM: ", 0, out!) out.real32 (f, 3, 1, out!) out ! '*n' tune.mw; f SEQ out.string ("Tuned to medium wave: ", 0, out!) out.real32 (f, 3, 1, out!) out ! '*n' : PROC q6 (CHAN BYTE out!) SHARED! CHAN TUNER tune: PAR PAR i = 0 FOR 3 client (tune!) radio (tune?, out!) :