Issue #165 - -A and -I options

This commit is contained in:
Justin Ethier 2017-02-02 00:10:54 -05:00
parent 379cac7ac3
commit 17d819a399
3 changed files with 15 additions and 5 deletions

View file

@ -3,6 +3,16 @@
Features
- Koz Ross added an implementation of SRFI 60.
- Added the `-A` and `-I` compiler options from SRFI 138 to `cyclone`:
> `-A directory`
>
> Append directory to the list of directories that are searched in order to locate imported libraries.
>
> `-I directory`
>
> Prepend directory to the list of directories that are searched in order to locate imported libraries.
- Updated the garbage collector to enhance performance for programs with a high allocation rate, and to scale better to multiple concurrent threads.
- Improved error handling by `display` and `write`.
- Removed the `make_int` C macro which was deprecated and could cause problems when used in FFI functions.

View file

@ -304,7 +304,7 @@
(lib-deps
(if (and program?
(tagged-list? 'import (car in-prog)))
(lib:get-all-import-deps (cdar in-prog))
(lib:get-all-import-deps (cdar in-prog) append-dirs prepend-dirs)
'()))
(exec-file (basename in-file))
(src-file (string-append exec-file ".c"))

View file

@ -265,9 +265,9 @@
;; Given a single import from an import-set, open the corresponding
;; library file and retrieve the library's import-set.
(define (lib:read-imports import)
(define (lib:read-imports import append-dirs prepend-dirs)
(let* ((lib-name (lib:import->library-name import))
(dir (lib:import->filename lib-name))
(dir (lib:import->filename lib-name ".sld" append-dirs prepend-dirs))
(fp (open-input-file dir))
(lib (read-all fp))
(imports (lib:imports (car lib))))
@ -471,7 +471,7 @@
;; Given an import set, get all dependant import names that are required
;; The list of deps is intended to be returned in order, such that the
;; libraries can be initialized properly in sequence.
(define (lib:get-all-import-deps imports)
(define (lib:get-all-import-deps imports append-dirs prepend-dirs)
(letrec ((libraries/deps '())
(find-deps!
(lambda (import-sets)
@ -483,7 +483,7 @@
;; Prevent cycles by only processing new libraries
((not (assoc lib-name libraries/deps))
;; Find all dependencies of i (IE, libraries it imports)
(let* ((deps (lib:read-imports import-set))
(let* ((deps (lib:read-imports import-set append-dirs prepend-dirs))
(dep-libs (map lib:import->library-name deps)))
(set!
libraries/deps