--
-- A simple client of the IntStack package.
--
-- Gnat I/O comes with the Gnat Ada compiler.  It's not part of the Ada 
-- standard, AFAIK.
with Gnat.Io; use Gnat.Io;
with IntStackPkg; use IntStackPkg;
procedure Driver is
   IntIn: Integer;              -- Integer read in.
   Cnt: Integer;                -- Uh...  A counter.
   
   IntOut1, IntOut2: Integer;   -- Integers popped from the stack.
   
   S1, S2: IntStack;            -- Two test stacks.
   begin
      -- Read in integers until -1, and push each on one stack, and each
      -- times the input ordinal on the other.
      Cnt := 1;
      loop
         Put("> ");
         Get(IntIn);
         exit when IntIn = -1;
         Push(S1, IntIn);
         Push(S2, Cnt*IntIn);
         Cnt := Cnt + 1;
      end loop;
      -- Pop 'em and print 'em
      while not IsEmpty(S1) loop
         Pop(S1, IntOut1);
         Pop(S2, IntOut2);
         Put(IntOut1);
         Put(" ");
         Put(IntOut2);
         New_Line;
      end loop;
   end Driver;