In READ-FORMS, open/close input port in DYNAMIC-WIND before/after

thunks.
This commit is contained in:
sperber 2002-12-16 11:00:11 +00:00
parent 196efa4e85
commit 4c90a345ec
1 changed files with 13 additions and 8 deletions

View File

@ -12,14 +12,19 @@
(define (read-forms pathname package)
(let* ((filename (namestring pathname #f *scheme-file-type*))
(truename (translate filename)))
(call-with-input-file truename
(lambda (port)
((fluid $note-file-package) filename package)
(let ((o-port (current-noise-port)))
(display truename o-port)
(force-output o-port)
(really-read-forms port))))))
(truename (translate filename))
(port #f))
(dynamic-wind
(lambda ()
(set! port (open-input-file truename)))
(lambda ()
((fluid $note-file-package) filename package)
(let ((o-port (current-noise-port)))
(display truename o-port)
(force-output o-port)
(really-read-forms port)))
(lambda ()
(close-input-port port)))))
(define (really-read-forms port)
(let loop ((forms '()))