summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
authorEric Blossom2010-11-18 22:22:23 -0800
committerEric Blossom2010-11-18 23:02:55 -0800
commit6237fafa53938db53a3e2a82b79e80b524dd05db (patch)
treeaa95a9db143c5454ed3b22c87fbc1dcc29797947 /gnuradio-core/src/lib/runtime
parentd1d226abdede58231583369047861cd2216489e9 (diff)
downloadgnuradio-6237fafa53938db53a3e2a82b79e80b524dd05db.tar.gz
gnuradio-6237fafa53938db53a3e2a82b79e80b524dd05db.tar.bz2
gnuradio-6237fafa53938db53a3e2a82b79e80b524dd05db.zip
gr_msg_queue now working correctly from within guile.
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.i58
1 files changed, 55 insertions, 3 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..932747688 100644
--- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i
+++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i
@@ -104,8 +104,60 @@ 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;
+ };
+
+ void *insert_tail_shim(void *arg)
+ {
+ arg_holder *a = (arg_holder *)arg;
+ a->q->insert_tail(a->msg);
+ return 0;
+ }
+
+ 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