[eichin:19960613.2333PDT] exercise 3.1 package Buffer_System is type Buffer is private; procedure Load(B: out Buffer; S: in String); -- wrong: needs inout procedure Load(B: in out Buffer; S: in String); procedure Get(B: in out Buffer; C: out Character); function Is_Empty() return Boolean; -- wrong: shoudld be function Is_Empty(B: in Buffer) return Boolean; Error: exception; private Max: constant Integer := 80; type Buffer is record Data: String(1..Max); Start: Integer := 1; Finish: Integer := 0; end record; end Buffer_System; package body Buffer_System is procedure Load(B: out Buffer; S: in String) is -- wrong: needs inout procedure Load(B: in out Buffer; S: in String) is begin -- start > finish if empty -- if S'Length>Max or not Is_Empty() then ?? if S'Length > Max or B.Start <= B.Finish then raise Error; -- too long or characters left end if; B.Start = 1; B.Finish = S'Length; B.Data (B.Start .. B.Finish) := S; -- rest of file lost! [eichin:19971226.2156EST]