summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authorEric Blossom2010-10-29 03:54:07 -0700
committerEric Blossom2010-11-10 12:13:53 -0800
commitda69e1c1f910cf6ab4fd54dea25255e266b2918e (patch)
tree2c85e6e16a3985fa7ec43bf75fa9d84ed4a8cf7d /gnuradio-core
parentcbfffe4100daff91746db0b6ea66cec9f7b2ceed (diff)
downloadgnuradio-da69e1c1f910cf6ab4fd54dea25255e266b2918e.tar.gz
gnuradio-da69e1c1f910cf6ab4fd54dea25255e266b2918e.tar.bz2
gnuradio-da69e1c1f910cf6ab4fd54dea25255e266b2918e.zip
gnuradio-core modules are almost loading cleanly.
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.am1
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio/core.scm6
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio/export-safely.scm45
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_general.i2
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_runtime.i7
5 files changed, 58 insertions, 3 deletions
diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am
index 60a1d952e..b9bc75348 100644
--- a/gnuradio-core/src/lib/swig/Makefile.am
+++ b/gnuradio-core/src/lib/swig/Makefile.am
@@ -60,6 +60,7 @@ if GUILE
# for gnuradio. This has to be installed top level to be found in the
# default search path.
nobase_guile_DATA = \
+ gnuradio/export-safely.scm \
gnuradio/core.scm \
Swig/common.scm
endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm
index 3b12d4025..294881146 100644
--- a/gnuradio-core/src/lib/swig/gnuradio/core.scm
+++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm
@@ -1,3 +1,5 @@
+;;; Glue the separate pieces of gnuradio-core into a single module
+
(define-module (gnuradio core)
#:use-module (gnuradio gnuradio_core_runtime)
#:use-module (gnuradio gnuradio_core_filter)
@@ -5,7 +7,7 @@
#:use-module (gnuradio gnuradio_core_general)
#:use-module (gnuradio gnuradio_core_gengen)
#:use-module (gnuradio gnuradio_core_hier)
- #:duplicates (merge-generics replace warn-override-core warn last))
+ #:duplicates (merge-generics check))
;; re-export everything...
-
+(re-export-all (current-module))
diff --git a/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm
new file mode 100644
index 000000000..52530abc9
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio/export-safely.scm
@@ -0,0 +1,45 @@
+(define-module (gnuradio export-safely)
+ #:use-module (oop goops)
+ #:use-module (srfi srfi-1)
+ #:export-syntax (export-safely))
+
+(define-public (generics-in-module module)
+ (let ((lst '()))
+ (module-for-each (lambda (sym var)
+ (if (variable-bound? var)
+ (let ((v (variable-ref var)))
+ (cond ((is-a? v <generic>)
+ (set! lst (cons v lst)))))))
+ module)
+ lst))
+
+(define-public (generic-function-names-in-module module)
+ (map generic-function-name (generics-in-module module)))
+
+(define-public (generic-function-names-in-imported-modules module)
+ (concatenate (map generic-function-names-in-module (module-uses module))))
+
+(define-public (export-syms-if-not-imported-gf list-of-syms)
+ (let ((gf-names (generic-function-names-in-imported-modules (current-module))))
+ (let ((to-export (filter (lambda (sym)
+ (not (memq sym gf-names)))
+ list-of-syms)))
+ (module-export! (current-module) to-export))))
+
+(defmacro export-safely names
+ `(export-syms-if-not-imported-gf ',names))
+
+
+(define-public (names-in-module module)
+ (let ((lst '()))
+ (module-for-each (lambda (sym var)
+ (if (variable-bound? var)
+ (set! lst (cons sym lst))))
+ module)
+ lst))
+
+(define-public (names-in-imported-modules module)
+ (concatenate (map names-in-module (module-uses module))))
+
+(define-public (re-export-all module)
+ (module-re-export! module (names-in-imported-modules module)))
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
index 8b3bf971b..759a65459 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
@@ -55,6 +55,6 @@
%}
%goops %{
- (use-modules (gnuradio gnuradio_core_runtime))
+(use-modules (gnuradio gnuradio_core_runtime))
%}
#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
index 2f6ca8227..bb10b36b2 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
@@ -36,4 +36,11 @@
%scheme %{
(load-extension "libguile-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module")
%}
+
+%goops %{
+(use-modules (gnuradio export-safely))
+(re-export export-syms-if-not-imported-gf)
+(re-export-syntax export-safely)
+(re-export re-export-all)
+%}
#endif