WIP - cond-expand library declarations

This commit is contained in:
Justin Ethier 2017-02-04 17:54:55 -05:00
parent c6cd5a744b
commit 91c8171c93
2 changed files with 12 additions and 6 deletions

View file

@ -340,11 +340,16 @@
;; Compile and emit:
(define (run-compiler args cc? append-dirs prepend-dirs)
(let* ((in-file (car args))
(in-prog (read-file in-file))
;; TODO: expand in-prog, if a library, using lib:cond-expand.
;; TODO: will also need to do below in lib:get-all-import-deps, after reading each library
(expander (base-expander))
(program? (not (library? (car in-prog))))
(in-prog-raw (read-file in-file))
(program? (not (library? (car in-prog-raw))))
(in-prog
(if program?
in-prog-raw
;; Account for any cond-expand declarations in the library
(list (lib:cond-expand (car in-prog-raw) expander))))
;; TODO: expand in-prog, if a library, using lib:cond-expand. (OK, this works now)
;; TODO: will also need to do below in lib:get-all-import-deps, after reading each library
(program:imports/code (if program? (import-reduction in-prog expander) '()))
(lib-deps
(if (and program?

View file

@ -188,7 +188,7 @@
(define (lib:cond-expand expr expander)
(let ((name (cadr expr))
(decls (lib:cond-expand-decls (cddr expr) expander)))
`(define-library ,name ,decls)))
`(define-library ,name ,@decls)))
(define (lib:cond-expand-decls decls expander)
(reverse
@ -196,7 +196,8 @@
(lambda (d acc)
(cond
((tagged-list? 'cond-expand d)
(lib:cond-expand-decls (expander d)))
(cons (expander d) acc))
;(lib:cond-expand-decls (expander d)))
(else
(cons d acc)) ))
'()