comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Update of SAL
Date: 20 Nov 2001 07:24:47 -0500
Date: 2001-11-20T12:27:17+00:00	[thread overview]
Message-ID: <uherpd3zk.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3bfa43f6@pull.gecm.com

"Martin Dowie" <martin.dowie@nospam.baesystems.com> writes:

> "LeakyStain" <leakstan@erols.com> wrote in message
> news:3BF83DFF.52C85B1D@erols.com...
> > I've posted a new version of SAL to my website:
> >
> > http://users.erols.com/leakstan/Stephe/Ada/sal.html
> >
> > There are a couple new packages, and the sorted tree now supports three
> > options for duplicate keys; error, allow, ignore.
> 
> Got a quick URL to 'Endianness'? I'm sure I could regenerate
> it to get the SAL to compile but if you have a quick link
> that would obviously save some effort.

Hmm. There seems to be a problem with my quality control!

I apparently added sal-gen-word_order_convert without adding a test
for it, so I never actually compiled it, so I didn't notice I left out
Endianness. Sigh.

Below is the version for GNAT on x86; this package is compiler and CPU
specific. Obviously, I should rename it to SAL.Endianness or
something.

Let me know if this doesn't work.

-- 
-- Stephe


--
-- Define constants to reflect hardware bit and word endianness in record
-- representation clauses. Obviously, this file is highly system-dependent.
--
with System;
package Endianness is
   pragma Pure;

   -- this is for gnat on an Intel 386 compatible processor
   System_Name : constant System.Name := System.SYSTEM_NAME_GNAT;

   Endianness_Error : exception;

   Bit_Order      : constant := 1; -- 1 or -1
   High_Bit_First : constant := 0; -- 0 or 1
   Low_Bit_First  : constant := 1; -- opposite of High_Bit_First
   LSBit          : constant := 0; -- 0 or 7 or 15 (for word machines)

   -- typical usage of these constants, to make record spec independent of
   -- bit-endianness:
   --
   --    for Foo_Type use record
   --       User_Ephemeris_Needed       at 0 range LSBit + Bit_Order * 0 .. LSBit + Bit_Order * 0;
   --
   --       Operational_Status          at 0 range
   --          Low_Bit_First  * (LSBit + Bit_Order * 4) + High_Bit_First * (LSBit + Bit_Order * 7) ..
   --          High_Bit_First * (LSBit + Bit_Order * 4) + Low_Bit_First  * (LSBit + Bit_Order * 7);
   --    end record;

   type Byte_Order_Type is (Big_Endian, Little_Endian);
   Byte_Order : constant Byte_Order_Type := Little_Endian;

end Endianness;



  reply	other threads:[~2001-11-20 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-18 23:02 Update of SAL LeakyStain
2001-11-20 12:07 ` Martin Dowie
2001-11-20 12:24   ` Stephen Leake [this message]
2001-11-20 20:24     ` martin.m.dowie
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox