From: Chris Hanson Date: Wed, 6 Oct 2004 18:46:59 +0000 (+0000) Subject: Implement better fix for READ-FINISH operation in ttyio. Export all X-Git-Tag: 20090517-FFI~1568 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=861c41340f7670489bb037a6f94f2427b7eec0ef;p=mit-scheme.git Implement better fix for READ-FINISH operation in ttyio. Export all of the PORT-TYPE/ operation accessors. --- diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index deaed3b35..6836707b1 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.497 2004/10/01 02:48:06 cph Exp $ +$Id: runtime.pkg,v 14.498 2004/10/06 18:46:55 cph Exp $ Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology @@ -1810,9 +1810,26 @@ USA. notification-output-port output-port-type? output-port? + port-type/char-ready? + port-type/discard-char + port-type/discretionary-flush-output + port-type/flush-output + port-type/fresh-line + port-type/get-transcript-port port-type/operation port-type/operation-names port-type/operations + port-type/peek-char + port-type/read-char + port-type/read-external-substring + port-type/read-substring + port-type/read-wide-substring + port-type/set-transcript-port + port-type/unread-char + port-type/write-char + port-type/write-external-substring + port-type/write-substring + port-type/write-wide-substring port-type? port/coding port/copy diff --git a/v7/src/runtime/ttyio.scm b/v7/src/runtime/ttyio.scm index c05886301..ba4229fef 100644 --- a/v7/src/runtime/ttyio.scm +++ b/v7/src/runtime/ttyio.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: ttyio.scm,v 1.19 2004/10/06 13:48:51 cph Exp $ +$Id: ttyio.scm,v 1.20 2004/10/06 18:46:59 cph Exp $ Copyright 1991,1993,1996,1999,2003,2004 Massachusetts Institute of Technology @@ -96,32 +96,28 @@ USA. (define console-input-port) (define console-output-port) -(define *exit-on-eof?* #t) - (define (operation/read-char port) (let ((char (generic-io/read-char port))) (if (eof-object? char) - (if *exit-on-eof?* - (begin - (if (not (nearest-cmdl/batch-mode?)) - (begin - (fresh-line port) - (write-string "End of input stream reached." port))) - (%exit))) - (maybe-echo-input port char)) + (begin + (if (not (nearest-cmdl/batch-mode?)) + (begin + (fresh-line port) + (write-string "End of input stream reached." port))) + (%exit))) + (maybe-echo-input port char) char)) (define (operation/read-finish port) - (fluid-let ((*exit-on-eof?* #f)) - (let loop () - (if (input-port/char-ready? port) - (let ((char (input-port/read-char port))) - (if (not (eof-object? char)) - (if (char-whitespace? char) - (begin - (maybe-echo-input port char) - (loop)) - (input-port/unread-char port char))))))) + (let loop () + (if ((port-type/char-ready? generic-i/o-type) port) + (let ((char ((port-type/read-char generic-i/o-type) port))) + (if (not (eof-object? char)) + (if (char-whitespace? char) + (begin + (maybe-echo-input port char) + (loop)) + ((port-type/unread-char generic-i/o-type) port char)))))) (output-port/discretionary-flush port)) (define (maybe-echo-input port char)