summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Guile-TODO73
-rw-r--r--config/Makefile.am1
-rw-r--r--config/grc_gr_guile.m436
-rw-r--r--configure.ac3
-rw-r--r--gnuradio-core/src/guile/Makefile.am6
-rw-r--r--gnuradio-core/src/guile/gnuradio/waveform.scm (renamed from gnuradio-core/src/guile/gnuradio/waveform-spec.scm)38
-rw-r--r--gnuradio-core/src/lib/.gitignore2
-rw-r--r--gr-audio-alsa/src/audio_alsa.test2
-rw-r--r--gr-guile/.gitignore6
-rw-r--r--gr-guile/Makefile.am22
-rw-r--r--gr-guile/apps/.gitignore6
-rw-r--r--gr-guile/apps/Makefile.am23
-rw-r--r--gr-guile/apps/README2
-rwxr-xr-xgr-guile/apps/gr-run-waveform64
-rw-r--r--gr-guile/example-waveforms/.gitignore6
-rw-r--r--gr-guile/example-waveforms/Makefile.am25
-rw-r--r--gr-guile/example-waveforms/dial-tone.wfd41
17 files changed, 339 insertions, 17 deletions
diff --git a/Guile-TODO b/Guile-TODO
new file mode 100644
index 000000000..95f50e74f
--- /dev/null
+++ b/Guile-TODO
@@ -0,0 +1,73 @@
+In no particular order:
+
+1) Ensure that libraries containing swig generated code are regenerated
+ when any relevant .i file is touched.
+
+2) SIGINT handling in gr_top_block::wait
+
+3) Ensure that all 4 combinations of
+ --{enable,disable}-python --{enable,disable}-guile
+ work correctly.
+
+ When both are disabled swig should NOT be run.
+ When --enable-guile --disable-python, python swig stuff should not be generated.
+ When --disable-guile --enable-python, guile swig stuff should not be generated.
+
+4) Fix GR_SWIG_BLOCK_MAGIC so that in the guile case we don't map all
+ the constructors into the same name. E.g. audio_alsa_sink -> sink.
+ (Causes problem when multiple gr-* modules are used.)
+
+5) Ensure that all gr-* components are generating guile code when
+ enabled, and that (1) and (3) are handled in all gr-* components.
+
+5b) Don't forget gr-howto-write-a-block. (It's got its own
+ configure.ac and is built separately from the rest.)
+
+6) Fix printed representation of blocks in gr_block.i
+
+7) Fix gr-usrp so that it works. Probably related to
+ warning received when generating python bindings.
+ Making the swig/python warning go away will probably resolve the
+ guile problem.
+
+8) Fix gr_message_{sink,source} so that they work under guile.
+ (Not sure if I disabled one or both of these...)
+
+9) Any other FIXME style warnings
+
+10) Finish gnuradio-core test cases
+
+11) Write test cases for gr-* components.
+
+ For the one's that have a h/w dependency, just confirm that we can
+ load the module. See gr_audio_alsa/src/audio_alsa.test for an
+ example.
+
+ For the others, write a test in the style of the ones in
+ gnuradio-core.
+
+12) Swig guile modules names: s/_/-/g
+
+13) Change guile libnames to libguile-gnuradio-<module-name>
+
+14) Add support to setup_guile_test_env.in for
+ "withlibs", OS/X (DYLD_LIBRARY_PATH), windows (PATH)
+
+
+
+I'm sure I'm forgetting some things...
+
+
+
+80) Confirm make dist and make distcheck work
+
+81) Anything else that would keep us from merging into next.
+
+82) Get some other developers to try it out.
+
+
+
+
+90) Merge to next
+
+100) Handle any fallout we missed.
diff --git a/config/Makefile.am b/config/Makefile.am
index 4dc7216f1..f5f478cff 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -61,6 +61,7 @@ m4macros = \
grc_gr_gcell.m4 \
grc_gr_gpio.m4 \
grc_gr_gsm_fr_vocoder.m4 \
+ grc_gr_guile.m4 \
grc_gr_noaa.m4 \
grc_gr_radar_mono.m4 \
grc_gr_radio_astronomy.m4 \
diff --git a/config/grc_gr_guile.m4 b/config/grc_gr_guile.m4
new file mode 100644
index 000000000..35d6834eb
--- /dev/null
+++ b/config/grc_gr_guile.m4
@@ -0,0 +1,36 @@
+dnl Copyright 2001,2002,2003,2004,2005,2006,2008,2009,2010 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_GR_GUILE],[
+ GRC_ENABLE(gr-guile)
+
+ dnl Don't do gr-guile if gnuradio-core skipped
+ GRC_CHECK_DEPENDENCY(gr-guile, gnuradio-core)
+
+ AC_CONFIG_FILES([ \
+ gr-guile/Makefile \
+ gr-guile/apps/Makefile \
+ gr-guile/example-waveforms/Makefile \
+ ])
+
+ GRC_BUILD_CONDITIONAL(gr-guile,[
+ dnl run_tests is created from run_tests.in. Make it executable.
+ dnl AC_CONFIG_COMMANDS([run_tests_guile], [chmod +x gr-guile/apps/run_guile_tests])
+ ])
+])
diff --git a/configure.ac b/configure.ac
index 1e17f8d6a..b99b60b44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -389,6 +389,7 @@ GRC_GR_COMEDI
GRC_GR_CVSD_VOCODER
GRC_GR_GPIO
GRC_GR_GSM_FR_VOCODER
+GRC_GR_GUILE
GRC_GR_NOAA
GRC_GR_PAGER
GRC_GR_RADAR_MONO
@@ -398,7 +399,7 @@ GRC_GR_VIDEO_SDL
GRC_GR_WXGUI
GRC_GR_QTGUI
GRC_GR_SOUNDER dnl this must come after GRC_USRP
-GRC_GR_UTILS dnl this must come after GRC_GR_WXGUI
+GRC_GR_UTILS dnl this must come after GRC_GR_WXGUI
GRC_GNURADIO_EXAMPLES dnl must come after all GRC_GR_*
GRC_GRC
GRC_GR_UHD
diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am
index f4cc14175..0c0becbc1 100644
--- a/gnuradio-core/src/guile/Makefile.am
+++ b/gnuradio-core/src/guile/Makefile.am
@@ -22,7 +22,8 @@ include $(top_srcdir)/Makefile.common
TESTS = run_guile_tests
EXTRA_DIST = \
- run_guile_tests.in
+ run_guile_tests.in \
+ $(GUILE_TESTS)
# These are the hand-code guile files for gnuradio-core.
#
@@ -36,10 +37,11 @@ nobase_guile_DATA = \
gnuradio/core.scm \
gnuradio/export-safely.scm \
gnuradio/runtime-shim.scm \
+ gnuradio/waveform.scm \
gnuradio/test-suite/guile-test \
gnuradio/test-suite/lib.scm
-noinst_DATA = \
+GUILE_TESTS = \
tests/00_runtime_basics.test \
tests/00_runtime_ctors.test \
tests/filter_ctors.test \
diff --git a/gnuradio-core/src/guile/gnuradio/waveform-spec.scm b/gnuradio-core/src/guile/gnuradio/waveform.scm
index 956a36106..0031be931 100644
--- a/gnuradio-core/src/guile/gnuradio/waveform-spec.scm
+++ b/gnuradio-core/src/guile/gnuradio/waveform.scm
@@ -17,20 +17,38 @@
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;
-(define-module (gnuradio waveform-spec)
+(define-module (gnuradio waveform)
#:use-module (ice-9 syncase)
- #:export-syntax waveform-spec)
+ #:export-syntax (define-waveform))
-(define-syntax waveform-spec
+
+(define *registry* '()) ; alist
+(define *last-registered* #f)
+
+
+(define-syntax define-waveform
(syntax-rules (vars blocks connections)
- ((_ (args ...)
+ ((_ (name cmd-line-args)
(vars (v-name v-val) ...)
(blocks (b-name b-val) ...)
(connections (endpoint1 endpoint2 ...) ...))
- (lambda (args ...)
- (let* ((v-name v-val) ...
- (b-name b-val) ...
- (tb (gr:top-block-swig "waveform-top-block")))
- (gr:connect tb endpoint1 endpoint2 ...) ...
- tb)))))
+ (waveform-register 'name
+ (lambda (cmd-line-args)
+ (let* ((v-name v-val) ...
+ (b-name b-val) ...
+ (tb (gr:top-block-swig "waveform-top-block")))
+ (gr:connect tb endpoint1 endpoint2 ...) ...
+ tb))))))
+
+
+(define-public (waveform-register name thunk)
+ (set! *registry* (assoc-set! *registry* name thunk))
+ (set! *last-registered* thunk)
+ #t)
+
+(define-public (waveform-lookup name)
+ (let ((r (assoc name *registry*)))
+ (and r (cdr r))))
+(define-public (waveform-last-registered)
+ *last-registered*)
diff --git a/gnuradio-core/src/lib/.gitignore b/gnuradio-core/src/lib/.gitignore
index e3bc1ee6a..0d5077da5 100644
--- a/gnuradio-core/src/lib/.gitignore
+++ b/gnuradio-core/src/lib/.gitignore
@@ -1,7 +1,5 @@
/Makefile
/Makefile.in
-/.la
-/.lo
/.deps
/.libs
/*.la
diff --git a/gr-audio-alsa/src/audio_alsa.test b/gr-audio-alsa/src/audio_alsa.test
index edf425b9f..240045593 100644
--- a/gr-audio-alsa/src/audio_alsa.test
+++ b/gr-audio-alsa/src/audio_alsa.test
@@ -34,5 +34,3 @@
(use-modules (gnuradio audio_alsa))
-
-
diff --git a/gr-guile/.gitignore b/gr-guile/.gitignore
new file mode 100644
index 000000000..16c984055
--- /dev/null
+++ b/gr-guile/.gitignore
@@ -0,0 +1,6 @@
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
diff --git a/gr-guile/Makefile.am b/gr-guile/Makefile.am
new file mode 100644
index 000000000..34b4b6fba
--- /dev/null
+++ b/gr-guile/Makefile.am
@@ -0,0 +1,22 @@
+#
+# 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, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+SUBDIRS = apps example-waveforms
diff --git a/gr-guile/apps/.gitignore b/gr-guile/apps/.gitignore
new file mode 100644
index 000000000..16c984055
--- /dev/null
+++ b/gr-guile/apps/.gitignore
@@ -0,0 +1,6 @@
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
diff --git a/gr-guile/apps/Makefile.am b/gr-guile/apps/Makefile.am
new file mode 100644
index 000000000..7e4c3c2c4
--- /dev/null
+++ b/gr-guile/apps/Makefile.am
@@ -0,0 +1,23 @@
+#
+# 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, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+bin_SCRIPTS = \
+ gr-run-waveform
diff --git a/gr-guile/apps/README b/gr-guile/apps/README
new file mode 100644
index 000000000..703146bd4
--- /dev/null
+++ b/gr-guile/apps/README
@@ -0,0 +1,2 @@
+This applications will not run from the build tree. They must be
+installed first using "make install"
diff --git a/gr-guile/apps/gr-run-waveform b/gr-guile/apps/gr-run-waveform
new file mode 100755
index 000000000..a8d1d0389
--- /dev/null
+++ b/gr-guile/apps/gr-run-waveform
@@ -0,0 +1,64 @@
+#!/usr/bin/guile \
+-e main -s
+!#
+;;;
+;;; 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, see <http://www.gnu.org/licenses/>.
+;;;
+
+;;; Load and run a waveform defined with define-waveform
+;;;
+;;; usage: gr-run-waveform filename.wfd
+
+
+(use-modules (oop goops)
+ (gnuradio core)
+ (gnuradio waveform))
+
+
+(define (enable-debug-mode)
+ (display %load-path)
+ (newline)
+ (set! %load-verbosely #t)
+ (debug-enable 'backtrace 'debug))
+
+(define (usage args)
+ (let ((port (current-error-port)))
+ (display "usage: " port)
+ (display (car args) port)
+ (newline port)
+ (exit 1)))
+
+
+(define (main args)
+ (if (not (>= (length args) 2))
+ (usage args))
+ (enable-debug-mode)
+ (let ((filename (cadr args)))
+ ;; Probably ought to handle errors here
+ (load filename)
+ (let ((f (waveform-last-registered)))
+ (if (not f)
+ (begin
+ (format 1 "No define-waveform found in file '~A'\n" filename)
+ (exit 1)))
+ (gr:run (f (cdr args))))))
+
+
+;;; Local Variables:
+;;; mode: scheme
+;;; End:
diff --git a/gr-guile/example-waveforms/.gitignore b/gr-guile/example-waveforms/.gitignore
new file mode 100644
index 000000000..16c984055
--- /dev/null
+++ b/gr-guile/example-waveforms/.gitignore
@@ -0,0 +1,6 @@
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
diff --git a/gr-guile/example-waveforms/Makefile.am b/gr-guile/example-waveforms/Makefile.am
new file mode 100644
index 000000000..cda4172de
--- /dev/null
+++ b/gr-guile/example-waveforms/Makefile.am
@@ -0,0 +1,25 @@
+#
+# 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, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+waveformdir=$(datarootdir)/gnuradio/example-waveforms
+
+waveform_DATA = \
+ dial-tone.wfd
diff --git a/gr-guile/example-waveforms/dial-tone.wfd b/gr-guile/example-waveforms/dial-tone.wfd
new file mode 100644
index 000000000..75091ad36
--- /dev/null
+++ b/gr-guile/example-waveforms/dial-tone.wfd
@@ -0,0 +1,41 @@
+;;; Emacs, format this using -*-scheme-*- mode.
+;;;
+;;; 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, see <http://www.gnu.org/licenses/>.
+;;;
+
+;;; This example waveform outputs a signal to an audio_alsa_sink
+;;; that sounds like North American dial tone.
+
+(use-modules (gnuradio audio_alsa))
+
+
+(define-waveform (dial-tone cmd-line-args)
+ (vars
+ (sample-rate 48000)
+ (ampl 0.1))
+
+ (blocks
+ (src0 (gr:sig-source-f sample-rate (gr:GR-SIN-WAVE) 350 ampl))
+ (src1 (gr:sig-source-f sample-rate (gr:GR-SIN-WAVE) 440 ampl))
+ ;;(sink (gr:audio-alsa-sink sample-rate "plughw:0,0"))
+ (sink (gr:sink sample-rate "plughw:0,0"))
+ )
+
+ (connections
+ (src0 (list sink 0)) ; src0 to left input
+ (src1 (list sink 1)))) ; src1 to right input