comp.lang.ada
 help / color / mirror / Atom feed
* Handling of unfriendly data structures
@ 2002-09-15 13:48 L. Siever
  2002-09-15 20:26 ` tmoran
  2002-09-15 21:54 ` Nick Roberts
  0 siblings, 2 replies; 3+ messages in thread
From: L. Siever @ 2002-09-15 13:48 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-15 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-15 13:48 Handling of unfriendly data structures L. Siever
2002-09-15 20:26 ` tmoran
2002-09-15 21:54 ` Nick Roberts

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