[slime-devel] Unicode support for CMUCL

Raymond Toy toy.raymond at gmail.com
Sun Jun 1 22:12:28 UTC 2008


Here is a small patch to enable support for Unicode for CMUCL.

Seems to work.  May need some more work on the 
*external-format-to-coding-system*, but iso-8859-1 and utf-8 appear to 
work ok, for the little bit of testing I've done.

Ray

--- swank-cmucl.lisp-orig	2008-06-01 18:06:07.000000000 -0400
+++ swank-cmucl.lisp	2008-06-01 18:01:44.000000000 -0400
@@ -99,10 +99,13 @@
      (ext:close-socket fd)))

  (defimplementation accept-connection (socket &key
-                                      external-format buffering timeout)
-  (declare (ignore timeout external-format))
+                                             external-format buffering 
timeout)
+  (declare (ignore timeout))
    (let ((buffering (or buffering :full)))
-    (make-socket-io-stream (ext:accept-tcp-connection socket) buffering)))
+    (make-socket-io-stream (ext:accept-tcp-connection socket)
+                           buffering
+                           :external-format
+                           (or external-format :iso-8859-1))))

  ;;;;; Sockets

@@ -117,10 +120,23 @@
    (let ((hostent (ext:lookup-host-entry hostname)))
      (car (ext:host-entry-addr-list hostent))))

-(defun make-socket-io-stream (fd buffering)
+(defvar *external-format-to-coding-system*
+  '((:iso-8859-1
+     "latin-1" "latin-1-unix" "iso-latin-1-unix"
+     "iso-8859-1" "iso-8859-1-unix")
+    (:utf-8 "utf-8" "utf-8-unix")))
+
+(defimplementation find-external-format (coding-system)
+  (car (rassoc-if (lambda (x) (member coding-system x :test #'equal))
+                  *external-format-to-coding-system*)))
+
+
+(defun make-socket-io-stream (fd buffering &key external-format)
    "Create a new input/output fd-stream for FD."
    (sys:make-fd-stream fd :input t :output t :element-type 'base-char
-                      :buffering buffering))
+                      :buffering buffering
+                      #+unicode :external-format
+                      #+unicode external-format))

  ;;;;; Signal-driven I/O




More information about the slime-devel mailing list