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-Thread: a07f3367d7,6353697ffeb79d16 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!q36g2000vbi.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Encapsulating Ada.Direct_IO Date: Thu, 18 Nov 2010 08:31:20 -0800 (PST) Organization: http://groups.google.com Message-ID: <8bb3a7c0-c473-4c35-bc6e-3920ce80e6a8@q36g2000vbi.googlegroups.com> References: <5ba4147a-6099-4a05-b548-09544f58247a@j18g2000yqd.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1290097881 16237 127.0.0.1 (18 Nov 2010 16:31:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 18 Nov 2010 16:31:21 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q36g2000vbi.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16558 Date: 2010-11-18T08:31:20-08:00 List-Id: On Nov 17, 5:16=A0pm, "Randy Brukardt" wrote: > "Peter C. Chapin" wrote in messagenews:tM6dnaTzn6sh= VH7RRVn_vwA@giganews.com... > ... > > > Something I wonder about (I don't have the answer) is if it necessary t= o > > use a representation clause to force the size of the objects being read > > to be 8 bits. I'm a little unclear if the standard requires Character t= o > > be stored in a file in 8 bit units. That is, the language might treat > > the type Character rather more abstractly than you want. Again I'm not > > sure of this and I'd love to get some insights from others myself. > > Surely not. Not all machines have 8-bits as any sort of native type. For > instance, the Unisys U2200 (a 36-bit machine, with 9-bit bytes) used > Character'Size =3D 9. (It was great fun for the cross-compiler.) Yeah, I was going to say something about Honeywell 600 series, which was also a 36-bit machine and used 9-bit bytes. My dad worked for Honeywell so I have some more useless knowledge about some of their machine than others would. Unlike the Unisys U2200, all the Honeywell machines were dead by the time Ada was developed, so I don't think anyone ever tried to write an Ada compiler for it. Then there was a DEC machine that used 36-bit words and represented strings by sticking five 7-bit ASCII characters in each word, but I don't remember much else. But now I'm drifting... I did notice, though, that Peter was talking about how data was stored in a *file*. In the Unisys U2200 system, how were files kept, conceptually? Were they streams of 8-bit bytes, or were they stored as 36-bit words or 9-bit bytes or what? I'd assume that for a text file, when you read it in, four bytes would be stored in each word and the high bit of each 9-bit byte would be zeroed---whether that zero bit was actually stored on disk or not should be the OS's concern, not the program's, and I'd presume that the OS would also have to handle things correctly when text files are transferred from a different machine. What I'm leading up to, though, is that I think Peter's question is too simple. We're all spoiled in having to deal exclusively, or almost exclusively, with machines with 8-bit byte addressability and files that are unstructured sequences of 8-bit bytes. But there are other systems out there. There are machines in use that are not byte- addressable---Analog Devices 21060 series comes to mind, which uses 32- bit words whose bytes are not individually addressable. When reading from a file on that system, do you want each word to hold one byte, or four? Even in VAX/VMS, which does run on a machine with 8-bit byte addressibility, the OS is able to create files that have more structure than just being sequences of bytes. What would it mean to instantiate Direct_IO(Character) on a file like that? I don't think the answer is trivial. How did the Pick operating system treat files conceptually? How would Direct_IO work on one of that system's files? Ada's designers have tried to design a language that could work on any of those systems, and therefore I think the standard does not and cannot answer Peter's question. In fact, I'm not entirely sure that his question is meaningful on platforms that don't use 8-bit bytes and/ or use files with some structure. (It might have to be rephrased.) In any event, I think that details like this are left up to the implementation. And if you were trying to do something like this on a U2200, there is no Ada answer to the question, because you would have to know more about the particular OS's file system and how the Ada implementation interacts with it. -- Adam