summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/swig/Makefile.am1
-rw-r--r--gnuradio-core/src/lib/swig/gr_swig_block_magic.i35
-rw-r--r--gr-guile/example-waveforms/dial-tone.wfd3
3 files changed, 25 insertions, 14 deletions
diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am
index 5e003bdf2..8e356bea8 100644
--- a/gnuradio-core/src/lib/swig/Makefile.am
+++ b/gnuradio-core/src/lib/swig/Makefile.am
@@ -104,6 +104,7 @@ 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,%.scm,$(HFILE)))
GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE)))
# GUILE_GEN_STAMPS = $(filter %.scm,$(TOP_SWIG_IFILES))
diff --git a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
index ea6368fd4..a080c2b27 100644
--- a/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
+++ b/gnuradio-core/src/lib/swig/gr_swig_block_magic.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,29 +21,40 @@
*/
%define GR_SWIG_BLOCK_MAGIC(PKG, BASE_NAME)
-_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, PKG ## _ ## BASE_NAME, BASE_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, PKG ## _ ## BASE_NAME)
%enddef
-%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME)
-class NAME;
-typedef boost::shared_ptr<NAME> NAME ## _sptr;
-%template(NAME ## _sptr) boost::shared_ptr<NAME>;
+%define _GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
+class FULL_NAME;
+typedef boost::shared_ptr<FULL_NAME> FULL_NAME ## _sptr;
+%template(FULL_NAME ## _sptr) boost::shared_ptr<FULL_NAME>;
%rename(BASE_NAME) PKG ## _make_ ## BASE_NAME;
-%ignore NAME;
+%ignore FULL_NAME;
%enddef
#ifdef SWIGPYTHON
-%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME)
-_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME)
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
%pythoncode %{
-NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
+FULL_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id ())
%}
%enddef
#endif
#ifdef SWIGGUILE
-%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, NAME, BASE_NAME)
-_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, NAME, BASE_NAME)
+#ifdef IN_GNURADIO_CORE // normal behavior
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+_GR_SWIG_BLOCK_MAGIC_HELPER_COMMON(PKG, BASE_NAME, FULL_NAME)
/* FIXME May want to add something here to get a friendlier printed representation */
%enddef
+#else // Don't strip PKG from name
+%define _GR_SWIG_BLOCK_MAGIC_HELPER(PKG, BASE_NAME, FULL_NAME)
+class FULL_NAME;
+typedef boost::shared_ptr<FULL_NAME> FULL_NAME ## _sptr;
+%template(FULL_NAME ## _sptr) boost::shared_ptr<FULL_NAME>;
+%ignore FULL_NAME;
+%rename(FULL_NAME) PKG ## _make_ ## BASE_NAME;
+/* FIXME May want to add something here to get a friendlier printed representation */
+%enddef
+#endif
#endif
diff --git a/gr-guile/example-waveforms/dial-tone.wfd b/gr-guile/example-waveforms/dial-tone.wfd
index 75091ad36..ced3df572 100644
--- a/gr-guile/example-waveforms/dial-tone.wfd
+++ b/gr-guile/example-waveforms/dial-tone.wfd
@@ -32,8 +32,7 @@
(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"))
+ (sink (gr:audio-alsa-sink sample-rate "plughw:0,0"))
)
(connections