Skip to content
Snippets Groups Projects
Forked from cmucl / cmucl
Source project has a limited visibility.
user avatar
gerd authored
	(require :gray-streams)

	(defclass my-in-stream (ext:fundamental-character-input-stream)
	  ((last-char :initarg :last-char)))

	(let ((string " a ")
	      (i 0))
	  (defmethod ext:stream-read-char ((s my-in-stream))
	    (with-input-from-string (s "b") (read s))
	    (with-slots (last-char) s
	      (cond (last-char (prog1 last-char (setf last-char nil)))
		     (t (prog1 (aref string i)
			  (setq i (mod (1+ i) (length string)))))))))

	(defmethod ext:stream-unread-char ((s my-in-stream) char)
	  (setf (slot-value s 'last-char) char)
	  nil)

	(setq x (make-instance 'my-in-stream :last-char nil))
	(read x)
	 => b, instead of a

	* src/code/reader.lisp: Use a new read buffer for each call to
	read or read-preserving-whitespace, instead of using one global
	buffer.  From Helmut Eller.
097ec481
History
Name Last commit Last update
..