Skip to content
Snippets Groups Projects
Commit 2ea523e6 authored by rtoy's avatar rtoy
Browse files

Oops. Last change to fd-stream doesn't actually compile because no

everything is defined yet.  Hence, add dummy
%SET-FD-STREAM-EXTERNAL-FORMAT and move the real one to
fd-stream-extfmt.lisp.  This builds.

code/fd-stream.lisp:
o Always call %SET-FD-STREAM-EXTERNAL-FORMAT, even if
  LISP::*ENABLE-STREAM-BUFFER-P* is NIL.

code/stream.lisp:
o Move %SET-FD-STREAM-EXTERNAL-FORMAT to fd-stream-extfmt.lisp.
o Add dummy implementation of %SET-FD-STREAM-EXTERNAL-FORMAT.

code/fd-stream-extfmt.lisp:
o %SET-FD-STREAM-EXTERNAL-FORMAT moved here.
parent c0810abb
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; domain. ;;; domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream-extfmt.lisp,v 1.5 2009/12/15 17:22:41 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream-extfmt.lisp,v 1.6 2010/01/23 18:02:04 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -61,6 +61,58 @@ ...@@ -61,6 +61,58 @@
(error "Setting external-format on Gray streams not supported.")) (error "Setting external-format on Gray streams not supported."))
extfmt) extfmt)
(defun %set-fd-stream-external-format (stream extfmt &optional (updatep t))
(declare (type fd-stream stream))
(let ((old-format (fd-stream-external-format stream)))
(setf (fd-stream-external-format stream)
(stream::ef-name (stream::find-external-format extfmt))
(fd-stream-oc-state stream) nil
(fd-stream-co-state stream) nil)
(when (fd-stream-ibuf-sap stream) ; input stream
(setf (fd-stream-in stream) (ef-cin extfmt)))
(when (fd-stream-obuf-sap stream) ; output stream
(setf (fd-stream-out stream) (ef-cout extfmt)
;;@@ (fd-stream-sout stream) (ef-sout extfmt)
))
(when (and lisp::*enable-stream-buffer-p* updatep
(lisp-stream-string-buffer stream))
;; We want to reconvert any octets that haven't been converted
;; yet. So, we need to figure out which octet to start with.
;; This is done by converting (the previously converted) octets
;; until we've converted the right number of characters.
(let ((ibuf (lisp-stream-in-buffer stream))
(sindex (1- (lisp-stream-string-index stream)))
(index 0)
(state (fd-stream-saved-oc-state stream)))
;; Reconvert all the octets we've already converted and read.
;; We don't know how many octets that is, but do know how many
;; characters there are.
(multiple-value-bind (s pos count new-state)
(octets-to-string ibuf
:start 0
:external-format old-format
:string (make-string sindex)
:state state)
(declare (ignore s pos))
(setf state new-state)
(setf index count))
;; We now know the last octet that was used. Now convert the
;; rest of the octets using the new format.
(multiple-value-bind (s pos count new-state)
(octets-to-string ibuf
:start index
:end (fd-stream-in-length stream)
:external-format (fd-stream-external-format stream)
:string (lisp-stream-string-buffer stream)
:s-start 1
:state state)
(declare (ignore s))
(setf (lisp-stream-string-index stream) 1)
(setf (lisp-stream-string-buffer-len stream) pos)
(setf (lisp-stream-in-index stream) (+ index count))
(setf (fd-stream-oc-state stream) new-state))))
extfmt))
(stream::precompile-ef-slot :iso8859-1 #.stream::+ef-cin+) (stream::precompile-ef-slot :iso8859-1 #.stream::+ef-cin+)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.95 2010/01/23 03:00:07 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.96 2010/01/23 18:02:05 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -1803,8 +1803,7 @@ ...@@ -1803,8 +1803,7 @@
;; ;;
;;#-unicode-bootstrap ; fails in stream-reinit otherwise ;;#-unicode-bootstrap ; fails in stream-reinit otherwise
#+(and unicode (not unicode-bootstrap)) #+(and unicode (not unicode-bootstrap))
(when lisp::*enable-stream-buffer-p* (%set-fd-stream-external-format stream external-format nil)
(%set-fd-stream-external-format stream external-format nil))
(set-routines stream element-type input output input-buffer-p (set-routines stream element-type input output input-buffer-p
:binary-stream-p binary-stream-p) :binary-stream-p binary-stream-p)
#+(and unicode (not unicode-bootstrap)) #+(and unicode (not unicode-bootstrap))
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.88 2009/10/18 14:21:24 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.89 2010/01/23 18:02:05 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -298,59 +298,12 @@ ...@@ -298,59 +298,12 @@
;; fundamental-stream ;; fundamental-stream
:default)) :default))
;; This is only used while building; it's reimplemented in
;; fd-stream-extfmt.lisp
#+unicode #+unicode
(defun %set-fd-stream-external-format (stream extfmt &optional (updatep t)) (defun %set-fd-stream-external-format (stream extfmt &optional (updatep t))
(declare (type fd-stream stream)) extfmt)
(let ((old-format (fd-stream-external-format stream)))
(setf (fd-stream-external-format stream)
(stream::ef-name (stream::find-external-format extfmt))
(fd-stream-oc-state stream) nil
(fd-stream-co-state stream) nil)
(when (fd-stream-ibuf-sap stream) ; input stream
(setf (fd-stream-in stream) (ef-cin extfmt)))
(when (fd-stream-obuf-sap stream) ; output stream
(setf (fd-stream-out stream) (ef-cout extfmt)
;;@@ (fd-stream-sout stream) (ef-sout extfmt)
))
(when (and lisp::*enable-stream-buffer-p* updatep
(lisp-stream-string-buffer stream))
;; We want to reconvert any octets that haven't been converted
;; yet. So, we need to figure out which octet to start with.
;; This is done by converting (the previously converted) octets
;; until we've converted the right number of characters.
(let ((ibuf (lisp-stream-in-buffer stream))
(sindex (1- (lisp-stream-string-index stream)))
(index 0)
(state (fd-stream-saved-oc-state stream)))
;; Reconvert all the octets we've already converted and read.
;; We don't know how many octets that is, but do know how many
;; characters there are.
(multiple-value-bind (s pos count new-state)
(octets-to-string ibuf
:start 0
:external-format old-format
:string (make-string sindex)
:state state)
(declare (ignore s pos))
(setf state new-state)
(setf index count))
;; We now know the last octet that was used. Now convert the
;; rest of the octets using the new format.
(multiple-value-bind (s pos count new-state)
(octets-to-string ibuf
:start index
:end (fd-stream-in-length stream)
:external-format (fd-stream-external-format stream)
:string (lisp-stream-string-buffer stream)
:s-start 1
:state state)
(declare (ignore s))
(setf (lisp-stream-string-index stream) 1)
(setf (lisp-stream-string-buffer-len stream) pos)
(setf (lisp-stream-in-index stream) (+ index count))
(setf (fd-stream-oc-state stream) new-state))))
extfmt))
;; This is only used while building; it's reimplemented in ;; This is only used while building; it's reimplemented in
;; fd-stream-extfmt.lisp ;; fd-stream-extfmt.lisp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment