summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.common1
-rw-r--r--Makefile.swig6
-rw-r--r--Makefile.swig.gen.t4
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.am7
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.swig.gen24
-rw-r--r--gnuradio-core/src/lib/swig/Swig/common.scm76
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio/.gitignore12
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio/core.scm11
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core.scm32
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_filter.i8
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_general.i6
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_gengen.i6
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_hier.i6
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_io.i6
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio_core_runtime.i2
15 files changed, 152 insertions, 55 deletions
diff --git a/Makefile.common b/Makefile.common
index df9a6f6d5..e008dbf23 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -130,6 +130,7 @@ if GUILE
-module $* -o guile/$*.cc $<
sed -e 's:guile/gnuradio_core_runtime.cc:gnuradio_core_runtime.scm:' guile/$*.Std > guile/$*.d
$(RM) guile/$*.Std
+ $(SED) -i -e 's/<--dummy-[0-9]\+-->/<top>/g' gnuradio/$*.scm
endif
# Compile a .i file to what python needs
diff --git a/Makefile.swig b/Makefile.swig
index 2608a57be..c8b07f617 100644
--- a/Makefile.swig
+++ b/Makefile.swig
@@ -51,6 +51,12 @@ SWIG_GUILE_FLAGS = \
-guile \
-scm \
-scmstub \
+ -package gnuradio \
+ -Linkage module \
+ -proxy \
+ -goopsprefix gr: \
+ -emit-slot-accessors \
+ -emit-setters \
-outdir .
## standard swig flags used by most components
diff --git a/Makefile.swig.gen.t b/Makefile.swig.gen.t
index 41532bfd1..e547e2cfe 100644
--- a/Makefile.swig.gen.t
+++ b/Makefile.swig.gen.t
@@ -46,7 +46,7 @@
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/@NAME@
# FIXME: determince whether these should be installed with gnuradio.
-@NAME@_scmdir = $(guiledir)/gnuradio
+@NAME@_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -128,7 +128,7 @@ if GUILE
libguile_@NAME@_la_SOURCES = \
guile/@NAME@.cc \
$(@NAME@_la_swig_sources)
-@NAME@_scm_DATA = @NAME@.scm
+nobase_@NAME@_scm_DATA = gnuradio/@NAME@.scm gnuradio/@NAME@-primtive.scm
# Guile can use the same flags as python does
libguile_@NAME@_la_LIBADD = $(_@NAME@_la_LIBADD)
diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am
index f30b877a1..60a1d952e 100644
--- a/gnuradio-core/src/lib/swig/Makefile.am
+++ b/gnuradio-core/src/lib/swig/Makefile.am
@@ -59,7 +59,9 @@ if GUILE
# This is the top level guile file, which loads all the other scm files
# for gnuradio. This has to be installed top level to be found in the
# default search path.
-grguile_DATA = gnuradio_core.scm
+nobase_guile_DATA = \
+ gnuradio/core.scm \
+ Swig/common.scm
endif
@@ -112,7 +114,8 @@ BUILT_SOURCES += $(PYTHON_GEN)
endif # end of if python
if GUILE
-GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.scm,$(HFILE)))
+GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,%.scm,$(HFILE)))
+#GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE)))
# BUILT_SOURCES += $(foreach HFILE,$(GUILE_GEN), $(subst gnuradio,guile/gnuradio,$(HFILE)))
BUILT_SOURCES += $(GUILE_GEN)
endif
diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen
index f6e3fa1b1..67cefe7d0 100644
--- a/gnuradio-core/src/lib/swig/Makefile.swig.gen
+++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen
@@ -46,7 +46,7 @@ gnuradio_core_runtime_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/gnuradio_core_runtime
# FIXME: determince whether these should be installed with gnuradio.
-gnuradio_core_runtime_scmdir = $(guiledir)/gnuradio
+gnuradio_core_runtime_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -128,7 +128,7 @@ gnuradio_core_runtime_scmlib_LTLIBRARIES = libguile-gnuradio_core_runtime.la
libguile_gnuradio_core_runtime_la_SOURCES = \
guile/gnuradio_core_runtime.cc \
$(gnuradio_core_runtime_la_swig_sources)
-gnuradio_core_runtime_scm_DATA = gnuradio_core_runtime.scm
+nobase_gnuradio_core_runtime_scm_DATA = gnuradio/gnuradio_core_runtime.scm gnuradio/gnuradio_core_runtime-primtive.scm
# Guile can use the same flags as python does
libguile_gnuradio_core_runtime_la_LIBADD = $(_gnuradio_core_runtime_la_LIBADD)
@@ -194,7 +194,7 @@ gnuradio_core_general_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/gnuradio_core_general
# FIXME: determince whether these should be installed with gnuradio.
-gnuradio_core_general_scmdir = $(guiledir)/gnuradio
+gnuradio_core_general_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -276,7 +276,7 @@ gnuradio_core_general_scmlib_LTLIBRARIES = libguile-gnuradio_core_general.la
libguile_gnuradio_core_general_la_SOURCES = \
guile/gnuradio_core_general.cc \
$(gnuradio_core_general_la_swig_sources)
-gnuradio_core_general_scm_DATA = gnuradio_core_general.scm
+nobase_gnuradio_core_general_scm_DATA = gnuradio/gnuradio_core_general.scm gnuradio/gnuradio_core_general-primtive.scm
# Guile can use the same flags as python does
libguile_gnuradio_core_general_la_LIBADD = $(_gnuradio_core_general_la_LIBADD)
@@ -342,7 +342,7 @@ gnuradio_core_gengen_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/gnuradio_core_gengen
# FIXME: determince whether these should be installed with gnuradio.
-gnuradio_core_gengen_scmdir = $(guiledir)/gnuradio
+gnuradio_core_gengen_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -424,7 +424,7 @@ gnuradio_core_gengen_scmlib_LTLIBRARIES = libguile-gnuradio_core_gengen.la
libguile_gnuradio_core_gengen_la_SOURCES = \
guile/gnuradio_core_gengen.cc \
$(gnuradio_core_gengen_la_swig_sources)
-gnuradio_core_gengen_scm_DATA = gnuradio_core_gengen.scm
+nobase_gnuradio_core_gengen_scm_DATA = gnuradio/gnuradio_core_gengen.scm gnuradio/gnuradio_core_gengen-primtive.scm
# Guile can use the same flags as python does
libguile_gnuradio_core_gengen_la_LIBADD = $(_gnuradio_core_gengen_la_LIBADD)
@@ -490,7 +490,7 @@ gnuradio_core_filter_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/gnuradio_core_filter
# FIXME: determince whether these should be installed with gnuradio.
-gnuradio_core_filter_scmdir = $(guiledir)/gnuradio
+gnuradio_core_filter_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -572,7 +572,7 @@ gnuradio_core_filter_scmlib_LTLIBRARIES = libguile-gnuradio_core_filter.la
libguile_gnuradio_core_filter_la_SOURCES = \
guile/gnuradio_core_filter.cc \
$(gnuradio_core_filter_la_swig_sources)
-gnuradio_core_filter_scm_DATA = gnuradio_core_filter.scm
+nobase_gnuradio_core_filter_scm_DATA = gnuradio/gnuradio_core_filter.scm gnuradio/gnuradio_core_filter-primtive.scm
# Guile can use the same flags as python does
libguile_gnuradio_core_filter_la_LIBADD = $(_gnuradio_core_filter_la_LIBADD)
@@ -638,7 +638,7 @@ gnuradio_core_io_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/gnuradio_core_io
# FIXME: determince whether these should be installed with gnuradio.
-gnuradio_core_io_scmdir = $(guiledir)/gnuradio
+gnuradio_core_io_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -720,7 +720,7 @@ gnuradio_core_io_scmlib_LTLIBRARIES = libguile-gnuradio_core_io.la
libguile_gnuradio_core_io_la_SOURCES = \
guile/gnuradio_core_io.cc \
$(gnuradio_core_io_la_swig_sources)
-gnuradio_core_io_scm_DATA = gnuradio_core_io.scm
+nobase_gnuradio_core_io_scm_DATA = gnuradio/gnuradio_core_io.scm gnuradio/gnuradio_core_io-primtive.scm
# Guile can use the same flags as python does
libguile_gnuradio_core_io_la_LIBADD = $(_gnuradio_core_io_la_LIBADD)
@@ -786,7 +786,7 @@ gnuradio_core_hier_scmlibdir = $(libdir)
# The scm files for the guile modules get installed where ever guile
# is installed, usually /usr/share/guile/site/gnuradio_core_hier
# FIXME: determince whether these should be installed with gnuradio.
-gnuradio_core_hier_scmdir = $(guiledir)/gnuradio
+gnuradio_core_hier_scmdir = $(guiledir)
## SWIG headers are always installed into the same directory.
@@ -868,7 +868,7 @@ gnuradio_core_hier_scmlib_LTLIBRARIES = libguile-gnuradio_core_hier.la
libguile_gnuradio_core_hier_la_SOURCES = \
guile/gnuradio_core_hier.cc \
$(gnuradio_core_hier_la_swig_sources)
-gnuradio_core_hier_scm_DATA = gnuradio_core_hier.scm
+nobase_gnuradio_core_hier_scm_DATA = gnuradio/gnuradio_core_hier.scm gnuradio/gnuradio_core_hier-primtive.scm
# Guile can use the same flags as python does
libguile_gnuradio_core_hier_la_LIBADD = $(_gnuradio_core_hier_la_LIBADD)
diff --git a/gnuradio-core/src/lib/swig/Swig/common.scm b/gnuradio-core/src/lib/swig/Swig/common.scm
new file mode 100644
index 000000000..a51d3a71d
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/Swig/common.scm
@@ -0,0 +1,76 @@
+;;;************************************************************************
+;;;*common.scm
+;;;*
+;;;* This file contains generic SWIG GOOPS classes for generated
+;;;* GOOPS file support
+;;;*
+;;;* Copyright (C) 2003 John Lenz (jelenz@wisc.edu)
+;;;* Copyright (C) 2004 Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de)
+;;;*
+;;;* This file may be freely redistributed without license or fee provided
+;;;* this copyright message remains intact.
+;;;************************************************************************
+
+(define-module (Swig swigrun))
+
+(define-module (Swig common)
+ #:use-module (oop goops)
+ #:use-module (Swig swigrun))
+
+(define-class <swig-metaclass> (<class>)
+ (new-function #:init-value #f))
+
+(define-method (initialize (class <swig-metaclass>) initargs)
+ (slot-set! class 'new-function (get-keyword #:new-function initargs #f))
+ (next-method))
+
+(define-class <swig> ()
+ (swig-smob #:init-value #f)
+ #:metaclass <swig-metaclass>
+)
+
+(define-method (initialize (obj <swig>) initargs)
+ (next-method)
+ (slot-set! obj 'swig-smob
+ (let ((arg (get-keyword #:init-smob initargs #f)))
+ (if arg
+ arg
+ (let ((ret (apply (slot-ref (class-of obj) 'new-function) (get-keyword #:args initargs '()))))
+ ;; if the class is registered with runtime environment,
+ ;; new-Function will return a <swig> goops class. In that case, extract the smob
+ ;; from that goops class and set it as the current smob.
+ (if (slot-exists? ret 'swig-smob)
+ (slot-ref ret 'swig-smob)
+ ret))))))
+
+(define (display-address o file)
+ (display (number->string (object-address o) 16) file))
+
+(define (display-pointer-address o file)
+ ;; Don't fail if the function SWIG-PointerAddress is not present.
+ (let ((address (false-if-exception (SWIG-PointerAddress o))))
+ (if address
+ (begin
+ (display " @ " file)
+ (display (number->string address 16) file)))))
+
+(define-method (write (o <swig>) file)
+ ;; We display _two_ addresses to show the object's identity:
+ ;; * first the address of the GOOPS proxy object,
+ ;; * second the pointer address.
+ ;; The reason is that proxy objects are created and discarded on the
+ ;; fly, so different proxy objects for the same C object will appear.
+ (let ((class (class-of o)))
+ (if (slot-bound? class 'name)
+ (begin
+ (display "#<" file)
+ (display (class-name class) file)
+ (display #\space file)
+ (display-address o file)
+ (display-pointer-address o file)
+ (display ">" file))
+ (next-method))))
+
+(export <swig-metaclass> <swig>)
+
+;;; common.scm ends here
diff --git a/gnuradio-core/src/lib/swig/gnuradio/.gitignore b/gnuradio-core/src/lib/swig/gnuradio/.gitignore
new file mode 100644
index 000000000..20ce65795
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio/.gitignore
@@ -0,0 +1,12 @@
+/gnuradio_core_filter.scm
+/gnuradio_core_filter-primitive.scm
+/gnuradio_core_general.scm
+/gnuradio_core_general-primitive.scm
+/gnuradio_core_gengen.scm
+/gnuradio_core_gengen-primitive.scm
+/gnuradio_core_hier.scm
+/gnuradio_core_hier-primitive.scm
+/gnuradio_core_io.scm
+/gnuradio_core_io-primitive.scm
+/gnuradio_core_runtime.scm
+/gnuradio_core_runtime-primitive.scm
diff --git a/gnuradio-core/src/lib/swig/gnuradio/core.scm b/gnuradio-core/src/lib/swig/gnuradio/core.scm
new file mode 100644
index 000000000..3b12d4025
--- /dev/null
+++ b/gnuradio-core/src/lib/swig/gnuradio/core.scm
@@ -0,0 +1,11 @@
+(define-module (gnuradio core)
+ #:use-module (gnuradio gnuradio_core_runtime)
+ #:use-module (gnuradio gnuradio_core_filter)
+ #:use-module (gnuradio gnuradio_core_io)
+ #: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))
+
+;; re-export everything...
+
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core.scm b/gnuradio-core/src/lib/swig/gnuradio_core.scm
deleted file mode 100644
index 2aae2d1d8..000000000
--- a/gnuradio-core/src/lib/swig/gnuradio_core.scm
+++ /dev/null
@@ -1,32 +0,0 @@
-;;;
-;;; Copyright 2010 Free Software Foundation, Inc.
-;;;
-;;; This file is part of GNU Radio
-;;;
-;;; GNU Radio is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 3, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Radio is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License along
-;;; with this program; if not, write to the Free Software Foundation, Inc.,
-;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-;;;
-
-;; Only use these if load-* fails to find a .scm or .so. If you can't
-;; find a .so, try running ldconfig. guile seems to only load modules
-;; that are in the ldconfig paths.
-;; (set! %load-path (append %load-path '("/usr/lib/guile/gnuradio")))
-;; (set! %load-path (append %load-path '("/usr/share/gnuradio")))
-
-(load "gnuradio/gnuradio_core_filter.scm")
-(load "gnuradio/gnuradio_core_io.scm")
-(load "gnuradio/gnuradio_core_runtime.scm")
-(load "gnuradio/gnuradio_core_general.scm")
-(load "gnuradio/gnuradio_core_gengen.scm")
-(load "gnuradio/gnuradio_core_hier.scm")
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
index b03996b76..0acbfa3a6 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_filter.i
@@ -31,6 +31,10 @@
#if SWIGGUILE
%scheme %{
-(load-extension "libguile-gnuradio_core_filter" "SWIG_init")
+(load-extension "libguile-gnuradio_core_filter" "scm_init_gnuradio_gnuradio_core_filter_module")
%}
- #endif
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
+%}
+#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_general.i b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
index 3edca69ef..8b3bf971b 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_general.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_general.i
@@ -51,6 +51,10 @@
#if SWIGGUILE
%scheme %{
-(load-extension "libguile-gnuradio_core_general" "SWIG_init")
+(load-extension "libguile-gnuradio_core_general" "scm_init_gnuradio_gnuradio_core_general_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
%}
#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
index e6f9ebcf4..c08109173 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_gengen.i
@@ -31,6 +31,10 @@
#if SWIGGUILE
%scheme %{
-(load-extension "libguile-gnuradio_core_gengen" "SWIG_init")
+(load-extension "libguile-gnuradio_core_gengen" "scm_init_gnuradio_gnuradio_core_gengen_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
%}
#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
index 0da432ce0..6d7a38321 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_hier.i
@@ -31,6 +31,10 @@
#if SWIGGUILE
%scheme %{
-(load-extension "libguile-gnuradio_core_hier" "SWIG_init")
+(load-extension "libguile-gnuradio_core_hier" "scm_init_gnuradio_gnuradio_core_hier_module")
+%}
+
+%goops %{
+ (use-modules (gnuradio gnuradio_core_runtime))
%}
#endif
diff --git a/gnuradio-core/src/lib/swig/gnuradio_core_io.i b/gnuradio-core/src/lib/swig/gnuradio_core_io.i
index b1dcfaf21..936522ada 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_io.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_io.i
@@ -31,6 +31,10 @@
#if SWIGGUILE
%scheme %{
-(load-extension "libguile-gnuradio_core_io" "SWIG_init")
+(load-extension "libguile-gnuradio_core_io" "scm_init_gnuradio_gnuradio_core_io_module")
+%}
+
+%goops %{
+ (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 4372b993d..2f6ca8227 100644
--- a/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
+++ b/gnuradio-core/src/lib/swig/gnuradio_core_runtime.i
@@ -34,6 +34,6 @@
#if SWIGGUILE
%scheme %{
-(load-extension "libguile-gnuradio_core_runtime" "SWIG_init")
+(load-extension "libguile-gnuradio_core_runtime" "scm_init_gnuradio_gnuradio_core_runtime_module")
%}
#endif