Raymond Toy pushed to branch master at cmucl / cmucl
Commits: 6b9f32f5 by Tarn Burton at 2023-11-29T22:39:39+00:00 Add support for Gray stream implementation of file-length
- - - - - b218d29c by Raymond Toy at 2023-11-29T22:39:54+00:00 Merge branch 'gray-file-length' into 'master'
Add support for Gray stream implementation of file-length
See merge request cmucl/cmucl!179 - - - - -
5 changed files:
- src/code/exports.lisp - src/code/stream.lisp - src/general-info/release-21f.md - src/pcl/gray-compat.lisp - src/pcl/gray-streams.lisp
Changes:
===================================== src/code/exports.lisp ===================================== @@ -1620,6 +1620,7 @@ "STREAM-ADVANCE-TO-COLUMN" "STREAM-CLEAR-INPUT" "STREAM-CLEAR-OUTPUT" "STREAM-FILE-POSITION" + "STREAM-FILE-LENGTH" "STREAM-FINISH-OUTPUT" "STREAM-FORCE-OUTPUT" "STREAM-FRESH-LINE" "STREAM-LINE-COLUMN" "STREAM-LINE-LENGTH" "STREAM-LISTEN" "STREAM-PEEK-CHAR" "STREAM-READ-BYTE"
===================================== src/code/stream.lisp ===================================== @@ -397,7 +397,9 @@ ;; simple-stream (stream::%file-length stream) ;; lisp-stream - (funcall (lisp-stream-misc stream) stream :file-length))) + (funcall (lisp-stream-misc stream) stream :file-length) + ;; fundamental-stream + (stream-file-length stream)))
;;; Input functions:
===================================== src/general-info/release-21f.md ===================================== @@ -20,6 +20,8 @@ public domain. ## New in this release: * Known issues: * Feature enhancements: + * Add support for Gray streams implementation of file-length via + `ext:stream-file-length` generic function. * Changes: * ANSI compliance fixes: * Bug fixes:
===================================== src/pcl/gray-compat.lisp ===================================== @@ -39,6 +39,9 @@ (file-position stream position) (file-position stream)))
+(define-gray-stream-method ext:stream-file-length ((stream simple-stream)) + (file-length stream)) + (define-gray-stream-method ext:stream-clear-output ((stream simple-stream)) (clear-output stream))
===================================== src/pcl/gray-streams.lisp ===================================== @@ -376,6 +376,13 @@ (defmethod (setf stream-file-position) (position (stream character-output-stream)) (file-position (character-output-stream-lisp-stream stream) position))
+(defgeneric stream-file-length (stream) + (:documentation + _N"Implements FILE-LENGTH for the stream.")) + +(defmethod stream-file-length (stream) + (error 'type-error :datum stream :expected-type 'file-stream)) + ;;; Binary streams. ;;;
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/1af08245e0418f61157891b...