add module-export-all!
authorAndy Wingo <wingo@pobox.com>
Tue, 27 Apr 2010 20:57:54 +0000 (22:57 +0200)
committerAndy Wingo <wingo@pobox.com>
Tue, 27 Apr 2010 20:57:54 +0000 (22:57 +0200)
* module/ice-9/boot-9.scm (module-export-all!): New function, exports
  all current and future local variables from a module.

module/ice-9/boot-9.scm

index 05b6a19..d83b0bf 100644 (file)
@@ -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)