From 3eeefd6b217ddf9be108e9a0beafabc02a541d28 Mon Sep 17 00:00:00 2001 From: emarsden <emarsden> Date: Wed, 7 Apr 2004 11:03:38 +0000 Subject: [PATCH] More ANSI-compliance BROADCAST-STREAM fixes: - FILE-LENGTH and FILE-POSITION return the value from the last component stream, or 0 if there are no component streams. Will require a similar change for FILE-STRING-LENGTH (and addition of a :file-string-length misc-op). --- code/stream.lisp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/stream.lisp b/code/stream.lisp index 42effc0e5..a56184607 100644 --- a/code/stream.lisp +++ b/code/stream.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.70 2004/04/06 17:30:12 emarsden Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.71 2004/04/07 11:03:38 emarsden Exp $") ;;; ;;; ********************************************************************** ;;; @@ -970,6 +970,17 @@ streams." (dolist (stream streams min) (let ((res (line-length stream))) (when res (setq min (if min (min res min) res))))))) + ;; CLHS: The functions file-length, file-position, file-string-length, and + ;; stream-external-format return the value from the last component + ;; stream; if there are no component streams, file-length and + ;; file-position return 0, file-string-length returns 1, and + ;; stream-external-format returns :default. + (:file-length + (if (null streams) 0 + (file-length (last streams)))) + (:file-position + (if (null streams) 0 + (file-position (last streams)))) (:element-type #+nil ; old, arguably more logical, version (let (res) -- GitLab