Date: Thursday, September 23, 2010 @ 20:51:03
Author: rtoy
Path: /project/cmucl/cvsroot/src/code
Tag: RELEASE-20B-BRANCH
Modified: fd-stream-extfmt.lisp
Merge change from HEAD that fixes the case of changing the external
format from :iso8859-1 to something else.
-----------------------+
fd-stream-extfmt.lisp | 150 ++++++++++++++++++++++++++++--------------------
1 file changed, 90 insertions(+), 60 deletions(-)
Index: src/code/fd-stream-extfmt.lisp
diff -u src/code/fd-stream-…
[View More]extfmt.lisp:1.10.2.1 src/code/fd-stream-extfmt.lisp:1.10.2.2
--- src/code/fd-stream-extfmt.lisp:1.10.2.1 Mon Sep 6 11:41:30 2010
+++ src/code/fd-stream-extfmt.lisp Thu Sep 23 20:51:03 2010
@@ -5,7 +5,7 @@
;;; domain.
;;;
(ext:file-comment
- "$Header: /project/cmucl/cvsroot/src/code/fd-stream-extfmt.lisp,v 1.10.2.1 2010-09-06 15:41:30 rtoy Exp $")
+ "$Header: /project/cmucl/cvsroot/src/code/fd-stream-extfmt.lisp,v 1.10.2.2 2010-09-24 00:51:03 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
@@ -76,65 +76,95 @@
(setf (fd-stream-out stream) (ef-cout extfmt)
;;@@ (fd-stream-sout stream) (ef-sout extfmt)
))
- ;; FIXME: We currently don't handle the case of changing from
- ;; ISO8859-1 to something else. This is because ISO8859-1 doesn't
- ;; use the string-buffer, so when we switch to another external
- ;; format that does, we need to set up the string-buffer
- ;; appropriately.
- (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 (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 (1- sindex))
- :state state
- :error (fd-stream-octets-to-char-error stream))
- (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. The new
- ;; characters are placed in the string buffer at the point
- ;; just after the last character that we've already read.
- (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 sindex
- :state state
- :error (fd-stream-octets-to-char-error stream))
- (cond ((eq (fd-stream-external-format stream) :iso8859-1)
- ;; ISO8859-1 doesn't use the string-buffer, so we
- ;; need to copy the string to the in-buffer and then
- ;; set the string-buffer to nil to indicate we're not
- ;; using the string buffer anymore.
- (let ((index (- in-buffer-length count)))
- (dotimes (k count)
- (setf (aref ibuf (+ k index))
- (char-code (aref s (+ k sindex)))))
- (setf (lisp-stream-in-index stream) index)
- (setf (lisp-stream-string-buffer stream) nil)
- (setf (lisp-stream-string-buffer-len stream) 0)
- (setf (lisp-stream-string-index stream) 0)))
- (t
- (setf (lisp-stream-string-index stream) sindex)
- (setf (lisp-stream-string-buffer-len stream) pos)
- (setf (lisp-stream-in-index stream) (+ index count))
- (setf (fd-stream-oc-state stream) new-state))))))
+ ;; The following handles the case of setting the external format
+ ;; for input streams where we need to handle the various buffering
+ ;; strategies.
+ ;;
+ (cond
+ ((eq old-format (fd-stream-external-format stream))
+ ;; Nothing to do if the new and old formats are the same.
+ )
+ ((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. Or,
+ ;; since we have the octet-count, just sum up them up to figure
+ ;; out how many octets we've already consumed.
+ (let* ((ibuf (lisp-stream-in-buffer stream))
+ (sindex (lisp-stream-string-index stream))
+ (octet-count (fd-stream-octet-count stream))
+ (oc (make-array in-buffer-length :element-type '(unsigned-byte 8)))
+ (index (loop for k of-type fixnum from 0 below (1- sindex)
+ summing (aref octet-count k))))
+ ;; We now know the last octet that was used. Now convert the
+ ;; rest of the octets using the new format. The new
+ ;; characters are placed in the string buffer at the point
+ ;; just after the last character that we've already read.
+ (multiple-value-bind (s pos count new-state)
+ (stream::octets-to-string-counted ibuf
+ oc
+ :start index
+ :end (fd-stream-in-length stream)
+ :external-format (fd-stream-external-format stream)
+ :string (lisp-stream-string-buffer stream)
+ :s-start sindex
+ :error (fd-stream-octets-to-char-error stream))
+ (replace octet-count oc :start1 index :end2 pos)
+ (cond ((eq (fd-stream-external-format stream) :iso8859-1)
+ ;; ISO8859-1 doesn't use the string-buffer, so we
+ ;; need to copy the string to the in-buffer and then
+ ;; set the string-buffer to nil to indicate we're not
+ ;; using the string buffer anymore.
+ (let ((index (- in-buffer-length count)))
+ (dotimes (k count)
+ (setf (aref ibuf (+ k index))
+ (char-code (aref s (+ k sindex)))))
+ (setf (lisp-stream-in-index stream) index)
+ (setf (lisp-stream-string-buffer stream) nil)
+ (setf (lisp-stream-string-buffer-len stream) 0)
+ (setf (lisp-stream-string-index stream) 0)))
+ (t
+ (setf (lisp-stream-string-index stream) sindex)
+ (setf (lisp-stream-string-buffer-len stream) pos)
+ (setf (lisp-stream-in-index stream) (+ index count))
+ (setf (fd-stream-oc-state stream) new-state))))))
+ ((and updatep (lisp-stream-in-buffer stream))
+ ;; This means the external format was ISO8859-1 and we're
+ ;; switching to something else. If so, we need to convert all
+ ;; the octets that haven't been processed yet and place them in
+ ;; the string buffer. We also need to adjust the in-buffer to
+ ;; put those octets in the expected place at the beginning of
+ ;; in-buffer.
+ (let ((index (lisp-stream-in-index stream))
+ (ibuf (lisp-stream-in-buffer stream)))
+ (setf (lisp-stream-string-buffer stream)
+ (make-string (1+ in-buffer-length)))
+ (setf (lisp-stream-string-index stream) 1)
+ ;; Set the unread char to be the last read octet.
+ (setf (aref (lisp-stream-string-buffer stream) 0)
+ (code-char (aref ibuf (1- index))))
+
+ (let ((oc (or (fd-stream-octet-count stream)
+ (setf (fd-stream-octet-count stream)
+ (make-array in-buffer-length :element-type '(unsigned-byte 8))))))
+ (multiple-value-bind (s pos count new-state)
+ (stream::octets-to-string-counted ibuf
+ oc
+ :start index
+ :external-format (fd-stream-external-format stream)
+ :string (lisp-stream-string-buffer stream)
+ :s-start 1
+ :error (fd-stream-octets-to-char-error stream))
+ (declare (ignore s))
+ (setf (lisp-stream-string-buffer-len stream) pos)
+ (setf (fd-stream-oc-state stream) new-state)
+ ;; Move the octets from the end of the in-buffer to the
+ ;; beginning. Set the index to the number of octets we've
+ ;; processed.
+ (replace ibuf ibuf :start2 index)
+ (setf (lisp-stream-in-index stream) count))))))
extfmt))
[View Less]
Date: Thursday, September 23, 2010 @ 20:36:03
Author: rtoy
Path: /project/cmucl/cvsroot/src/code
Modified: fd-stream-extfmt.lisp
o When changing external format from :iso8859-1 to another format, we
need to call octets-to-string-counted to setup the octet count array
correctly.
o Minor cleanup of code.
-----------------------+
fd-stream-extfmt.lisp | 105 +++++++++++++++++++++++++-----------------------
1 file changed, 55 insertions(+), 50 deletions(-)
Index: src/code/fd-…
[View More]stream-extfmt.lisp
diff -u src/code/fd-stream-extfmt.lisp:1.12 src/code/fd-stream-extfmt.lisp:1.13
--- src/code/fd-stream-extfmt.lisp:1.12 Tue Sep 7 23:04:54 2010
+++ src/code/fd-stream-extfmt.lisp Thu Sep 23 20:36:03 2010
@@ -5,7 +5,7 @@
;;; domain.
;;;
(ext:file-comment
- "$Header: /project/cmucl/cvsroot/src/code/fd-stream-extfmt.lisp,v 1.12 2010-09-08 03:04:54 rtoy Exp $")
+ "$Header: /project/cmucl/cvsroot/src/code/fd-stream-extfmt.lisp,v 1.13 2010-09-24 00:36:03 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
@@ -92,44 +92,44 @@
;; until we've converted the right number of characters. Or,
;; since we have the octet-count, just sum up them up to figure
;; out how many octets we've already consumed.
- (let ((ibuf (lisp-stream-in-buffer stream))
- (sindex (lisp-stream-string-index stream))
- (index 0)
- (octet-count (fd-stream-octet-count stream)))
- (setf index (loop for k of-type fixnum from 0 below (1- sindex) summing (aref octet-count k)))
+ (let* ((ibuf (lisp-stream-in-buffer stream))
+ (sindex (lisp-stream-string-index stream))
+ (octet-count (fd-stream-octet-count stream))
+ (oc (make-array in-buffer-length :element-type '(unsigned-byte 8)))
+ (index (loop for k of-type fixnum from 0 below (1- sindex)
+ summing (aref octet-count k))))
;; We now know the last octet that was used. Now convert the
;; rest of the octets using the new format. The new
;; characters are placed in the string buffer at the point
;; just after the last character that we've already read.
- (let ((oc (make-array in-buffer-length :element-type '(unsigned-byte 8))))
- (multiple-value-bind (s pos count new-state)
- (stream::octets-to-string-counted ibuf
- oc
- :start index
- :end (fd-stream-in-length stream)
- :external-format (fd-stream-external-format stream)
- :string (lisp-stream-string-buffer stream)
- :s-start sindex
- :error (fd-stream-octets-to-char-error stream))
- (replace octet-count oc :start1 index :end2 pos)
- (cond ((eq (fd-stream-external-format stream) :iso8859-1)
- ;; ISO8859-1 doesn't use the string-buffer, so we
- ;; need to copy the string to the in-buffer and then
- ;; set the string-buffer to nil to indicate we're not
- ;; using the string buffer anymore.
- (let ((index (- in-buffer-length count)))
- (dotimes (k count)
- (setf (aref ibuf (+ k index))
- (char-code (aref s (+ k sindex)))))
- (setf (lisp-stream-in-index stream) index)
- (setf (lisp-stream-string-buffer stream) nil)
- (setf (lisp-stream-string-buffer-len stream) 0)
- (setf (lisp-stream-string-index stream) 0)))
- (t
- (setf (lisp-stream-string-index stream) sindex)
- (setf (lisp-stream-string-buffer-len stream) pos)
- (setf (lisp-stream-in-index stream) (+ index count))
- (setf (fd-stream-oc-state stream) new-state)))))))
+ (multiple-value-bind (s pos count new-state)
+ (stream::octets-to-string-counted ibuf
+ oc
+ :start index
+ :end (fd-stream-in-length stream)
+ :external-format (fd-stream-external-format stream)
+ :string (lisp-stream-string-buffer stream)
+ :s-start sindex
+ :error (fd-stream-octets-to-char-error stream))
+ (replace octet-count oc :start1 index :end2 pos)
+ (cond ((eq (fd-stream-external-format stream) :iso8859-1)
+ ;; ISO8859-1 doesn't use the string-buffer, so we
+ ;; need to copy the string to the in-buffer and then
+ ;; set the string-buffer to nil to indicate we're not
+ ;; using the string buffer anymore.
+ (let ((index (- in-buffer-length count)))
+ (dotimes (k count)
+ (setf (aref ibuf (+ k index))
+ (char-code (aref s (+ k sindex)))))
+ (setf (lisp-stream-in-index stream) index)
+ (setf (lisp-stream-string-buffer stream) nil)
+ (setf (lisp-stream-string-buffer-len stream) 0)
+ (setf (lisp-stream-string-index stream) 0)))
+ (t
+ (setf (lisp-stream-string-index stream) sindex)
+ (setf (lisp-stream-string-buffer-len stream) pos)
+ (setf (lisp-stream-in-index stream) (+ index count))
+ (setf (fd-stream-oc-state stream) new-state))))))
((and updatep (lisp-stream-in-buffer stream))
;; This means the external format was ISO8859-1 and we're
;; switching to something else. If so, we need to convert all
@@ -145,21 +145,26 @@
;; Set the unread char to be the last read octet.
(setf (aref (lisp-stream-string-buffer stream) 0)
(code-char (aref ibuf (1- index))))
- (multiple-value-bind (s pos count new-state)
- (octets-to-string ibuf
- :start index
- :external-format (fd-stream-external-format stream)
- :string (lisp-stream-string-buffer stream)
- :s-start 1
- :error (fd-stream-octets-to-char-error stream))
- (declare (ignore s))
- (setf (lisp-stream-string-buffer-len stream) pos)
- (setf (fd-stream-oc-state stream) new-state)
- ;; Move the octets from the end of the in-buffer to the
- ;; beginning. Set the index to the number of octets we've
- ;; processed.
- (replace ibuf ibuf :start2 index)
- (setf (lisp-stream-in-index stream) count)))))
+
+ (let ((oc (or (fd-stream-octet-count stream)
+ (setf (fd-stream-octet-count stream)
+ (make-array in-buffer-length :element-type '(unsigned-byte 8))))))
+ (multiple-value-bind (s pos count new-state)
+ (stream::octets-to-string-counted ibuf
+ oc
+ :start index
+ :external-format (fd-stream-external-format stream)
+ :string (lisp-stream-string-buffer stream)
+ :s-start 1
+ :error (fd-stream-octets-to-char-error stream))
+ (declare (ignore s))
+ (setf (lisp-stream-string-buffer-len stream) pos)
+ (setf (fd-stream-oc-state stream) new-state)
+ ;; Move the octets from the end of the in-buffer to the
+ ;; beginning. Set the index to the number of octets we've
+ ;; processed.
+ (replace ibuf ibuf :start2 index)
+ (setf (lisp-stream-in-index stream) count))))))
extfmt))
[View Less]
Date: Monday, September 20, 2010 @ 22:30:54
Author: rtoy
Path: /project/cmucl/cvsroot/src
Modified: docs/cmu-user/cmu-user.tex general-info/release-20b.txt
Merge changes from 20b branch.
------------------------------+
docs/cmu-user/cmu-user.tex | 2 +-
general-info/release-20b.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: src/docs/cmu-user/cmu-user.tex
diff -u src/docs/cmu-user/cmu-user.tex:1.43 src/docs/cmu-user/cmu-user.tex:1.44
--- src/docs/cmu-…
[View More]user/cmu-user.tex:1.43 Sun Aug 1 12:18:01 2010
+++ src/docs/cmu-user/cmu-user.tex Mon Sep 20 22:30:54 2010
@@ -47,7 +47,7 @@
\newcommand{\keywords}{lisp, Common Lisp, manual, compiler, programming
language implementation, programming environment}
-\date{August 2010 \\ Snapshot 2010-08}
+\date{October 2010 \\ 20b}
\begin{document}
Index: src/general-info/release-20b.txt
diff -u src/general-info/release-20b.txt:1.49 src/general-info/release-20b.txt:1.50
--- src/general-info/release-20b.txt:1.49 Sun Sep 19 00:10:52 2010
+++ src/general-info/release-20b.txt Mon Sep 20 22:30:54 2010
@@ -2,7 +2,7 @@
The CMUCL project is pleased to announce the release of CMUCL 20b.
This is a major release which contains numerous enhancements and
-bug fixes from the 19f release.
+bug fixes from the 20a release.
CMUCL is a free, high performance implementation of the Common Lisp
programming language which runs on most major Unix platforms. It
[View Less]
Date: Monday, September 20, 2010 @ 20:19:21
Author: rtoy
Path: /project/cmucl/cvsroot/src/general-info
Tag: RELEASE-20B-BRANCH
Modified: release-20b.txt
Fix typo: 19f->20a.
-----------------+
release-20b.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: src/general-info/release-20b.txt
diff -u src/general-info/release-20b.txt:1.41.2.7 src/general-info/release-20b.txt:1.41.2.8
--- src/general-info/release-20b.txt:1.41.2.7 Sat Sep 18 23:46:02 2010
+++ src/…
[View More]general-info/release-20b.txt Mon Sep 20 20:19:21 2010
@@ -2,7 +2,7 @@
The CMUCL project is pleased to announce the release of CMUCL 20b.
This is a major release which contains numerous enhancements and
-bug fixes from the 19f release.
+bug fixes from the 20a release.
CMUCL is a free, high performance implementation of the Common Lisp
programming language which runs on most major Unix platforms. It
[View Less]