comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Endian-Independent Rep Clauses
Date: Mon, 26 Jan 2004 22:16:39 -0500
Date: 2004-01-26T22:16:39-05:00	[thread overview]
Message-ID: <b4ednUnOXeuHRYjdRVn-tw@comcast.com> (raw)
In-Reply-To: <mailman.29.1075168937.2270.comp.lang.ada@ada-france.org>

Stephen Leake wrote:
...
> There is probably a way to improve the SAL.Endianness package, so I
> don't need more than one. I was unable to find a smaller expression
> for the rep clauses.

You can use the method I recommended for defining the contents of 
SAL.Endianness in a manner that derives it all from 
System.Default_Bit_Order.  Then it is really worth defining some 
additional constants there that make it easier to define some common 
fields.  i.e.

Byte1_First: constant := ....
Byte1_Last constant := ...

Then you can layout things using those constants.  The way I do it is to 
put all the cruft into one package spec, then when I need a bit position 
defined that isn't in there, I add it.  It could grow like Topsy, but I 
found that mostly I needed about a dozen values.  (But it is worth 
noting that I had two sets, one set that was right for String layouts 
and another for numbers.)

-- 
                                           Robert I. Eachus

"The war on terror is a different kind of war, waged capture by capture, 
cell by cell, and victory by victory. Our security is assured by our 
perseverance and by our sure belief in the success of liberty." -- 
George W. Bush




  reply	other threads:[~2004-01-27  3:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26 13:30 Standard Ada Preprocessor Lionel.DRAGHI
2004-01-26 16:10 ` Robert I. Eachus
2004-01-26 19:20   ` Endian-Independent Rep Clauses (was: Standard Ada Preprocessor) Jeffrey Carter
2004-01-27  1:03     ` Endian-Independent Rep Clauses Robert I. Eachus
2004-01-27  2:01       ` Stephen Leake
2004-01-27  3:16         ` Robert I. Eachus [this message]
2004-01-27  8:10           ` Stephen Leake
2004-01-27  3:34         ` Jeffrey Carter
2004-01-27  8:14           ` Stephen Leake
replies disabled

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