From: Chris Hanson Date: Sat, 7 Jul 2007 17:22:19 +0000 (+0000) Subject: Implement and use EOF-OBJECT procedure. X-Git-Tag: 20090517-FFI~499 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=31b67d74cfe90f46895a9e6db39d867852ad3457;p=mit-scheme.git Implement and use EOF-OBJECT procedure. --- diff --git a/v7/src/edwin/bufinp.scm b/v7/src/edwin/bufinp.scm index f0572da95..b11462aa9 100644 --- a/v7/src/edwin/bufinp.scm +++ b/v7/src/edwin/bufinp.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: bufinp.scm,v 1.15 2007/01/05 21:19:23 cph Exp $ +$Id: bufinp.scm,v 1.16 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -89,7 +89,7 @@ USA. (let ((char (group-right-char (bstate-group state) start))) (set-bstate-start! state (fix:+ start 1)) char) - (make-eof-object port)))))) + (eof-object)))))) (WRITE-SELF ,(lambda (port output) (write-string " from buffer at " output) diff --git a/v7/src/imail/imail-rmail.scm b/v7/src/imail/imail-rmail.scm index 7dac1a331..18813471f 100644 --- a/v7/src/imail/imail-rmail.scm +++ b/v7/src/imail/imail-rmail.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: imail-rmail.scm,v 1.75 2007/01/05 21:19:25 cph Exp $ +$Id: imail-rmail.scm,v 1.76 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -365,7 +365,7 @@ USA. (if (eqv? rmail-message:end-char (peek-char port)) (begin (read-char port) ;discard - (make-eof-object port)) + (eof-object)) (read-required-line port))))) (define (read-to-eom port) diff --git a/v7/src/imail/imail-util.scm b/v7/src/imail/imail-util.scm index 73c61c6ee..e8b311daa 100644 --- a/v7/src/imail/imail-util.scm +++ b/v7/src/imail/imail-util.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: imail-util.scm,v 1.49 2007/04/01 17:33:07 riastradh Exp $ +$Id: imail-util.scm,v 1.50 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -52,7 +52,7 @@ USA. (let ((item (car items))) (set! items (cdr items)) item) - (make-eof-object #f)))) + (eof-object)))) (define (cut-list! items predicate) (if (or (not (pair? items)) (predicate (car items))) @@ -526,7 +526,7 @@ USA. (if (read-xstring-buffer state) (loop p) p))))))) - (make-eof-object port)))) + (eof-object)))) (define xstring-input-type (make-port-type @@ -541,7 +541,7 @@ USA. (- position (istate-buffer-start state))))) (set-istate-position! state (+ position 1)) char) - (make-eof-object port)))))) + (eof-object)))))) (EOF? ,(lambda (port) (let ((state (port/state port))) diff --git a/v7/src/runtime/genio.scm b/v7/src/runtime/genio.scm index 4aba4faf9..e3a100cee 100644 --- a/v7/src/runtime/genio.scm +++ b/v7/src/runtime/genio.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: genio.scm,v 1.52 2007/05/01 14:12:52 cph Exp $ +$Id: genio.scm,v 1.53 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -189,7 +189,7 @@ USA. (case r ((OK) (loop)) ((WOULD-BLOCK) #f) - ((EOF) (make-eof-object port)) + ((EOF) (eof-object)) (else (error "Unknown result:" r)))))))) (define (generic-io/read-substring port string start end) diff --git a/v7/src/runtime/input.scm b/v7/src/runtime/input.scm index 7e887ea86..5ff127e8b 100644 --- a/v7/src/runtime/input.scm +++ b/v7/src/runtime/input.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: input.scm,v 14.35 2007/06/06 19:42:42 cph Exp $ +$Id: input.scm,v 14.36 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -132,6 +132,9 @@ USA. (define (make-eof-object port) port + (eof-object)) + +(define (eof-object) (object-new-type (ucode-type constant) 6)) (define (eof-object? object) @@ -178,7 +181,7 @@ USA. (let ((eof? (port/operation port 'EOF?))) (and eof? (eof? port) - (make-eof-object 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/parse.scm b/v7/src/runtime/parse.scm index 04de22faf..f9b5fa22d 100644 --- a/v7/src/runtime/parse.scm +++ b/v7/src/runtime/parse.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: parse.scm,v 14.66 2007/01/09 06:16:49 cph Exp $ +$Id: parse.scm,v 14.67 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -529,7 +529,7 @@ USA. ((string-ci=? name "rest") lambda-rest-tag) ((string-ci=? name "key") lambda-key-tag) ((string-ci=? name "aux") lambda-aux-tag) - ((string-ci=? name "eof") (make-eof-object #f)) + ((string-ci=? name "eof") (eof-object)) ((string-ci=? name "default") (default-object)) ((string-ci=? name "unspecific") unspecific) (else (error:illegal-named-constant name))))) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index 4dae1f7f0..77729b2c0 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.619 2007/06/07 15:12:17 cph Exp $ +$Id: runtime.pkg,v 14.620 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -2046,6 +2046,7 @@ USA. (discard-char read-char) (input-port/discard-char input-port/read-char) char-ready? + eof-object eof-object? input-port/char-ready? input-port/discard-chars diff --git a/v7/src/runtime/unicode.scm b/v7/src/runtime/unicode.scm index 4b57278be..ea5c28061 100644 --- a/v7/src/runtime/unicode.scm +++ b/v7/src/runtime/unicode.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: unicode.scm,v 1.33 2007/05/07 05:32:24 cph Exp $ +$Id: unicode.scm,v 1.34 2007/07/07 17:22:19 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -1242,7 +1242,7 @@ USA. `((READ-CHAR ,(lambda (port) (or ((port/state port)) - (make-eof-object port)))) + (eof-object)))) (WRITE-SELF ,(lambda (port output-port) port