\f
(define (make-console-screen)
(let ((description (console-termcap-description)))
- (cond ((not (output-port/baud-rate console-i/o-port))
+ (cond ((not (output-port/baud-rate (console-i/o-port)))
(error "standard output not a terminal"))
((not description)
(error "terminal type not set"))
((not (no-undesirable-characteristics? description))
(error "terminal type has undesirable characteristics"
(terminal-type-name description))))
- (let ((baud-rate (output-port/baud-rate console-i/o-port))
- (x-size (output-port/x-size console-i/o-port))
- (y-size (output-port/y-size console-i/o-port)))
+ (let ((baud-rate (output-port/baud-rate (console-i/o-port)))
+ (x-size (output-port/x-size (console-i/o-port)))
+ (y-size (output-port/y-size (console-i/o-port))))
(make-screen (with-values
(lambda ()
(compute-scrolling-costs description
(set! console-description
(let ((term (get-environment-variable "TERM")))
(and term
- (or (and (output-port/baud-rate console-i/o-port)
+ (or (and (output-port/baud-rate (console-i/o-port))
(make-termcap-description term))
term)))))
console-description)
;; terminal's special key sequences against the buffer. They wait a
;; little-while for incomplete sequences, then yield the individual
;; characters.
- (let ((channel (port/input-channel console-i/o-port))
+ (let ((channel (port/input-channel (console-i/o-port)))
(buffer (make-string (* 3 input-buffer-size)))
(start 0)
(end 0)
(bind-console-state false
(lambda (get-outside-state)
(terminal-operation terminal-raw-input
- (port/input-channel console-i/o-port))
- (channel-nonblocking (port/input-channel console-i/o-port))
+ (port/input-channel (console-i/o-port)))
+ (channel-nonblocking (port/input-channel (console-i/o-port)))
(terminal-operation terminal-raw-output
- (port/output-channel console-i/o-port))
+ (port/output-channel (console-i/o-port)))
(tty-set-interrupt-enables 2)
(receiver
(lambda (thunk)
(set-console-state! outside-state)))))
(define (console-state)
- (vector (channel-state (port/input-channel console-i/o-port))
- (channel-state (port/output-channel console-i/o-port))
+ (vector (channel-state (port/input-channel (console-i/o-port)))
+ (channel-state (port/output-channel (console-i/o-port)))
(tty-get-interrupt-enables)))
(define (set-console-state! state)
- (set-channel-state! (port/input-channel console-i/o-port)
+ (set-channel-state! (port/input-channel (console-i/o-port))
(vector-ref state 0))
- (set-channel-state! (port/output-channel console-i/o-port)
+ (set-channel-state! (port/output-channel (console-i/o-port))
(vector-ref state 1))
(tty-set-interrupt-enables (vector-ref state 2)))
(exit-insert-mode screen)
(maybe-output screen (ts-exit-keypad-mode description))
(maybe-output screen (ts-exit-termcap-mode description)))
- (output-port/flush-output console-i/o-port))
+ (output-port/flush-output (console-i/o-port)))
(define (console-modeline-event! screen window type)
screen window type
(define (console-wrap-update! screen thunk)
(let ((finished? (thunk)))
(window-direct-output-cursor! (screen-cursor-window screen))
- (output-port/flush-output console-i/o-port)
+ (output-port/flush-output (console-i/o-port))
finished?))
(define (console-discretionary-flush screen)
- (let ((n (output-port/buffered-bytes console-i/o-port)))
+ (let ((n (output-port/buffered-bytes (console-i/o-port))))
(if (fix:< 20 n)
(begin
- (output-port/flush-output console-i/o-port)
+ (output-port/flush-output (console-i/o-port))
(let ((baud-rate (screen-baud-rate screen)))
(if (fix:< baud-rate 2400)
(let ((msec (quotient (* n 10000) baud-rate)))
(define (console-flush! screen)
screen
- (output-port/flush-output console-i/o-port))
+ (output-port/flush-output (console-i/o-port)))
\f
(define (console-write-cursor! screen x y)
(move-cursor screen x y))
(exit-insert-mode screen)
(move-cursor screen x y)
(highlight-if-desired screen highlight)
- (output-port/write-char console-i/o-port char)
+ (output-port/write-char (console-i/o-port) char)
(record-cursor-after-output screen (fix:1+ x)))))
(define (console-write-substring! screen x y string start end highlight)
(screen-x-size screen))))
(fix:-1+ end)
end)))
- (output-port/write-substring console-i/o-port string start end)
+ (output-port/write-substring (console-i/o-port) string start end)
(record-cursor-after-output screen (fix:+ x (fix:- end start)))))))
(define (console-clear-line! screen x y first-unused-x)
first-unused-x)))
(do ((x (screen-cursor-x screen) (fix:1+ x)))
((fix:= x first-unused-x))
- (output-port/write-char console-i/o-port #\space))
+ (output-port/write-char (console-i/o-port) #\space))
(record-cursor-after-output screen first-unused-x)))))))
(define (clear-multi-char screen n)
x-end))))
(do ((x cursor-x (fix:1+ x)))
((fix:= x x-end))
- (output-port/write-char console-i/o-port #\space))
+ (output-port/write-char (console-i/o-port) #\space))
(record-cursor-after-output screen x-end))))))))
\f
(define (insert-lines screen yl yu n)
(output-n screen command 1))
(define-integrable (output-n screen command n-lines)
- (output-port/write-string console-i/o-port
+ (output-port/write-string (console-i/o-port)
(pad-string screen command n-lines)))
(define (maybe-output screen command)
(state (screen-state screen)))
(if (not (terminal-state? state))
(editor-error "Not a terminal screen")
- (let ((port console-i/o-port)
+ (let ((port (console-i/o-port))
(desc (terminal-state/description state)))
(let ((x-size (output-port/x-size port))
(y-size (output-port/y-size port)))
(set-channel-port! input-channel port)
(set-channel-port! output-channel port)
(set! the-console-port port)
- (set-console-i/o-port! port)
(current-input-port port)
(current-output-port port))))
(set! port/echo-input? (generic-i/o-port-accessor 0))
(define (save-console-input)
((ucode-primitive reload-save-string 1)
- (generic-io/buffer-contents console-input-port)))
+ (generic-io/buffer-contents the-console-port)))
(define (reset-console)
(let ((input-channel (tty-input-channel))
(default-object)
(channel-type=file? input-channel)))
-(define (set-console-i/o-port! port)
- (if (not (i/o-port? port))
- (error:wrong-type-argument port "I/O port" 'set-console-i/o-port!))
- (set! console-i/o-port port)
- (set! console-input-port port)
- (set! console-output-port port)
- unspecific)
+(define (console-i/o-port)
+ the-console-port)
(define (console-i/o-port? port)
- (eqv? port console-i/o-port))
+ (eqv? port the-console-port))
(define the-console-port)
-(define console-i/o-port)
-(define console-input-port)
-(define console-output-port)
\f
(define (operation/read-char port)
(let ((char (generic-io/read-char port)))