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

Luke Gorrie lgorrie at common-lisp.net
Mon Jan 12 02:14:18 UTC 2004


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

Modified Files:
	swank-gray.lisp 
Log Message:
(slime-input-stream, slime-output-buffer): Added slots to support the
new `make-fn-streams' interface from swank-backend.lisp. These slots
need to be initialized by the backend, see swank-sbcl.lisp for an
example (very easy).

Date: Sun Jan 11 21:14:17 2004
Author: lgorrie

Index: slime/swank-gray.lisp
diff -u slime/swank-gray.lisp:1.1 slime/swank-gray.lisp:1.2
--- slime/swank-gray.lisp:1.1	Sun Nov 16 12:46:59 2003
+++ slime/swank-gray.lisp	Sun Jan 11 21:14:17 2004
@@ -7,13 +7,14 @@
 ;;; This code has been placed in the Public Domain.  All warranties
 ;;; are disclaimed.
 ;;;
-;;;   $Id: swank-gray.lisp,v 1.1 2003/11/16 17:46:59 heller Exp $
+;;;   $Id: swank-gray.lisp,v 1.2 2004/01/12 02:14:17 lgorrie Exp $
 ;;;
 
 (in-package :swank)
 
 (defclass slime-output-stream (fundamental-character-output-stream)
-  ((buffer :initform (make-string 512))
+  ((output-fn :initarg :output-fn)
+   (buffer :initform (make-string 512))
    (fill-pointer :initform 0)
    (column :initform 0)))
 
@@ -35,20 +36,24 @@
   75)
 
 (defmethod stream-force-output ((stream slime-output-stream))
-  (with-slots (buffer fill-pointer) stream
+  (with-slots (buffer fill-pointer output-fn) stream
     (let ((end fill-pointer))
       (unless (zerop end)
-        (send-to-emacs `(:read-output ,(subseq buffer 0 end)))
+        (funcall output-fn (subseq buffer 0 end))
         (setf fill-pointer 0))))
   nil)
 
 (defclass slime-input-stream (fundamental-character-input-stream)
-  ((buffer :initform "") (index :initform 0)))
+  ((output-stream :initarg :output-stream)
+   (input-fn :initarg :input-fn)
+   (buffer :initform "") (index :initform 0)))
 
 (defmethod stream-read-char ((s slime-input-stream))
-  (with-slots (buffer index) s
+  (with-slots (buffer index output-stream input-fn) s
     (when (= index (length buffer))
-      (setf buffer (slime-read-string))
+      (when output-stream
+        (force-output output-stream))
+      (setf buffer (funcall input-fn))
       (setf index 0))
     (assert (plusp (length buffer)))
     (prog1 (aref buffer index) (incf index))))





More information about the slime-cvs mailing list