From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 17 Dec 92 14:29:35 GMT From: aio!dnsurber@eos.arc.nasa.gov (Douglas N. Surber) Subject: Re: Novice Question on Record Representation Message-ID: List-Id: In <1992Dec16.225712.23791@saifr00.cfsat.honeywell.com> lam@saifr00.cfsat.honey well.com (Josh Lam) writes: >There is a type in another package I need to use in a record in my package. >Unfortunately, that type is private and I need to use record representation >for my record. > for My_Rec use record > A at 0 range 0..15; > B at 0 range 16..31; > C at 1 range 0..31; -- of course there is an error here! > Choice at 2 range 0..31; > D at 0 range 0..15; > end record; Try the following small kludge: package P1 is type T is private; T_Size : constant := 32; private type T is new Integer; subtype Assertion is boolean range true .. true; a1 : constant Assertion := T_Size = T'Size; end P1; with P1; package P2 is type T is record F : P1.T; end record; for T use record F at 0 range 0 .. P1.T_Size - 1; end record; end P2; You can't use P1.T'Size directly since it isn't static outside of the private part (at least according to the Alsys compiler). By using the Assertion, you assure that T_Size has the right value. Yes, you may have to tweak its value when you port, but you can't get a clean compile with the wrong value so it is safe. -- Douglas Surber "Would you rather debug at Lockheed compile time or run time?" Houston, TX --Michael B. Feldman