1999-09-14 08:45:02 -04:00
|
|
|
; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING.
|
|
|
|
|
|
|
|
; The value of $NOTE-FILE-PACKAGE is called whenever a file is loaded into
|
|
|
|
; a package. env/debug.scm uses this to associate packages with files so
|
|
|
|
; that code stuffed to the REPL will be eval'ed in the correct package.
|
|
|
|
;
|
|
|
|
; Is there any point in having this be a fluid?
|
|
|
|
|
|
|
|
(define $note-file-package
|
|
|
|
(make-fluid (lambda (filename package)
|
|
|
|
(values))))
|
|
|
|
|
|
|
|
(define (read-forms pathname package)
|
|
|
|
(let* ((filename (namestring pathname #f *scheme-file-type*))
|
2002-12-16 06:00:11 -05:00
|
|
|
(truename (translate filename))
|
2002-12-17 08:50:14 -05:00
|
|
|
(port (open-input-file truename)))
|
2002-12-16 06:00:11 -05:00
|
|
|
(dynamic-wind
|
|
|
|
(lambda ()
|
2002-12-17 08:50:14 -05:00
|
|
|
(if (not port)
|
|
|
|
(error "attempt to throw back into a file read"))) ; message needs work
|
2002-12-16 06:00:11 -05:00
|
|
|
(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 ()
|
2002-12-17 08:50:14 -05:00
|
|
|
(close-input-port port)
|
|
|
|
(set! port #f)))))
|
1999-09-14 08:45:02 -04:00
|
|
|
|
|
|
|
(define (really-read-forms port)
|
|
|
|
(let loop ((forms '()))
|
|
|
|
(let ((form (read port)))
|
|
|
|
(if (eof-object? form)
|
|
|
|
(reverse forms)
|
|
|
|
(loop (cons form forms))))))
|
|
|
|
|
|
|
|
|