From 406bd9d6725b58736959eb705235bb50fe48d48d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 1 Nov 2010 21:20:05 -0700 Subject: Reduce guile load time from 4.5 to 1.2 seconds. Rewrite re-export-all to only export symbols from the module name supplied. --- gnuradio-core/src/lib/swig/gnuradio/core.scm | 9 +++++++-- .../src/lib/swig/gnuradio/export-safely.scm | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm index 08daeeb34..f13a8fb60 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/core.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm @@ -10,5 +10,10 @@ #:use-module (gnuradio gnuradio_core_hier) #:duplicates (merge-generics check)) -;; re-export everything... -(re-export-all (current-module)) +(re-export-all '(gnuradio gnuradio_core_runtime)) +(re-export-all '(gnuradio runtime-shim)) +(re-export-all '(gnuradio gnuradio_core_filter)) +(re-export-all '(gnuradio gnuradio_core_io)) +(re-export-all '(gnuradio gnuradio_core_general)) +(re-export-all '(gnuradio gnuradio_core_gengen)) +(re-export-all '(gnuradio gnuradio_core_hier)) diff --git a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm index 2da7e633e..664292d2b 100644 --- a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm +++ b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm @@ -75,13 +75,16 @@ (define-public (names-in-imported-modules module) (delete-duplicates (concatenate (map names-in-module (module-uses module))))) -(define-public (re-export-all module) - (define (ok-to-re-export? name) - (let ((var (module-variable module name))) - (cond ((not var) #f) ; Undefined var - ((eq? var (module-local-variable module name)) #f) ; local var - (else #t)))) ; OK +(define-public (re-export-all src-module-name) + (let ((current (current-module)) + (src-module (resolve-interface src-module-name))) - (module-re-export! module - (filter ok-to-re-export? - (names-in-imported-modules module)))) + (define (ok-to-re-export? name) + (let ((var (module-variable current name))) + (cond ((not var) #f) ; Undefined var + ((eq? var (module-local-variable current name)) #f) ; local var + (else #t)))) ; OK + + (module-re-export! current + (filter ok-to-re-export? + (names-in-module src-module))))) -- cgit