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,2203a21a136b39cc X-Google-Attributes: gid103376,public From: okellogg@cube.net (Oliver Kellogg) Subject: Re: Fortran's Equivalence Date: 1997/03/28 Message-ID: <5hhg7q$9ra$1@salyko.cube.net>#1/1 X-Deja-AN: 229101575 References: <333840D1.7B12@cae.ca> <5hbcdn$i1h@top.mitre.org> Organization: CUBENet Munich Newsgroups: comp.lang.ada Date: 1997-03-28T00:00:00+00:00 List-Id: Michael F Brenner (mfb@mbunix.mitre.org) wrote: > [...] The portability problem comes in because > the Ada-95 manual did not standardize a bit numbering in the word, nor > does it standardize a pragma to tell which bit is zero in a portable > manner. Portability is nevertheless not impossible, just more difficult to achieve. For porting code between a host computer and a 1750A target, we wrote following package: -- package Bitranges, 1750A version with System; package Bitranges is -- MIL-STD-1750A version Unit : constant := System.Storage_Unit; subtype Bit_00_00 is Natural range 15..15; subtype Bit_00_01 is Natural range 14..15; subtype Bit_00_02 is Natural range 13..15; subtype Bit_00_03 is Natural range 12..15; subtype Bit_00_04 is Natural range 11..15; subtype Bit_00_05 is Natural range 10..15; subtype Bit_00_06 is Natural range 09..15; subtype Bit_00_07 is Natural range 08..15; subtype Bit_00_08 is Natural range 07..15; subtype Bit_00_09 is Natural range 06..15; subtype Bit_00_10 is Natural range 05..15; subtype Bit_00_11 is Natural range 04..15; subtype Bit_00_12 is Natural range 03..15; subtype Bit_00_13 is Natural range 02..15; subtype Bit_00_14 is Natural range 01..15; subtype Bit_00_15 is Natural range 00..15; subtype Bit_01_01 is Natural range 14..14; subtype Bit_01_02 is Natural range 13..14; subtype Bit_01_03 is Natural range 12..14; subtype Bit_01_04 is Natural range 11..14; [...] subtype Bit_01_14 is Natural range 01..14; subtype Bit_01_15 is Natural range 00..14; subtype Bit_02_02 is Natural range 13..13; subtype Bit_02_03 is Natural range 12..13; [...] subtype Bit_02_15 is Natural range 00..13; [...] subtype Bit_14_14 is Natural range 01..01; subtype Bit_14_15 is Natural range 00..01; subtype Bit_15_15 is Natural range 00..00; end Bitranges; -- Package bitranges spec, host computer version with System; package Bitranges is -- host computer native version Unit : constant := System.Storage_Unit; subtype Bit_00_00 is Natural range 00..00; subtype Bit_00_01 is Natural range 00..01; subtype Bit_00_02 is Natural range 00..02; [...] subtype Bit_15_15 is Natural range 15..15; end Bitranges; -- Representation clauses must then be written e.g. as follows: with Bitranges; use Bitranges; package Example is type My_Rec is record A : Short_Integer; B : Short_Integer; end My_Rec; for My_Rec use record A at 0*Unit range Bit_00_01'first..Bit_00_01'last; B at 0*Unit range Bit_02_15'first..Bit_02_15'last; end record; end Example;