From: Chris Hanson Date: Wed, 12 Sep 2007 23:35:01 +0000 (+0000) Subject: Implement INPUT-PORT/EOF?. X-Git-Tag: 20090517-FFI~442 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9ee3c22d0dec9ddbcbc8ada139981d8b11d3a83c;p=mit-scheme.git Implement INPUT-PORT/EOF?. --- diff --git a/v7/src/runtime/input.scm b/v7/src/runtime/input.scm index 5ff127e8b..560acab08 100644 --- a/v7/src/runtime/input.scm +++ b/v7/src/runtime/input.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: input.scm,v 14.36 2007/07/07 17:22:19 cph Exp $ +$Id: input.scm,v 14.37 2007/09/12 23:35:00 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -139,6 +139,11 @@ USA. (define (eof-object? object) (eq? object (object-new-type (ucode-type constant) 6))) + +(define (input-port/eof? port) + (let ((eof? (port/operation port 'EOF?))) + (and eof? + (eof? port)))) ;;;; High level @@ -178,10 +183,8 @@ USA. (let ((port (optional-input-port port 'READ-CHAR-NO-HANG))) (if (input-port/char-ready? port) (input-port/read-char port) - (let ((eof? (port/operation port 'EOF?))) - (and eof? - (eof? port) - (eof-object)))))) + (and (input-port/eof? port) + (eof-object))))) (define (read-string delimiters #!optional port) (input-port/read-string (optional-input-port port 'READ-STRING) delimiters)) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index f7535d329..48ed51d0b 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.625 2007/08/10 19:07:13 cph Exp $ +$Id: runtime.pkg,v 14.626 2007/09/12 23:35:01 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -2052,6 +2052,7 @@ USA. eof-object? input-port/char-ready? input-port/discard-chars + input-port/eof? input-port/peek-char input-port/read-char input-port/read-external-string!