comp.lang.ada
 help / color / mirror / Atom feed
From: Kilgallen@SpamCop.net (Larry Kilgallen)
Subject: Re: AI-248 and counting the elements in an external file
Date: 23 May 2003 20:42:29 -0500
Date: 2003-05-23T20:42:29-05:00	[thread overview]
Message-ID: <X5uMu8X9J4P6@eisner.encompasserve.org> (raw)
In-Reply-To: u4r3l5pvw.fsf@nasa.gov

In article <u4r3l5pvw.fsf@nasa.gov>, Stephen Leake <Stephe.Leake@nasa.gov> 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).



  parent reply	other threads:[~2003-05-24  1:42 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
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 [this message]
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