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

Helmut Eller heller at common-lisp.net
Sat Feb 21 16:37:27 UTC 2004


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

Modified Files:
	swank.lisp 
Log Message:
(create-connection): Add support for fd-handlers.
(install-fd-handler,  deinstall-fd-handler): New functions.
Date: Sat Feb 21 11:37:27 2004
Author: heller

Index: slime/swank.lisp
diff -u slime/swank.lisp:1.122 slime/swank.lisp:1.123
--- slime/swank.lisp:1.122	Sat Feb 21 02:35:12 2004
+++ slime/swank.lisp	Sat Feb 21 11:37:27 2004
@@ -398,7 +398,14 @@
                         :read #'read-from-socket-io
                         :send #'send-to-socket-io
                         :serve-requests #'install-sigio-handler
-                        :cleanup #'remove-sigio-handler))
+                        :cleanup #'deinstall-fd-handler))
+      (:fd-handler
+       (make-connection :socket-io socket-io :dedicated-output dedicated
+                        :user-input in :user-output out :user-io io
+                        :read #'read-from-socket-io
+                        :send #'send-to-socket-io
+                        :serve-requests #'install-fd-handler
+                        :cleanup #'deinstall-fd-handler))
       ((nil)
        (make-connection :socket-io socket-io :dedicated-output dedicated
                         :user-input in :user-output out :user-io io
@@ -411,6 +418,8 @@
                    (listen stream))
         do (funcall fn)))
 
+;;;;;; Signal driven IO
+
 (defun install-sigio-handler (connection)
   (let ((client (connection.socket-io connection)))
     (flet ((handler ()   
@@ -419,11 +428,38 @@
                       (process-available-input client #'handle-request)))
                    ((eq (car *swank-state-stack*) :read-next-form))
                    (t (process-available-input client #'read-from-emacs)))))
-      (add-input-handler client #'handler)
+      (add-sigio-handler client #'handler)
       (handler))))
 
-(defun remove-sigio-handler (connection)
-  (remove-input-handlers (connection.socket-io connection)))
+(defun deinstall-sigio-handler (connection)
+  (remove-sigio-handlers (connection.socket-io connection)))
+
+;;;;;; SERVE-EVENT based IO
+
+(defun install-fd-handler (connection)
+  (let ((client (connection.socket-io connection)))
+    (flet ((handler ()   
+             (cond ((null *swank-state-stack*)
+                    (with-reader-error-handler (connection)
+                      (process-available-input client #'handle-request)))
+                   ((eq (car *swank-state-stack*) :read-next-form))
+                   (t (process-available-input client #'read-from-emacs)))))
+      (encode-message '(:use-sigint-for-interrupt) client)
+      (setq *debugger-hook* 
+            (lambda (c h)
+              (with-reader-error-handler (connection)
+		(block debugger
+		  (catch 'slime-toplevel
+		    (swank-debugger-hook c h)
+		    (return-from debugger))
+		  (abort)))))
+      (add-fd-handler client #'handler)
+      (handler))))
+
+(defun deinstall-fd-handler (connection)
+  (remove-fd-handlers (connection.socket-io connection)))
+
+;;;;;; Simple sequential IO
 
 (defun simple-serve-requests (connection)
   (let ((socket-io (connection.socket-io connection)))





More information about the slime-cvs mailing list