Implement better fix for READ-FINISH operation in ttyio. Export all
authorChris Hanson <org/chris-hanson/cph>
Wed, 6 Oct 2004 18:46:59 +0000 (18:46 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 6 Oct 2004 18:46:59 +0000 (18:46 +0000)
of the PORT-TYPE/ operation accessors.

v7/src/runtime/runtime.pkg
v7/src/runtime/ttyio.scm

index deaed3b350cfd0fc9e8a1d843ed792b2c6c72713..6836707b163a37b31afd5e2beac3b9c4fc440a17 100644 (file)
@@ -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
index c058863015d7768d713db20b3f44d9450df08e32..ba4229fefed9cbf87f888851f9268cba1600f29c 100644 (file)
@@ -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)
 \f
-(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)