Skip to content
Snippets Groups Projects
Commit 35aebeba authored by rtoy's avatar rtoy
Browse files

Make read-char and read-byte signal errors when given the wrong kind

of streams.  This is a change from current 20a and 20b behavior which
didn't signal errors, but matches the behavior for releases 19f and
earlier.

But allow them to work on binary-text-streams.  This is the same
behavior as before for binary-text-stream streams.

However, read-sequence no longer allows reading from streams into
arbitrary objects, unless the stream is a binary-text-stream stream.

code/fd-stream-extfmt.lisp:
o In %SET-FD-STREAM-EXTERNAL-FORMAT, only update
  fd-stream-in/fd-stream-out if we have a character or
  binary-text-stream stream.
o Don't update the fd-stream-string-buffer or lisp-stream-in-buffer if
  we have a binary-text-stream because that will mess up how
  fast-read-char and fast-read-byte dispatch to do the right thing for
  binary-text-stream streams.

code/fd-stream.lisp:
o Set the fd-stream-in and fd-stream-bin slots appropriately depending
  on whether we have a character, binary, or binary-text-stream
  stream.
o Only create the lisp-stream-in-buffer if we do NOT have a
  binary-text-stream.  (Binary streams didn't use the
  lisp-stream-buffer previously, so no change there.  Character
  streams use the lisp-stream-buffer and/or lisp-string-buffer.)
o Set the fd-stream-flags appropriately for the kind of stream this
  is.  Checking a fixnum is faster than checking the type of a stream.

code/struct.lisp:
o Add FLAGS slot to LISP-STREAM so we can tell what kind of stream
  (character, binary, binary-text-stream) we have.

code/sysmacs.lisp:
o Change FAST-READ-CHAR so that if we have a have a binary or
  binary-text-stream stream, we dispatch to the fast-read-char methods
  to do the right thing, including signaling an error for the wrong
  kind of stream.
o Change FAST-READ-BYTE so that if we do not have a binary stream, we
  dispatch to the fast-read-char method to do the right thing.

compiler/dump.lisp:
o With the above changes, we can no longer write characters to a
  binary stream, like a FASL file.  Make the fasl file a
  binary-text-stream so that we can.  (Alternatively, we could create
  the FASL header as a string, convert to octets and dump the octest
  to the file.  This is easier, and should still be fast for writing
  fasls.)
parent a2efb646
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment