mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 08:10:17 +02:00
Make `cond-expand' compilable.
* module/ice-9/boot-9.scm (cond-expand): Changed into a `define-macro' macro.
This commit is contained in:
parent
23044464c2
commit
f4bf64b4d4
1 changed files with 60 additions and 63 deletions
|
@ -3192,11 +3192,8 @@ module '(ice-9 q) '(make-q q-length))}."
|
||||||
(append (hashq-ref %cond-expand-table mod '())
|
(append (hashq-ref %cond-expand-table mod '())
|
||||||
features)))))
|
features)))))
|
||||||
|
|
||||||
(define cond-expand
|
(define-macro (cond-expand . clauses)
|
||||||
(procedure->memoizing-macro
|
(let ((syntax-error (lambda (cl)
|
||||||
(lambda (exp env)
|
|
||||||
(let ((clauses (cdr exp))
|
|
||||||
(syntax-error (lambda (cl)
|
|
||||||
(error "invalid clause in `cond-expand'" cl))))
|
(error "invalid clause in `cond-expand'" cl))))
|
||||||
(letrec
|
(letrec
|
||||||
((test-clause
|
((test-clause
|
||||||
|
@ -3204,7 +3201,7 @@ module '(ice-9 q) '(make-q q-length))}."
|
||||||
(cond
|
(cond
|
||||||
((symbol? clause)
|
((symbol? clause)
|
||||||
(or (memq clause %cond-expand-features)
|
(or (memq clause %cond-expand-features)
|
||||||
(let lp ((uses (module-uses (env-module env))))
|
(let lp ((uses (module-uses (current-module))))
|
||||||
(if (pair? uses)
|
(if (pair? uses)
|
||||||
(or (memq clause
|
(or (memq clause
|
||||||
(hashq-ref %cond-expand-table
|
(hashq-ref %cond-expand-table
|
||||||
|
@ -3254,7 +3251,7 @@ module '(ice-9 q) '(make-q q-length))}."
|
||||||
(syntax-error c))
|
(syntax-error c))
|
||||||
`(begin ,@(cdar c)))
|
`(begin ,@(cdar c)))
|
||||||
(else
|
(else
|
||||||
(lp (cdr c))))))))))
|
(lp (cdr c))))))))
|
||||||
|
|
||||||
;; This procedure gets called from the startup code with a list of
|
;; This procedure gets called from the startup code with a list of
|
||||||
;; numbers, which are the numbers of the SRFIs to be loaded on startup.
|
;; numbers, which are the numbers of the SRFIs to be loaded on startup.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue