1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-29 16:30:19 +02:00

* session.scm (make-fold-modules): Detect circular references in

module graph.  (Thanks to Matthias Köppe.)
This commit is contained in:
Mikael Djurfeldt 2000-06-20 17:10:34 +00:00
parent 5bc9cbd2d8
commit 9aec475196

View file

@ -264,12 +264,18 @@ The forest traversed is the image of the forest generated by root
modules returned by INIT-THUNK and the generator TRAVERSE. modules returned by INIT-THUNK and the generator TRAVERSE.
It is an image under the mapping EXTRACT." It is an image under the mapping EXTRACT."
(lambda (fold-module init) (lambda (fold-module init)
(let rec ((data init) (let* ((table (make-hash-table 31))
(modules (init-thunk))) (first? (lambda (obj)
(do ((modules modules (cdr modules)) (and (not (hash-ref table obj))
(data data (rec (fold-module (extract (car modules)) data) (hash-create-handle! table obj #t)))))
(traverse (car modules))))) (let rec ((data init)
((null? modules) data))))) (modules (init-thunk)))
(do ((modules modules (cdr modules))
(data data (if (first? (car modules))
(rec (fold-module (extract (car modules)) data)
(traverse (car modules)))
data)))
((null? modules) data))))))
(define-public (apropos-fold-accessible module) (define-public (apropos-fold-accessible module)
(make-fold-modules (lambda () (list module)) (make-fold-modules (lambda () (list module))