X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-simple-streams%2Fimpl.lisp;h=c37e141ebe207d6b280f76d63ff14ec758fe81c2;hb=eaa8a506790bb6ed627da617247bfd13802eb365;hp=79fe4c47d98e92835c1ccacf090a3d0923db4de6;hpb=988afd9d54ba6c8a915544822658824ab6ae0d6c;p=sbcl.git diff --git a/contrib/sb-simple-streams/impl.lisp b/contrib/sb-simple-streams/impl.lisp index 79fe4c4..c37e141 100644 --- a/contrib/sb-simple-streams/impl.lisp +++ b/contrib/sb-simple-streams/impl.lisp @@ -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)