Fixed up Unix sockets a bit.
[lisp-utils.git] / charcode.lisp
index ac1c74d..a3cb5ad 100644 (file)
@@ -2,7 +2,7 @@
 ;;;; representations thereof
 
 (defpackage :charcode
-  (:use :cl #+sbcl :sb-gray #-sbcl :gray)
+  (:use :cl)
   (:export "MAKE-ENCODER" "MAKE-DECODER" "ENCODE-STRING" "DECODE-STRING" "SYSTEM-CHARSET"
           "NO-CODEC-ERROR" "CODING-ERROR"
           "MAKE-CODEC-CHARACTER-STREAM"
 
 ;;; Gray stream implementation
 
+;; Disabled for now. There doesn't seem to be any good way to get
+;; these working generally over various implementations.
+
+#+unused (
 (defclass codec-character-stream (fundamental-character-input-stream fundamental-character-output-stream)
   ((decoder :initarg :decoder)
    (encoder :initarg :encoder)
     (let ((outbuf (make-array (list (- end start)) :element-type '(unsigned-byte 8) :adjustable t :fill-pointer 0)))
       (funcall encoder seq outbuf)
       (write-sequence outbuf back))))
+)
 
 ;;; Implementation-specific functions
 
-#+(or (and clisp unicode) sbcl)
+#+(or (and clisp unicode) sbcl abcl)
+(defun unicode->char (unicode)
+  (declare (type (unsigned-byte 24) unicode))
+  (code-char unicode))
+
+#+(or (and clisp unicode) sbcl abcl)
+(defun char->unicode (char)
+  (declare (type character char))
+  (char-code char))
+
+#+ecl
 (defun unicode->char (unicode)
   (declare (type (unsigned-byte 24) unicode))
+  (when (>= unicode 256)
+    (error "ECL does not handle Unicode characters outside Latin-1."))
   (code-char unicode))
 
-#+(or (and clisp unicode) sbcl)
+#+ecl
 (defun char->unicode (char)
   (declare (type character char))
   (char-code char))