Permalink
Browse files

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

Update callers accordingly.
  • Loading branch information...
1 parent c13c596 commit ae18afc61627a04b5910b5b113042677085e1dd0 heller committed Aug 31, 2008
Showing with 34 additions and 69 deletions.
  1. +2 −0 ChangeLog
  2. +2 −6 swank-abcl.lisp
  3. +0 −11 swank-backend.lisp
  4. +1 −10 swank-cmucl.lisp
  5. +0 −7 swank-gray.lisp
  6. +8 −12 swank-scl.lisp
  7. +21 −23 swank.lisp
View
@@ -2,6 +2,8 @@
* swank-backend.lisp (*gray-stream-symbols*): Remove
stream-file-position because it's called stream-position in CCL.
+ (make-input-stream): Remove make-fn-streams.
+ Update callers accordingly.
2008-08-30 Helmut Eller <heller@common-lisp.net>
View
@@ -28,12 +28,8 @@
(ext:make-slime-output-stream write-string))
(defimplementation make-input-stream (read-string)
- (ext:make-slime-input-stream read-string))
-
-(defimplementation make-fn-streams (input-fn output-fn)
- (let* ((output (ext:make-slime-output-stream output-fn))
- (input (ext:make-slime-input-stream input-fn output)))
- (values input output)))
+ (ext:make-slime-input-stream read-string
+ (make-synonym-stream '*standard-output*)))
(defimplementation call-with-compilation-hooks (function)
(funcall function))
View
@@ -469,17 +469,6 @@ The stream calls WRITE-STRING when output is ready.")
"Return a new character input stream.
The stream calls READ-STRING when input is needed.")
-(definterface make-fn-streams (input-fn output-fn)
- "Return character input and output streams backended by functions.
-When input is needed, INPUT-FN is called with no arguments to
-return a string.
-When output is ready, OUTPUT-FN is called with the output as its
-argument.
-
-Output should be forced to OUTPUT-FN before calling INPUT-FN.
-
-The streams are returned as two values.")
-
;;;; Documentation
View
@@ -202,11 +202,6 @@ specific functions.")
(defimplementation make-input-stream (read-string)
(make-slime-input-stream read-string))
-(defimplementation make-fn-streams (input-fn output-fn)
- (let* ((output (make-slime-output-stream output-fn))
- (input (make-slime-input-stream input-fn output)))
- (values input output)))
-
(defstruct (slime-output-stream
(:include lisp::lisp-stream
(lisp::misc #'sos/misc)
@@ -298,16 +293,12 @@ specific functions.")
(lisp::misc #'sis/misc))
(:conc-name sis.)
(:print-function %print-slime-output-stream)
- (:constructor make-slime-input-stream (input-fn sos)))
+ (:constructor make-slime-input-stream (input-fn)))
(input-fn nil :type function)
- ;; We know our sibling output stream, so that we can force it before
- ;; requesting input.
- (sos nil :type slime-output-stream)
(buffer "" :type string)
(index 0 :type kernel:index))
(defun sis/in (stream eof-errorp eof-value)
- (finish-output (sis.sos stream))
(let ((index (sis.index stream))
(buffer (sis.buffer stream)))
(when (= index (length buffer))
View
@@ -164,10 +164,3 @@
(defimplementation make-input-stream (read-string)
(make-instance 'slime-input-stream :input-fn read-string))
-
-(defimplementation 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)))
- (values input output)))
View
@@ -100,19 +100,17 @@
(index :initarg :index :initform 0 :type fixnum)
(position :initarg :position :initform 0 :type integer)
(interactive :initarg :interactive :initform nil :type (member nil t))
- (output-stream :initarg :output-stream :initform nil)
(input-fn :initarg :input-fn :type function)
))
-(defun make-slime-input-stream (input-fn &optional output-stream)
+(defun make-slime-input-stream (input-fn)
(declare (function input-fn))
(make-instance 'slime-input-stream
:in-buffer (make-string 256)
:in-head 0 :in-tail 0
:out-buffer ""
:buffer "" :index 0
- :input-fn input-fn
- :output-stream output-stream))
+ :input-fn input-fn))
(defmethod print-object ((s slime-input-stream) stream)
(print-unreadable-object (s stream :type t)))
@@ -202,11 +200,8 @@
(incf (slot-value stream 'position) copy)
copy)
(waitp
- (let ((output-stream (slot-value stream 'output-stream))
- (input-fn (slot-value stream 'input-fn)))
+ (let ((input-fn (slot-value stream 'input-fn)))
(declare (type function input-fn))
- (when output-stream
- (force-output output-stream))
(let ((new-input (funcall input-fn)))
(cond ((zerop (length new-input))
-1)
@@ -344,10 +339,11 @@
;;;
-(defimplementation make-fn-streams (input-fn output-fn)
- (let* ((output (make-slime-output-stream output-fn))
- (input (make-slime-input-stream input-fn output)))
- (values input output)))
+(defimplementation make-output-stream (output-fn)
+ (make-slime-output-stream output-fn))
+
+(defimplementation make-input-stream (input-fn)
+ (make-slime-input-stream input-fn))
;;;; Compilation Commands
View
@@ -824,25 +824,26 @@ if the file doesn't exist; otherwise the first line of the file."
(defun open-streams (connection)
"Return the 5 streams for IO redirection:
DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
- (let ((output-fn (make-output-function connection))
- (input-fn
- (lambda ()
- (with-connection (connection)
- (with-simple-restart (abort-read
- "Abort reading input from Emacs.")
- (read-user-input-from-emacs))))))
- (multiple-value-bind (in out) (make-fn-streams input-fn output-fn)
- (let* ((dedicated-output (if *use-dedicated-output-stream*
- (open-dedicated-output-stream
- (connection.socket-io connection))))
- (out (or dedicated-output out))
- (io (make-two-way-stream in out))
- (repl-results (make-output-stream-for-target connection
- :repl-result)))
- (when (eq (connection.communication-style connection) :spawn)
- (spawn (lambda () (auto-flush-loop out))
- :name "auto-flush-thread"))
- (values dedicated-output in out io repl-results)))))
+ (let* ((output-fn (make-output-function connection))
+ (input-fn
+ (lambda ()
+ (with-connection (connection)
+ (with-simple-restart (abort-read
+ "Abort reading input from Emacs.")
+ (read-user-input-from-emacs)))))
+ (dedicated-output (if *use-dedicated-output-stream*
+ (open-dedicated-output-stream
+ (connection.socket-io connection))))
+ (out (make-output-stream output-fn))
+ (in (make-input-stream input-fn))
+ (out (or dedicated-output out))
+ (io (make-two-way-stream in out))
+ (repl-results (make-output-stream-for-target connection
+ :repl-result)))
+ (when (eq (connection.communication-style connection) :spawn)
+ (spawn (lambda () (auto-flush-loop out))
+ :name "auto-flush-thread"))
+ (values dedicated-output in out io repl-results)))
(defvar *maximum-pipelined-output-chunks* 20)
@@ -874,10 +875,7 @@ DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
(defun make-output-stream-for-target (connection target)
"Create a stream that sends output to a specific TARGET in Emacs."
- (nth-value 1 (make-fn-streams
- (lambda ()
- (error "Should never be called"))
- (make-output-function-for-target connection target))))
+ (make-output-stream (make-output-function-for-target connection target)))
(defun open-dedicated-output-stream (socket-io)
"Open a dedicated output connection to the Emacs on SOCKET-IO.

0 comments on commit ae18afc

Please sign in to comment.