Replace half-assed DYNAMIC-WIND protection of input port by the one

Richard Kelsey suggested for Scheme 48.
This commit is contained in:
sperber 2002-12-17 13:50:14 +00:00
parent 91002918fc
commit 69a2031350
1 changed files with 5 additions and 3 deletions

View File

@ -13,10 +13,11 @@
(define (read-forms pathname package)
(let* ((filename (namestring pathname #f *scheme-file-type*))
(truename (translate filename))
(port #f))
(port (open-input-file truename)))
(dynamic-wind
(lambda ()
(set! port (open-input-file truename)))
(if (not port)
(error "attempt to throw back into a file read"))) ; message needs work
(lambda ()
((fluid $note-file-package) filename package)
(let ((o-port (current-noise-port)))
@ -24,7 +25,8 @@
(force-output o-port)
(really-read-forms port)))
(lambda ()
(close-input-port port)))))
(close-input-port port)
(set! port #f)))))
(define (really-read-forms port)
(let loop ((forms '()))