summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/general/gr_bin_statistics_f.i7
-rw-r--r--gnuradio-core/src/lib/general/gr_feval.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_msg_queue.i65
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.i37
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.am21
6 files changed, 107 insertions, 55 deletions
diff --git a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
index 5cec882f0..be98a464b 100644
--- a/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
+++ b/gnuradio-core/src/lib/general/gr_bin_statistics_f.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -19,6 +19,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+// Directors are only supported in Python, Java and C#. gr_feval_dd uses directors
+#ifdef SWIGPYTHON
+
GR_SWIG_BLOCK_MAGIC(gr,bin_statistics_f);
gr_bin_statistics_f_sptr
@@ -40,3 +43,5 @@ private:
public:
~gr_bin_statistics_f();
};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_feval.i b/gnuradio-core/src/lib/general/gr_feval.i
index 843ca3f2a..c5522805d 100644
--- a/gnuradio-core/src/lib/general/gr_feval.i
+++ b/gnuradio-core/src/lib/general/gr_feval.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006 Free Software Foundation, Inc.
+ * Copyright 2006,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -43,6 +43,9 @@
*/
+// Directors are only supported in Python, Java and C#
+#ifdef SWIGPYTHON
+
// Enable SWIG directors for these classes
%feature("director") gr_py_feval_dd;
%feature("director") gr_py_feval_cc;
@@ -65,8 +68,8 @@
// catch (Swig::DirectorException &e) { std::cerr << e.getMessage(); SWIG_fail; }
//}
-#ifdef SWIGPYTHON
%{
+
// class that ensures we acquire and release the Python GIL
class ensure_py_gil_state {
@@ -77,19 +80,6 @@ public:
};
%}
-#endif
-
-#ifdef SWIGGUILE
-#if 0
-// FIXME: this is a bogus stub, just here so things build
-class ensure_py_gil_state {
-public:
- ensure_py_gil_state() { }
- ~ensure_py_gil_state() { }
-};
-#endif
-#warning "class ensure_py_gil_state needs to be implemented!"
-#endif
/*
* These are the real C++ base classes, however we don't want these exposed.
@@ -158,9 +148,7 @@ class gr_py_feval_dd : public gr_feval_dd
public:
double calleval(double x)
{
-#ifdef PYTHON
ensure_py_gil_state _lock;
-#endif
return eval(x);
}
};
@@ -170,9 +158,7 @@ class gr_py_feval_cc : public gr_feval_cc
public:
gr_complex calleval(gr_complex x)
{
-#ifdef PYTHON
ensure_py_gil_state _lock;
-#endif
return eval(x);
}
};
@@ -182,9 +168,7 @@ class gr_py_feval_ll : public gr_feval_ll
public:
long calleval(long x)
{
-#ifdef PYTHON
ensure_py_gil_state _lock;
-#endif
return eval(x);
}
};
@@ -194,9 +178,7 @@ class gr_py_feval : public gr_feval
public:
void calleval()
{
-#ifdef PYTHON
ensure_py_gil_state _lock;
-#endif
eval();
}
};
@@ -218,3 +200,5 @@ long gr_feval_ll_example(gr_feval_ll *f, long x);
%rename(feval_example) gr_feval_example;
void gr_feval_example(gr_feval *f);
+
+#endif // SWIGPYTHON
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i
index 30c692926..3850220ba 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i
+++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.i
@@ -26,7 +26,7 @@ gr_ofdm_mapper_bcv_sptr
gr_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation,
unsigned int msgq_limit,
unsigned int bits_per_symbol,
- unsigned int fft_length);
+ unsigned int fft_length) throw(std::exception);
class gr_ofdm_mapper_bcv : public gr_sync_block
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
diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am
index 95edf5181..a97bb6ea0 100644
--- a/gnuradio-core/src/lib/swig/Makefile.am
+++ b/gnuradio-core/src/lib/swig/Makefile.am
@@ -24,11 +24,6 @@ include $(top_srcdir)/Makefile.swig
BUILT_SOURCES = $(grinclude_HEADERS) $(swig_built_sources)
-CLEANFILES = python/*.cc python/*.h
-if GUILE
-CLEANFILES += guile/*.cc gnuradio/*.scm
-endif
-
# ----------------------------------------------------------------
# We've split the previously monstrous gnuradio_core into 6
# smaller pieces. This reduces compile time coupling and creates
@@ -62,7 +57,6 @@ AM_CPPFLAGS = -I$(srcdir) $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \
EXTRA_DIST = gen-swig-bug-fix
-if PYTHON
# special install for this top-level Python script which includes all
# of the split Python libraries.
ourpythondir = $(grpythondir)/gr
@@ -95,20 +89,5 @@ gnuradio_core_filter_la_swig_libadd = $(GNURADIO_CORE_LA)
gnuradio_core_io_la_swig_libadd = $(GNURADIO_CORE_LA)
gnuradio_core_hier_la_swig_libadd = $(GNURADIO_CORE_LA)
-# add some of the variables generated inside the Makefile.swig
-
-# include the SWIG-generated .h files in the BUILT SOURCES, since they
-# aren't by default when using Makefile.swig; order doesn't matter.
-PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE)))
-swig_built_sources += $(PYTHON_GEN)
-endif # end of if python
-if GUILE
SWIG_GUILE_FLAGS += -DIN_GNURADIO_CORE
-GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE)))
-swig_built_sources += $(GUILE_GEN)
-endif # end of if guile
-
-# Do not distribute the output of SWIG
-no_dist_files = $(swig_built_sources)
-