From: Raymond T. <to...@rt...> - 2002-11-18 13:48:34
|
>>>>> "Matthew" == Matthew Danish <md...@an...> writes: Matthew> + Matthew> (defun echo-misc (stream operation &optional arg1 arg2) Matthew> (let* ((in (two-way-stream-input-stream stream)) Matthew> (out (two-way-stream-output-stream stream))) Matthew> @@ -990,6 +1016,20 @@ Matthew> in-type `(and ,in-type ,out-type)))) Matthew> (:close Matthew> (set-closed-flame stream)) Matthew> + (:peek-char Matthew> + ;; For the special case of peeking into an echo-stream Matthew> + ;; arg1 is peek-type, arg2 is (eof-error-p eof-value) Matthew> + ;; returns peeked-char, eof-value, or errors end-of-file Matthew> + (flet ((outfn (c) Matthew> + (if (ansi-stream-p out) Matthew> + (funcall (ansi-stream-out out) out c) Matthew> + ;; gray-stream Matthew> + (stream-write-char out c)))) Matthew> + (generalized-peeking-mechanism Matthew> + arg1 (second arg2) char Matthew> + (read-char in (first arg2) (second arg2)) Matthew> + (unread-char char in) Matthew> + (outfn char)))) While trying to port this patch to CMUCL, I got confused by this part. It seems we are still sending output characters to the out-stream of an echo-stream because generalized-peeking-mechanism calls (outfn char). If we're not supposed to send output to echo-stream, why do we call (outfn char)? I must be missing something! Ray |