Raymond Toy pushed to branch issue-140-stream-element-type-two-way-stream at cmucl / cmucl
Commits:
-
402c0c01
by Raymond Toy at 2022-11-02T01:00:20+00:00
-
d825aa54
by Raymond Toy at 2022-11-02T01:00:20+00:00
-
23f6f8ef
by Raymond Toy at 2022-11-02T11:52:39-07:00
-
4d69dda7
by Raymond Toy at 2022-11-02T11:57:23-07:00
3 changed files:
Changes:
... | ... | @@ -290,8 +290,7 @@ |
290 | 290 | (stream-dispatch stream
|
291 | 291 | ;; simple-stream
|
292 | 292 | (stream::%stream-external-format stream)
|
293 | - ;; lisp-stream
|
|
294 | - ;; The stream is a file stream; signal an error if it's not.
|
|
293 | + ;; lisp-stream. For unsupported streams, signal a type error.
|
|
295 | 294 | (etypecase stream
|
296 | 295 | #+unicode
|
297 | 296 | (fd-stream (fd-stream-external-format stream))
|
... | ... | @@ -299,18 +298,14 @@ |
299 | 298 | ;; See http://www.lispworks.com/documentation/HyperSpec/Body/t_broadc.htm
|
300 | 299 | :default)
|
301 | 300 | (synonym-stream
|
302 | - ;; What should happen if (synonym-stream-symbol stream) is unbound?
|
|
301 | + ;; Not defined by CLHS. What should happen if
|
|
302 | + ;; (synonym-stream-symbol stream) is unbound?
|
|
303 | 303 | (stream-external-format
|
304 | 304 | (symbol-value (synonym-stream-symbol stream))))
|
305 | 305 | (two-way-stream
|
306 | - ;; Not defined by CLHS, but useful to return the common format
|
|
307 | - ;; of the input and output streams when they're the same;
|
|
308 | - ;; otherwise return :default.
|
|
309 | - (let ((in-format (stream-external-format (two-way-stream-input-stream stream)))
|
|
310 | - (out-format (stream-external-format (two-way-stream-output-stream stream))))
|
|
311 | - (if (eql in-format out-format)
|
|
312 | - in-format
|
|
313 | - :default))))
|
|
306 | + ;; Not defined by CLHS, but use default for backward
|
|
307 | + ;; compatibility.
|
|
308 | + :default))
|
|
314 | 309 | ;; fundamental-stream
|
315 | 310 | :default))
|
316 | 311 |
... | ... | @@ -223,6 +223,8 @@ windows-cp1252 cp1252 |
223 | 223 | windows-latin1 cp1252
|
224 | 224 | ms-ansi cp1252
|
225 | 225 | |
226 | +euckr euc-kr
|
|
227 | +cp949 euc-kr
|
|
226 | 228 | ;; These are not yet implemented
|
227 | 229 | ;;iso-2022-jp iso2022-jp
|
228 | 230 | ;;iso2022jp iso2022-jp
|
... | ... | @@ -749,7 +749,7 @@ |
749 | 749 | |
750 | 750 | ;; Test two-way-stream where both streams have the same external
|
751 | 751 | ;; format.
|
752 | -(define-test issue.140.1
|
|
752 | +(define-test issue.140.two-way-stream-same
|
|
753 | 753 | (:tag :issues)
|
754 | 754 | (with-open-file (in (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
|
755 | 755 | :direction :input
|
... | ... | @@ -759,11 +759,11 @@ |
759 | 759 | :external-format :utf-8
|
760 | 760 | :if-exists :supersede)
|
761 | 761 | (let ((two-way-stream (make-two-way-stream in out)))
|
762 | - (assert-equal :utf-8 (stream-external-format two-way-stream))))))
|
|
762 | + (assert-equal :default (stream-external-format two-way-stream))))))
|
|
763 | 763 | |
764 | 764 | ;; Test two-way-stream where the two streams have the different
|
765 | 765 | ;; external formats.
|
766 | -(define-test issue.140.2
|
|
766 | +(define-test issue.140.two-way-stream-diff
|
|
767 | 767 | (:tag :issues)
|
768 | 768 | (with-open-file (in (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
|
769 | 769 | :direction :input
|
... | ... | @@ -776,7 +776,7 @@ |
776 | 776 | (assert-equal :default (stream-external-format two-way-stream))))))
|
777 | 777 | |
778 | 778 | ;; Test synonym-stream returns the format of the underlying stream.
|
779 | -(define-test issue.140.3
|
|
779 | +(define-test issue.140.synonym-stream
|
|
780 | 780 | (:tag :issues)
|
781 | 781 | (with-open-file (s (merge-pathnames "issues.lisp" cmucl-test-runner::*load-path*)
|
782 | 782 | :direction :input
|
... | ... | @@ -784,3 +784,10 @@ |
784 | 784 | (let ((syn (make-synonym-stream '*syn-stream*)))
|
785 | 785 | (setf syn s)
|
786 | 786 | (assert-equal :iso8859-1 (stream-external-format syn)))))
|
787 | + |
|
788 | +(define-test issue.150
|
|
789 | + (:tag :issues)
|
|
790 | + (let ((ext:*gc-verbose* nil)
|
|
791 | + (*compile-print* nil))
|
|
792 | + (assert-true (stream::find-external-format :euckr))
|
|
793 | + (assert-true (stream::find-external-format :cp949)))) |