0.9.3.18:
authorAlexey Dejneka <adejneka@comail.ru>
Tue, 2 Aug 2005 18:11:14 +0000 (18:11 +0000)
committerAlexey Dejneka <adejneka@comail.ru>
Tue, 2 Aug 2005 18:11:14 +0000 (18:11 +0000)
        * DEFINE-UNIBYTE-MAPPER defines correct externalization
          routine for encodings, swapping 8-bit codes.

NEWS
src/code/octets.lisp
tests/external-format.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index cae99e3..4eceb3b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ changes in sbcl-0.9.4 relative to sbcl-0.9.3:
   * minor incompatible change: *INVOKE-DEBUGGER-HOOK* is run before
     *DEBUGGER-HOOK* => *DEBUGGER-HOOK* is not run when the debugger
     is disabled
+  * bug fix: degree sign (<U00B0>) could not be encoded in KOI8-R.
 
 changes in sbcl-0.9.3 relative to sbcl-0.9.2:
   * New feature: Experimental support for bivalent streams: streams
index c499211..b68d59c 100644 (file)
@@ -190,12 +190,12 @@ one-past-the-end"
       (declare (optimize speed (safety 0))
                (type char-code code))
       (case code
-        (,(mapcar #'car exceptions) nil)
         ,@(mapcar (lambda (exception)
                     (destructuring-bind (byte code) exception
                       `(,code ,byte)))
                   exceptions)
-        (otherwise code)))))
+        (,(mapcar #'car exceptions) nil)
+        (otherwise (if (< code 256) code nil))))))
 
 #!+sb-unicode
 (define-unibyte-mapper
index d4e9cbd..d1a9644 100644 (file)
@@ -15,9 +15,6 @@
 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
 ;;;; more information.
 
-#-sb-unicode
-(sb-ext:quit :unix-status 104)
-
 (defmacro do-external-formats ((xf &optional result) &body body)
   (let ((nxf (gensym)))
     `(dolist (,nxf sb-impl::*external-formats* ,result)
       (loop for character across standard-characters
             do (assert (eql (read-char s) character))))))
 
+(delete-file "external-format-test.txt")
+#-sb-unicode
+(sb-ext:quit :unix-status 104)
+
 ;;; Test UTF-8 writing and reading of 1, 2, 3 and 4 octet characters with
 ;;; all possible offsets. Tests for buffer edge bugs. fd-stream buffers are
 ;;; 4096 wide.
       (when p
         (delete-file p)))))
 
-(delete-file "external-format-test.txt")
+\f
+;;;; KOI8-R external format
+(with-open-file (s "external-format-test.txt" :direction :output
+                 :if-exists :supersede :external-format :koi8-r)
+  (write-char (code-char #xB0) s)
+  (assert (eq
+           (handler-case
+               (progn
+                 (write-char (code-char #xBAAD) s)
+                 :bad)
+             (sb-int:character-encoding-error ()
+               :good))
+           :good)))
+(with-open-file (s "external-format-test.txt" :direction :input
+                 :element-type '(unsigned-byte 8))
+  (let ((byte (read-byte s)))
+    (assert (= (eval byte) #x9C))))
+(with-open-file (s "external-format-test.txt" :direction :input
+                 :external-format :koi8-r)
+  (let ((char (read-char s)))
+    (assert (= (char-code (eval char)) #xB0))))
 
+\f
+(delete-file "external-format-test.txt")
 (sb-ext:quit :unix-status 104)
index 5e2f013..7bcf166 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.3.17"
+"0.9.3.18"