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
((fluid $note-file-package) filename package) (lambda ()
(let ((o-port (current-noise-port))) (set! port (open-input-file truename)))
(display truename o-port) (lambda ()
(force-output o-port) ((fluid $note-file-package) filename package)
(really-read-forms port)))))) (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) (define (really-read-forms port)
(let loop ((forms '())) (let loop ((forms '()))