keep a root file named after a CHICKEN module out of the graph

Only the eggs were told apart from the modules, so a scheme.scm became
the scheme every unit imports, a dependency of every object and of
itself, and the build went on to link it.
This commit is contained in:
2026-10-20 11:46:13 +03:00
parent 67749c8db0
commit 49b463ac7b

View File

@@ -23,6 +23,7 @@
(import scheme
(chicken base)
(chicken condition)
(chicken eval)
(chicken file)
(chicken io)
(chicken pathname)
@@ -43,11 +44,22 @@
;;; module the tests import
(define eggs (call-with-input-file "dependencies.txt" read-list))
;;; A scheme.scm is not the module every unit imports. Asked from /,
;;; since here a NAME.import.scm built from NAME.scm would answer
(define (chicken-module? name)
(let ((here (current-directory)))
(dynamic-wind
(lambda () (change-directory "/"))
(lambda () (handle-exceptions exn #f (module-environment name) #t))
(lambda () (change-directory here)))))
(define (module-file name)
(and (symbol? name)
(not (memq name eggs))
(let ((file (string-append (symbol->string name) ".scm")))
(and (file-exists? file) file))))
(and (file-exists? file)
(not (chicken-module? name))
file))))
;;; FILE's forms, or the end of the scan, naming the file that has none
(define (forms-of file)