diff options
author | Eric Blossom | 2010-10-28 15:05:52 -0700 |
---|---|---|
committer | Eric Blossom | 2010-11-10 12:13:53 -0800 |
commit | 299aba578b76e1f07cb3e4e5ff59ee6b306afb5a (patch) | |
tree | 827f1f80a477a4caa59676bdc24a02c60d502e83 /gnuradio-core/src/lib/swig | |
parent | 4cfeec9a0be5606cfadd03b0fcfa0615766b1676 (diff) | |
download | gnuradio-299aba578b76e1f07cb3e4e5ff59ee6b306afb5a.tar.gz gnuradio-299aba578b76e1f07cb3e4e5ff59ee6b306afb5a.tar.bz2 gnuradio-299aba578b76e1f07cb3e4e5ff59ee6b306afb5a.zip |
Version that builds guile goops bindings, but dependencies are hosed.
Doesn't compile cleanly, but does enough to allow experimentation with
goops wrappers. We're currently seeing the nasty interaction between
the package system, the "export" syntax, and generic-functions.
See thread here:
http://lists.gnu.org/archive/html/guile-user/2006-05/msg00007.html
for background.
Diffstat (limited to 'gnuradio-core/src/lib/swig')
-rw-r--r-- | gnuradio-core/src/lib/swig/Makefile.am | 7 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/Makefile.swig.gen | 24 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/Swig/common.scm | 76 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio/.gitignore | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio/core.scm | 11 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core.scm | 32 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core_filter.i | 8 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core_general.i | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core_gengen.i | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core_hier.i | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core_io.i | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio_core_runtime.i | 2 |
12 files changed, 143 insertions, 53 deletions
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 |