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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1757aa928c05e15f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-15 06:48:54 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: lsiever6619@yahoo.com (L. Siever) Newsgroups: comp.lang.ada Subject: Handling of unfriendly data structures Date: 15 Sep 2002 06:48:54 -0700 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 217.227.77.99 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1032097734 17313 127.0.0.1 (15 Sep 2002 13:48:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 15 Sep 2002 13:48:54 GMT Xref: archiver1.google.com comp.lang.ada:28981 Date: 2002-09-15T13:48:54+00:00 List-Id: Hello, I'm getting a block of binary data from a proprietary communication channel. I've successfully read the data in an array of U8 :) Now I've to interpret the data. The problem is that the block has a rather unfriendly data structure. type U8 is mod 2 ** 8; type U8 is mod 2 ** 14; type part_a is record a_byte : U8; b_byte : U14; ... many more bits of many differnt types ... size : U8; end record; type part_b is record a_byte : U8; b_byte : U8; ... many more bits of many differnt types ... size : U8; end record; ... type part_y is record .. The layout of a block looks like this: part_a text string -- size is stored in part_a part_b text string -- size is stored in part_b .. .. part_y text string -- size is stored in part_y next block: part_a And finaly my question is: What would be the "Ada-way" to implement this, considering that the code should run on little- and big-endian with 32 and 64 bit plattforms. My idea is to copy&convert somehow the data into the records. Since I've alot of differnt records, I wonder if any OO aproaches would be possible and efficient? (I'm new to OOP) Linda