mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 21:59:16 +02:00
Issue #202 - Allow -A / -I options for icyc
This commit is contained in:
parent
1032673c8a
commit
d65e7428b9
2 changed files with 17 additions and 4 deletions
9
icyc.scm
9
icyc.scm
|
@ -102,12 +102,19 @@ Options:
|
||||||
")
|
")
|
||||||
(newline))
|
(newline))
|
||||||
|
|
||||||
(let ((args (command-line-arguments))
|
(let* ((args (command-line-arguments))
|
||||||
|
(append-dirs (collect-opt-values args "-A"))
|
||||||
|
(prepend-dirs (collect-opt-values args "-I"))
|
||||||
(run-as-script #f))
|
(run-as-script #f))
|
||||||
;; Process arguments used by main REPL
|
;; Process arguments used by main REPL
|
||||||
(if (member "-s" args)
|
(if (member "-s" args)
|
||||||
(set! run-as-script #t))
|
(set! run-as-script #t))
|
||||||
|
|
||||||
|
;; Add additional places to look for imports, if necessary
|
||||||
|
(if (or (not (null? append-dirs))
|
||||||
|
(not (null? prepend-dirs)))
|
||||||
|
(%set-import-dirs! append-dirs prepend-dirs))
|
||||||
|
|
||||||
;; Process remaining arguments that, if present, will cause icyc to
|
;; Process remaining arguments that, if present, will cause icyc to
|
||||||
;; do something other than start the REPL. If no such arguments are
|
;; do something other than start the REPL. If no such arguments are
|
||||||
;; found, just run icyc.
|
;; found, just run icyc.
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
;; Dynamic import
|
;; Dynamic import
|
||||||
%import
|
%import
|
||||||
imported?
|
imported?
|
||||||
|
%set-import-dirs!
|
||||||
)
|
)
|
||||||
(inline
|
(inline
|
||||||
primitive-implementation
|
primitive-implementation
|
||||||
|
@ -615,6 +616,11 @@
|
||||||
; (loop))
|
; (loop))
|
||||||
;(loop)
|
;(loop)
|
||||||
|
|
||||||
|
(define *append-dirs* '())
|
||||||
|
(define *prepend-dirs* '())
|
||||||
|
(define (%set-import-dirs! append-dirs prepend-dirs)
|
||||||
|
(set! *append-dirs* append-dirs)
|
||||||
|
(set! *prepend-dirs* prepend-dirs))
|
||||||
|
|
||||||
;; TODO: right now this is a hack, just get all the imports sets and call their entry point
|
;; TODO: right now this is a hack, just get all the imports sets and call their entry point
|
||||||
;; function to initialize them. longer-term will need to only load the specific identifiers
|
;; function to initialize them. longer-term will need to only load the specific identifiers
|
||||||
|
@ -626,7 +632,7 @@
|
||||||
(explicit-lib-names
|
(explicit-lib-names
|
||||||
(map lib:import->library-name (lib:list->import-set import-sets)))
|
(map lib:import->library-name (lib:list->import-set import-sets)))
|
||||||
;; All dependent libraries
|
;; All dependent libraries
|
||||||
(lib-names (lib:get-all-import-deps import-sets '() '())))
|
(lib-names (lib:get-all-import-deps import-sets *append-dirs* *prepend-dirs*)))
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (lib-name)
|
(lambda (lib-name)
|
||||||
(let* ((us (lib:name->unique-string lib-name))
|
(let* ((us (lib:name->unique-string lib-name))
|
||||||
|
@ -634,7 +640,7 @@
|
||||||
(if (or (not loaded?)
|
(if (or (not loaded?)
|
||||||
(member lib-name explicit-lib-names))
|
(member lib-name explicit-lib-names))
|
||||||
(c:import-shared-obj
|
(c:import-shared-obj
|
||||||
(lib:import->filename lib-name ".so")
|
(lib:import->filename lib-name ".so" *append-dirs* *prepend-dirs*)
|
||||||
(string-append
|
(string-append
|
||||||
"c_" (lib:name->string lib-name) "_entry_pt_first_lambda"))
|
"c_" (lib:name->string lib-name) "_entry_pt_first_lambda"))
|
||||||
;(begin (write `(,lib-name ,us ,loaded? is already loaded skipping)) (newline))
|
;(begin (write `(,lib-name ,us ,loaded? is already loaded skipping)) (newline))
|
||||||
|
|
Loading…
Add table
Reference in a new issue