From: dweller@Starbase.NeoSoft.COM (David Weller)
Subject: Re: Generic child units with Gnat
Date: 1995/03/30
Date: 1995-03-30T00:00:00+00:00 [thread overview]
Message-ID: <3le685$l9h@Starbase.NeoSoft.COM> (raw)
In-Reply-To: 3l5q2n$6le@unix.sbu.ac.uk
In article <3l5q2n$6le@unix.sbu.ac.uk>,
Fintan Culwin <fintan@sbu.ac.uk> wrote:
>[supplied source deleted]
>Where is the library level ??
>What have I got wrong ??
>How does one instantiate generic children in gnat??
>help !!
>
>Private e-mail preferred & I will sumarise later ...
>
I'm posting publicly, since I think a lot of folks would like to know
this (and to prevent your mailbox from getting flooded... :-)
There were only two small problems:
1) generic package instantiations go inside that package declaration,
not before
2) Your child instantion syntax was a little off
3) your filenaming convention was slightly off (to my knowledge, GNAT
still requires a specific manner to naming child units)
(*Ahem* I'm sure Norm Cohen will point out that I now qualify as the other
half of those "three types of people" :-)
Instead of going into gory details, I'm posting the corrected source
below. It was pretty easy to fix.
-- File: complexnumbers.ads
generic
type FloatType is digits <>;
package ComplexNumbers is
procedure foo( Dummy : in FloatType);
end ComplexNumbers;
--File: complexnumbers.adb
package body ComplexNumbers is
procedure foo( Dummy : in FloatType) is
begin -- foo
null;
end foo;
end ComplexNumbers;
--File: complexnumbers-polar.ads
generic
package ComplexNumbers.Polar is
procedure bar( Dummy : in FloatType);
end ComplexNumbers.Polar;
--File: complexnumbers-polar.adb
package body ComplexNumbers.Polar is
procedure bar( Dummy : in FloatType) is
begin -- bar
null;
end bar;
end ComplexNumbers.Polar;
--Filename foobar.adb
with ComplexNumbers.Polar; -- auto visibility to parent
procedure FooBar is
package RealComplexNumbers is new ComplexNumbers( Float);
package PolarRealComplexNumbers is new RealComplexNumbers.Polar;
begin -- FooBar
null;
end FooBar;
--
Frustrated with C, C++, Pascal, Fortran? Ada95 _might_ be for you!
For all sorts of interesting Ada95 tidbits, run the command:
"finger dweller@starbase.neosoft.com | more" (or e-mail with "finger" as subj.)
if u cn rd ths, u r gd enuf to chg to Ada :-)
next prev parent reply other threads:[~1995-03-30 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-03-27 7:39 Generic child units with Gnat Fintan Culwin
1995-03-30 0:00 ` David Weller [this message]
1995-03-31 0:00 ` Sean McNeil
1995-04-04 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox