Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* swank-backend.lisp (make-input-stream): Remove make-fn-streams.

Update callers accordingly.
  • Loading branch information...
commit ae18afc61627a04b5910b5b113042677085e1dd0 1 parent c13c596
authored August 31, 2008
2  ChangeLog
@@ -2,6 +2,8 @@
2 2
 
3 3
 	* swank-backend.lisp (*gray-stream-symbols*): Remove
4 4
 	stream-file-position because it's called stream-position in CCL.
  5
+	(make-input-stream): Remove make-fn-streams.
  6
+	Update callers accordingly.
5 7
 
6 8
 2008-08-30  Helmut Eller  <heller@common-lisp.net>
7 9
 
8  swank-abcl.lisp
@@ -28,12 +28,8 @@
28 28
   (ext:make-slime-output-stream write-string))
29 29
 
30 30
 (defimplementation make-input-stream (read-string)
31  
-  (ext:make-slime-input-stream read-string))
32  
-
33  
-(defimplementation make-fn-streams (input-fn output-fn)
34  
-  (let* ((output (ext:make-slime-output-stream output-fn))
35  
-         (input  (ext:make-slime-input-stream input-fn output)))
36  
-    (values input output)))
  31
+  (ext:make-slime-input-stream read-string  
  32
+                               (make-synonym-stream '*standard-output*)))
37 33
 
38 34
 (defimplementation call-with-compilation-hooks (function)
39 35
   (funcall function))
11  swank-backend.lisp
@@ -469,17 +469,6 @@ The stream calls WRITE-STRING when output is ready.")
469 469
   "Return a new character input stream.
470 470
 The stream calls READ-STRING when input is needed.")
471 471
 
472  
-(definterface make-fn-streams (input-fn output-fn)
473  
-   "Return character input and output streams backended by functions.
474  
-When input is needed, INPUT-FN is called with no arguments to
475  
-return a string.
476  
-When output is ready, OUTPUT-FN is called with the output as its
477  
-argument.
478  
-
479  
-Output should be forced to OUTPUT-FN before calling INPUT-FN.
480  
-
481  
-The streams are returned as two values.")
482  
-
483 472
 
484 473
 ;;;; Documentation
485 474
 
11  swank-cmucl.lisp
@@ -202,11 +202,6 @@ specific functions.")
202 202
 (defimplementation make-input-stream (read-string)
203 203
   (make-slime-input-stream read-string))
204 204
 
205  
-(defimplementation make-fn-streams (input-fn output-fn)
206  
-  (let* ((output (make-slime-output-stream output-fn))
207  
-         (input  (make-slime-input-stream input-fn output)))
208  
-    (values input output)))
209  
-
210 205
 (defstruct (slime-output-stream
211 206
              (:include lisp::lisp-stream
212 207
                        (lisp::misc #'sos/misc)
@@ -298,16 +293,12 @@ specific functions.")
298 293
                        (lisp::misc #'sis/misc))
299 294
              (:conc-name sis.)
300 295
              (:print-function %print-slime-output-stream)
301  
-             (:constructor make-slime-input-stream (input-fn sos)))
  296
+             (:constructor make-slime-input-stream (input-fn)))
302 297
   (input-fn nil :type function)
303  
-  ;; We know our sibling output stream, so that we can force it before
304  
-  ;; requesting input.
305  
-  (sos      nil :type slime-output-stream)
306 298
   (buffer   ""  :type string)
307 299
   (index    0   :type kernel:index))
308 300
 
309 301
 (defun sis/in (stream eof-errorp eof-value)
310  
-  (finish-output (sis.sos stream))
311 302
   (let ((index (sis.index stream))
312 303
 	(buffer (sis.buffer stream)))
313 304
     (when (= index (length buffer))
7  swank-gray.lisp
@@ -164,10 +164,3 @@
164 164
 
165 165
 (defimplementation make-input-stream (read-string)
166 166
   (make-instance 'slime-input-stream :input-fn read-string))
167  
-
168  
-(defimplementation make-fn-streams (input-fn output-fn)
169  
-  (let* ((output (make-instance 'slime-output-stream 
170  
-                                :output-fn output-fn))
171  
-         (input  (make-instance 'slime-input-stream
172  
-                                :input-fn input-fn)))
173  
-    (values input output)))
20  swank-scl.lisp
@@ -100,19 +100,17 @@
100 100
    (index :initarg :index :initform 0 :type fixnum)
101 101
    (position :initarg :position :initform 0 :type integer)
102 102
    (interactive :initarg :interactive :initform nil :type (member nil t))
103  
-   (output-stream :initarg :output-stream :initform nil)
104 103
    (input-fn :initarg :input-fn :type function)
105 104
    ))
106 105
 
107  
-(defun make-slime-input-stream (input-fn &optional output-stream)
  106
+(defun make-slime-input-stream (input-fn)
108 107
   (declare (function input-fn))
109 108
   (make-instance 'slime-input-stream
110 109
                  :in-buffer (make-string 256)
111 110
                  :in-head 0 :in-tail 0
112 111
                  :out-buffer ""
113 112
                  :buffer "" :index 0
114  
-                 :input-fn input-fn
115  
-                 :output-stream output-stream))
  113
+                 :input-fn input-fn))
116 114
 
117 115
 (defmethod print-object ((s slime-input-stream) stream)
118 116
   (print-unreadable-object (s stream :type t)))
@@ -202,11 +200,8 @@
202 200
            (incf (slot-value stream 'position) copy)
203 201
 	   copy)
204 202
 	  (waitp
205  
-           (let ((output-stream (slot-value stream 'output-stream))
206  
-                 (input-fn (slot-value stream 'input-fn)))
  203
+           (let ((input-fn (slot-value stream 'input-fn)))
207 204
              (declare (type function input-fn))
208  
-             (when output-stream
209  
-               (force-output output-stream))
210 205
              (let ((new-input (funcall input-fn)))
211 206
                (cond ((zerop (length new-input))
212 207
                       -1)
@@ -344,10 +339,11 @@
344 339
 
345 340
 ;;;
346 341
 
347  
-(defimplementation make-fn-streams (input-fn output-fn)
348  
-  (let* ((output (make-slime-output-stream output-fn))
349  
-         (input  (make-slime-input-stream input-fn output)))
350  
-    (values input output)))
  342
+(defimplementation make-output-stream (output-fn)
  343
+  (make-slime-output-stream output-fn))
  344
+
  345
+(defimplementation make-input-stream (input-fn)
  346
+  (make-slime-input-stream input-fn))
351 347
 
352 348
 
353 349
 ;;;; Compilation Commands
44  swank.lisp
@@ -824,25 +824,26 @@ if the file doesn't exist; otherwise the first line of the file."
824 824
 (defun open-streams (connection)
825 825
   "Return the 5 streams for IO redirection:
826 826
 DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
827  
-  (let ((output-fn (make-output-function connection))
828  
-        (input-fn
829  
-         (lambda () 
830  
-           (with-connection (connection)
831  
-             (with-simple-restart (abort-read
832  
-                                   "Abort reading input from Emacs.")
833  
-               (read-user-input-from-emacs))))))
834  
-    (multiple-value-bind (in out) (make-fn-streams input-fn output-fn)
835  
-      (let* ((dedicated-output (if *use-dedicated-output-stream*
836  
-                                   (open-dedicated-output-stream
837  
-                                    (connection.socket-io connection))))
838  
-             (out (or dedicated-output out))
839  
-             (io (make-two-way-stream in out))
840  
-             (repl-results (make-output-stream-for-target connection
841  
-                                                          :repl-result)))
842  
-        (when (eq (connection.communication-style connection) :spawn)
843  
-          (spawn (lambda () (auto-flush-loop out)) 
844  
-                 :name "auto-flush-thread"))
845  
-        (values dedicated-output in out io repl-results)))))
  827
+  (let* ((output-fn (make-output-function connection))
  828
+         (input-fn
  829
+          (lambda () 
  830
+            (with-connection (connection)
  831
+              (with-simple-restart (abort-read
  832
+                                    "Abort reading input from Emacs.")
  833
+                (read-user-input-from-emacs)))))
  834
+         (dedicated-output (if *use-dedicated-output-stream*
  835
+                               (open-dedicated-output-stream
  836
+                                (connection.socket-io connection))))
  837
+         (out (make-output-stream output-fn))
  838
+         (in (make-input-stream input-fn))
  839
+         (out (or dedicated-output out))
  840
+         (io (make-two-way-stream in out))
  841
+         (repl-results (make-output-stream-for-target connection
  842
+                                                      :repl-result)))
  843
+    (when (eq (connection.communication-style connection) :spawn)
  844
+      (spawn (lambda () (auto-flush-loop out))
  845
+             :name "auto-flush-thread"))
  846
+    (values dedicated-output in out io repl-results)))
846 847
 
847 848
 (defvar *maximum-pipelined-output-chunks* 20)
848 849
 
@@ -874,10 +875,7 @@ DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
874 875
 
875 876
 (defun make-output-stream-for-target (connection target)
876 877
   "Create a stream that sends output to a specific TARGET in Emacs."
877  
-  (nth-value 1 (make-fn-streams 
878  
-                (lambda ()
879  
-                  (error "Should never be called"))
880  
-                (make-output-function-for-target connection target))))
  878
+  (make-output-stream (make-output-function-for-target connection target)))
881 879
 
882 880
 (defun open-dedicated-output-stream (socket-io)
883 881
   "Open a dedicated output connection to the Emacs on SOCKET-IO.

0 notes on commit ae18afc

Please sign in to comment.
Something went wrong with that request. Please try again.