summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--config/grc_gr_fcd.m42
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_float.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_char_to_short.h2
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_char.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_int.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_short.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_char.h2
-rw-r--r--gnuradio-core/src/lib/general/gr_short_to_float.h10
-rw-r--r--gr-digital/grc/CMakeLists.txt35
-rw-r--r--gr-digital/grc/Makefile.am2
-rw-r--r--gr-digital/grc/digital_block_tree.xml2
-rw-r--r--gr-digital/grc/digital_mpsk_snr_est_cc.xml56
-rw-r--r--gr-digital/grc/digital_probe_mpsk_snr_est_c.xml52
-rw-r--r--gr-fcd/lib/fcd_source_c_impl.cc2
-rw-r--r--gr-fcd/swig/CMakeLists.txt3
-rw-r--r--gr-fcd/swig/Makefile.am3
-rw-r--r--gr-fcd/swig/fcd_source_c.i22
-rw-r--r--gr-fcd/swig/fcd_swig.i10
-rw-r--r--grc/blocks/Makefile.am3
-rw-r--r--grc/blocks/block_tree.xml3
-rw-r--r--grc/blocks/gr_char_to_float.xml17
-rw-r--r--grc/blocks/gr_char_to_short.xml28
-rw-r--r--grc/blocks/gr_float_to_char.xml17
-rw-r--r--grc/blocks/gr_float_to_int.xml35
-rw-r--r--grc/blocks/gr_float_to_short.xml17
-rw-r--r--grc/blocks/gr_int_to_float.xml17
-rw-r--r--grc/blocks/gr_short_to_char.xml28
-rw-r--r--grc/blocks/gr_short_to_float.xml17
-rw-r--r--gruel/src/include/gruel/pmt.h19
-rw-r--r--gruel/src/lib/pmt/pmt.cc14
-rw-r--r--gruel/src/lib/pmt/pmt_int.h9
33 files changed, 414 insertions, 67 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4979e3498..a9cbe055a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,10 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
include(GrVersion) #setup version info
+# Append -O2 optimization flag for Debug builds
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2")
+
########################################################################
# Import executables from a native build (for cross compiling)
# http://www.vtk.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build
diff --git a/config/grc_gr_fcd.m4 b/config/grc_gr_fcd.m4
index 8094e1926..61727168f 100644
--- a/config/grc_gr_fcd.m4
+++ b/config/grc_gr_fcd.m4
@@ -32,7 +32,7 @@ AC_DEFUN([GRC_GR_FCD],[
AC_SUBST(USB_CPPFLAGS)
AC_SUBST(USB_LIBS)
- FCD_CPPFLAGS="${FCD_CPPFLAGS} -I\${abs_top_srcdir}/gr-fcd/include"
+ FCD_CPPFLAGS="${FCD_CPPFLAGS} -I\${abs_top_srcdir}/gr-fcd/include/fcd"
AC_SUBST(FCD_CPPFLAGS)
case "$target" in
diff --git a/gnuradio-core/src/lib/general/gr_char_to_float.h b/gnuradio-core/src/lib/general/gr_char_to_float.h
index 4ad8e59a8..1ab53a087 100644
--- a/gnuradio-core/src/lib/general/gr_char_to_float.h
+++ b/gnuradio-core/src/lib/general/gr_char_to_float.h
@@ -35,6 +35,9 @@ gr_make_char_to_float (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of chars to a stream of float
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
*/
class GR_CORE_API gr_char_to_float : public gr_sync_block
@@ -48,7 +51,14 @@ class GR_CORE_API gr_char_to_float : public gr_sync_block
float d_scale;
public:
+ /*!
+ * Get the scalar divider value.
+ */
float scale() const;
+
+ /*!
+ * Set the scalar divider value.
+ */
void set_scale(float scale);
virtual int work (int noutput_items,
diff --git a/gnuradio-core/src/lib/general/gr_char_to_short.h b/gnuradio-core/src/lib/general/gr_char_to_short.h
index 58f9a62b0..e93c15b12 100644
--- a/gnuradio-core/src/lib/general/gr_char_to_short.h
+++ b/gnuradio-core/src/lib/general/gr_char_to_short.h
@@ -35,6 +35,8 @@ gr_make_char_to_short (size_t vlen=1);
/*!
* \brief Convert stream of chars to a stream of float
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
*/
class GR_CORE_API gr_char_to_short : public gr_sync_block
diff --git a/gnuradio-core/src/lib/general/gr_float_to_char.h b/gnuradio-core/src/lib/general/gr_float_to_char.h
index c88645a18..00e83d465 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_char.h
+++ b/gnuradio-core/src/lib/general/gr_float_to_char.h
@@ -35,6 +35,9 @@ gr_make_float_to_char (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of float to a stream of char
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
*/
class GR_CORE_API gr_float_to_char : public gr_sync_block
@@ -48,7 +51,14 @@ class GR_CORE_API gr_float_to_char : public gr_sync_block
float d_scale;
public:
+ /*!
+ * Get the scalar multiplier value.
+ */
float scale() const;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
void set_scale(float scale);
virtual int work (int noutput_items,
diff --git a/gnuradio-core/src/lib/general/gr_float_to_int.h b/gnuradio-core/src/lib/general/gr_float_to_int.h
index 0b42c0aab..ef1987a76 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_int.h
+++ b/gnuradio-core/src/lib/general/gr_float_to_int.h
@@ -35,6 +35,9 @@ gr_make_float_to_int (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of float to a stream of short
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
*/
class GR_CORE_API gr_float_to_int : public gr_sync_block
@@ -48,7 +51,14 @@ class GR_CORE_API gr_float_to_int : public gr_sync_block
float d_scale;
public:
+ /*!
+ * Get the scalar multiplier value.
+ */
float scale() const;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
void set_scale(float scale);
virtual int work (int noutput_items,
diff --git a/gnuradio-core/src/lib/general/gr_float_to_short.h b/gnuradio-core/src/lib/general/gr_float_to_short.h
index 93e441f41..beb95486f 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_short.h
+++ b/gnuradio-core/src/lib/general/gr_float_to_short.h
@@ -35,6 +35,9 @@ gr_make_float_to_short (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of float to a stream of short
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar multiplier to change the output signal scale.
*/
class GR_CORE_API gr_float_to_short : public gr_sync_block
@@ -47,7 +50,14 @@ class GR_CORE_API gr_float_to_short : public gr_sync_block
float d_scale;
public:
+ /*!
+ * Get the scalar multiplier value.
+ */
float scale() const;
+
+ /*!
+ * Set the scalar multiplier value.
+ */
void set_scale(float scale);
virtual int work (int noutput_items,
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h
index af6488a50..7c55e3b3c 100644
--- a/gnuradio-core/src/lib/general/gr_int_to_float.h
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.h
@@ -35,6 +35,9 @@ gr_make_int_to_float (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of int to a stream of float
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
*/
class GR_CORE_API gr_int_to_float : public gr_sync_block
@@ -48,7 +51,14 @@ class GR_CORE_API gr_int_to_float : public gr_sync_block
float d_scale;
public:
+ /*!
+ * Get the scalar divider value.
+ */
float scale() const;
+
+ /*!
+ * Set the scalar divider value.
+ */
void set_scale(float scale);
virtual int work (int noutput_items,
diff --git a/gnuradio-core/src/lib/general/gr_short_to_char.h b/gnuradio-core/src/lib/general/gr_short_to_char.h
index 9682d86ec..f6b3b41ca 100644
--- a/gnuradio-core/src/lib/general/gr_short_to_char.h
+++ b/gnuradio-core/src/lib/general/gr_short_to_char.h
@@ -35,6 +35,8 @@ gr_make_short_to_char (size_t vlen=1);
/*!
* \brief Convert stream of short to a stream of float
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
*/
class GR_CORE_API gr_short_to_char : public gr_sync_block
diff --git a/gnuradio-core/src/lib/general/gr_short_to_float.h b/gnuradio-core/src/lib/general/gr_short_to_float.h
index efdc81ecd..e45d0b14b 100644
--- a/gnuradio-core/src/lib/general/gr_short_to_float.h
+++ b/gnuradio-core/src/lib/general/gr_short_to_float.h
@@ -35,6 +35,9 @@ gr_make_short_to_float (size_t vlen=1, float scale=1);
/*!
* \brief Convert stream of short to a stream of float
* \ingroup converter_blk
+ *
+ * \param vlen vector length of data streams.
+ * \param scale a scalar divider to change the output signal scale.
*/
class GR_CORE_API gr_short_to_float : public gr_sync_block
@@ -48,7 +51,14 @@ class GR_CORE_API gr_short_to_float : public gr_sync_block
float d_scale;
public:
+ /*!
+ * Get the scalar divider value.
+ */
float scale() const;
+
+ /*!
+ * Set the scalar divider value.
+ */
void set_scale(float scale);
virtual int work (int noutput_items,
diff --git a/gr-digital/grc/CMakeLists.txt b/gr-digital/grc/CMakeLists.txt
index e94c53556..bace20847 100644
--- a/gr-digital/grc/CMakeLists.txt
+++ b/gr-digital/grc/CMakeLists.txt
@@ -17,36 +17,5 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-install(FILES
- digital_block_tree.xml
- digital_binary_slicer_fb.xml
- digital_clock_recovery_mm_xx.xml
- digital_constellation_decoder_cb.xml
- digital_constellation_receiver_cb.xml
- digital_correlate_access_code_bb.xml
- digital_costas_loop_cc.xml
- digital_cma_equalizer_cc.xml
- digital_cpmmod_bc.xml
- digital_fll_band_edge_cc.xml
- digital_gmsk_demod.xml
- digital_gmsk_mod.xml
- digital_gmskmod_bc.xml
- digital_kurtotic_equalizer_cc.xml
- digital_lms_dd_equalizer_cc.xml
- digital_mpsk_receiver_cc.xml
- digital_dxpsk_mod.xml
- digital_dxpsk_demod.xml
- digital_psk_mod.xml
- digital_psk_demod.xml
- digital_qam_mod.xml
- digital_qam_demod.xml
- digital_ofdm_mod.xml
- digital_ofdm_demod.xml
- digital_ofdm_cyclic_prefixer.xml
- digital_ofdm_frame_acquisition.xml
- digital_ofdm_insert_preamble.xml
- digital_ofdm_sampler.xml
- digital_ofdm_sync_pn.xml
- DESTINATION ${GRC_BLOCKS_DIR}
- COMPONENT "digital_python"
-)
+file(GLOB xml_files "*.xml")
+install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "digital_python")
diff --git a/gr-digital/grc/Makefile.am b/gr-digital/grc/Makefile.am
index e6dd2aa92..029eeece2 100644
--- a/gr-digital/grc/Makefile.am
+++ b/gr-digital/grc/Makefile.am
@@ -40,6 +40,8 @@ dist_grcblocks_DATA = \
digital_kurtotic_equalizer_cc.xml \
digital_lms_dd_equalizer_cc.xml \
digital_mpsk_receiver_cc.xml \
+ digital_mpsk_snr_est_cc.xml \
+ digital_probe_mpsk_snr_est_c.xml \
digital_dxpsk_mod.xml \
digital_dxpsk_demod.xml \
digital_psk_mod.xml \
diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml
index 49a01973f..3ef4d0b1d 100644
--- a/gr-digital/grc/digital_block_tree.xml
+++ b/gr-digital/grc/digital_block_tree.xml
@@ -41,6 +41,8 @@
<block>digital_kurtotic_equalizer_cc</block>
<block>digital_lms_dd_equalizer_cc</block>
<block>digital_mpsk_receiver_cc</block>
+ <block>digital_mpsk_snr_est_cc</block>
+ <block>digital_probe_mpsk_snr_est_c</block>
</cat>
<cat>
<name>Digital Modulators</name>
diff --git a/gr-digital/grc/digital_mpsk_snr_est_cc.xml b/gr-digital/grc/digital_mpsk_snr_est_cc.xml
new file mode 100644
index 000000000..6039e5b13
--- /dev/null
+++ b/gr-digital/grc/digital_mpsk_snr_est_cc.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##MPSK SNR Estimator
+###################################################
+ -->
+<block>
+ <name>MPSK SNR Estimator</name>
+ <key>digital_mpsk_snr_est_cc</key>
+ <import>from gnuradio import digital</import>
+ <make>digital.mpsk_snr_est_cc($type, $tag_nsamples, $alpha)</make>
+ <callback>set_type($type)</callback>
+ <callback>set_tag_nsamples($tag_nsamples)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Simple</name>
+ <key>0</key>
+ </option>
+ <option>
+ <name>Skewness</name>
+ <key>1</key>
+ </option>
+ <option>
+ <name>2nd and 4th Moment</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>SVR</name>
+ <key>3</key>
+ </option>
+ </param>
+ <param>
+ <name>Samples between tags</name>
+ <key>tag_nsamples</key>
+ <value>10000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Filter Alpha</name>
+ <key>alpha</key>
+ <value>0.001</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml b/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml
new file mode 100644
index 000000000..62c5fad97
--- /dev/null
+++ b/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##MPSK SNR Estimator
+###################################################
+ -->
+<block>
+ <name>MPSK SNR Estimator Probe</name>
+ <key>digital_probe_mpsk_snr_est_c</key>
+ <import>from gnuradio import digital</import>
+ <make>digital.probe_mpsk_snr_est_c($type, $msg_nsamples, $alpha)</make>
+ <callback>set_type($type)</callback>
+ <callback>set_msg_nsample($msg_nsamples)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Simple</name>
+ <key>0</key>
+ </option>
+ <option>
+ <name>Skewness</name>
+ <key>1</key>
+ </option>
+ <option>
+ <name>2nd and 4th Moment</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>SVR</name>
+ <key>3</key>
+ </option>
+ </param>
+ <param>
+ <name>Samples between SNR messages</name>
+ <key>msg_nsamples</key>
+ <value>10000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Filter Alpha</name>
+ <key>alpha</key>
+ <value>0.001</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+</block>
diff --git a/gr-fcd/lib/fcd_source_c_impl.cc b/gr-fcd/lib/fcd_source_c_impl.cc
index 9543f16eb..ca370d9f3 100644
--- a/gr-fcd/lib/fcd_source_c_impl.cc
+++ b/gr-fcd/lib/fcd_source_c_impl.cc
@@ -47,7 +47,7 @@ static const int MIN_OUT = 1; /*!< Minimum number of output streams. */
static const int MAX_OUT = 1; /*!< Maximum number of output streams. */
fcd_source_c_impl::fcd_source_c_impl(const std::string device_name)
- : gr_hier_block2 ("fcd_source_c_impl",
+ : gr_hier_block2 ("fcd_source_c",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
d_freq_corr(-120),
diff --git a/gr-fcd/swig/CMakeLists.txt b/gr-fcd/swig/CMakeLists.txt
index 7d881c0b4..f715c4785 100644
--- a/gr-fcd/swig/CMakeLists.txt
+++ b/gr-fcd/swig/CMakeLists.txt
@@ -23,6 +23,8 @@
include(GrPython)
include(GrSwig)
+#set(GR_SWIG_FLAGS -DGR_HAVE_FCD) #needed to parse fcd_swig.i
+
set(GR_SWIG_INCLUDE_DIRS
${GR_FCD_INCLUDE_DIRS}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
@@ -45,7 +47,6 @@ GR_SWIG_INSTALL(
install(
FILES
fcd_swig.i
- fcd_source_c.i
${CMAKE_CURRENT_BINARY_DIR}/fcd_swig_doc.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "fcd_swig"
diff --git a/gr-fcd/swig/Makefile.am b/gr-fcd/swig/Makefile.am
index cec8fa29a..225f32ae0 100644
--- a/gr-fcd/swig/Makefile.am
+++ b/gr-fcd/swig/Makefile.am
@@ -43,6 +43,8 @@ AM_CPPFLAGS = \
# The SWIG library
# TESTS = run_tests
+fcd_swig_swig_args = $(FCD_CPPFLAGS)
+
TOP_SWIG_DOC_IFILES = \
fcd_swig_doc.i
@@ -72,7 +74,6 @@ fcd_swig_la_swig_libadd = \
# additional SWIG files to be installed
fcd_swig_swiginclude_headers = \
- fcd_source_c.i \
$(TOP_SWIG_DOC_IFILES)
if GUILE
diff --git a/gr-fcd/swig/fcd_source_c.i b/gr-fcd/swig/fcd_source_c.i
deleted file mode 100644
index 77fcf8a42..000000000
--- a/gr-fcd/swig/fcd_source_c.i
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * First arg is the package prefix.
- * Second arg is the name of the class minus the prefix.
- *
- * This does some behind-the-scenes magic so we can
- * access fcd_source_c from python as fcd.source_c
- */
-GR_SWIG_BLOCK_MAGIC(fcd,source_c);
-
-fcd_source_c_sptr fcd_make_source_c (const std::string device_name = "");
-
-class fcd_source_c : public gr_hier_block2
-{
-public:
- void set_freq(float freq);
- void set_freq_khz(int freq);
- void set_lna_gain(float gain);
- void set_mixer_gain(float gain);
- void set_freq_corr(int ppm);
- void set_dc_corr(double dci, double dcq);
- void set_iq_corr(double gain, double phase);
-};
diff --git a/gr-fcd/swig/fcd_swig.i b/gr-fcd/swig/fcd_swig.i
index a565fb895..8fcc7d059 100644
--- a/gr-fcd/swig/fcd_swig.i
+++ b/gr-fcd/swig/fcd_swig.i
@@ -20,6 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
+#define FCD_API
+
+//suppress 319. No access specifier given for base class name (ignored).
+#pragma SWIG nowarn=319
+
%include "gnuradio.i"
//load generated python docstrings
@@ -29,7 +34,10 @@
#include "fcd_source_c.h"
%}
-%include "fcd_source_c.i"
+%include "fcd_source_c.h"
+
+GR_SWIG_BLOCK_MAGIC(fcd,source_c);
+fcd_source_c_sptr fcd_make_source_c (const std::string device_name = "");
#if SWIGGUILE
%scheme %{
diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am
index 104ba8062..37f493ce5 100644
--- a/grc/blocks/Makefile.am
+++ b/grc/blocks/Makefile.am
@@ -61,6 +61,7 @@ dist_ourdata_DATA = \
gr_argmax_xx.xml \
gr_channel_model.xml \
gr_char_to_float.xml \
+ gr_char_to_short.xml \
gr_chunks_to_symbols.xml \
gr_complex_to_arg.xml \
gr_complex_to_float.xml \
@@ -93,6 +94,7 @@ dist_ourdata_DATA = \
gr_fir_filter_xxx.xml \
gr_float_to_char.xml \
gr_float_to_complex.xml \
+ gr_float_to_int.xml \
gr_float_to_short.xml \
gr_float_to_uchar.xml \
gr_fractional_interpolator_xx.xml \
@@ -149,6 +151,7 @@ dist_ourdata_DATA = \
gr_sample_and_hold_xx.xml \
gr_scrambler_bb.xml \
gr_short_to_float.xml \
+ gr_short_to_char.xml \
gr_sig_source_x.xml \
gr_simple_correlator.xml \
gr_simple_framer.xml \
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 6c4cc0e88..42187585e 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -73,13 +73,16 @@
<block>gr_complex_to_float</block>
<block>gr_float_to_complex</block>
+ <block>gr_float_to_int</block>
<block>gr_float_to_short</block>
<block>gr_short_to_float</block>
+ <block>gr_short_to_char</block>
<block>gr_int_to_float</block>
<block>gr_float_to_char</block>
<block>gr_char_to_float</block>
+ <block>gr_char_to_short</block>
<block>gr_float_to_uchar</block>
<block>gr_uchar_to_float</block>
diff --git a/grc/blocks/gr_char_to_float.xml b/grc/blocks/gr_char_to_float.xml
index 9ab778051..838b6a203 100644
--- a/grc/blocks/gr_char_to_float.xml
+++ b/grc/blocks/gr_char_to_float.xml
@@ -8,13 +8,28 @@
<name>Char To Float</name>
<key>gr_char_to_float</key>
<import>from gnuradio import gr</import>
- <make>gr.char_to_float()</make>
+ <make>gr.char_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
<sink>
<name>in</name>
<type>byte</type>
+ <vlen>$vlen</vlen>
</sink>
<source>
<name>out</name>
<type>float</type>
+ <vlen>$vlen</vlen>
</source>
</block>
diff --git a/grc/blocks/gr_char_to_short.xml b/grc/blocks/gr_char_to_short.xml
new file mode 100644
index 000000000..57261e084
--- /dev/null
+++ b/grc/blocks/gr_char_to_short.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Char to Short:
+###################################################
+ -->
+<block>
+ <name>Char To Short</name>
+ <key>gr_char_to_short</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.char_to_short($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_char.xml b/grc/blocks/gr_float_to_char.xml
index 907de7743..1fa500e3c 100644
--- a/grc/blocks/gr_float_to_char.xml
+++ b/grc/blocks/gr_float_to_char.xml
@@ -8,13 +8,28 @@
<name>Float To Char</name>
<key>gr_float_to_char</key>
<import>from gnuradio import gr</import>
- <make>gr.float_to_char()</make>
+ <make>gr.float_to_char($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
<sink>
<name>in</name>
<type>float</type>
+ <vlen>$vlen</vlen>
</sink>
<source>
<name>out</name>
<type>byte</type>
+ <vlen>$vlen</vlen>
</source>
</block>
diff --git a/grc/blocks/gr_float_to_int.xml b/grc/blocks/gr_float_to_int.xml
new file mode 100644
index 000000000..b43c208a5
--- /dev/null
+++ b/grc/blocks/gr_float_to_int.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Float to Int:
+###################################################
+ -->
+<block>
+ <name>Float To Int</name>
+ <key>gr_float_to_int</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.float_to_int($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>int</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_float_to_short.xml b/grc/blocks/gr_float_to_short.xml
index cb2bcd4be..4f76b8f58 100644
--- a/grc/blocks/gr_float_to_short.xml
+++ b/grc/blocks/gr_float_to_short.xml
@@ -8,13 +8,28 @@
<name>Float To Short</name>
<key>gr_float_to_short</key>
<import>from gnuradio import gr</import>
- <make>gr.float_to_short()</make>
+ <make>gr.float_to_short($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
<sink>
<name>in</name>
<type>float</type>
+ <vlen>$vlen</vlen>
</sink>
<source>
<name>out</name>
<type>short</type>
+ <vlen>$vlen</vlen>
</source>
</block>
diff --git a/grc/blocks/gr_int_to_float.xml b/grc/blocks/gr_int_to_float.xml
index 8e6d024e2..7430fec72 100644
--- a/grc/blocks/gr_int_to_float.xml
+++ b/grc/blocks/gr_int_to_float.xml
@@ -8,13 +8,28 @@
<name>Int To Float</name>
<key>gr_int_to_float</key>
<import>from gnuradio import gr</import>
- <make>gr.int_to_float()</make>
+ <make>gr.int_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
<sink>
<name>in</name>
<type>int</type>
+ <vlen>$vlen</vlen>
</sink>
<source>
<name>out</name>
<type>float</type>
+ <vlen>$vlen</vlen>
</source>
</block>
diff --git a/grc/blocks/gr_short_to_char.xml b/grc/blocks/gr_short_to_char.xml
new file mode 100644
index 000000000..9c41da84e
--- /dev/null
+++ b/grc/blocks/gr_short_to_char.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Short to char:
+###################################################
+ -->
+<block>
+ <name>Short To Char</name>
+ <key>gr_short_to_char</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.short_to_char($vlen)</make>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>short</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/grc/blocks/gr_short_to_float.xml b/grc/blocks/gr_short_to_float.xml
index 8dac97c09..529f8c78c 100644
--- a/grc/blocks/gr_short_to_float.xml
+++ b/grc/blocks/gr_short_to_float.xml
@@ -8,13 +8,28 @@
<name>Short To Float</name>
<key>gr_short_to_float</key>
<import>from gnuradio import gr</import>
- <make>gr.short_to_float()</make>
+ <make>gr.short_to_float($vlen, $scale)</make>
+ <callback>set_scale($scale)</callback>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Scale</name>
+ <key>scale</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
<sink>
<name>in</name>
<type>short</type>
+ <vlen>$vlen</vlen>
</sink>
<source>
<name>out</name>
<type>float</type>
+ <vlen>$vlen</vlen>
</source>
</block>
diff --git a/gruel/src/include/gruel/pmt.h b/gruel/src/include/gruel/pmt.h
index 58533e54e..f904d37e1 100644
--- a/gruel/src/include/gruel/pmt.h
+++ b/gruel/src/include/gruel/pmt.h
@@ -32,6 +32,7 @@
#include <stdint.h>
#include <iosfwd>
#include <stdexcept>
+#include <boost/function.hpp>
namespace gruel {
class msg_accepter;
@@ -805,6 +806,24 @@ GRUEL_API std::string pmt_serialize_str(pmt_t obj);
*/
GRUEL_API pmt_t pmt_deserialize_str(std::string str);
+/*
+ * ------------------------------------------------------------------------
+ * advanced
+ * ------------------------------------------------------------------------
+ */
+
+#define GRUEL_PMT_HAVE_PMT_SET_DELETER
+
+/*!
+ * Set a deleter function to be called when the PMT dereferences.
+ * User beware! This function is for extremely advanced use.
+ * Use boost bind to bind extra parameters into the deleter function.
+ * Set an empty function type to reset the PMT to the default deleter.
+ * \param obj the pmt object in which to set the deleter function
+ * \param deleter a function that gets an opaque PMT pointer type
+ */
+GRUEL_API void pmt_set_deleter(pmt_t obj, boost::function<void(pmt_base *)> &deleter);
+
} /* namespace pmt */
#include <gruel/pmt_sugar.h>
diff --git a/gruel/src/lib/pmt/pmt.cc b/gruel/src/lib/pmt/pmt.cc
index f9cf6b4bf..57b66b1a4 100644
--- a/gruel/src/lib/pmt/pmt.cc
+++ b/gruel/src/lib/pmt/pmt.cc
@@ -58,7 +58,7 @@ pmt_base::operator delete(void *p, size_t size)
#endif
void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); }
-void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; }
+void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) p->deleter_(p); }
pmt_base::~pmt_base()
{
@@ -1383,4 +1383,16 @@ pmt_dump_sizeof()
printf("sizeof(pmt_uniform_vector) = %3zd\n", sizeof(pmt_uniform_vector));
}
+/*
+ * ------------------------------------------------------------------------
+ * advanced
+ * ------------------------------------------------------------------------
+ */
+
+void
+pmt_set_deleter(pmt_t obj, boost::function<void(pmt_base *)> &deleter)
+{
+ obj->deleter_ = (deleter)? deleter : &pmt_base::default_deleter;
+}
+
} /* namespace pmt */
diff --git a/gruel/src/lib/pmt/pmt_int.h b/gruel/src/lib/pmt/pmt_int.h
index 3a5cd382b..745dbc666 100644
--- a/gruel/src/lib/pmt/pmt_int.h
+++ b/gruel/src/lib/pmt/pmt_int.h
@@ -38,8 +38,15 @@ namespace pmt {
class GRUEL_API pmt_base : boost::noncopyable {
mutable boost::detail::atomic_count count_;
+public:
+ static void default_deleter(pmt_base *p){
+ delete p;
+ }
+
+ boost::function<void(pmt_base *)> deleter_;
+
protected:
- pmt_base() : count_(0) {};
+ pmt_base() : count_(0), deleter_(&pmt::pmt_base::default_deleter) {};
virtual ~pmt_base();
public: