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 18:42:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!tdsnet-transit!newspeer.tds.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: AI-248 and counting the elements in an external file Date: 23 May 2003 20:42:29 -0500 Organization: LJK Software Message-ID: References: NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1053740458 11366 192.135.80.34 (24 May 2003 01:40:58 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Sat, 24 May 2003 01:40:58 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:37727 Date: 2003-05-23T20:42:29-05:00 List-Id: In article , Stephen Leake writes: > 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? Yes, that was my problem. >> 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. On VMS that would be true if one writes a fixed-length record file, or a stream-lf, stream-cr or stream-crlf file, but not if one is writing a (VMS default) variable length record file. > >> 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. In DEC Ada83, there is no function to return "bytes in a file", and certainly an Ada program reading a normal VMS file would not know down to the byte level how large a file is if it had been written by a program from another language. File length statistics on VMS are kept in disk blocks, and the number of actual data bytes in standard (variable length record) files will vary according to the number of records, whether they have odd or even lengths, and whether they evenly fill an integral number of blocks. Does anyone reading this use GNAT Ada95 on VMS, and know whether they have dealt with any of this (I thought they had some GNAT-specific directory functions).