Add "slow mode" to editor loosely simulating a 9600 baud serial line
This commit is contained in:
parent
c2fde9fdd0
commit
8173da5d08
1 changed files with 7 additions and 1 deletions
|
@ -11,6 +11,9 @@
|
||||||
(require '#:sb-posix)
|
(require '#:sb-posix)
|
||||||
|
|
||||||
(defvar *eio*)
|
(defvar *eio*)
|
||||||
|
(defparameter *slow-mode-p* nil
|
||||||
|
"Slows down the sending of characters to the terminal to simulate the slow
|
||||||
|
serial connection the editor normally runs under.")
|
||||||
|
|
||||||
(defclass hybrid-stream (fundamental-stream)
|
(defclass hybrid-stream (fundamental-stream)
|
||||||
((%input-stream :accessor input-stream :initarg :input-stream)
|
((%input-stream :accessor input-stream :initarg :input-stream)
|
||||||
|
@ -29,7 +32,10 @@
|
||||||
(sb-posix:file-descriptor (output-stream stream)))
|
(sb-posix:file-descriptor (output-stream stream)))
|
||||||
|
|
||||||
(defmethod stream-write-byte ((stream hybrid-stream) integer)
|
(defmethod stream-write-byte ((stream hybrid-stream) integer)
|
||||||
(write-byte integer (output-stream stream)))
|
(write-byte integer (output-stream stream))
|
||||||
|
(when *slow-mode-p*
|
||||||
|
(force-output stream)
|
||||||
|
(sleep 10/9600)))
|
||||||
|
|
||||||
(defmethod stream-write-char ((stream hybrid-stream) character)
|
(defmethod stream-write-char ((stream hybrid-stream) character)
|
||||||
(if (char= character #\Newline)
|
(if (char= character #\Newline)
|
||||||
|
|
Loading…
Add table
Reference in a new issue