From: Nikodemus Siivola Date: Sun, 28 Mar 2010 10:44:04 +0000 (+0000) Subject: 1.0.37.3: make *STANDARD-INPUT*, *STANDARD-OUTPUT*, and *ERROR-OUTPUT* bivalent X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=b5368af8c66b7bc92af74a884a31eabb2b1e7e16;p=sbcl.git 1.0.37.3: make *STANDARD-INPUT*, *STANDARD-OUTPUT*, and *ERROR-OUTPUT* bivalent * Also allow bivalent output streams to use :LINE buffering: take it to mean :FULL for binary output. --- diff --git a/NEWS b/NEWS index 78c2c54..c59c33b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes relative to sbcl-1.0.36: + * enhancement: *STANDARD-OUTPUT*, *STANDARD-INPUT*, and *ERROR-OUTPUT* are + now bivalent. * bug fix: correct restart text for the continuable error in MAKE-PACKAGE. changes in sbcl-1.0.37 relative to sbcl-1.0.36: diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp index d2acaee..d98bf4a 100644 --- a/src/code/fd-stream.lisp +++ b/src/code/fd-stream.lisp @@ -1792,11 +1792,14 @@ (when (or (not character-stream-p) bivalent-stream-p) (multiple-value-setq (bout-routine bout-type bout-size output-bytes normalized-external-format) - (pick-output-routine (if bivalent-stream-p - '(unsigned-byte 8) - target-type) - (fd-stream-buffering fd-stream) - external-format)) + (let ((buffering (fd-stream-buffering fd-stream))) + (if bivalent-stream-p + (pick-output-routine '(unsigned-byte 8) + (if (eq :line buffering) + :full + buffering) + external-format) + (pick-output-routine target-type buffering external-format)))) (unless bout-routine (error "could not find any output routine for ~S buffered ~S" (fd-stream-buffering fd-stream) @@ -2483,13 +2486,16 @@ (with-output-to-string (*error-output*) (setf *stdin* (make-fd-stream 0 :name "standard input" :input t :buffering :line - :external-format (stdstream-external-format nil))) + :element-type :default + :external-format (stdstream-external-format nil))) (setf *stdout* (make-fd-stream 1 :name "standard output" :output t :buffering :line - :external-format (stdstream-external-format t))) + :element-type :default + :external-format (stdstream-external-format t))) (setf *stderr* (make-fd-stream 2 :name "standard error" :output t :buffering :line - :external-format (stdstream-external-format t))) + :element-type :default + :external-format (stdstream-external-format t))) (let* ((ttyname #.(coerce "/dev/tty" 'simple-base-string)) (tty (sb!unix:unix-open ttyname sb!unix:o_rdwr #o666))) (if tty diff --git a/tests/stream.test.sh b/tests/stream.test.sh new file mode 100644 index 0000000..3c5e38e --- /dev/null +++ b/tests/stream.test.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# This software is part of the SBCL system. See the README file for +# more information. +# +# While most of SBCL is derived from the CMU CL system, the test +# files (like this one) were written from scratch after the fork +# from CMU CL. +# +# This software is in the public domain and is provided with +# absolutely no warranty. See the COPYING and CREDITS files for +# more information. + +. ./subr.sh + +use_test_subdirectory + +tmpfilename="$TEST_FILESTEM.lisp" + +cat > $tmpfilename < $tmpfilename < $tmpfilename.out +check_status_maybe_lose bivalent-standard-output $? +test_output=$(cat $tmpfilename.out) +rm -f $tmpfilename.out +if [ 'Bivalent *STANDARD-OUTPUT*' != "$test_output" ]; then + echo "bad test output: '$test_output'" + exit $EXIT_LOSE +fi + +cat > $tmpfilename < $tmpfilename.out +check_status_maybe_lose bivalent-error-output $? +test_output=$(cat $tmpfilename.out) +rm -f $tmpfilename.out +if [ 'Bivalent *ERROR-OUTPUT*' != "$test_output" ]; then + echo "bad test output: '$test_output'" + exit $EXIT_LOSE +fi + +# success +exit $EXIT_TEST_WIN diff --git a/version.lisp-expr b/version.lisp-expr index ce76924..6424f02 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.37.2" +"1.0.37.3"