comp.lang.ada
 help / color / mirror / Atom feed
From: lsiever6619@yahoo.com (L. Siever)
Subject: Handling of unfriendly data structures
Date: 15 Sep 2002 06:48:54 -0700
Date: 2002-09-15T13:48:54+00:00	[thread overview]
Message-ID: <cfbd115b.0209150548.75f52e4a@posting.google.com> (raw)

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



             reply	other threads:[~2002-09-15 13:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-15 13:48 L. Siever [this message]
2002-09-15 20:26 ` Handling of unfriendly data structures tmoran
2002-09-15 21:54 ` Nick Roberts
replies disabled

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