comp.lang.ada
 help / color / mirror / Atom feed
From: Caffeine Junky <nospam@hotmail.com>
Subject: Re: A little help on Generics.
Date: Mon, 24 Jun 2002 18:50:22 GMT
Date: 2002-06-24T18:50:22+00:00	[thread overview]
Message-ID: <ORJR8.298791$352.29149@sccrnsc02> (raw)
In-Reply-To: DOCR8.55102$EP.5365@sccrnsc03

On Mon, 24 Jun 2002 06:49:07 -0400, Jeffrey 

> Since you did not post the body you may have other problems here but the
> first I see is the
> syntax here.  Try something like
> 
> package Int_Stack is new genstack(Max => 500, Item => Integer);
> 
> 
> Also, try to avoid the 'img attribute even in your test code..It is a
> handy feature
> but is not portable..It is a nice trick to have up your sleeve but it is
> only a few
> more kestrokes to type integer'image(ints(J)).
> 
> I there are a few more problems lurking in that test driver as well but
> I am sure you will find these soon enough.
 
I dont seem to be having any problems with the body of the package, it
was just with the declaration of the package.

The only errors the compiler gave me told me that procedure Push was not
visible, Pop was not visible, etc...

However when running the compiler over just the package, it produces a
nice object file. Which leads me to beleive that my problem is in
calling the package from my test program rather than in the package
itself.

However, just to be sure, here is a copy of the body of the package...

package body genstack is

   procedure Push(X : in Item; S : in out Stack) is

   begin

      S := new Cell'(X, S);

   end Push;

   function Pop(S : in Stack) return Item is

      G : Item;

   begin

      G := S.Value;
      S := S.Next;
      return G;

   end Pop;

   function Is_Empty(S : in Stack) return Boolean is

   begin

      if S.Next = null then
         return True;
      else
         return False;
      end if;

   end Is_Empty;

end genstack;




Any pointers would be appreciated, as usual.


St4pL3



  reply	other threads:[~2002-06-24 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-24  6:15 A little help on Generics Caffeine Junky
2002-06-24  7:34 ` Dale Stanbrough
2002-06-24 10:49 ` Jeffrey Creem
2002-06-24 18:50   ` Caffeine Junky [this message]
2002-06-24 20:21     ` Jeffrey Creem
2002-06-24 22:29       ` Caffeine Junky
2002-06-25  2:52 ` SteveD
2002-06-25  7:25   ` Caffeine Junky
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox