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,FREEMAIL_FROM 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-28 14:17:26 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: Brian.Gaffney@myrealbox.com (Brian Gaffney) Newsgroups: comp.lang.ada Subject: Re: AI-248 and counting the elements in an external file Date: 28 May 2003 14:17:25 -0700 Organization: http://groups.google.com/ Message-ID: <5e9b8c34.0305281317.3a6eb6a4@posting.google.com> References: NNTP-Posting-Host: 137.244.215.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1054156646 384 127.0.0.1 (28 May 2003 21:17:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 28 May 2003 21:17:26 GMT Xref: archiver1.google.com comp.lang.ada:37943 Date: 2003-05-28T21:17:26+00:00 List-Id: Kilgallen@SpamCop.net (Larry Kilgallen) wrote in message news:... > 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. > My suggestion for VMS would be for File_Size to represent the size in blocks, since that is what the VMS user would be used to working with. This would imply File_Size would have an implementation-defined unit as well as range. (BTW why is stream elements used as the size definition, shouldn't it be whatever is natural to the implementation/OS enviroment?) (Or should a stream element on VMS be a block?:-) File_Size isn't the only issue VMS would have with this package. What would an implementation do about Logicals in returning a Full_Name? Depending on how the Logical is defined, sometimes they are translated to give the full path, and sometimes they are not (i.e. used like the drive letter in DOS). The user may never see the true "full paths", and the system administrator may have it set up that way intentionally. Also, Set_Directory raises an exception if the target doesn't exist. This is not usual in VMS (from a user's perspective). I can SET DEF to a nonexistant directory, and only get an error if I try to access it. (I have found this to be a feature, since I can still log in if the drive my home directory is on has crashed.) VMS is not the only enviroment where this package, as written, would cause problems. For example, the Discussion for the function Compose states that a null Name is not valid, however a file with no Name and an Extension (as defined in the AI), is allowed in DOS/Windows and is actually a 'feature' in Linux (and Unix?). --Brian