From: "Samuel T. Harris" <samuel_t_harris@Raytheon.com>
Subject: Re: HELP: renames and enum values
Date: 2000/04/07
Date: 2000-04-07T00:00:00+00:00 [thread overview]
Message-ID: <38EE2019.4C91075D@Raytheon.com> (raw)
In-Reply-To: 38ECE0EB.4BD4A53E@mindspring.com
Al Johnston wrote:
>
> I am having a little trouble with the following:
>
> package EU_AG.ET.Dsc is
>
> type OvrRd0State_Typ is (OVERRIDE_OFF,OVERRIDE_ON);
> for OvrRd0State_Typ'size use integer'size;
> for OvrRd0State_Typ use (OVERRIDE_OFF => 0,OVERRIDE_ON => 1);
> end EU_AG.ET.Dsc;
>
> with EU_AG.ET.Dsc;
> package SK_Types.Dsc is
> package EU_AGETDsc renames EU_AG.ET.Dsc;
> subtype OvrRd0State_Typ is EU_AGETDsc.OvrRd0State_Typ;
> end SK_Types.Dsc;
>
> with SK_Types.Dsc;
> package THREE is
> foo : SK_Types.Dsc.OvrRd0State_Typ := SK_Types.Dsc.OVERRIDE_OFF;
> end THREE;
>
> When I compile "THREE" the compiler complains that "OVERRIDE_OFF" is not
>
> declared in "Dsc". I could get around this by renaming each of the enum
> values
> (that is adding OVERRIDE _OFF renames EU_AG.ET.Dsc.OVERRIDE_OFF;
> to the sk_types.dsc package spec,) but that would be pretty nasty for a
> large
> enum type... plus the fact that it totally defeats the point of package
> in the first place.
>
> Any one know of a better way of doing the reference to OVERRIDE_OFF in
> the package THREE?
>
> thanks,
>
> -al
Type OvrRd0State_Typ is a subtype. Subtypes do not propogate new
definitions for the enumeration literals. The literals remain
defined within package EU_AG.ET.Dsc. A derived type would create
new and visible enumeration literals but I assume you don't
want a derived type here.
Since package SK_Types.Dsc renames package EU_AG.ET.Dsc as
package EU_AGETDsc and package three only withs SK_Types.Dsc
and does not with EU_AG.ET.Dsc I assume you want a solution
which does not introduce a new with clause.
Within package three, you can add 'use EU_AGETDsc;' which will
makes the enumeration literals visible. So you would have ...
with SK_Types.Dsc;
package THREE is
use SK_Types.Dsc.EU_AGETDsc;
foo : SK_Types.Dsc.OvrRd0State_Typ := SK_Types.Dsc.OVERRIDE_OFF;
end THREE;
So you actually were very nearly there :)
--
Samuel T. Harris, Principal Engineer
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"
next parent reply other threads:[~2000-04-07 0:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <38ECE0EB.4BD4A53E@mindspring.com>
2000-04-07 0:00 ` Samuel T. Harris [this message]
2000-04-07 0:00 ` HELP: renames and enum values Al Johnston
2000-04-09 0:00 ` Robert Dewar
2000-04-09 0:00 ` dale
2000-04-09 0:00 ` Robert Dewar
2000-04-10 0:00 ` Dale Stanbrough
2000-04-13 0:00 ` John English
2000-04-13 0:00 ` Samuel T. Harris
2000-04-13 0:00 ` Ted Dennison
2000-04-13 0:00 ` Samuel T. Harris
2000-04-13 0:00 ` Robert A Duff
2000-04-13 0:00 ` Robert Dewar
2000-04-14 0:00 ` John English
2000-04-14 0:00 ` Tucker Taft
2000-04-10 0:00 ` Samuel T. Harris
2000-04-11 0:00 ` Al Johnston
2000-04-10 0:00 ` Samuel T. Harris
2000-04-11 0:00 ` Al Johnston
2000-04-11 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox