comp.lang.ada
 help / color / mirror / Atom feed
* How does the Ada 95 Streams package Index?
@ 1994-12-16  5:54 Timothy Halloran
  1994-12-16 12:58 ` Robert I. Eachus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Timothy Halloran @ 1994-12-16  5:54 UTC (permalink / raw)


From examining the Ada 95 reference manual I get the impression that
a file created with the streams package is able to move to numbered
records in the file (e.g. Read the 5th record).  How is this intended
to be implemented in light of the variable length of the records which
could be in the file?  Are all the records expanded to the largest size
or are divider bytes inserted in the file.

GNAT doesn't have this package yet (but soon will I am told) so I
haven't been able to "test" this package out.  Anyone up on this?

A Humble Ada Programmer,
Tim Halloran




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

* Re: How does the Ada 95 Streams package Index?
  1994-12-16  5:54 How does the Ada 95 Streams package Index? Timothy Halloran
@ 1994-12-16 12:58 ` Robert I. Eachus
  1994-12-16 15:16 ` Robert Dewar
  1994-12-17 14:05 ` Tucker Taft
  2 siblings, 0 replies; 4+ messages in thread
From: Robert I. Eachus @ 1994-12-16 12:58 UTC (permalink / raw)


In article <3cra2n$rio@ixnews1.ix.netcom.com> halloran@ix.netcom.com (Timothy Halloran) writes:

 > From examining the Ada 95 reference manual I get the impression that
 > a file created with the streams package is able to move to numbered
 > records in the file (e.g. Read the 5th record).  How is this intended
 > to be implemented in light of the variable length of the records which
 > could be in the file?  Are all the records expanded to the largest size
 > or are divider bytes inserted in the file.

   I think that you are jumping to conclusions.  The RM refers to
indexes and positions, but explicitly does not say what size the
elements measured are.  However I expect that all implementations will
use bytes as stream elements, with a (very) few machines still using
9-bit instead of 8-bit bytes.  So no, no divider bytes are expected to
be inserted, and each value written is expected to occupy the smallest
possible number of stream elements.  When Gnat supports streams, I'll
probably write an IFF implementation on top of it, which is the
expected proper use.  (IFF files are self-describing heterogenous
files.  Each section of an IFF file starts with a header containing a
32-bit identifier and a length field.)
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



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

* Re: How does the Ada 95 Streams package Index?
  1994-12-16  5:54 How does the Ada 95 Streams package Index? Timothy Halloran
  1994-12-16 12:58 ` Robert I. Eachus
@ 1994-12-16 15:16 ` Robert Dewar
  1994-12-17 14:05 ` Tucker Taft
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1994-12-16 15:16 UTC (permalink / raw)


Tim, your question on stream files is confusing, streams do not have any
concept of records. Indeed that might be considered to be THE
distinguishing characteristic of streams. Certainly there is no filling
out of these (non-existent) records to their maximum size.

The Set_Index function is like lseek in C, although a little more
abstracted. It sets the position to the indicated storage element.
If you are writing "variable length records" to the stream, it is
up to the program to know the proper starting position for a record
that you want to point to (possibly by use of the Index function).

Actually, if you think of record = one storage element, then your
view of things is correct, but then of course there is no issue
of variable length records, or filling out a record to its maximum
size :-)




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

* Re: How does the Ada 95 Streams package Index?
  1994-12-16  5:54 How does the Ada 95 Streams package Index? Timothy Halloran
  1994-12-16 12:58 ` Robert I. Eachus
  1994-12-16 15:16 ` Robert Dewar
@ 1994-12-17 14:05 ` Tucker Taft
  2 siblings, 0 replies; 4+ messages in thread
From: Tucker Taft @ 1994-12-17 14:05 UTC (permalink / raw)


In article <3cra2n$rio@ixnews1.ix.netcom.com>,
Timothy Halloran <halloran@ix.netcom.com> wrote:

>From examining the Ada 95 reference manual I get the impression that
>a file created with the streams package is able to move to numbered
>records in the file (e.g. Read the 5th record).  How is this intended
>to be implemented in light of the variable length of the records which
>could be in the file?  Are all the records expanded to the largest size
>or are divider bytes inserted in the file.

The positioning is by Stream_Element, not by record.   A Stream_Element
is expected to be a byte on most systems, so this is simply lo-tech
seek-to-specified-byte, something that is available on (almost ;-)
every operating system.

>GNAT doesn't have this package yet (but soon will I am told) so I
>haven't been able to "test" this package out.  Anyone up on this?

See above.

>A Humble Ada Programmer,
>Tim Halloran

-Tucker Taft  stt@inmet.com



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

end of thread, other threads:[~1994-12-17 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-16  5:54 How does the Ada 95 Streams package Index? Timothy Halloran
1994-12-16 12:58 ` Robert I. Eachus
1994-12-16 15:16 ` Robert Dewar
1994-12-17 14:05 ` Tucker Taft

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