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=0.2 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, LOTS_OF_MONEY,XPRIO_SHORT_SUBJ autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,78b2880bc7e78e39 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-22 13:12:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: RISC Date: Thu, 22 Mar 2001 15:51:09 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <99dokc$m9f$1@nh.pace.co.uk> References: NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 985294284 22831 136.170.200.133 (22 Mar 2001 20:51:24 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 22 Mar 2001 20:51:24 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:6009 Date: 2001-03-22T20:51:24+00:00 List-Id: A "rep clause" is more properly a "representation clause" (Take time to look over Chapter 13 of the ARM - lots of really interesting stuff there!) Representation clauses take a number of forms - for example to control the size of an Integer type or the underlying numeric values for an Enumeration type. Probably the most commonly used representation clause (and the one that is mostly the target of this sub-thread) is the record representation clause. Employing a little "documentation reuse" I've lifted this example from the ARM: type Program_Status_Word is record System_Mask : Byte_Mask; Protection_Key : Integer range 0 .. 3; Machine_State : State_Mask; Interrupt_Cause : Interruption_Code; Ilc : Integer range 0 .. 3; Cc : Integer range 0 .. 3; Program_Mask : Mode_Mask; Inst_Address : Address; end record; for Program_Status_Word use record System_Mask at 0*Word range 0 .. 7; Protection_Key at 0*Word range 10 .. 11; -- bits 8,9 unused Machine_State at 0*Word range 12 .. 15; Interrupt_Cause at 0*Word range 16 .. 31; Ilc at 1*Word range 0 .. 1; -- second word Cc at 1*Word range 2 .. 3; Program_Mask at 1*Word range 4 .. 7; Inst_Address at 1*Word range 8 .. 31; end record; for Program_Status_Word'Size use 8*System.Storage_Unit; for Program_Status_Word'Alignment use 8; All this good stuff (and more) *IN THEORY* will allow you to control how your data is represented in memory. This is important when you are using structured data to either directly access hardware or are sending/receiving the data to/from an external source. The problem, as many of us observe, is that there is sometimes a lack of compiler support for all representation clauses. In many of the simple cases you get what you ask for. In more complex cases, you sometimes have the compiler refuse to do what you asked - which is legal, if not helpful. As for books on Ada? My favorite is "Programming in Ada 95" by John Barnes, but that is mostly because his earlier book was the source from which I originally learned Ada83 in depth. (That, and reading the Ada83 LRM). However, there are a lot of good books on the subject. You should try: http://www.adapower.org/ and look under "Books" for several good titles & descriptions. See also: http://www.science-books.net/ada.htm I hope you find this helpful... MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "chris.danx" wrote in message news:P%su6.28479$bL.2621853@news6-win.server.ntlworld.com... > I've been following the rep clause debate in this thread for sometime. All > of a sudden i had the realisation that i didn't have a clue as to what they > are. So what are rep clauses? > > Are there any good books on Ada that cover stuff like direct_io, rep clauses > and low level stuff. Most of the books i've got cover ADT/OOP programming > and are meant as an introduction to Ada. I'm skint now but the books don't > need to be cheap -- but i'd prefer it if they were. > > > Chris Campbell > >