From d2b7b761e510e9616db837b2e72819c90a3db25b Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 27 Apr 2010 22:57:54 +0200 Subject: [PATCH] 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. --- module/ice-9/boot-9.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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)