From b387f6ae447b55e203f47fc40af4a36e756fe345 Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Tue, 8 Apr 2003 23:56:27 +0000 Subject: [PATCH] 0.pre8.49: merged antonio martinez' INTERACTIVE-STREAM-P and *STANDARD-INPUT* patches (sbcl-devel ca. 2003-04-07) --- NEWS | 1 + src/code/fd-stream.lisp | 12 +++--------- src/code/unix.lisp | 5 +++++ src/compiler/generic/primtype.lisp | 6 +++--- tests/stream.pure.lisp | 10 ++++++++++ version.lisp-expr | 2 +- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 75200c1..7f8f0d3 100644 --- a/NEWS +++ b/NEWS @@ -1636,6 +1636,7 @@ changes in sbcl-0.8.0 relative to sbcl-0.7.14 forward-referenced superclasses. (thanks to Gerd Moellmann) * fixed evaluation order in optional entries. (reported by Gilbert Baumann) + * *STANDARD-INPUT* is now * SB-MOP:ENSURE-CLASS-USING-CLASS now takes its arguments in the specified-by-AMOP order of (CLASS NAME &REST ARGS &KEY). * fixed bug 20: DEFMETHOD can define methods using names that are diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp index f19caf8..ae79940 100644 --- a/src/code/fd-stream.lisp +++ b/src/code/fd-stream.lisp @@ -848,7 +848,8 @@ (fd-stream-element-type fd-stream)) (:interactive-p ;; FIXME: sb!unix:unix-isatty is undefined. - (sb!unix:unix-isatty (fd-stream-fd fd-stream))) + (= 1 (the (member 0 1) + (sb!unix:unix-isatty (fd-stream-fd fd-stream))))) (:line-length 80) (:charpos @@ -1234,14 +1235,7 @@ (stream-reinit) (setf *terminal-io* (make-synonym-stream '*tty*)) (setf *standard-output* (make-synonym-stream '*stdout*)) - (setf *standard-input* - (#!-high-security - ;; FIXME: Why is *STANDARD-INPUT* a TWO-WAY-STREAM? ANSI says - ;; it's an input stream. - make-two-way-stream - #!+high-security - %make-two-way-stream (make-synonym-stream '*stdin*) - *standard-output*)) + (setf *standard-input* (make-synonym-stream '*stdin*)) (setf *error-output* (make-synonym-stream '*stderr*)) (setf *query-io* (make-synonym-stream '*terminal-io*)) (setf *debug-io* *query-io*) diff --git a/src/code/unix.lisp b/src/code/unix.lisp index e886257..4dce234 100644 --- a/src/code/unix.lisp +++ b/src/code/unix.lisp @@ -204,6 +204,11 @@ (defconstant l_incr 1) ; to increment the file pointer (defconstant l_xtnd 2) ; to extend the file size +;;; Is a stream interactive? +(defun unix-isatty (fd) + (declare (type unix-fd fd)) + (int-syscall ("isatty" int) fd)) + ;;; Accept a file descriptor and move the file pointer ahead ;;; a certain offset for that file. WHENCE can be any of the following: ;;; L_SET Set the file pointer. diff --git a/src/compiler/generic/primtype.lisp b/src/compiler/generic/primtype.lisp index 50d0a26..6b8a396 100644 --- a/src/compiler/generic/primtype.lisp +++ b/src/compiler/generic/primtype.lisp @@ -139,8 +139,8 @@ (!def-primitive-type simple-array-complex-long-float (descriptor-reg) :type (simple-array (complex long-float) (*))) -;;; Note: The complex array types are not included, 'cause it is pointless to -;;; restrict VOPs to them. +;;; Note: The complex array types are not included, 'cause it is +;;; pointless to restrict VOPs to them. ;;; other primitive other-pointer types (!def-primitive-type system-area-pointer (sap-reg descriptor-reg)) @@ -151,7 +151,7 @@ ;;;; PRIMITIVE-TYPE-OF and friends -;;; Return the most restrictive primitive type that contains Object. +;;; Return the most restrictive primitive type that contains OBJECT. (/show0 "primtype.lisp 147") (!def-vm-support-routine primitive-type-of (object) (let ((type (ctype-of object))) diff --git a/tests/stream.pure.lisp b/tests/stream.pure.lisp index 2593683..70fc40d 100644 --- a/tests/stream.pure.lisp +++ b/tests/stream.pure.lisp @@ -80,3 +80,13 @@ (with-input-from-string (q "foo") (let* ((r (make-concatenated-stream p q))) (peek-char nil r)))) + +;; 0.7.14 and previous SBCLs don't have a working INTERACTIVE-STREAM-P +;; because it called UNIX-ISATTY, which wasn't defined. +(with-input-from-string (s "a non-interactive stream") + (assert (not (interactive-stream-p s)))) +;;; KLUDGE: Unfortunately it's hard to find a reliably interactive +;;; stream to test, since it's reasonable for these tests to be run +;;; from a script, conceivably even as something like a cron job. +;;; Ideas? +#+nil (assert (eq (interactive-stream-p *terminal-io*) t)) diff --git a/version.lisp-expr b/version.lisp-expr index 85c7ed7..9c5e783 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.pre8.48" +"0.pre8.49" -- 1.7.10.4