with Text_io; procedure CRYPTO is package CRYPTO_TASKS is -- standard input->(p1)->characters->(P2)->standard output task P1 is -- consume text and produce unformatted cypher text end P1; task P2 is -- consume, output, and format cypher text. entry Get( CIN: in character); entry EOS; end P2; end CRYPTO_TASKS; package body CRYPTO_TASKS is task body P1 is A,B,C,D:character; NOTEND:boolean; procedure PF(A,B:in character; C,D:out character) is begin -- this is a stub for testing purposes. -- The real code will not be used for testing for security reasons C:=B; D:=A; end PF; procedure Get(X:out character; NOTEND:out boolean) is begin Text_io.Get(X); NOTEND:=true; exception when Text_io.End_error => NOTEND:=false; end Get; begin Get(A,NOTEND);Get(B,NOTEND); while NOTEND loop PF(A,B,C,D); P2.Get(C); P2.Get(D); Get(A,NOTEND); Get(B,NOTEND); end loop; P2.EOS; end P1; task body P2 is C:character; N,M: integer; EOF:boolean; begin EOF:=false; select accept Get(CIN:in character) do C:=CIN; end; or accept EOS do EOF:=true; end; end select; TEXT:while not EOF loop M:=1; LINE:while M<=10 and not EOF loop N:=1; GROUP:while N<=5 and not EOF loop Text_io.Put(C); select accept Get(CIN:in character) do C:=CIN; end; or accept EOS do EOF:=true; end; end select; N:=N+1; end loop GROUP; Text_io.Put(" "); M:=M+1; end loop LINE; Text_io.Put_line(""); end loop TEXT; end P2; end CRYPTO_TASKS; begin -- crypto program null; -- the two tasks start up automatically end CRYPTO;