Added lib:read-includes

This commit is contained in:
Justin Ethier 2020-01-09 22:44:57 -05:00
parent 93393a4f1c
commit b28238f8dd

View file

@ -46,6 +46,7 @@
lib:import->path lib:import->path
lib:check-system-path lib:check-system-path
lib:read-imports lib:read-imports
lib:read-includes
lib:import->export-list lib:import->export-list
lib:import-set/exports->imports lib:import-set/exports->imports
;lib:resolve-imports ;lib:resolve-imports
@ -368,6 +369,17 @@
(close-input-port fp) (close-input-port fp)
imports)) imports))
;; Given a single import from an import-set, open the corresponding
;; library file and retrieve the library's includes
(define (lib:read-includes import append-dirs prepend-dirs)
(let* ((lib-name (lib:import->library-name import))
(dir (lib:import->filename lib-name ".sld" append-dirs prepend-dirs))
(fp (open-input-file dir))
(lib (read-all fp))
(includes (lib:includes (car lib))))
(close-input-port fp)
includes))
;; Read export list for a given import ;; Read export list for a given import
(define (lib:import->export-list import append-dirs prepend-dirs) (define (lib:import->export-list import append-dirs prepend-dirs)
(let* ((lib-name (lib:import->library-name import)) (let* ((lib-name (lib:import->library-name import))