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) (define (read-forms pathname package)
(let* ((filename (namestring pathname #f *scheme-file-type*)) (let* ((filename (namestring pathname #f *scheme-file-type*))
(truename (translate filename))) (truename (translate filename))
(call-with-input-file truename (port #f))
(lambda (port) (dynamic-wind
(lambda ()
(set! port (open-input-file truename)))
(lambda ()
((fluid $note-file-package) filename package) ((fluid $note-file-package) filename package)
(let ((o-port (current-noise-port))) (let ((o-port (current-noise-port)))
(display truename o-port) (display truename o-port)
(force-output o-port) (force-output o-port)
(really-read-forms port)))))) (really-read-forms port)))
(lambda ()
(close-input-port port)))))
(define (really-read-forms port) (define (really-read-forms port)
(let loop ((forms '())) (let loop ((forms '()))