/[slime]/slime/swank.lisp
ViewVC logotype

Diff of /slime/swank.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.444 by mkoeppe, Fri Dec 29 16:10:26 2006 UTC revision 1.445 by mkoeppe, Sun Dec 31 12:28:28 2006 UTC
# Line 198  Backend code should treat the connection Line 198  Backend code should treat the connection
198    (user-input       nil :type (or stream null))    (user-input       nil :type (or stream null))
199    (user-output      nil :type (or stream null))    (user-output      nil :type (or stream null))
200    (user-io          nil :type (or stream null))    (user-io          nil :type (or stream null))
201      ;; A stream where we send REPL results.
202      (repl-results     nil :type (or stream null))
203    ;; In multithreaded systems we delegate certain tasks to specific    ;; In multithreaded systems we delegate certain tasks to specific
204    ;; threads. The `reader-thread' is responsible for reading network    ;; threads. The `reader-thread' is responsible for reading network
205    ;; requests from Emacs and sending them to the `control-thread'; the    ;; requests from Emacs and sending them to the `control-thread'; the
# Line 518  if the file doesn't exist; otherwise the Line 520  if the file doesn't exist; otherwise the
520      (force-output *debug-io*)))      (force-output *debug-io*)))
521    
522  (defun open-streams (connection)  (defun open-streams (connection)
523    "Return the 4 streams for IO redirection:    "Return the 5 streams for IO redirection:
524  DEDICATED-OUTPUT INPUT OUTPUT IO"  DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
525    (multiple-value-bind (output-fn dedicated-output)    (multiple-value-bind (output-fn dedicated-output)
526        (make-output-function connection)        (make-output-function connection)
527      (let ((input-fn      (let ((input-fn
# Line 532  DEDICATED-OUTPUT INPUT OUTPUT IO" Line 534  DEDICATED-OUTPUT INPUT OUTPUT IO"
534          (let ((out (or dedicated-output out)))          (let ((out (or dedicated-output out)))
535            (let ((io (make-two-way-stream in out)))            (let ((io (make-two-way-stream in out)))
536              (mapc #'make-stream-interactive (list in out io))              (mapc #'make-stream-interactive (list in out io))
537              (values dedicated-output in out io)))))))              (let* ((repl-results-fn
538                        (make-output-function-for-target connection :repl-result))
539                       (repl-results
540                        (nth-value 1 (make-fn-streams nil repl-results-fn))))
541                  (values dedicated-output in out io repl-results))))))))
542    
543  (defun make-output-function (connection)  (defun make-output-function (connection)
544    "Create function to send user output to Emacs.    "Create function to send user output to Emacs.
# Line 553  stream (or NIL if none was created)." Line 559  stream (or NIL if none was created)."
559                      (send-to-emacs `(:write-string ,string)))))                      (send-to-emacs `(:write-string ,string)))))
560                nil)))                nil)))
561    
562    (defun make-output-function-for-target (connection target)
563      "Create a function to send user output to a specific TARGET in Emacs."
564      (lambda (string)
565        (with-connection (connection)
566          (with-simple-restart
567              (abort "Abort sending output to Emacs.")
568            (send-to-emacs `(:write-string ,string nil ,target))))))
569    
570  (defun open-dedicated-output-stream (socket-io)  (defun open-dedicated-output-stream (socket-io)
571    "Open a dedicated output connection to the Emacs on SOCKET-IO.    "Open a dedicated output connection to the Emacs on SOCKET-IO.
572  Return an output stream suitable for writing program output.  Return an output stream suitable for writing program output.
# Line 880  of the toplevel restart." Line 894  of the toplevel restart."
894         (send event)))))         (send event)))))
895    
896  (defun initialize-streams-for-connection (connection)  (defun initialize-streams-for-connection (connection)
897    (multiple-value-bind (dedicated in out io) (open-streams connection)    (multiple-value-bind (dedicated in out io repl-results)
898          (open-streams connection)
899      (setf (connection.dedicated-output connection) dedicated      (setf (connection.dedicated-output connection) dedicated
900            (connection.user-io connection)          io            (connection.user-io connection)          io
901            (connection.user-output connection)      out            (connection.user-output connection)      out
902            (connection.user-input connection)       in)            (connection.user-input connection)       in
903              (connection.repl-results connection)     repl-results)
904      connection))      connection))
905    
906  (defun create-connection (socket-io style)  (defun create-connection (socket-io style)

Legend:
Removed from v.1.444  
changed lines
  Added in v.1.445

  ViewVC Help
Powered by ViewVC 1.1.5