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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38159b1b5557a2e7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-27 00:17:45 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Endian-Independent Rep Clauses Date: 27 Jan 2004 03:10:35 -0500 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1075191049 27554 80.67.180.195 (27 Jan 2004 08:10:49 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 27 Jan 2004 08:10:49 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.3 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:4882 Date: 2004-01-27T03:10:35-05:00 "Robert I. Eachus" writes: > 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. Yes, others have suggested that. I haven't found it to be worth the time, yet. > 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 := ... Hmm. I guess Byte1_First is 8 for little endian, and Byte1_Last is 15? But it depends on the size of the whole record for big endian, so it can't be a constant. That's what LSBit_32 etc is for. I have LSBit_56 because I encountered a 56 bit record once. I guess I could have Byte1_of_4_first, Byte1_of_5_first, etc. > 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.) Could you post an example from real code? Or perhaps for the record I posted? All I get from your message is "it's possible to do better"; if I could figure it out from that, I'd have done it already :). -- -- Stephe