mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
Fixing handling of multiple exports in a library. export-all now supported.
This commit is contained in:
parent
a3daf9f728
commit
cb4d0c77f6
1 changed files with 16 additions and 5 deletions
21
lib/meta.scm
21
lib/meta.scm
|
@ -217,14 +217,24 @@
|
||||||
(cons (car (cddr x)) (cadr x))
|
(cons (car (cddr x)) (cadr x))
|
||||||
(error "invalid module export" x))
|
(error "invalid module export" x))
|
||||||
x))
|
x))
|
||||||
|
(define (extract-exports)
|
||||||
|
(cond
|
||||||
|
((assq 'export-all ,this-module)
|
||||||
|
=> (lambda (x)
|
||||||
|
(if (pair? (cdr x))
|
||||||
|
(error "export-all takes no parameters" x))
|
||||||
|
#f))
|
||||||
|
(else
|
||||||
|
(let lp ((ls ,this-module) (res '()))
|
||||||
|
(cond
|
||||||
|
((null? ls) res)
|
||||||
|
((and (pair? (car ls)) (eq? 'export (caar ls)))
|
||||||
|
(lp (cdr ls) (append (map rewrite-export (cdar ls)) res)))
|
||||||
|
(else (lp (cdr ls) res)))))))
|
||||||
(set! ,this-module '())
|
(set! ,this-module '())
|
||||||
,@body
|
,@body
|
||||||
(set! ,this-module (reverse ,this-module))
|
(set! ,this-module (reverse ,this-module))
|
||||||
(let ((exports
|
(,add-module! ',name (make-module (extract-exports) #f ,this-module))
|
||||||
(cond ((assq 'export ,this-module)
|
|
||||||
=> (lambda (x) (map rewrite-export (cdr x))))
|
|
||||||
(else '()))))
|
|
||||||
(,add-module! ',name (make-module exports #f ,this-module)))
|
|
||||||
(set! ,this-module ,tmp))))))
|
(set! ,this-module ,tmp))))))
|
||||||
|
|
||||||
(define-syntax define-library define-library-transformer)
|
(define-syntax define-library define-library-transformer)
|
||||||
|
@ -243,6 +253,7 @@
|
||||||
(define-config-primitive import)
|
(define-config-primitive import)
|
||||||
(define-config-primitive import-immutable)
|
(define-config-primitive import-immutable)
|
||||||
(define-config-primitive export)
|
(define-config-primitive export)
|
||||||
|
(define-config-primitive export-all)
|
||||||
(define-config-primitive include)
|
(define-config-primitive include)
|
||||||
(define-config-primitive include-ci)
|
(define-config-primitive include-ci)
|
||||||
(define-config-primitive include-shared)
|
(define-config-primitive include-shared)
|
||||||
|
|
Loading…
Add table
Reference in a new issue