From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a00ff2b882a06fda,start X-Google-Attributes: gid103376,public From: "Samuel T. Harris" Subject: Re: HELP: renames and enum values Date: 2000/04/07 Message-ID: <38EE2019.4C91075D@Raytheon.com>#1/1 X-Deja-AN: 608077737 Content-Transfer-Encoding: 7bit References: <38ECE0EB.4BD4A53E@mindspring.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Raytheon Aerospace Engineering Services Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-04-07T00:00:00+00:00 List-Id: 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!"