From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f6f130eea077b8f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-23 14:25:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: AI-248 and counting the elements in an external file Date: 23 May 2003 17:12:19 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1053725287 22722 128.183.235.92 (23 May 2003 21:28:07 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 23 May 2003 21:28:07 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:37719 Date: 2003-05-23T21:28:07+00:00 List-Id: 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