From 8d2016b0dd24721e92568606debe7daf943c1c77 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 11 Jan 2004 07:18:05 +0000 Subject: [PATCH] Eliminate INPUT-BUFFER/DISCARD-CHAR, which couldn't be used with non-blocking input ports because there was no way to tell whether the char was discarded. Instead, use INPUT-BUFFER/READ-CHAR in its place, which is only slightly slower and does provide this indication. --- v7/src/runtime/genio.scm | 9 +++------ v7/src/runtime/io.scm | 16 ++-------------- v7/src/runtime/runtime.pkg | 3 +-- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/v7/src/runtime/genio.scm b/v7/src/runtime/genio.scm index dbea9fd7f..e25dee6e9 100644 --- a/v7/src/runtime/genio.scm +++ b/v7/src/runtime/genio.scm @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Id: genio.scm,v 1.19 2003/03/21 17:50:58 cph Exp $ +$Id: genio.scm,v 1.20 2004/01/11 07:17:57 cph Exp $ Copyright 1991,1993,1995,1996,1999,2002 Massachusetts Institute of Technology -Copyright 2003 Massachusetts Institute of Technology +Copyright 2003,2004 Massachusetts Institute of Technology This file is part of MIT/GNU Scheme. @@ -35,7 +35,7 @@ USA. (CHAR-READY? ,operation/char-ready?) (CHARS-REMAINING ,operation/chars-remaining) (CLOSE-INPUT ,operation/close-input) - (DISCARD-CHAR ,operation/discard-char) + (DISCARD-CHAR ,operation/read-char) (DISCARD-CHARS ,operation/discard-chars) (EOF? ,operation/eof?) (INPUT-BLOCKING-MODE ,operation/input-blocking-mode) @@ -167,9 +167,6 @@ USA. (define (operation/chars-remaining port) (input-buffer/chars-remaining (port/input-buffer port))) -(define (operation/discard-char port) - (input-buffer/discard-char (port/input-buffer port))) - (define (operation/discard-chars port delimiters) (input-buffer/discard-until-delimiter (port/input-buffer port) delimiters)) diff --git a/v7/src/runtime/io.scm b/v7/src/runtime/io.scm index b5ea8fe0f..b599913fb 100644 --- a/v7/src/runtime/io.scm +++ b/v7/src/runtime/io.scm @@ -1,10 +1,10 @@ #| -*-Scheme-*- -$Id: io.scm,v 14.76 2003/11/11 01:53:38 cph Exp $ +$Id: io.scm,v 14.77 2004/01/11 07:18:01 cph Exp $ Copyright 1986,1987,1988,1990,1991,1993 Massachusetts Institute of Technology Copyright 1994,1995,1998,1999,2000,2001 Massachusetts Institute of Technology -Copyright 2002,2003 Massachusetts Institute of Technology +Copyright 2002,2003,2004 Massachusetts Institute of Technology This file is part of MIT/GNU Scheme. @@ -994,18 +994,6 @@ USA. ((fix:= n 0) eof-object) (else (string-ref (input-buffer/string buffer) 0)))))))))) - -(define (input-buffer/discard-char buffer) - (without-interrupts - (lambda () - (let ((start-index (input-buffer/start-index buffer))) - (cond ((fix:< start-index (input-buffer/end-index buffer)) - (set-input-buffer/start-index! buffer (fix:+ start-index 1))) - ((input-buffer/open? buffer) - (if (let ((n (input-buffer/fill buffer))) - (and n - (not (fix:= n 0)))) - (set-input-buffer/start-index! buffer 1)))))))) (define (input-buffer/read-substring buffer string start end) (define (transfer-input-buffer index) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index 560f71878..d94aad8bb 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.471 2004/01/09 21:12:19 cph Exp $ +$Id: runtime.pkg,v 14.472 2004/01/11 07:18:05 cph Exp $ Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology @@ -2592,7 +2592,6 @@ USA. input-buffer/char-ready? input-buffer/chars-remaining input-buffer/close - input-buffer/discard-char input-buffer/discard-until-delimiter input-buffer/eof? input-buffer/open? -- 2.25.1