[slime-cvs] CVS update: slime/swank-clisp.lisp
Wolfgang Jenkner
wjenkner at common-lisp.net
Fri Jan 9 02:26:11 UTC 2004
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv30243
Modified Files:
swank-clisp.lisp
Log Message:
Add methods for GRAY:STREAM-READ-CHAR-NO-HANG and for the CLISP
specific GRAY:STREAM-READ-CHAR-WILL-HANG-P. This should fix the
behaviour of SYS::READ-FORM.
Date: Thu Jan 8 21:26:10 2004
Author: wjenkner
Index: slime/swank-clisp.lisp
diff -u slime/swank-clisp.lisp:1.3 slime/swank-clisp.lisp:1.4
--- slime/swank-clisp.lisp:1.3 Thu Jan 8 02:02:20 2004
+++ slime/swank-clisp.lisp Thu Jan 8 21:26:10 2004
@@ -49,6 +49,34 @@
#+win32 (defslimefun getpid () (or (system::getenv "PID") -1))
;; the above is likely broken; we need windows NT users!
+
+;;; Gray streams
+
+;; From swank-gray.lisp.
+
+(defclass slime-input-stream (fundamental-character-input-stream)
+ ((buffer :initform "") (index :initform 0)))
+
+;; 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))))
+
+
;;; TCP Server
(defun get-socket-stream (port announce close-socket-p)
More information about the slime-cvs
mailing list