diff options
author | Andy Wingo <wingo@pobox.com> | 2010-04-27 22:57:54 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-04-27 22:57:54 +0200 |
commit | d2b7b761e510e9616db837b2e72819c90a3db25b (patch) | |
tree | 2c6ebe83b072b6f1c9abe324a08af8fefe9447d9 | |
parent | 4d67cd4073b43bb48af6c1664357b5e18247e335 (diff) | |
download | guile-d2b7b761e510e9616db837b2e72819c90a3db25b.tar.gz |
add module-export-all!
* module/ice-9/boot-9.scm (module-export-all!): New function, exports
all current and future local variables from a module.
-rw-r--r-- | module/ice-9/boot-9.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 05b6a194a..d83b0bf5d 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -3411,6 +3411,20 @@ module '(ice-9 q) '(make-q q-length))}." (module-add! public-i external-name var))) names))) +;; Export all local variables from a module +;; +(define (module-export-all! mod) + (define (fresh-interface!) + (let ((iface (make-module))) + (set-module-name! iface (module-name mod)) + ;; for guile 2: (set-module-version! iface (module-version mod)) + (set-module-kind! iface 'interface) + (set-module-public-interface! mod iface) + iface)) + (let ((iface (or (module-public-interface mod) + (fresh-interface!)))) + (set-module-obarray! iface (module-obarray mod)))) + ;; Re-export a imported variable ;; (define (module-re-export! m names) |