summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
authorEric Blossom2010-11-21 19:11:33 -0800
committerEric Blossom2010-11-21 19:11:33 -0800
commit6f6a9f3f2f089c94e58a4202ee5ff2c47d1baf1f (patch)
treeb671e7ca06ae10397a84001b92709b86870b7da3 /gnuradio-core/src/lib/runtime
parentd4ed4d96470c91bcb7fb45da5e07641b24331cba (diff)
parentff62557a42b6ce89a711f9d0603c0fe52a891ed8 (diff)
downloadgnuradio-6f6a9f3f2f089c94e58a4202ee5ff2c47d1baf1f.tar.gz
gnuradio-6f6a9f3f2f089c94e58a4202ee5ff2c47d1baf1f.tar.bz2
gnuradio-6f6a9f3f2f089c94e58a4202ee5ff2c47d1baf1f.zip
Merge branch 'works' into broken
* works: Make Guile bindings work with --with-gnuradio-core et al. Update TODO Add guile SIGINT handler to gr:wait. Minor tweaks: comments, static Add guile shim to gr_top_block::wait that exits guile mode before blocking. Enable more tests Enable a couple more tests Remove 868 useless warnings about "is deprecated". gr_msg_queue now working correctly from within guile. Disable items that require swig directors when building guile bindings.
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.i65
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.i37
2 files changed, 93 insertions, 9 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
index 5b8fea49f..c9214bef3 100644
--- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i
+++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2009 Free Software Foundation, Inc.
+ * Copyright 2005,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -104,8 +104,65 @@ gr_msg_queue_sptr.delete_head = gr_py_msg_queue__delete_head
gr_msg_queue_sptr.insert_tail = gr_py_msg_queue__insert_tail
gr_msg_queue_sptr.handle = gr_py_msg_queue__insert_tail
%}
-#endif
+#endif // SWIGPYTHON
+/*
+ * Similar trickery as above, only this time for Guile
+ */
#ifdef SWIGGUILE
-#warning "gr_msg_queue.i: gr_msg_queue_sptr needs to be implemented!"
-#endif
+
+%{
+ struct arg_holder {
+ gr_msg_queue_sptr q;
+ gr_message_sptr msg;
+ };
+
+ static void *
+ insert_tail_shim(void *arg)
+ {
+ arg_holder *a = (arg_holder *)arg;
+ a->q->insert_tail(a->msg);
+ return 0;
+ }
+
+ static void *
+ delete_head_shim(void *arg)
+ {
+ arg_holder *a = (arg_holder *)arg;
+ a->msg = a->q->delete_head();
+ return 0;
+ }
+%}
+
+%inline %{
+
+ // handle and insert_tail are equivalent
+ static void
+ handle(gr_msg_queue_sptr q, gr_message_sptr msg)
+ {
+ arg_holder a;
+ a.q = q;
+ a.msg = msg;
+ scm_without_guile(insert_tail_shim, (void *) &a);
+ }
+
+ static void
+ insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg)
+ {
+ arg_holder a;
+ a.q = q;
+ a.msg = msg;
+ scm_without_guile(insert_tail_shim, (void *) &a);
+ }
+
+ static gr_message_sptr
+ delete_head(gr_msg_queue_sptr q)
+ {
+ arg_holder a;
+ a.q = q;
+ scm_without_guile(delete_head_shim, (void *) &a);
+ return a.msg;
+ }
+%}
+
+#endif // SWIGGUILE
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i
index f18d8890b..90fa18b94 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -42,8 +42,8 @@ public:
void start() throw (std::runtime_error);
void stop();
- void wait();
- void run() throw (std::runtime_error);
+ //void wait();
+ //void run() throw (std::runtime_error);
void lock();
void unlock() throw (std::runtime_error);
void dump();
@@ -71,6 +71,33 @@ void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
#endif
-#ifdef SWIG_GUILE
-#warning "gr_top_block.i: top_block_run_unlocked needs to be implemented!"
+#ifdef SWIGGUILE
+
+%{
+ struct tb_arg_holder {
+ gr_top_block_sptr tb;
+ };
+
+ static void *
+ tb_wait_shim(void *arg)
+ {
+ tb_arg_holder *a = (tb_arg_holder *)arg;
+ a->tb->wait();
+ return 0;
+ }
+
+%}
+
+%inline %{
+
+ static void
+ top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
+ {
+ tb_arg_holder a;
+ a.tb = r;
+ scm_without_guile(tb_wait_shim, (void *) &a);
+ }
+
+%}
+
#endif