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

Helmut Eller heller at common-lisp.net
Tue Jan 13 18:21:48 UTC 2004


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

Modified Files:
	swank-gray.lisp 
Log Message:
(make-fn-streams): New function.

(stream-read-char-no-hang, stream-read-char-will-hang-p): Moved to
here from swank-clisp.lisp.

Date: Tue Jan 13 13:21:48 2004
Author: heller

Index: slime/swank-gray.lisp
diff -u slime/swank-gray.lisp:1.2 slime/swank-gray.lisp:1.3
--- slime/swank-gray.lisp:1.2	Sun Jan 11 21:14:17 2004
+++ slime/swank-gray.lisp	Tue Jan 13 13:21:48 2004
@@ -7,7 +7,7 @@
 ;;; This code has been placed in the Public Domain.  All warranties
 ;;; are disclaimed.
 ;;;
-;;;   $Id: swank-gray.lisp,v 1.2 2004/01/12 02:14:17 lgorrie Exp $
+;;;   $Id: swank-gray.lisp,v 1.3 2004/01/13 18:21:48 heller Exp $
 ;;;
 
 (in-package :swank)
@@ -79,3 +79,34 @@
 (defmethod stream-line-length ((s slime-input-stream))
   75)
 
+
+;;; CLISP extensions
+
+;; We have to define an additional method for the sake of the C
+;; function listen_char (see src/stream.d), on which SYS::READ-FORM
+;; depends.
+
+;; We could make do with either of the two methods below.
+
+(defmethod stream-read-char-no-hang ((s slime-input-stream))
+  (with-slots (buffer index) s
+    (when (< index (length buffer))
+      (prog1 (aref buffer index) (incf index)))))
+
+;; This CLISP extension is what listen_char actually calls.  The
+;; default method would call STREAM-READ-CHAR-NO-HANG, so it is a bit
+;; more efficient to define it directly.
+
+(defmethod stream-read-char-will-hang-p ((s slime-input-stream))
+  (with-slots (buffer index) s
+    (= index (length buffer))))
+
+
+;;;
+(defmethod make-fn-streams (input-fn output-fn)
+  (let* ((output (make-instance 'slime-output-stream 
+                                :output-fn output-fn))
+         (input  (make-instance 'slime-input-stream
+                                :input-fn input-fn 
+                                :output-stream output)))
+    (values input output)))
\ No newline at end of file





More information about the slime-cvs mailing list