comp.lang.ada
 help / color / mirror / Atom feed
* Decoding an octet stream
@ 1999-11-28  0:00 Florian Weimer
  1999-11-29  0:00 ` David C. Hoos, Sr.
  0 siblings, 1 reply; 39+ messages in thread
From: Florian Weimer @ 1999-11-28  0:00 UTC (permalink / raw)


What is the best way to decode an octet stream (i.e. a sequence of
unsigned eight-bit values) with Ada?  The octet stream consists of
packet markes (single octets), two-octet integers (stored with the
most significant octet first), strings (sequences of octets of a given
length) and so on.  I don't want to use Ada.Sequential_IO, because it
would mean that only one octet can be read at a time, which seems to
be quite inefficient.

Streams seem to be nice, though.  If I specify the necessary
representation clauses, I think I'll only have to write a few 'Read
and 'Write operations, and composed types will be handled correctly
almost automatically.  But is this really portable?  Are there any
targets (except supercomputers, mainframes, and embedded systems)
where Stream_Element'Size isn't equal to 8?

BTW: I'm currently reading the two-octet integers using a construct like
`First_Octet * 2**8 + Second_Octet'.  Is it possible to denote the octet
ordering using a representation clause?  For a target with a matching
octet order, more efficient code could be generated.




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

end of thread, other threads:[~1999-12-08  0:00 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-28  0:00 Decoding an octet stream Florian Weimer
1999-11-29  0:00 ` David C. Hoos, Sr.
1999-11-30  0:00   ` Florian Weimer
1999-12-03  0:00     ` Robert Dewar
1999-12-01  0:00   ` Robert Dewar
1999-12-01  0:00     ` David C. Hoos, Sr.
1999-12-01  0:00       ` swhalen
1999-12-01  0:00         ` Florian Weimer
1999-12-02  0:00           ` Ted Dennison
1999-12-02  0:00             ` tmoran
1999-12-02  0:00           ` Robert Dewar
1999-12-02  0:00           ` Geoff Bull
1999-12-02  0:00             ` Lutz Donnerhacke
1999-12-01  0:00         ` Larry Kilgallen
1999-12-01  0:00           ` Kenneth Almquist
1999-12-02  0:00             ` Geoff Bull
1999-12-02  0:00               ` Stupid patent tricks (was: Decoding an octet stream) Ted Dennison
1999-12-06  0:00               ` Decoding an octet stream Kenneth Almquist
1999-12-02  0:00         ` Geoff Bull
1999-12-02  0:00           ` swhalen
1999-12-02  0:00             ` Larry Kilgallen
1999-12-03  0:00               ` Geoff Bull
1999-12-03  0:00               ` swhalen
1999-12-04  0:00                 ` Robert Dewar
1999-12-04  0:00                 ` Geoff Bull
1999-12-06  0:00                   ` Robert Dewar
1999-12-06  0:00               ` Richard D Riehle
1999-12-06  0:00                 ` Ed Falis
1999-12-07  0:00                   ` Ted Dennison
1999-12-08  0:00                 ` Robert Dewar
1999-12-08  0:00                   ` Brian Rogoff
1999-12-02  0:00           ` Robert Dewar
1999-12-08  0:00         ` Numeric types Mario Amado Alves
1999-12-08  0:00           ` Tucker Taft
1999-12-01  0:00       ` Decoding an octet stream Robert Dewar
1999-12-01  0:00       ` Robert Dewar
1999-12-07  0:00         ` Stefan Skoglund
1999-12-01  0:00     ` Geoff Bull
1999-12-01  0:00       ` Robert Dewar

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