comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Encapsulating Ada.Direct_IO
Date: Thu, 18 Nov 2010 08:31:20 -0800 (PST)
Date: 2010-11-18T08:31:20-08:00	[thread overview]
Message-ID: <8bb3a7c0-c473-4c35-bc6e-3920ce80e6a8@q36g2000vbi.googlegroups.com> (raw)
In-Reply-To: ic1uop$nhs$1@munin.nbi.dk

On Nov 17, 5:16 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> "Peter C. Chapin" <pcc482...@gmail.com> wrote in messagenews:tM6dnaTzn6shVH7RRVn_vwA@giganews.com...
> ...
>
> > Something I wonder about (I don't have the answer) is if it necessary to
> > 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 to
> > 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 = 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



  parent reply	other threads:[~2010-11-18 16:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17  4:44 Encapsulating Ada.Direct_IO Bryan
2010-11-17  5:20 ` Adam Beneschan
2010-11-26 15:31   ` Bryan
2010-11-17 12:25 ` Peter C. Chapin
2010-11-18  1:16   ` Randy Brukardt
2010-11-18  2:21     ` Peter C. Chapin
2010-11-18 16:36       ` Adam Beneschan
2010-11-18 18:21         ` Peter C. Chapin
2010-11-18 18:36           ` Randy Brukardt
2010-11-18 19:48           ` Adam Beneschan
2010-11-18 20:15             ` Dmitry A. Kazakov
2010-11-18  7:39     ` AdaMagica
2010-11-18 18:38       ` Randy Brukardt
2010-11-18  9:46     ` Maciej Sobczak
2010-11-18 16:31     ` Adam Beneschan [this message]
2010-11-18 17:05       ` Dmitry A. Kazakov
     [not found]         ` <ENidndoH8qoqjHvRnZ2dnUVZ_j-dnZ2d@earthlink.com>
2010-11-19  8:24           ` Dmitry A. Kazakov
2010-11-19 16:19             ` Adam Beneschan
2010-11-18 18:45       ` Randy Brukardt
2010-11-24 21:31     ` Warren
2010-11-17 22:32 ` Yannick Duchêne (Hibou57)
2010-11-17 23:03   ` Adam Beneschan
2010-11-17 23:11     ` Yannick Duchêne (Hibou57)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox