From 09f780617e69557ae49e6c451e7c112222e3e30d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 26 Feb 2004 19:05:06 +0000 Subject: [PATCH] INPUT-PORT/READ-STRING wasn't returning an EOF object when needed. --- v7/src/runtime/input.scm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/v7/src/runtime/input.scm b/v7/src/runtime/input.scm index 4b36248c7..6a4a304ff 100644 --- a/v7/src/runtime/input.scm +++ b/v7/src/runtime/input.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: input.scm,v 14.26 2004/02/16 05:36:44 cph Exp $ +$Id: input.scm,v 14.27 2004/02/26 19:05:06 cph Exp $ Copyright 1986,1987,1988,1989,1990,1991 Massachusetts Institute of Technology Copyright 1992,1993,1997,1999,2002,2003 Massachusetts Institute of Technology @@ -81,7 +81,7 @@ USA. (let loop ((a (make-accum 128))) (let ((char (input-port/read-char port))) (cond ((eof-object? char) - (if (fix:> (cdr a) 0) + (if (fix:> (accum-count a) 0) (accum->string a) char)) ((char=? char #\newline) (accum->string a)) @@ -93,7 +93,9 @@ USA. (let loop ((a (make-accum 128))) (let ((char (input-port/read-char port))) (cond ((eof-object? char) - (accum->string a)) + (if (fix:> (accum-count a) 0) + (accum->string a) + char)) ((char-set-member? delimiters char) (input-port/unread-char port char) (accum->string a)) @@ -128,6 +130,9 @@ USA. (set-string-maximum-length! (car a) (cdr a)) (car a)) +(define-integrable (accum-count a) + (cdr a)) + (define-record-type (make-eof-object port) eof-object? -- 2.25.1