0.pre8.49:
authorWilliam Harold Newman <william.newman@airmail.net>
Tue, 8 Apr 2003 23:56:27 +0000 (23:56 +0000)
committerWilliam Harold Newman <william.newman@airmail.net>
Tue, 8 Apr 2003 23:56:27 +0000 (23:56 +0000)
merged antonio martinez' INTERACTIVE-STREAM-P and
*STANDARD-INPUT* patches (sbcl-devel ca. 2003-04-07)

NEWS
src/code/fd-stream.lisp
src/code/unix.lisp
src/compiler/generic/primtype.lisp
tests/stream.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 75200c1..7f8f0d3 100644 (file)
--- 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
index f19caf8..ae79940 100644 (file)
      (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
   (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*)
index e886257..4dce234 100644 (file)
 (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.
index 50d0a26..6b8a396 100644 (file)
 (!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))
 \f
 ;;;; 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)))
index 2593683..70fc40d 100644 (file)
   (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))
index 85c7ed7..9c5e783 100644 (file)
@@ -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"