[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: keyword pairs and OPEN
- To: dlw at SCRC-TENEX at MIT-MC
- Subject: Re: keyword pairs and OPEN
- From: HEDRICK at RUTGERS (Mgr DEC-20s/Dir LCSR Comp Facility)
- Date: Sat, 09 Oct 1982 00:42:00 -0000
- Cc: Masinter at PARC-MAXC, common-lisp at SU-AI
- In-reply-to: Your message of 8-Oct-82 1837-EDT
Here is an attempt to flesh out the meanings of the flags you mentioned.
:ACCESS
This flag indicates what kind of I/O you intend to do with the
file. Unless otherwise specified, I/O operations will begin
at the beginning of the file.
input - you are only going to read from it.
output - you want to start with an empty file, and write new
data to it. (Some operating systems allow two modes of
writing to a file, one of which clears the file beforehand
and one of which does not. Typically "output" means that
you want a file which is clear. Indeed the alternative
may be so bizaare that we don't even want to worry about
it.)
write-only - you are only going to write to it, but any existing
data should not be cleared. (This is the one that is so
bizaare you may choose to ignore it. Probably it would be
enough to have update mode.)
append - like write-only, but if the file already exists,
writing will start from the end of the existing data.
(Logically, this is not required, as it is equivalent to
a write-only open followed by random access to the end
of file. However a number of operating systems make
special provisions for append access to files where you
would not normally be able to open for output and then
position to the end of file. Thus it is a useful
distinction.)
update - you are going to do both input and output.
:RECOG
This flag indicates attributes of the file that may help in
finding it.
old - file must exist, the existing version is used
new - file must not exist, it is created
old-version - file need not exist. If it does, the existing
version is used. If it does not, the file is created.
new-version - file need not exist. If it does, a new version
is created. If it does not, the file is created.
Lest you think I have designed this specifically for Tops-20,
which allows multiple versions, these distinctions are also
meaningful on Tops-10, which does not. On Tops-10, if the file
exists, old-version would update the existing file and
new-version would supercede it with a new one.
Defaults are:
input - old
output - new-version
write-only - old-version
append - old-version
update - old-version
Certain combinations are meaningless. Others may not be allowed
by the operating system. Exactly which combinations are allowed
is implementation-dependent. However every implementation is
required to support the following combinations
input, old
output, new-version
and all implementations are strongly urged to implement all 5
default combinations, plus append/old and update/old.
:RANDOM-ACCESS
This flag indicates that the file will be accessed in some
manner other than sequentially. I don't need it for Tops-20, but
I think some operating systems may. In my opinion we should
include it if any system of interest requires it. Does any?
:IMAGE
Most runtime systems end up doing various character processing
such as removing null characters, turning CRLF into LF, removing
the parity bit, turning control characters into representations
with ^, turning two-character CDC "ASCII" into actual ASCII (if
anyone is going to do a CDC implementation). This turns all of
that off and give you characters unchanged. No doubt
implementors will choose their own extensions to control
behavior appropriate for the operating system, but this one
option seems generally useful enough to put in the language.
INPUT, NEW - this is generally meaningless. Some implementations
would probably create a zero-length file and give immediate end of
file. Others might call it an error. (Do we want to try to define
exactly what happens? Does anyone understand I/O well enough to try
to make a model at that level of detail?)
OUTPUT, OLD - this one supercedes an existing file. It guarantees
that the file must exist. It is possible that some implementations
would not allow it, but I would think it would be meaningful for most.
-------