diff --git a/cyclone.scm b/cyclone.scm index f3cde87d..fdb0a0fb 100644 --- a/cyclone.scm +++ b/cyclone.scm @@ -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? diff --git a/scheme/cyclone/libraries.sld b/scheme/cyclone/libraries.sld index ea71a779..f55a14c6 100644 --- a/scheme/cyclone/libraries.sld +++ b/scheme/cyclone/libraries.sld @@ -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)) )) '()