--
-- A simple client of the Int_Stack package.
--
with Gnat.Io; use Gnat.Io;
with I_Stack; use I_Stack;
procedure Int_Stack_User is
-- Here is a stack. We can use the name of the private type,
S: Int_Stack;
-- Here's an exciting integer.
Exciting: Integer;
begin
-- S.Size := 5; -- This is not allowed since the type is private.
-- Read in some integers, and push 'em
loop
Put("> ");
Get(Exciting);
exit when Exciting = -1;
Push(S, Exciting);
end loop;
-- Pop 'em and print 'em
while not Empty(S) loop
Pop(S, Exciting);
Put(Exciting);
exit when Empty(S);
Put(" ");
end loop;
New_Line;
end Int_Stack_User;