;;; -*-Scheme-*-
;;;
-;;;$Id: bufinp.scm,v 1.6 1999/02/16 20:12:24 cph Exp $
+;;;$Id: bufinp.scm,v 1.7 1999/02/18 04:14:41 cph Exp $
;;;
;;; Copyright (c) 1986, 1989-1999 Massachusetts Institute of Technology
;;;
value
(receiver
value
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(make-mark (buffer-input-port-state/group state)
(buffer-input-port-state/current-index state))))))))
(define (operation/char-ready? port interval)
interval ;ignore
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(< (buffer-input-port-state/current-index state)
(buffer-input-port-state/end-index state))))
(define (operation/peek-char port)
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(let ((current-index (buffer-input-port-state/current-index state)))
(if (< current-index (buffer-input-port-state/end-index state))
(group-right-char (buffer-input-port-state/group state)
(make-eof-object port)))))
(define (operation/discard-char port)
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(set-buffer-input-port-state/current-index!
state
(1+ (buffer-input-port-state/current-index state)))))
\f
(define (operation/read-char port)
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(let ((current-index (buffer-input-port-state/current-index state)))
(if (< current-index (buffer-input-port-state/end-index state))
(let ((char
(make-eof-object port)))))
(define (operation/read-string port delimiters)
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(let ((current-index (buffer-input-port-state/current-index state))
(end-index (buffer-input-port-state/end-index state))
(group (buffer-input-port-state/group state)))
string))))))
(define (operation/discard-chars port delimiters)
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(let ((current-index (buffer-input-port-state/current-index state))
(end-index (buffer-input-port-state/end-index state)))
(if (< current-index end-index)
(unparse-string state "from buffer at ")
(unparse-object
state
- (let ((state (input-port/state port)))
+ (let ((state (port/state port)))
(make-mark (buffer-input-port-state/group state)
(buffer-input-port-state/current-index state)))))
#| -*-Scheme-*-
-$Id: tterm.scm,v 1.29 1999/02/18 04:04:05 cph Exp $
+$Id: tterm.scm,v 1.30 1999/02/18 04:14:36 cph Exp $
Copyright (c) 1990-1999 Massachusetts Institute of Technology
\f
(define (make-console-screen)
(let ((description (console-termcap-description)))
- (cond ((not (output-port/baud-rate console-output-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-output-port))
- (x-size (output-port/x-size console-output-port))
- (y-size (output-port/y-size console-output-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
(tty-set-interrupt-enables 1))
(define (output-port/baud-rate port)
- (let ((channel (output-port/channel port)))
+ (let ((channel (port/output-channel port)))
(and channel
(channel-type=terminal? channel)
(terminal-output-baud-rate channel))))
0)))
(define (output-port/y-size port)
- ((output-port/custom-operation port 'Y-SIZE) port))
+ ((output-port/operation port 'Y-SIZE) port))
(define (console-available?)
(let ((description (console-termcap-description)))
(set! console-description
(let ((term (get-environment-variable "TERM")))
(and term
- (or (and (output-port/baud-rate console-output-port)
+ (or (and (output-port/baud-rate console-i/o-port)
(make-termcap-description term))
term)))))
console-description)
)))
\f
(define (get-console-input-operations terminal-state)
- (let ((channel (input-port/channel console-input-port))
+ (let ((channel (port/input-channel console-i/o-port))
(string (make-string (* 3 input-buffer-size)))
(start 0)
(end 0)
(bind-console-state false
(lambda (get-outside-state)
(terminal-operation terminal-raw-input
- (input-port/channel console-input-port))
+ (port/input-channel console-i/o-port))
(terminal-operation terminal-raw-output
- (output-port/channel console-output-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 (input-port/channel console-input-port))
- (channel-state (output-port/channel console-output-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! (input-port/channel console-input-port)
+ (set-channel-state! (port/input-channel console-i/o-port)
(vector-ref state 0))
- (set-channel-state! (output-port/channel console-output-port)
+ (set-channel-state! (port/output-channel console-i/o-port)
(vector-ref state 1))
(tty-set-interrupt-enables (vector-ref state 2)))
(exit-standout-mode screen)
(exit-insert-mode screen)
(maybe-output screen (ts-exit-termcap-mode description)))
- (output-port/flush-output console-output-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)
screen
(let ((finished? (thunk)))
- (output-port/flush-output console-output-port)
+ (output-port/flush-output console-i/o-port)
finished?))
(define (console-discretionary-flush screen)
- (let ((n (output-port/buffered-chars console-output-port)))
+ (let ((n (output-port/buffered-chars console-i/o-port)))
(if (fix:< 20 n)
(begin
- (output-port/flush-output console-output-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-output-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-output-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-output-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-output-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-output-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-output-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-output-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)))
#| -*-Scheme-*-
-$Id: dosproc.scm,v 1.2 1999/01/02 06:11:34 cph Exp $
+$Id: dosproc.scm,v 1.3 1999/02/18 04:14:10 cph Exp $
Copyright (c) 1992-1999 Massachusetts Institute of Technology
(lambda (port*)
(recvr
(channel-descriptor
- (output-port/channel port*)))))))
+ (port/output-channel port*)))))))
(call-with-input-file fname
(lambda (input)
(let ((string (read-string (char-set) input)))
(lambda (port*)
(recvr
(channel-descriptor
- (input-port/channel port*))))))))
+ (port/input-channel port*))))))))
(define (with-output-channel in out)
(cond ((default-object? stderr)
(run in out -1))
((not (output-port? stderr))
(error "run: stderr not an output port" stderr))
- ((output-port/channel stderr)
+ ((port/output-channel stderr)
=>
(lambda (channel)
(output-port/flush-output stderr)
(with-output-channel in -1))
((not (output-port? stdout))
(error "run: stdout not an output port" stdout))
- ((output-port/channel stdout)
+ ((port/output-channel stdout)
=>
(lambda (channel)
(output-port/flush-output stdout)
(with-input-channel -1))
((not (input-port? stdin))
(error "run: stdin not an input port" stdin))
- ((input-port/channel stdin)
+ ((port/input-channel stdin)
=> (lambda (channel)
(with-input-channel (channel-descriptor channel))))
(else
#| -*-Scheme-*-
-$Id: strnin.scm,v 14.6 1999/02/16 20:11:55 cph Exp $
+$Id: strnin.scm,v 14.7 1999/02/18 04:14:22 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
(end #f read-only #t))
(define-integrable (input-port/string port)
- (input-string-state/string (input-port/state port)))
+ (input-string-state/string (port/state port)))
(define-integrable (input-port/start port)
- (input-string-state/start (input-port/state port)))
+ (input-string-state/start (port/state port)))
(define-integrable (set-input-port/start! port index)
- (set-input-string-state/start! (input-port/state port) index))
+ (set-input-string-state/start! (port/state port) index))
(define-integrable (input-port/end port)
- (input-string-state/end (input-port/state port)))
+ (input-string-state/end (port/state port)))
\f
(define (operation/char-ready? port interval)
interval
#| -*-Scheme-*-
-$Id: strott.scm,v 14.7 1999/02/16 20:11:51 cph Exp $
+$Id: strott.scm,v 14.8 1999/02/18 04:14:19 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
counter)
(define (operation/write-char port char)
- (let ((state (output-port/state port)))
+ (let ((state (port/state port)))
(let ((accumulator (output-string-state/accumulator state))
(counter (output-string-state/counter state)))
(if (zero? counter)
(set-output-string-state/counter! state (-1+ counter)))))))
(define (operation/write-substring port string start end)
- (let ((state (output-port/state port)))
+ (let ((state (port/state port)))
(let ((accumulator
(cons (substring string start end)
(output-string-state/accumulator state)))
#| -*-Scheme-*-
-$Id: strout.scm,v 14.10 1999/02/16 20:11:47 cph Exp $
+$Id: strout.scm,v 14.11 1999/02/18 04:14:15 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
(define (operation/write-char port char)
(without-interrupts
(lambda ()
- (let* ((state (output-port/state port))
+ (let* ((state (port/state port))
(n (output-string-state/counter state))
(n* (fix:+ n 1)))
(if (fix:= (string-length (output-string-state/accumulator state)) n)
(define (operation/write-substring port string start end)
(without-interrupts
(lambda ()
- (let* ((state (output-port/state port))
+ (let* ((state (port/state port))
(n (output-string-state/counter state))
(n* (fix:+ n (fix:- end start))))
(if (fix:> n* (string-length (output-string-state/accumulator state)))
#| -*-Scheme-*-
-$Id: load.scm,v 14.53 1999/01/02 06:11:34 cph Exp $
+$Id: load.scm,v 14.54 1999/02/18 04:14:03 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
(define (with-binary-input-file file action)
(with-binary-file-channel file action
open-binary-input-file
- input-port/channel
+ port/input-channel
'with-binary-input-file))
(define (with-binary-file-channel file action open extract-channel name)