From: Stephen Leake <Stephe.Leake@nasa.gov>
Subject: Re: AI-248 and counting the elements in an external file
Date: 23 May 2003 17:12:19 -0400
Date: 2003-05-23T21:28:07+00:00 [thread overview]
Message-ID: <u4r3l5pvw.fsf@nasa.gov> (raw)
In-Reply-To: qN$+hNiTRFwu@eisner.encompasserve.org
Kilgallen@SpamCop.net (Larry Kilgallen) writes:
> I suppose my lack of experience with Ada95 streams ('read, etc.)
> may be the reason for my confusion, but in reading
>
> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00248.TXT?rev=1.16
>
> I see in several places the text:
>
> The size of an external file is the number of
> stream elements contained in the file.
a "stream element" is just a "byte"; it's Ada-ese for "smallest
writeable chunk". On all "normal" OS's, it's 8 bits.
I think perhaps you are thinking of "stream element" as some
higher-level object?
> That is straightforward for a file of some record type, or a file of
> integers, but what if the file is one created with Ada95 stream
> semantics ?
It makes no difference. All of these types must be converted to raw
stream elements (bytes) before they can be written to the file. That's
the nature of files!
> I thought that 'write and write() relied upon the reading program to
> know "how" to read the file, and that implementations would not have
> kept a tally of how many elements were in the file.
The OS certainly has to know how big the file is; that's all that
matters here.
> I don't know enough about this to know if it is possible to do a
> linear search of a file to count the elements, but even if it were,
> that would be a very slow operation.
Yes, but the OS keeps track.
> Is it envisioned by the authors of AI-248 that implementations would
> preserve metadata containing the element count ?
Only if the underlying OS doesn't; in which case this whole package
makes no sense anyway.
> If so, what about stream files that were written under Ada95 ?
I don't see why you think stream files are different from other files,
as far as this package is concerned.
> Or can someone suggest what it is that I don't understand about Ada
> streams ?
--
-- Stephe
next prev parent reply other threads:[~2003-05-23 21:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-21 0:07 'Write attribute vs Write procedure Jano
2003-05-21 0:42 ` tmoran
2003-05-21 7:48 ` Ole-Hjalmar Kristensen
2003-05-21 9:23 ` Ole-Hjalmar Kristensen
2003-05-21 16:22 ` tmoran
2003-05-22 7:51 ` Ole-Hjalmar Kristensen
2003-05-21 16:24 ` tmoran
2003-05-21 21:17 ` Simon Wright
2003-05-22 8:02 ` Ole-Hjalmar Kristensen
2003-05-22 13:49 ` Marc A. Criley
2003-05-22 20:07 ` Simon Wright
2003-05-23 6:09 ` Craig Carey
2003-05-23 19:55 ` Simon Wright
2003-05-23 20:48 ` AI-248 and counting the elements in an external file Larry Kilgallen
2003-05-23 21:12 ` Stephen Leake [this message]
2003-05-23 21:45 ` Randy Brukardt
2003-05-24 1:45 ` Larry Kilgallen
2003-05-24 22:00 ` Robert I. Eachus
2003-05-25 3:54 ` Larry Kilgallen
2003-05-27 20:19 ` Randy Brukardt
2003-05-27 20:57 ` Larry Kilgallen
2003-05-28 18:26 ` Randy Brukardt
2003-05-24 1:42 ` Larry Kilgallen
2003-05-28 21:17 ` Brian Gaffney
2003-05-28 22:06 ` Larry Kilgallen
2003-05-24 14:11 ` 'Write attribute vs Write procedure Craig Carey
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox