mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-13 07:47:39 +02:00
Added new functions for cond-expand
This commit is contained in:
parent
6ebc9e6b8f
commit
e41586da69
1 changed files with 25 additions and 0 deletions
|
@ -30,6 +30,8 @@
|
||||||
lib:rename-exports
|
lib:rename-exports
|
||||||
lib:imports
|
lib:imports
|
||||||
lib:body
|
lib:body
|
||||||
|
lib:cond-expand
|
||||||
|
lib:cond-expand-decls
|
||||||
lib:includes
|
lib:includes
|
||||||
lib:include-c-headers
|
lib:include-c-headers
|
||||||
lib:import-set:library-name?
|
lib:import-set:library-name?
|
||||||
|
@ -177,6 +179,29 @@
|
||||||
|
|
||||||
;; TODO: include-ci, cond-expand
|
;; TODO: include-ci, cond-expand
|
||||||
|
|
||||||
|
;TODO: maybe just want a function that will take a define-library expression and expand any top-level cond-expand expressions.
|
||||||
|
;then just return all of that. the front-end can then call this function once to pre-process the library code before any further compilation.
|
||||||
|
;
|
||||||
|
;obviously also need to expand cond-expand in cases where the code reads sld files to track down library dependencies
|
||||||
|
|
||||||
|
;; Take given define-library expression and cond-expand all declarations
|
||||||
|
(define (lib:cond-expand expr expander)
|
||||||
|
(let ((name (cadr expr))
|
||||||
|
(decls (lib:cond-expand-decls (cddr expr) expander)))
|
||||||
|
`(define-library ,name ,decls)))
|
||||||
|
|
||||||
|
(define (lib:cond-expand-decls decls expander)
|
||||||
|
(reverse
|
||||||
|
(foldl
|
||||||
|
(lambda (d acc)
|
||||||
|
(cond
|
||||||
|
((tagged-list? 'cond-expand d)
|
||||||
|
(lib:cond-expand-decls (expander d)))
|
||||||
|
(else
|
||||||
|
(cons d acc)) ))
|
||||||
|
'()
|
||||||
|
decls)))
|
||||||
|
|
||||||
(define (lib:atom->string atom)
|
(define (lib:atom->string atom)
|
||||||
(cond
|
(cond
|
||||||
((symbol? atom)
|
((symbol? atom)
|
||||||
|
|
Loading…
Add table
Reference in a new issue