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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4c06e1e4fc2bf2d1 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!b38g2000prf.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Controlling endian-ness? Date: Tue, 5 Aug 2008 17:16:25 -0700 (PDT) Organization: http://groups.google.com Message-ID: <66265b13-8e35-4bc7-8e9f-7c4d76adb5b7@b38g2000prf.googlegroups.com> References: <4897b7f5$0$19705$4d3efbfe@news.sover.net> <4898d0ca$0$19680$4d3efbfe@news.sover.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1217981786 14422 127.0.0.1 (6 Aug 2008 00:16:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 6 Aug 2008 00:16:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b38g2000prf.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7183 Date: 2008-08-05T17:16:25-07:00 List-Id: On Aug 5, 3:14 pm, "Peter C. Chapin" wrote: > anon wrote: > > For using Unsigned_32. Why not just override the built-in Write attributes > > routines for Unsigned_32 by re-writing the attributes routines. This may at > > most require a new package with a few extra attributes routines that may > > be needed. Also, this will also allow you to use "Shift_Left/Shift_Right" > > directly with Unsigned_32. > > > So in your program you could use: > > > Data : Unsigned_32 ; > > ... > > Unsigned_32'Write ( Stream_Pointer, Data ) ; > > I actually tried something like this but the compiler told me that I > couldn't redefine attributes for that type (or something like that). I > think the problem is that since the type is defined in another package > it is already frozen or some such. It could also be that I did it wrong. Yes. You can't apply any "for T'attribute use..." clause to something defined in another package. (It sounds to me like this is what you tried... if I guessed wrong, sorry.) You might consider defining your own type (perhaps *derived* from Unsigned_32) and using your new type when declaring a variable or component that needs to be written using a special routine. type My_Unsigned_32 is new Unsigned_32; procedure My_Write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in My_Unsigned_32); for My_Unsigned_32'Write use My_Write; -- Adam -- Adam