From: Chris Hanson Date: Fri, 9 Nov 1990 08:56:28 +0000 (+0000) Subject: Change peek-char, read-char, and read-string operations to return EOF X-Git-Tag: 20090517-FFI~11088 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d9bf2214e2c91e234c9e8c22806c6c76ed56e1b4;p=mit-scheme.git Change peek-char, read-char, and read-string operations to return EOF objects when they reach the end of the input region. This is an incompatible change required by runtime system version 14.101. --- diff --git a/v7/src/edwin/bufinp.scm b/v7/src/edwin/bufinp.scm index afbcdc909..8b5592c1b 100644 --- a/v7/src/edwin/bufinp.scm +++ b/v7/src/edwin/bufinp.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufinp.scm,v 1.2 1989/04/28 22:47:26 cph Rel $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufinp.scm,v 1.3 1990/11/09 08:56:14 cph Rel $ ;;; -;;; Copyright (c) 1986, 1989 Massachusetts Institute of Technology +;;; Copyright (c) 1986, 1989, 1990 Massachusetts Institute of Technology ;;; ;;; This material was developed by the Scheme project at the ;;; Massachusetts Institute of Technology, Department of @@ -85,9 +85,10 @@ (define (operation/peek-char port) (let ((state (input-port/state port))) (let ((current-index (buffer-input-port-state/current-index state))) - (and (< current-index (buffer-input-port-state/end-index state)) - (group-right-char (buffer-input-port-state/group state) - current-index))))) + (if (< current-index (buffer-input-port-state/end-index state)) + (group-right-char (buffer-input-port-state/group state) + current-index) + (make-eof-object port))))) (define (operation/discard-char port) (let ((state (input-port/state port))) @@ -98,13 +99,14 @@ (define (operation/read-char port) (let ((state (input-port/state port))) (let ((current-index (buffer-input-port-state/current-index state))) - (and (< current-index (buffer-input-port-state/end-index state)) - (let ((char - (group-right-char (buffer-input-port-state/group state) - current-index))) - (set-buffer-input-port-state/current-index! state - (1+ current-index)) - char))))) + (if (< current-index (buffer-input-port-state/end-index state)) + (let ((char + (group-right-char (buffer-input-port-state/group state) + current-index))) + (set-buffer-input-port-state/current-index! state + (1+ current-index)) + char) + (make-eof-object port))))) (define (operation/read-string port delimiters) (let ((state (input-port/state port))) @@ -112,7 +114,7 @@ (end-index (buffer-input-port-state/end-index state)) (group (buffer-input-port-state/group state))) (if (>= current-index end-index) - "" + (make-eof-object port) (let ((new-index (or (%find-next-char-in-set group current-index end-index delimiters) diff --git a/v7/src/edwin/make.scm b/v7/src/edwin/make.scm index 3209885d3..ddca76c2f 100644 --- a/v7/src/edwin/make.scm +++ b/v7/src/edwin/make.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/make.scm,v 3.22 1990/11/02 04:19:34 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/make.scm,v 3.23 1990/11/09 08:56:28 cph Exp $ Copyright (c) 1989, 1990 Massachusetts Institute of Technology @@ -37,4 +37,4 @@ MIT in each case. |# (declare (usual-integrations)) (package/system-loader "edwin" '() 'QUERY) -(add-system! (make-system "Edwin" 3 22 '())) \ No newline at end of file +(add-system! (make-system "Edwin" 3 23 '())) \ No newline at end of file