summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/guile
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/guile')
-rw-r--r--gnuradio-core/src/guile/Makefile.am1
-rw-r--r--gnuradio-core/src/guile/gnuradio/run-waveform.scm53
2 files changed, 54 insertions, 0 deletions
diff --git a/gnuradio-core/src/guile/Makefile.am b/gnuradio-core/src/guile/Makefile.am
index 4e12b646d..50d46411a 100644
--- a/gnuradio-core/src/guile/Makefile.am
+++ b/gnuradio-core/src/guile/Makefile.am
@@ -41,6 +41,7 @@ nobase_guile_DATA = \
gnuradio/export-safely.scm \
gnuradio/runtime-shim.scm \
gnuradio/waveform.scm \
+ gnuradio/run-waveform.scm \
gnuradio/test-suite/guile-test \
gnuradio/test-suite/lib.scm
diff --git a/gnuradio-core/src/guile/gnuradio/run-waveform.scm b/gnuradio-core/src/guile/gnuradio/run-waveform.scm
new file mode 100644
index 000000000..3a2c4e6b7
--- /dev/null
+++ b/gnuradio-core/src/guile/gnuradio/run-waveform.scm
@@ -0,0 +1,53 @@
+;;;
+;;; 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
+
+
+;; I don't seem to be able to make this work...
+;; I think it's some kind of interaction with the syntax-case
+;; macro, define-waveform, and the module system.
+;;
+;;(define-module (gnuradio run-waveform)
+;; #:use-module (oop goops)
+;; #:use-module (gnuradio core)
+;; #:use-module (gnuradio waveform)
+;; #:duplicates (merge-generics replace check))
+
+(use-modules (oop goops)
+ (gnuradio core)
+ (gnuradio waveform))
+
+
+(define (load-into-module filename module)
+ (let ((f (open-file filename "r")))
+ (let loop ((form (read f)))
+ (cond ((eof-object? form) #t)
+ (else (eval form module)
+ (loop (read f)))))))
+
+
+(define-public (run-waveform waveform-filename . args)
+ (debug-enable 'backtrace 'debug)
+ (load waveform-filename)
+ ;;(load-into-module waveform-filename (current-module))
+ (let ((f (waveform-last-registered)))
+ (if (not f)
+ (error "No define-waveform found in file \n" filename)
+ (gr:run (f args)))))