diff options
author | Eric Blossom | 2010-11-15 23:49:35 -0800 |
---|---|---|
committer | Eric Blossom | 2010-11-15 23:49:35 -0800 |
commit | c80fdf2897624d10123a35b1a19d150f3a5645c8 (patch) | |
tree | 4503432c71143f385cf8264611c6528682a7b84c /gnuradio-core/src | |
parent | f0ed1de2d15b24eae7be7ab8a4762a6fd74ff681 (diff) | |
download | gnuradio-c80fdf2897624d10123a35b1a19d150f3a5645c8.tar.gz gnuradio-c80fdf2897624d10123a35b1a19d150f3a5645c8.tar.bz2 gnuradio-c80fdf2897624d10123a35b1a19d150f3a5645c8.zip |
Modify GR_SWIG_BLOCK_MAGIC to not strip package prefix when using
GUILE outside of gnuradio-core.
This avoids the problem with the guile bindings where multiple blocks
end up with the name gr:sink (e.g., audio_alsa_sink). With this
change, it ends us as gr:audio-alsa-sink.
Blocks in gnuradio-core continue to have the leading gr_ removed from
their class names.
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/lib/swig/Makefile.am | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/swig/gr_swig_block_magic.i | 35 |
2 files changed, 24 insertions, 12 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 |