X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-simple-streams%2Fimpl.lisp;h=c37e141ebe207d6b280f76d63ff14ec758fe81c2;hb=0fe5525f1f9d9f5eff63e583b5b7b19c0e1cb933;hp=d5b709cb920f6c9a7703ca898f2696594231a07e;hpb=a3da0e22e8cf9b718b486203ce568507228f4d11;p=sbcl.git diff --git a/contrib/sb-simple-streams/impl.lisp b/contrib/sb-simple-streams/impl.lisp index d5b709c..c37e141 100644 --- a/contrib/sb-simple-streams/impl.lisp +++ b/contrib/sb-simple-streams/impl.lisp @@ -173,7 +173,7 @@ (index 0) ; current index in current buffer (total 0)) ; total characters (declare (type simple-stream encap) - (type simple-base-string cbuf) + (type simple-string cbuf) (type cons bufs tail) (type sb-int:index index total)) (loop @@ -200,7 +200,7 @@ (do ((list bufs (cdr list))) ((eq list tail)) (let ((buf (car list))) - (declare (type simple-base-string buf)) + (declare (type simple-string buf)) (replace cbuf buf :start1 idx) (incf idx (length buf))))) (return (values (sb-kernel:shrink-vector cbuf total) @@ -210,7 +210,7 @@ (index 0)) (declare (type sb-int:index index)) (dolist (buf bufs) - (declare (type simple-base-string buf)) + (declare (type simple-string buf)) (replace string buf :start1 index) (incf index (length buf))) (return (values string (eq done :eof))))) @@ -292,14 +292,13 @@ (if (not (or (eql width 1) (null width))) (funcall-stm-handler j-listen (sm melded-stream stream)) (or (< (sm buffpos stream) (sm buffer-ptr stream)) - (when (or (not (any-stream-instance-flags stream :dual :string)) - (>= (sm mode stream) 0)) ;; device-connected @@ single-channel - (let ((lcrs (sm last-char-read-size stream))) - (unwind-protect - (progn - (setf (sm last-char-read-size stream) (1+ lcrs)) - (plusp (refill-buffer stream nil))) - (setf (sm last-char-read-size stream) lcrs)))))))) + ;; Attempt buffer refill + (let ((lcrs (sm last-char-read-size stream))) + (when (and (not (any-stream-instance-flags stream :dual :string)) + (>= (sm mode stream) 0)) + ;; single-channel stream dirty -> write data before reading + (flush-buffer stream nil)) + (>= (refill-buffer stream nil) width)))))) (defun %clear-input (stream buffer-only) (declare (type simple-stream stream)) @@ -687,10 +686,10 @@ :output-handle - a stream or Unix file descriptor to write to" (declare (ignore element-type external-format input-handle output-handle if-exists if-does-not-exist)) - (let ((class (or class 'sb-sys::file-stream)) + (let ((class (or class 'sb-sys:fd-stream)) (options (copy-list options)) (filespec (merge-pathnames filename))) - (cond ((eq class 'sb-sys::file-stream) + (cond ((eq class 'sb-sys:fd-stream) (remf options :class) (remf options :mapped) (remf options :input-handle) @@ -1082,7 +1081,7 @@ is supported only on simple-streams." (synonym-stream (wait-for-input-available (symbol-value (synonym-stream-symbol stream)) timeout)) - (sb-sys::file-stream + (sb-sys:fd-stream (or (< (sb-impl::fd-stream-in-index stream) (length (sb-impl::fd-stream-in-buffer stream))) (wait-for-input-available (sb-sys:fd-stream-fd stream) timeout)))))) @@ -1096,7 +1095,7 @@ is supported only on simple-streams." (%file-rename stream new-name)) (t (%file-name stream))))) - (sb-sys::file-stream + (sb-sys:fd-stream (cond (new-name (setf (sb-impl::fd-stream-pathname stream) new-name) (setf (sb-impl::fd-stream-file stream)