[slime-cvs] CVS update: slime/swank-allegro.lisp

Helmut Eller heller at common-lisp.net
Fri Nov 19 19:05:11 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv12697

Modified Files:
	swank-allegro.lisp 
Log Message:
(accept-connection): Accept :external-format as argument.
Date: Fri Nov 19 20:05:10 2004
Author: heller

Index: slime/swank-allegro.lisp
diff -u slime/swank-allegro.lisp:1.62 slime/swank-allegro.lisp:1.63
--- slime/swank-allegro.lisp:1.62	Fri Nov 19 02:18:19 2004
+++ slime/swank-allegro.lisp	Fri Nov 19 20:05:09 2004
@@ -51,8 +51,13 @@
 (defimplementation close-socket (socket)
   (close socket))
 
-(defimplementation accept-connection (socket)
-  (socket:accept-connection socket :wait t))
+(defimplementation accept-connection (socket &key external-format)
+  (let ((s (socket:accept-connection socket :wait t)))
+    (ecase external-format
+      (:iso-latin-1-unix (setf (stream-external-format s) :latin1))
+      (:emacs-mule-unix (setf (stream-external-format s) :emacs-mule))
+      (:utf-8-unix (setf (stream-external-format s) :utf8)))
+    s))
 
 (defimplementation format-sldb-condition (c)
   (princ-to-string c))
@@ -279,15 +284,16 @@
 ;; our own conversion.
 (defun count-cr (file pos)
   (let* ((bufsize 256)
-         (buf (make-array bufsize :element-type '(unsigned-byte 8)))
+         (type '(unsigned-byte 8))
+         (buf (make-array bufsize :element-type type))
          (cr-count 0))
-    (with-open-file (stream file :direction :input)
-      (loop for bytes-read = (read-sequence buf stream) do
-           (incf cr-count (count (char-code #\return) buf 
-                                 :end (min pos bytes-read)))
-           (decf pos bytes-read)
-           (when (<= pos 0)
-             (return cr-count))))))
+  (with-open-file (stream file :direction :input :element-type type)
+    (loop for bytes-read = (read-sequence buf stream) do
+          (incf cr-count (count (char-code #\return) buf 
+                                :end (min pos bytes-read)))
+          (decf pos bytes-read)
+          (when (<= pos 0)
+            (return cr-count))))))
               
 (defun find-definition-in-file (fspec type file)
   (let* ((start (or (scm:find-definition-in-file fspec type file)





More information about the slime-cvs mailing list