From 4c90a345ecfa2aacdfd8457c062a36dfc2751e73 Mon Sep 17 00:00:00 2001 From: sperber Date: Mon, 16 Dec 2002 11:00:11 +0000 Subject: [PATCH] In READ-FORMS, open/close input port in DYNAMIC-WIND before/after thunks. --- scheme/bcomp/read-form.scm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scheme/bcomp/read-form.scm b/scheme/bcomp/read-form.scm index 2964aaa..003a905 100644 --- a/scheme/bcomp/read-form.scm +++ b/scheme/bcomp/read-form.scm @@ -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 '()))