summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/gengen
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src/lib/gengen')
-rw-r--r--gnuradio-core/src/lib/gengen/CMakeLists.txt175
-rwxr-xr-xgnuradio-core/src/lib/gengen/generate_all.py33
-rwxr-xr-xgnuradio-core/src/lib/gengen/generate_common.py106
-rw-r--r--gnuradio-core/src/lib/gengen/gengen.i33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_XX.cc.t63
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_XX.h.t57
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t72
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t56
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t37
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t61
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t56
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_and_XX.cc.t62
-rw-r--r--gnuradio-core/src/lib/gengen/gr_and_XX.h.t55
-rw-r--r--gnuradio-core/src/lib/gengen/gr_and_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t72
-rw-r--r--gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t58
-rw-r--r--gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t79
-rw-r--r--gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t52
-rw-r--r--gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t34
-rw-r--r--gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t74
-rw-r--r--gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t73
-rw-r--r--gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t72
-rw-r--r--gnuradio-core/src/lib/gengen/gr_divide_XX.h.t57
-rw-r--r--gnuradio-core/src/lib/gengen/gr_divide_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_endianness.h27
-rw-r--r--gnuradio-core/src/lib/gengen/gr_endianness.i23
-rw-r--r--gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t116
-rw-r--r--gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t87
-rw-r--r--gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t40
-rw-r--r--gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t67
-rw-r--r--gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t61
-rw-r--r--gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_max_XX.cc.t71
-rw-r--r--gnuradio-core/src/lib/gengen/gr_max_XX.h.t52
-rw-r--r--gnuradio-core/src/lib/gengen/gr_max_XX.i.t34
-rw-r--r--gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t93
-rw-r--r--gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t72
-rw-r--r--gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t38
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t63
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t57
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t72
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t56
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t37
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t61
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t56
-rwxr-xr-xgnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_mute_XX.cc.t79
-rw-r--r--gnuradio-core/src/lib/gengen/gr_mute_XX.h.t56
-rw-r--r--gnuradio-core/src/lib/gengen/gr_mute_XX.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t99
-rw-r--r--gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t83
-rw-r--r--gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t40
-rw-r--r--gnuradio-core/src/lib/gengen/gr_noise_type.h30
-rw-r--r--gnuradio-core/src/lib/gengen/gr_not_XX.cc.t58
-rw-r--r--gnuradio-core/src/lib/gengen/gr_not_XX.h.t55
-rw-r--r--gnuradio-core/src/lib/gengen/gr_not_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_or_XX.cc.t62
-rw-r--r--gnuradio-core/src/lib/gengen/gr_or_XX.h.t55
-rw-r--r--gnuradio-core/src/lib/gengen/gr_or_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.cc.t137
-rw-r--r--gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t85
-rw-r--r--gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t111
-rw-r--r--gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t126
-rw-r--r--gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t49
-rw-r--r--gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t59
-rw-r--r--gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t58
-rw-r--r--gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t32
-rw-r--r--gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t59
-rw-r--r--gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t62
-rw-r--r--gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t32
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.cc.t62
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t58
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t241
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t82
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t52
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h29
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t71
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sub_XX.h.t57
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sub_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.cc.t129
-rw-r--r--gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t82
-rw-r--r--gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.i.t33
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t100
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t61
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t64
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t59
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t39
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t89
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t61
-rw-r--r--gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t37
-rw-r--r--gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t62
-rw-r--r--gnuradio-core/src/lib/gengen/gr_xor_XX.h.t55
-rw-r--r--gnuradio-core/src/lib/gengen/gr_xor_XX.i.t33
101 files changed, 6155 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt
new file mode 100644
index 000000000..db3103a26
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt
@@ -0,0 +1,175 @@
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
+include(GrPython)
+
+########################################################################
+# generate the python helper script which calls into the build utils
+########################################################################
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
+#!${PYTHON_EXECUTABLE}
+
+import sys, os, re
+sys.path.append('${GR_CORE_PYTHONPATH}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
+
+if __name__ == '__main__':
+ import build_utils
+ root, inp = sys.argv[1:3]
+ for sig in sys.argv[3:]:
+ name = re.sub ('X+', sig, root)
+ d = build_utils.standard_dict(name, sig)
+ build_utils.expand_template(d, inp)
+
+")
+
+########################################################################
+# generation helper macro to generate various files from template
+########################################################################
+macro(expand_h_cc_i root)
+
+ foreach(ext h cc i)
+ #make a list of all the generated files
+ unset(expanded_files_${ext})
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext})
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_${ext}}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.${ext}.t ${ARGN}
+ )
+ endforeach(ext)
+
+ #make source files depends on headers to force generation
+ set_source_files_properties(${expanded_files_cc}
+ PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
+ )
+
+ #install rules for the generated cc, h, and i files
+ list(APPEND generated_gengen_sources ${expanded_files_cc})
+ list(APPEND generated_gengen_includes ${expanded_files_h})
+ list(APPEND generated_gengen_swigs ${expanded_files_i})
+
+endmacro(expand_h_cc_i)
+
+########################################################################
+# Invoke macro to generate various sources
+########################################################################
+expand_h_cc_i(gr_vector_source_X b s i f c)
+expand_h_cc_i(gr_vector_insert_X b)
+expand_h_cc_i(gr_vector_sink_X b s i f c)
+expand_h_cc_i(gr_noise_source_X s i f c)
+expand_h_cc_i(gr_fastnoise_source_X s i f c)
+expand_h_cc_i(gr_sig_source_X s i f c)
+expand_h_cc_i(gr_probe_signal_X b s i f c)
+expand_h_cc_i(gr_probe_signal_vX b s i f c)
+
+expand_h_cc_i(gr_add_const_XX bb ss ii ff cc sf)
+expand_h_cc_i(gr_multiply_const_XX ss ii)
+expand_h_cc_i(gr_add_XX ss ii cc)
+expand_h_cc_i(gr_sub_XX ss ii ff cc)
+expand_h_cc_i(gr_multiply_XX ss ii)
+expand_h_cc_i(gr_divide_XX ss ii ff cc)
+expand_h_cc_i(gr_mute_XX ss ii ff cc)
+expand_h_cc_i(gr_add_const_vXX ss ii ff cc)
+expand_h_cc_i(gr_multiply_const_vXX ss ii ff cc)
+expand_h_cc_i(gr_integrate_XX ss ii ff cc)
+expand_h_cc_i(gr_moving_average_XX ss ii ff cc)
+
+expand_h_cc_i(gr_chunks_to_symbols_XX bf bc sf sc if ic)
+expand_h_cc_i(gr_unpacked_to_packed_XX bb ss ii)
+expand_h_cc_i(gr_packed_to_unpacked_XX bb ss ii)
+expand_h_cc_i(gr_xor_XX bb ss ii)
+expand_h_cc_i(gr_and_XX bb ss ii)
+expand_h_cc_i(gr_and_const_XX bb ss ii)
+expand_h_cc_i(gr_or_XX bb ss ii)
+expand_h_cc_i(gr_not_XX bb ss ii)
+expand_h_cc_i(gr_sample_and_hold_XX bb ss ii ff)
+expand_h_cc_i(gr_argmax_XX fs is ss)
+expand_h_cc_i(gr_max_XX ff ii ss)
+expand_h_cc_i(gr_peak_detector_XX fb ib sb)
+
+add_custom_target(gengen_generated DEPENDS
+ ${generated_gengen_includes}
+ ${generated_gengen_swigs}
+)
+
+########################################################################
+# Create the master gengen swig include files
+########################################################################
+set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i.in)
+file(WRITE ${generated_index} "
+//
+// This file is machine generated. All edits will be overwritten
+//
+")
+
+file(APPEND ${generated_index} "%{\n")
+foreach(swig_file ${generated_gengen_swigs})
+ get_filename_component(name ${swig_file} NAME_WE)
+ file(APPEND ${generated_index} "#include<${name}.h>\n")
+endforeach(swig_file)
+file(APPEND ${generated_index} "%}\n")
+
+foreach(swig_file ${generated_gengen_swigs})
+ get_filename_component(name ${swig_file} NAME)
+ file(APPEND ${generated_index} "%include<${name}>\n")
+endforeach(swig_file)
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i
+)
+
+########################################################################
+# Handle the generated sources + a few non-generated ones
+########################################################################
+list(APPEND gnuradio_core_sources
+ ${generated_gengen_sources}
+)
+
+install(FILES
+ ${generated_gengen_includes}
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_type.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_waveform.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+ COMPONENT "core_devel"
+)
+
+if(ENABLE_PYTHON)
+ install(FILES
+ ${generated_gengen_swigs}
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.i
+ ${CMAKE_CURRENT_SOURCE_DIR}/gengen.i
+ ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "core_swig"
+ )
+endif(ENABLE_PYTHON)
diff --git a/gnuradio-core/src/lib/gengen/generate_all.py b/gnuradio-core/src/lib/gengen/generate_all.py
new file mode 100755
index 000000000..6b0f20f05
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/generate_all.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+#
+# Copyright 2004 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from build_utils import output_glue
+
+import generate_common
+
+def generate_all ():
+ generate_common.generate ()
+ output_glue ('gengen')
+
+
+if __name__ == '__main__':
+ generate_all ()
diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py
new file mode 100755
index 000000000..13d01b0f9
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/generate_common.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2006,2007,2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from build_utils import expand_template, standard_dict
+from build_utils_codes import *
+
+import re
+
+
+# sources and sinks
+ss_signatures = ['s', 'i', 'f', 'c']
+
+ss_roots = [
+ 'gr_vector_source_X',
+ 'gr_vector_sink_X',
+ 'gr_noise_source_X',
+ 'gr_sig_source_X',
+ 'gr_probe_signal_X',
+ 'gr_probe_signal_vX'
+ ]
+
+# regular blocks
+reg_signatures = ['ss', 'ii', 'ff', 'cc']
+
+reg_roots = [
+ 'gr_add_const_XX',
+ 'gr_sub_XX',
+ 'gr_divide_XX',
+ 'gr_mute_XX',
+ 'gr_add_const_vXX',
+ 'gr_multiply_const_vXX',
+ 'gr_integrate_XX',
+ 'gr_moving_average_XX',
+ ]
+
+# other blocks
+others = (
+ ('gr_chunks_to_symbols_XX', ('bf', 'bc', 'sf', 'sc', 'if', 'ic')),
+ ('gr_unpacked_to_packed_XX', ('bb','ss','ii')),
+ ('gr_packed_to_unpacked_XX', ('bb','ss','ii')),
+ ('gr_xor_XX', ('bb','ss','ii')),
+ ('gr_and_XX', ('bb','ss','ii')),
+ ('gr_and_const_XX', ('bb','ss','ii')),
+ ('gr_or_XX', ('bb','ss','ii')),
+ ('gr_not_XX', ('bb','ss','ii')),
+ ('gr_sample_and_hold_XX', ('bb','ss','ii','ff')),
+ ('gr_argmax_XX', ('fs','is','ss')),
+ ('gr_max_XX', ('ff','ii','ss')),
+ ('gr_peak_detector_XX', ('fb','ib','sb')),
+ ('gr_multiply_XX', ('ss','ii')),
+ ('gr_multiply_const_XX', ('ss','ii')),
+ ('gr_add_XX', ('ss','cc','ii'))
+ )
+
+
+def expand_h_cc_i (root, sig):
+ # root looks like 'gr_vector_sink_X'
+ name = re.sub ('X+', sig, root)
+ d = standard_dict (name, sig)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+ expand_template (d, root + '.i.t')
+
+
+def generate ():
+ expand_h_cc_i ('gr_add_const_XX', 'sf') # for MC4020
+ expand_h_cc_i ('gr_vector_sink_X', 'b')
+ expand_h_cc_i ('gr_vector_source_X', 'b')
+ expand_h_cc_i ('gr_probe_signal_X', 'b')
+ expand_h_cc_i ('gr_probe_signal_vX', 'b')
+ for r in ss_roots:
+ for s in ss_signatures:
+ expand_h_cc_i (r, s)
+ for r in reg_roots :
+ for s in reg_signatures:
+ expand_h_cc_i (r, s)
+
+ for root, sigs in others:
+ for s in sigs:
+ expand_h_cc_i (root, s)
+
+
+
+if __name__ == '__main__':
+ generate ()
+
+
diff --git a/gnuradio-core/src/lib/gengen/gengen.i b/gnuradio-core/src/lib/gengen/gengen.i
new file mode 100644
index 000000000..d1895bfa8
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gengen.i
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%{
+#include "gr_endianness.h"
+#include "gr_sig_source_waveform.h"
+#include "gr_noise_type.h"
+%}
+
+%include "gr_endianness.i"
+%include "gr_sig_source_waveform.h"
+%include "gr_noise_type.h"
+
+%include "gengen_generated.i"
diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
new file mode 100644
index 000000000..5a888125b
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (size_t vlen)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (vlen));
+}
+
+@NAME@::@NAME@ (size_t vlen)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)),
+ d_vlen (vlen)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc += ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.h.t b/gnuradio-core/src/lib/gengen/gr_add_XX.h.t
new file mode 100644
index 000000000..cd6d80cd9
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_XX.h.t
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+/*!
+ * \brief output = sum (input_0, input_1, ...)
+ * \ingroup math_blk
+ *
+ * Add across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+ @NAME@ (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.i.t b/gnuradio-core/src/lib/gengen/gr_add_XX.i.t
new file mode 100644
index 000000000..b2c510610
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (size_t vlen);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t
new file mode 100644
index 000000000..3dccc86b8
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_XX.cc.t
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (@O_TYPE@ k)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (k));
+}
+
+@NAME@::@NAME@ (@O_TYPE@ k)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_k (k)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int size = noutput_items;
+
+ while (size >= 8){
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ *optr++ = *iptr++ + d_k;
+ size -= 8;
+ }
+
+ while (size-- > 0)
+ *optr++ = *iptr++ + d_k;
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t
new file mode 100644
index 000000000..00d2c9b58
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_XX.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+/*!
+ * \brief output = input + constant
+ * \ingroup math_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+ @O_TYPE@ d_k; // the constant
+ @NAME@ (@O_TYPE@ k);
+
+ public:
+ @O_TYPE@ k () const { return d_k; }
+ void set_k (@O_TYPE@ k) { d_k = k; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t b/gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t
new file mode 100644
index 000000000..b7921554e
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_XX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (@TYPE@ k);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (@TYPE@ k);
+
+ public:
+ @TYPE@ k () const { return d_k; }
+ void set_k (@TYPE@ k) { d_k = k; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t
new file mode 100755
index 000000000..b29f3014d
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.cc.t
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (k));
+}
+
+@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()),
+ gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size()))
+{
+ d_k = k;
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@O_TYPE@ *)input_items[0];
+ @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+
+ int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(@I_TYPE@);
+
+ for (int i = 0; i < noutput_items; i++)
+ for (int j = 0; j < nitems_per_block; j++)
+ *optr++ = *iptr++ + d_k[j];
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t
new file mode 100644
index 000000000..438a84bfd
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
+
+/*!
+ * \brief output vector = input vector + constant vector
+ * \ingroup math_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
+
+ std::vector<@I_TYPE@> d_k; // the constant
+ @NAME@ (const std::vector<@I_TYPE@> &k);
+
+ public:
+ const std::vector<@I_TYPE@> k () const { return d_k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t
new file mode 100755
index 000000000..e0e6ae905
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_add_const_vXX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (const std::vector<@I_TYPE@> &k);
+
+ public:
+ std::vector<@I_TYPE@> k () const { return d_k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_and_XX.cc.t
new file mode 100644
index 000000000..9d60e092a
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_and_XX.cc.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ()
+{
+ return gnuradio::get_initial_sptr (new @NAME@ ());
+}
+
+@NAME@::@NAME@ ()
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)))
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (int i = 0; i < noutput_items; i++) {
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc = acc & ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.h.t b/gnuradio-core/src/lib/gengen/gr_and_XX.h.t
new file mode 100644
index 000000000..224778096
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_and_XX.h.t
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+/*!
+ * \brief output = input_0 & input_1 & , ... & input_N)
+ * \ingroup math_blk
+ *
+ * bitwise boolean and across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+ @NAME@ ();
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_and_XX.i.t b/gnuradio-core/src/lib/gengen/gr_and_XX.i.t
new file mode 100644
index 000000000..06db5ca59
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_and_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t
new file mode 100644
index 000000000..d4f9a4b61
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (@I_TYPE@ k)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (k));
+};
+
+@NAME@::@NAME@ (@I_TYPE@ k)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_k (k)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int size = noutput_items;
+
+ while (size >= 8) {
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ *optr++ = *iptr++ & d_k;
+ size -= 8;
+ }
+
+ while (size-- > 0)
+ *optr++ = *iptr++ & d_k;
+
+ return (noutput_items);
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t
new file mode 100644
index 000000000..b331f33cc
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+/*!
+ * \brief output_N = input_N & value
+ * \ingroup math_blk
+ *
+ * bitwise boolean and of const to the data stream.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+ @O_TYPE@ d_k; // the constant
+ @NAME@ (@O_TYPE@ k);
+
+ public:
+ @O_TYPE@ k () const { return d_k; }
+ void set_k (@O_TYPE@ k) { d_k = k; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t b/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t
new file mode 100644
index 000000000..c797c45eb
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (@O_TYPE@ k);
+
+ public:
+ @O_TYPE@ k () const { return d_k; }
+ void set_k (@O_TYPE@ k) { d_k = k; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t
new file mode 100644
index 000000000..f780bd811
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.cc.t
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ( size_t vlen )
+{
+ return @SPTR_NAME@ ( new @NAME@(vlen));
+}
+
+@NAME@::@NAME@( size_t vlen)
+ : gr_sync_block ( "@BASE_NAME@",
+ gr_make_io_signature (1, -1, vlen*sizeof (@I_TYPE@)),
+ gr_make_io_signature (2, 2, sizeof (@O_TYPE@))),
+ d_vlen(vlen)
+{
+}
+
+
+int
+@NAME@::work( int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+
+ int ninputs = input_items.size ();
+
+ @O_TYPE@ *x_optr = (@O_TYPE@ *) output_items[0];
+ @O_TYPE@ *y_optr = (@O_TYPE@ *) output_items[1];
+
+ for (int i=0; i<noutput_items; i++) {
+
+ @I_TYPE@ max = ((@I_TYPE@ *) input_items[0])[i*d_vlen];
+ int x = 0;
+ int y = 0;
+
+ for (int j=0; j < (int) d_vlen; j++ ) {
+ for (int k=0; k<ninputs; k++) {
+ if ( ((@I_TYPE@ *) input_items[k])[i*d_vlen + j] > max) {
+ max = ((@I_TYPE@ *) input_items[k])[i*d_vlen + j];
+ x = j;
+ y = k;
+ }
+ }
+ }
+
+ *x_optr++ = (@O_TYPE@) x;
+ *y_optr++ = (@O_TYPE@) y;
+ }
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t
new file mode 100644
index 000000000..a706221fb
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.h.t
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+ @NAME@ (size_t vlen);
+ size_t d_vlen;
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t b/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t
new file mode 100644
index 000000000..233551ad9
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_argmax_XX.i.t
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (size_t vlen);
+ size_t d_vlen;
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t
new file mode 100644
index 000000000..4a642c13e
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <iostream>
+#include <string.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (symbol_table,D));
+}
+
+@NAME@::@NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D)
+ : gr_sync_interpolator ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, -1, sizeof (@O_TYPE@)),
+ D),
+ d_D (D),
+ d_symbol_table (symbol_table)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ assert (noutput_items % d_D == 0);
+ assert (input_items.size() == output_items.size());
+ int nstreams = input_items.size();
+
+ for (int m=0;m<nstreams;m++) {
+ const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
+
+ // per stream processing
+ for (int i = 0; i < noutput_items / d_D; i++){
+ assert (((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size());
+ memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(@O_TYPE@));
+ out+=d_D;
+ }
+ // end of per stream processing
+
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t
new file mode 100644
index 000000000..17d5688b8
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_interpolator.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+
+/*!
+ * \brief Map a stream of symbol indexes (unpacked bytes or shorts) to stream of float or complex onstellation points.in \p D dimensions (\p D = 1 by default)
+ * \ingroup converter_blk
+ *
+ * input: stream of @I_TYPE@; output: stream of @O_TYPE@
+ *
+ * out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1
+ *
+ * The combination of gr_packed_to_unpacked_XX followed by
+ * gr_chunks_to_symbols_XY handles the general case of mapping
+ * from a stream of bytes or shorts into arbitrary float
+ * or complex symbols.
+ *
+ * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
+ * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss,
+ * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
+ * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc.
+ */
+
+class GR_CORE_API @NAME@ : public gr_sync_interpolator
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D);
+
+ int d_D;
+ std::vector<@O_TYPE@> d_symbol_table;
+ @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+
+ public:
+ int D () const { return d_D; }
+ std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; }
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t
new file mode 100644
index 000000000..14c8be486
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+
+class @NAME@ : public gr_sync_interpolator
+{
+private:
+ @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1);
+
+public:
+ int D () const { return d_D; }
+ std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
new file mode 100644
index 000000000..63450cb3d
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (size_t vlen)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (vlen));
+}
+
+@NAME@::@NAME@ (size_t vlen)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)),
+ d_vlen (vlen)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ if (ninputs == 1){ // compute reciprocal
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
+ *optr++ = (@O_TYPE@) ((@O_TYPE@) 1 /
+ ((@I_TYPE@ *) input_items[0])[i]);
+ }
+
+ else {
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc /= ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t
new file mode 100644
index 000000000..40ee27a51
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.h.t
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+/*!
+ * \brief output = input_0 / input_1 / input_x ...)
+ * \ingroup math_blk
+ *
+ * Divide across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+ @NAME@ (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t
new file mode 100644
index 000000000..b2c510610
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (size_t vlen);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_endianness.h b/gnuradio-core/src/lib/gengen/gr_endianness.h
new file mode 100644
index 000000000..c4ecb1383
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_endianness.h
@@ -0,0 +1,27 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef INCLUDED_GR_ENDIANNESS_H
+#define INCLUDED_GR_ENDIANNESS_H
+
+typedef enum {GR_MSB_FIRST, GR_LSB_FIRST} gr_endianness_t;
+
+#endif /* INCLUDED_GR_ENDIANNESS_H */
diff --git a/gnuradio-core/src/lib/gengen/gr_endianness.i b/gnuradio-core/src/lib/gengen/gr_endianness.i
new file mode 100644
index 000000000..572b7a42f
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_endianness.i
@@ -0,0 +1,23 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%include <gr_endianness.h>
diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t
new file mode 100644
index 000000000..7be7bdde8
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.cc.t
@@ -0,0 +1,116 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed, long samples)
+{
+ return gnuradio::get_initial_sptr(new @NAME@ (type, ampl, seed, samples));
+}
+
+
+@NAME@::@NAME@ (gr_noise_type_t type, float ampl, long seed, long samples)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof (@TYPE@))),
+ d_type (type),
+ d_ampl (ampl),
+ d_rng (seed)
+{
+ d_samples.resize(samples);
+ generate();
+}
+
+void
+@NAME@::generate()
+{
+ int noutput_items = d_samples.size();
+ switch (d_type){
+#if @IS_COMPLEX@ // complex?
+
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = gr_complex (d_ampl * ((d_rng.ran1 () * 2.0) - 1.0),
+ d_ampl * ((d_rng.ran1 () * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = d_ampl * d_rng.rayleigh_complex ();
+ break;
+
+#else // nope...
+
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (@TYPE@)(d_ampl * ((d_rng.ran1 () * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (@TYPE@)(d_ampl * d_rng.gasdev ());
+ break;
+
+ case GR_LAPLACIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (@TYPE@)(d_ampl * d_rng.laplacian ());
+ break;
+
+ case GR_IMPULSE: // FIXME changeable impulse settings
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (@TYPE@)(d_ampl * d_rng.impulse (9));
+ break;
+#endif
+
+ default:
+ throw std::runtime_error ("invalid type");
+ }
+
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @TYPE@ *out = (@TYPE@ *) output_items[0];
+
+ for(int i=0; i<noutput_items; i++){
+#ifdef __USE_GNU
+ size_t idx = lrand48() % d_samples.size();
+#else
+ size_t idx = rand() % d_samples.size();
+#endif
+ out[i] = d_samples[idx];
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t
new file mode 100644
index 000000000..007e44975
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.h.t
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_noise_type.h>
+#include <gr_random.h>
+
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+/*! \brief Make a noise source
+ * \param type the random distribution to use (see gr_noise_type.h)
+ * \param ampl a scaling factor for the output
+ * \param seed seed for random generators. Note that for uniform and
+ * Gaussian distributions, this should be a negative number.
+ * \param samples number of samples to pre-generate.
+ */
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples=1024*16);
+
+/*!
+ * \brief Random number source
+ * \ingroup source_blk
+ *
+ * \details
+ * Generate random values from different distributions.
+ * Currently, only Gaussian and uniform are enabled.
+ *
+ * \param type the random distribution to use (see gr_noise_type.h)
+ * \param ampl a scaling factor for the output
+ * \param seed seed for random generators. Note that for uniform and
+ * Gaussian distributions, this should be a negative number.
+ * \param samples number of samples to pre-generate.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block {
+ friend GR_CORE_API @NAME@_sptr
+
+ gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed, long samples);
+
+ gr_noise_type_t d_type;
+ float d_ampl;
+ gr_random d_rng;
+ std::vector<@TYPE@> d_samples;
+
+ @NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples=1024*16);
+
+ public:
+ void set_type (gr_noise_type_t type) { d_type = type; generate(); }
+ void set_amplitude (float ampl) { d_ampl = ampl; generate(); }
+ void generate();
+
+ gr_noise_type_t type () const { return d_type; }
+ float amplitude () const { return d_ampl; }
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t
new file mode 100644
index 000000000..e1f7c775b
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_fastnoise_source_X.i.t
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples = 1024*16);
+
+class @NAME@ : public gr_block {
+ private:
+ @NAME@ (gr_noise_type_t type, float ampl, long seed = 0, long samples = 1024*16);
+
+ public:
+ void set_type (gr_noise_type_t type) { d_type = type; }
+ void set_amplitude (float ampl) { d_ampl = ampl; }
+
+ gr_noise_type_t type () const { return d_type; }
+ float amplitude () const { return d_ampl; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t
new file mode 100644
index 000000000..1dbee49db
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_integrate_XX.cc.t
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (int decim)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (decim));
+}
+
+@NAME@::@NAME@ (int decim)
+ : gr_sync_decimator ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)),
+ decim),
+ d_decim(decim),
+ d_count(0)
+{
+}
+
+@NAME@::~@NAME@ ()
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (@O_TYPE@)0;
+ for (int j = 0; j < d_decim; j++)
+ out[i] += in[i*d_decim+j];
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t
new file mode 100644
index 000000000..abb13ea90
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_integrate_XX.h.t
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_decimator.h>
+
+class @NAME@;
+
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int decim);
+
+/*!
+ * \brief output = sum(input[0]...input[n])
+ * \ingroup math_blk
+ *
+ * Integrate successive samples in input stream and decimate
+ */
+class GR_CORE_API @NAME@ : public gr_sync_decimator
+{
+private:
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int decim);
+
+ @NAME@ (int decim);
+
+ int d_decim;
+ int d_count;
+
+public:
+ ~@NAME@ ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t b/gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t
new file mode 100644
index 000000000..a96e5fd29
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_integrate_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int decim);
+
+class @NAME@ : public gr_sync_decimator
+{
+private:
+ @NAME@ ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t
new file mode 100644
index 000000000..c53820cd6
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_max_XX.cc.t
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ( size_t vlen )
+{
+ return @SPTR_NAME@ ( new @NAME@(vlen));
+}
+
+@NAME@::@NAME@( size_t vlen)
+ : gr_sync_block ( "@BASE_NAME@",
+ gr_make_io_signature (1, -1, vlen*sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_vlen(vlen)
+{
+}
+
+int
+@NAME@::work( int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (int i=0; i<noutput_items; i++) {
+
+ @I_TYPE@ max = ((@I_TYPE@ *) input_items[0])[i*d_vlen];
+
+ for (int j=0; j < (int) d_vlen; j++ ) {
+ for (int k=0; k<ninputs; k++) {
+ if ( ((@I_TYPE@ *) input_items[k])[i*d_vlen + j] > max) {
+ max = ((@I_TYPE@*) input_items[k])[i*d_vlen + j];
+ }
+ }
+ }
+
+ *optr++ = (@O_TYPE@) max;
+ }
+ return noutput_items;
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.h.t b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t
new file mode 100644
index 000000000..a706221fb
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_max_XX.h.t
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+ @NAME@ (size_t vlen);
+ size_t d_vlen;
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_max_XX.i.t b/gnuradio-core/src/lib/gengen/gr_max_XX.i.t
new file mode 100644
index 000000000..233551ad9
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_max_XX.i.t
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (size_t vlen);
+ size_t d_vlen;
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t
new file mode 100644
index 000000000..ddee30bd7
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.cc.t
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (length, scale, max_iter));
+}
+
+@NAME@::@NAME@ (int length, @O_TYPE@ scale, int max_iter)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_length(length),
+ d_scale(scale),
+ d_max_iter(max_iter),
+ d_new_length(length),
+ d_new_scale(scale),
+ d_updated(false)
+{
+ set_history(length);
+}
+
+@NAME@::~@NAME@ ()
+{
+}
+
+void
+@NAME@::set_length_and_scale(int length, @O_TYPE@ scale)
+{
+ d_new_length = length;
+ d_new_scale = scale;
+ d_updated = true;
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ if (d_updated) {
+ d_length = d_new_length;
+ d_scale = d_new_scale;
+ set_history(d_length);
+ d_updated = false;
+ return 0; // history requirements might have changed
+ }
+
+ const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+
+ @I_TYPE@ sum = 0;
+ int num_iter = (noutput_items>d_max_iter) ? d_max_iter : noutput_items;
+ for (int i = 0; i < d_length-1 ; i++) {
+ sum += in[i];
+ }
+
+ for (int i = 0; i < num_iter; i++) {
+ sum += in[i+d_length-1];
+ out[i] = sum * d_scale;
+ sum -= in[i];
+ }
+
+ return num_iter;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t
new file mode 100644
index 000000000..37678abe1
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.h.t
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096);
+
+/*!
+ * \brief output is the moving sum of the last N samples, scaled by the scale factor
+ * \ingroup filter_blk
+ *
+ * max_iter limits how long we go without flushing the accumulator
+ * This is necessary to avoid numerical instability for float and complex.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+private:
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@(int length, @O_TYPE@ scale, int max_iter);
+
+ @NAME@ (int length, @O_TYPE@ scale, int max_iter = 4096);
+
+ int d_length;
+ @O_TYPE@ d_scale;
+ int d_max_iter;
+
+ int d_new_length;
+ @O_TYPE@ d_new_scale;
+ bool d_updated;
+
+public:
+ ~@NAME@ ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ int length() const { return d_new_length; }
+ @O_TYPE@ scale() const { return d_new_scale; }
+
+ void set_length_and_scale(int length, @O_TYPE@ scale);
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t
new file mode 100644
index 000000000..6e3b9ca9b
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_moving_average_XX.i.t
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int length, @O_TYPE@ scale, int max_iter=4096);
+
+class @NAME@ : public gr_sync_block
+{
+private:
+ @NAME@ ();
+
+ public:
+ int length() const;
+ @O_TYPE@ scale() const;
+ void set_length_and_scale(int length, @O_TYPE@ scale);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
new file mode 100644
index 000000000..a60118e14
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (size_t vlen)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (vlen));
+}
+
+@NAME@::@NAME@ (size_t vlen)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)),
+ d_vlen (vlen)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc *= ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t
new file mode 100644
index 000000000..18ec6d0be
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.h.t
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+/*!
+ * \brief output = prod (input_0, input_1, ...)
+ * \ingroup math_blk
+ *
+ * Multiply across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+ @NAME@ (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t
new file mode 100644
index 000000000..b2c510610
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (size_t vlen);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t
new file mode 100644
index 000000000..424b62412
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.cc.t
@@ -0,0 +1,72 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (@O_TYPE@ k)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (k));
+}
+
+@NAME@::@NAME@ (@O_TYPE@ k)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_k (k)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int size = noutput_items;
+
+ while (size >= 8){
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ *optr++ = *iptr++ * d_k;
+ size -= 8;
+ }
+
+ while (size-- > 0)
+ *optr++ = *iptr++ * d_k;
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t
new file mode 100644
index 000000000..274fc3b99
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+/*!
+ * \brief output = input * constant
+ * \ingroup math_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k);
+
+ @O_TYPE@ d_k; // the constant
+ @NAME@ (@O_TYPE@ k);
+
+ public:
+ @O_TYPE@ k () const { return d_k; }
+ void set_k (@O_TYPE@ k) { d_k = k; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t
new file mode 100644
index 000000000..b7921554e
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_XX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (@TYPE@ k);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (@TYPE@ k);
+
+ public:
+ @TYPE@ k () const { return d_k; }
+ void set_k (@TYPE@ k) { d_k = k; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t
new file mode 100755
index 000000000..eb896dee5
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.cc.t
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (k));
+}
+
+@NAME@::@NAME@ (const std::vector<@I_TYPE@> &k)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof(@I_TYPE@)*k.size()),
+ gr_make_io_signature (1, 1, sizeof(@O_TYPE@)*k.size()))
+{
+ d_k = k;
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@O_TYPE@ *)input_items[0];
+ @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+
+ int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(@I_TYPE@);
+
+ for (int i = 0; i < noutput_items; i++)
+ for (int j = 0; j < nitems_per_block; j++)
+ *optr++ = *iptr++ * d_k[j];
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t
new file mode 100644
index 000000000..2c6edd364
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
+
+/*!
+ * \brief output vector = input vector * constant vector (element-wise)
+ * \ingroup math_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
+
+ std::vector<@I_TYPE@> d_k; // the constant
+ @NAME@ (const std::vector<@I_TYPE@> &k);
+
+ public:
+ const std::vector<@I_TYPE@> k () const { return d_k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t
new file mode 100755
index 000000000..e0e6ae905
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_const_vXX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@I_TYPE@> &k);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (const std::vector<@I_TYPE@> &k);
+
+ public:
+ std::vector<@I_TYPE@> k () const { return d_k; }
+ void set_k (const std::vector<@I_TYPE@> &k) { d_k = k; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_mute_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_mute_XX.cc.t
new file mode 100644
index 000000000..4b8ff8415
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_mute_XX.cc.t
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (bool mute)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (mute));
+}
+
+@NAME@::@NAME@ (bool mute)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_mute (mute)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int size = noutput_items;
+
+ if (d_mute){
+ memset (optr, 0, noutput_items * sizeof(@O_TYPE@));
+ }
+ else {
+ while (size >= 8){
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ *optr++ = *iptr++;
+ size -= 8;
+ }
+
+ while (size-- > 0)
+ *optr++ = *iptr++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t b/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t
new file mode 100644
index 000000000..ca23904e9
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_mute_XX.h.t
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (bool mute=false);
+
+/*!
+ * \brief output = input or zero if muted.
+ * \ingroup level_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (bool mute);
+
+ bool d_mute;
+ @NAME@ (bool mute);
+
+ public:
+ bool mute () const { return d_mute; }
+ void set_mute (bool mute) { d_mute = mute; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_mute_XX.i.t b/gnuradio-core/src/lib/gengen/gr_mute_XX.i.t
new file mode 100644
index 000000000..ffcfac8a6
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_mute_XX.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@(bool mute=false);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (bool mute);
+
+ public:
+ bool mute () const { return d_mute; }
+ void set_mute (bool mute) { d_mute = mute; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t
new file mode 100644
index 000000000..3078f6366
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t
@@ -0,0 +1,99 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed)
+{
+ return gnuradio::get_initial_sptr(new @NAME@ (type, ampl, seed));
+}
+
+
+@NAME@::@NAME@ (gr_noise_type_t type, float ampl, long seed)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof (@TYPE@))),
+ d_type (type),
+ d_ampl (ampl),
+ d_rng (seed)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @TYPE@ *out = (@TYPE@ *) output_items[0];
+
+ switch (d_type){
+#if @IS_COMPLEX@ // complex?
+
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = gr_complex (d_ampl * ((d_rng.ran1 () * 2.0) - 1.0),
+ d_ampl * ((d_rng.ran1 () * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = d_ampl * d_rng.rayleigh_complex ();
+ break;
+
+#else // nope...
+
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = (@TYPE@)(d_ampl * ((d_rng.ran1 () * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = (@TYPE@)(d_ampl * d_rng.gasdev ());
+ break;
+
+ case GR_LAPLACIAN:
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = (@TYPE@)(d_ampl * d_rng.laplacian ());
+ break;
+
+ case GR_IMPULSE: // FIXME changeable impulse settings
+ for (int i = 0; i < noutput_items; i++)
+ out[i] = (@TYPE@)(d_ampl * d_rng.impulse (9));
+ break;
+#endif
+
+ default:
+ throw std::runtime_error ("invalid type");
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t
new file mode 100644
index 000000000..31ffb2b16
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_noise_type.h>
+#include <gr_random.h>
+
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+/*! \brief Make a noise source
+ * \param type the random distribution to use (see gr_noise_type.h)
+ * \param ampl a scaling factor for the output
+ * \param seed seed for random generators. Note that for uniform and
+ * Gaussian distributions, this should be a negative number.
+ */
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0);
+
+/*!
+ * \brief Random number source
+ * \ingroup source_blk
+ *
+ * \details
+ * Generate random values from different distributions.
+ * Currently, only Gaussian and uniform are enabled.
+ *
+ * \param type the random distribution to use (see gr_noise_type.h)
+ * \param ampl a scaling factor for the output
+ * \param seed seed for random generators. Note that for uniform and
+ * Gaussian distributions, this should be a negative number.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block {
+ friend GR_CORE_API @NAME@_sptr
+
+ gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed);
+
+ gr_noise_type_t d_type;
+ float d_ampl;
+ gr_random d_rng;
+
+ @NAME@ (gr_noise_type_t type, float ampl, long seed = 0);
+
+ public:
+ void set_type (gr_noise_type_t type) { d_type = type; }
+ void set_amplitude (float ampl) { d_ampl = ampl; }
+
+ gr_noise_type_t type () const { return d_type; }
+ float amplitude () const { return d_ampl; }
+
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t
new file mode 100644
index 000000000..df27ab79b
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0);
+
+class @NAME@ : public gr_block {
+ private:
+ @NAME@ (gr_noise_type_t type, float ampl, long seed = 0);
+
+ public:
+ void set_type (gr_noise_type_t type) { d_type = type; }
+ void set_amplitude (float ampl) { d_ampl = ampl; }
+
+ gr_noise_type_t type () const { return d_type; }
+ float amplitude () const { return d_ampl; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_noise_type.h b/gnuradio-core/src/lib/gengen/gr_noise_type.h
new file mode 100644
index 000000000..d2aba9b0c
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_noise_type.h
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_NOISE_TYPE_H
+#define INCLUDED_GR_NOISE_TYPE_H
+
+typedef enum {
+ GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE
+} gr_noise_type_t;
+
+#endif /* INCLUDED_GR_NOISE_TYPE_H */
diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_not_XX.cc.t
new file mode 100644
index 000000000..4806b142f
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_not_XX.cc.t
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ()
+{
+ return gnuradio::get_initial_sptr (new @NAME@ ());
+}
+
+@NAME@::@NAME@ ()
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)))
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+ const @I_TYPE@ *inptr = (const @I_TYPE@ *) input_items[0];
+
+
+ for (int i = 0; i < noutput_items; i++) {
+ *optr++ = ~(inptr[i]);
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.h.t b/gnuradio-core/src/lib/gengen/gr_not_XX.h.t
new file mode 100644
index 000000000..aff421109
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_not_XX.h.t
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+/*!
+ * \brief output = ~input_0
+ * \ingroup math_blk
+ *
+ * bitwise boolean not across input stream.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+ @NAME@ ();
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_not_XX.i.t b/gnuradio-core/src/lib/gengen/gr_not_XX.i.t
new file mode 100644
index 000000000..06db5ca59
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_not_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_or_XX.cc.t
new file mode 100644
index 000000000..ee55eedda
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_or_XX.cc.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ()
+{
+ return gnuradio::get_initial_sptr (new @NAME@ ());
+}
+
+@NAME@::@NAME@ ()
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)))
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (int i = 0; i < noutput_items; i++) {
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc = acc | ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.h.t b/gnuradio-core/src/lib/gengen/gr_or_XX.h.t
new file mode 100644
index 000000000..8860eedd5
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_or_XX.h.t
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+/*!
+ * \brief output = input_0 | input_1 | , ... | input_N)
+ * \ingroup math_blk
+ *
+ * bitwise boolean or across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+ @NAME@ ();
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_or_XX.i.t b/gnuradio-core/src/lib/gengen/gr_or_XX.i.t
new file mode 100644
index 000000000..06db5ca59
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_or_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.cc.t
new file mode 100644
index 000000000..75e53c4ca
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.cc.t
@@ -0,0 +1,137 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <gr_log2_const.h>
+
+static const unsigned int BITS_PER_TYPE = sizeof(@I_TYPE@) * 8;
+static const unsigned int LOG2_L_TYPE = gr_log2_const<sizeof(@I_TYPE@) * 8>();
+
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness)
+{
+ return @SPTR_NAME@
+ (new @NAME@ (bits_per_chunk,endianness));
+}
+
+@NAME@::@NAME@ (unsigned int bits_per_chunk,
+ gr_endianness_t endianness)
+ : gr_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, -1, sizeof (@O_TYPE@))),
+ d_bits_per_chunk(bits_per_chunk),d_endianness(endianness),d_index(0)
+{
+ assert (bits_per_chunk <= BITS_PER_TYPE);
+ assert (bits_per_chunk > 0);
+
+ set_relative_rate ((1.0 * BITS_PER_TYPE) / bits_per_chunk);
+}
+
+void
+@NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+
+ int input_required = (int) ceil((d_index + noutput_items * d_bits_per_chunk) / (1.0 * BITS_PER_TYPE));
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = input_required;
+ //printf("Forecast wants %d needs %d\n",noutput_items,ninput_items_required[i]);
+ }
+}
+
+unsigned int
+get_bit_le (const @I_TYPE@ *in_vector,unsigned int bit_addr)
+{
+ @I_TYPE@ x = in_vector[bit_addr>>LOG2_L_TYPE];
+ return (x>>(bit_addr&(BITS_PER_TYPE-1)))&1;
+}
+
+unsigned int
+get_bit_be (const @I_TYPE@ *in_vector,unsigned int bit_addr)
+{
+ @I_TYPE@ x = in_vector[bit_addr>>LOG2_L_TYPE];
+ return (x>>((BITS_PER_TYPE-1)-(bit_addr&(BITS_PER_TYPE-1))))&1;
+}
+
+int
+@NAME@::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ unsigned int index_tmp = d_index;
+
+ assert (input_items.size() == output_items.size());
+ int nstreams = input_items.size();
+
+ for (int m=0; m < nstreams; m++){
+ const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
+ index_tmp = d_index;
+
+ // per stream processing
+
+ switch (d_endianness){
+
+ case GR_MSB_FIRST:
+ for (int i = 0; i < noutput_items; i++){
+ //printf("here msb %d\n",i);
+ @O_TYPE@ x = 0;
+ for(unsigned int j=0; j<d_bits_per_chunk; j++, index_tmp++)
+ x = (x<<1) | get_bit_be(in, index_tmp);
+ out[i] = x;
+ }
+ break;
+
+ case GR_LSB_FIRST:
+ for (int i = 0; i < noutput_items; i++){
+ //printf("here lsb %d\n",i);
+ @O_TYPE@ x = 0;
+ for(unsigned int j=0; j<d_bits_per_chunk; j++, index_tmp++)
+ x = (x<<1) | get_bit_le(in, index_tmp);
+ out[i] = x;
+ }
+ break;
+
+ default:
+ assert(0);
+ }
+
+ //printf("almost got to end\n");
+ assert(ninput_items[m] >= (int) ((d_index+(BITS_PER_TYPE-1))>>LOG2_L_TYPE));
+ }
+
+ d_index = index_tmp;
+ consume_each (d_index >> LOG2_L_TYPE);
+ d_index = d_index & (BITS_PER_TYPE-1);
+ //printf("got to end\n");
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t
new file mode 100644
index 000000000..e95771b37
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.h.t
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gr_endianness.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+/*!
+ * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts.
+ * \ingroup converter_blk
+ *
+ * input: stream of @I_TYPE@; output: stream of @O_TYPE@
+ *
+ * This is the inverse of gr_unpacked_to_packed_XX.
+ *
+ * The bits in the bytes or shorts input stream are grouped into chunks of
+ * \p bits_per_chunk bits and each resulting chunk is written right-
+ * justified to the output stream of bytes or shorts.
+ * All b or 16 bits of the each input bytes or short are processed.
+ * The right thing is done if bits_per_chunk is not a power of two.
+ *
+ * The combination of gr_packed_to_unpacked_XX_ followed by
+ * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the
+ * general case of mapping from a stream of bytes or shorts into
+ * arbitrary float or complex symbols.
+ *
+ * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
+ * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss,
+ * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
+ * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc.
+ */
+
+class GR_CORE_API @NAME@ : public gr_block
+{
+ friend GR_CORE_API @SPTR_NAME@
+ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+ @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+ unsigned int d_bits_per_chunk;
+ gr_endianness_t d_endianness;
+ unsigned int d_index;
+
+ public:
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }
+
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.i.t b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.i.t
new file mode 100644
index 000000000..1e978956a
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_packed_to_unpacked_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+class @NAME@ : public gr_block
+{
+ @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t
new file mode 100644
index 000000000..54af3c0cd
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.cc.t
@@ -0,0 +1,111 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (threshold_factor_rise,
+ threshold_factor_fall,
+ look_ahead, alpha));
+}
+
+@NAME@::@NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (char))),
+ d_threshold_factor_rise(threshold_factor_rise),
+ d_threshold_factor_fall(threshold_factor_fall),
+ d_look_ahead(look_ahead), d_avg_alpha(alpha), d_avg(0), d_found(0)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+ char *optr = (char *) output_items[0];
+
+ memset(optr, 0, noutput_items*sizeof(char));
+
+ @I_TYPE@ peak_val = -(@I_TYPE@)INFINITY;
+ int peak_ind = 0;
+ unsigned char state = 0;
+ int i = 0;
+
+ //printf("noutput_items %d\n",noutput_items);
+ while(i < noutput_items) {
+ if(state == 0) { // below threshold
+ if(iptr[i] > d_avg*d_threshold_factor_rise) {
+ state = 1;
+ }
+ else {
+ d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg;
+ i++;
+ }
+ }
+ else if(state == 1) { // above threshold, have not found peak
+ //printf("Entered State 1: %f i: %d noutput_items: %d\n", iptr[i], i, noutput_items);
+ if(iptr[i] > peak_val) {
+ peak_val = iptr[i];
+ peak_ind = i;
+ d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg;
+ i++;
+ }
+ else if (iptr[i] > d_avg*d_threshold_factor_fall) {
+ d_avg = (d_avg_alpha)*iptr[i] + (1-d_avg_alpha)*d_avg;
+ i++;
+ }
+ else {
+ optr[peak_ind] = 1;
+ state = 0;
+ peak_val = -(@I_TYPE@)INFINITY;
+ //printf("Leaving State 1: Peak: %f Peak Ind: %d i: %d noutput_items: %d\n",
+ //peak_val, peak_ind, i, noutput_items);
+ }
+ }
+ }
+
+ if(state == 0) {
+ //printf("Leave in State 0, produced %d\n",noutput_items);
+ return noutput_items;
+ }
+ else { // only return up to passing the threshold
+ //printf("Leave in State 1, only produced %d of %d\n",peak_ind,noutput_items);
+ return peak_ind+1;
+ }
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t
new file mode 100644
index 000000000..3e05594fb
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.h.t
@@ -0,0 +1,126 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25,
+ float threshold_factor_fall = 0.40,
+ int look_ahead = 10,
+ float alpha = 0.001);
+
+/*!
+ * \brief Detect the peak of a signal
+ * \ingroup level_blk
+ *
+ * If a peak is detected, this block outputs a 1,
+ * or it outputs 0's.
+ *
+ * \param threshold_factor_rise The threshold factor determins when a peak
+ * has started. An average of the signal is calculated and when the
+ * value of the signal goes over threshold_factor_rise*average, we
+ * start looking for a peak.
+ * \param threshold_factor_fall The threshold factor determins when a peak
+ * has ended. An average of the signal is calculated and when the
+ * value of the signal goes bellow threshold_factor_fall*average, we
+ * stop looking for a peak.
+ * \param look_ahead The look-ahead value is used when the threshold is
+ * found to look if there another peak within this step range.
+ * If there is a larger value, we set that as the peak and look ahead
+ * again. This is continued until the highest point is found with
+ * This look-ahead range.
+ * \param alpha The gain value of a moving average filter
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha);
+
+ @NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha);
+
+ private:
+ float d_threshold_factor_rise;
+ float d_threshold_factor_fall;
+ int d_look_ahead;
+ float d_avg_alpha;
+ float d_avg;
+ unsigned char d_found;
+
+ public:
+
+ /*! \brief Set the threshold factor value for the rise time
+ * \param thr new threshold factor
+ */
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+
+ /*! \brief Set the threshold factor value for the fall time
+ * \param thr new threshold factor
+ */
+ void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; }
+
+ /*! \brief Set the look-ahead factor
+ * \param look new look-ahead factor
+ */
+ void set_look_ahead(int look) { d_look_ahead = look; }
+
+ /*! \brief Set the running average alpha
+ * \param alpha new alpha for running average
+ */
+ void set_alpha(int alpha) { d_avg_alpha = alpha; }
+
+ /*! \brief Get the threshold factor value for the rise time
+ * \return threshold factor
+ */
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+
+ /*! \brief Get the threshold factor value for the fall time
+ * \return threshold factor
+ */
+ float threshold_factor_fall() { return d_threshold_factor_fall; }
+
+ /*! \brief Get the look-ahead factor value
+ * \return look-ahead factor
+ */
+ int look_ahead() { return d_look_ahead; }
+
+ /*! \brief Get the alpha value of the running average
+ * \return alpha
+ */
+ float alpha() { return d_avg_alpha; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t
new file mode 100644
index 000000000..212ce0c94
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_peak_detector_XX.i.t
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (float threshold_factor_rise = 0.25,
+ float threshold_factor_fall = 0.40,
+ int look_ahead = 10,
+ float alpha=0.001);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (float threshold_factor_rise,
+ float threshold_factor_fall,
+ int look_ahead, float alpha);
+
+ public:
+ void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
+ void set_threshold_factor_fall(float thr) { d_threshold_factor_fall = thr; }
+ void set_look_ahead(int look) { d_look_ahead = look; }
+ void set_alpha(int alpha) { d_avg_alpha = alpha; }
+
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ float threshold_factor_fall() { return d_threshold_factor_fall; }
+ int look_ahead() { return d_look_ahead; }
+ float alpha() { return d_avg_alpha; }
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t
new file mode 100644
index 000000000..9a10bab59
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@NAME@_sptr
+gr_make_@BASE_NAME@()
+{
+ return gnuradio::get_initial_sptr(new @NAME@());
+}
+
+@NAME@::@NAME@ ()
+: gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@TYPE@)),
+ gr_make_io_signature(0, 0, 0)),
+ d_level(0)
+{
+}
+
+@NAME@::~@NAME@()
+{
+}
+
+
+int
+@NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const @TYPE@ *in = (const @TYPE@ *) input_items[0];
+
+ if (noutput_items > 0)
+ d_level = in[noutput_items-1];
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t
new file mode 100644
index 000000000..936f437f1
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005, 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ ();
+
+/*!
+ * \brief Sink that allows a sample to be grabbed from Python.
+ * \ingroup sink_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ @TYPE@ d_level;
+
+ friend GR_CORE_API @NAME@_sptr
+ gr_make_@BASE_NAME@();
+
+ @NAME@();
+
+public:
+ ~@NAME@();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ @TYPE@ level() const { return d_level; }
+
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t
new file mode 100644
index 000000000..ec9643686
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005, 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ ();
+
+class @NAME@ : public gr_sync_block
+{
+public:
+ @TYPE@ level ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t
new file mode 100644
index 000000000..1aedca4ec
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+@NAME@_sptr
+gr_make_@BASE_NAME@(size_t size)
+{
+ return gnuradio::get_initial_sptr(new @NAME@(size));
+}
+
+@NAME@::@NAME@ (size_t size)
+: gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature(1, 1, size*sizeof(@TYPE@)),
+ gr_make_io_signature(0, 0, 0)),
+ d_level(size, 0), d_size(size)
+{
+}
+
+@NAME@::~@NAME@()
+{
+}
+
+int
+@NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const @TYPE@ *in = (const @TYPE@ *) input_items[0];
+
+ for (size_t i=0; i<d_size; i++)
+ d_level[i] = in[(noutput_items-1)*d_size+i];
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t
new file mode 100644
index 000000000..ee673c14a
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005, 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <vector>
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ (size_t size);
+
+/*!
+ * \brief Sink that allows a sample to be grabbed from Python.
+ * \ingroup sink_blk
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ std::vector<@TYPE@> d_level;
+
+ friend GR_CORE_API @NAME@_sptr
+ gr_make_@BASE_NAME@(size_t size);
+
+ @NAME@(size_t size);
+
+ size_t d_size;
+
+public:
+ ~@NAME@();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<@TYPE@> level() const { return d_level; }
+
+};
+
+#endif /* @GUARD_NAME@ */
diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t
new file mode 100644
index 000000000..b7de09125
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2005, 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (size_t size);
+
+class @NAME@ : public gr_sync_block
+{
+public:
+ std::vector<@TYPE@> level ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.cc.t
new file mode 100644
index 000000000..68f4d544e
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.cc.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ()
+{
+ return gnuradio::get_initial_sptr (new @NAME@ ());
+}
+
+@NAME@::@NAME@ ()
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature2 (2, 2, sizeof (@I_TYPE@), sizeof(char)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
+ d_data(0)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0];
+ const char *ctrl = (const char *) input_items[1];
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+ if(ctrl[i]) {
+ d_data = iptr[i];
+ }
+ optr[i] = d_data;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t
new file mode 100644
index 000000000..0364941cb
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.h.t
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+/*!
+ * \brief sample and hold circuit
+ * \ingroup level_blk
+ *
+ * Samples the data stream (input stream 0) and holds the value
+ * if the control signal is 1 (intput stream 1).
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+ @NAME@ ();
+
+ private:
+ @O_TYPE@ d_data;
+
+ public:
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.i.t b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.i.t
new file mode 100644
index 000000000..4620b0f2c
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sample_and_hold_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ ();
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
new file mode 100644
index 000000000..6959eac82
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
@@ -0,0 +1,241 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <@NAME@.h>
+#include <algorithm>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <algorithm>
+#include <gr_complex.h>
+
+
+@NAME@::@NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double frequency, double ampl, @TYPE@ offset)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof (@TYPE@))),
+ d_sampling_freq (sampling_freq), d_waveform (waveform), d_frequency (frequency),
+ d_ampl (ampl), d_offset (offset)
+{
+ d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq);
+}
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double frequency, double ampl, @TYPE@ offset)
+{
+ return gnuradio::get_initial_sptr(new @NAME@ (sampling_freq, waveform, frequency, ampl, offset));
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @TYPE@ *optr = (@TYPE@ *) output_items[0];
+ @TYPE@ t;
+
+ switch (d_waveform){
+
+#if @IS_COMPLEX@ // complex?
+
+ case GR_CONST_WAVE:
+ t = (gr_complex) d_ampl + d_offset;
+ std::fill_n(optr, noutput_items, t);
+ break;
+
+ case GR_SIN_WAVE:
+ case GR_COS_WAVE:
+ d_nco.sincos (optr, noutput_items, d_ampl);
+ if (d_offset == gr_complex(0,0))
+ break;
+
+ for (int i = 0; i < noutput_items; i++){
+ optr[i] += d_offset;
+ }
+ break;
+
+ /* Implements a real square wave high from -PI to 0.
+ * The imaginary square wave leads by 90 deg.
+ */
+ case GR_SQR_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < -1*M_PI/2)
+ optr[i] = gr_complex(d_ampl, 0)+d_offset;
+ else if (d_nco.get_phase() < 0)
+ optr[i] = gr_complex(d_ampl, d_ampl)+d_offset;
+ else if (d_nco.get_phase() < M_PI/2)
+ optr[i] = gr_complex(0, d_ampl)+d_offset;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real triangle wave rising from -PI to 0 and
+ * falling from 0 to PI. The imaginary triangle wave leads by 90 deg.
+ */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < -1*M_PI/2){
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2)+d_offset;
+ }
+ else if (d_nco.get_phase() < 0){
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ d_ampl*d_nco.get_phase()/M_PI + d_ampl/2)+d_offset;
+ }
+ else if (d_nco.get_phase() < M_PI/2){
+ optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ d_ampl*d_nco.get_phase()/M_PI + d_ampl/2)+d_offset;
+ }
+ else{
+ optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2)+d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real saw tooth wave rising from -PI to PI.
+ * The imaginary saw tooth wave leads by 90 deg.
+ */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < -1*M_PI/2){
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
+ d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4)+d_offset;
+ }
+ else{
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
+ d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4)+d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+
+#else // nope...
+
+ case GR_CONST_WAVE:
+ t = (@TYPE@) d_ampl + d_offset;
+ std::fill_n(optr, noutput_items, t);
+ break;
+
+ case GR_SIN_WAVE:
+ d_nco.sin (optr, noutput_items, d_ampl);
+ if (d_offset == 0)
+ break;
+
+ for (int i = 0; i < noutput_items; i++){
+ optr[i] += d_offset;
+ }
+ break;
+
+ case GR_COS_WAVE:
+ d_nco.cos (optr, noutput_items, d_ampl);
+ if (d_offset == 0)
+ break;
+
+ for (int i = 0; i < noutput_items; i++){
+ optr[i] += d_offset;
+ }
+ break;
+
+ /* The square wave is high from -PI to 0. */
+ case GR_SQR_WAVE:
+ t = (@TYPE@) d_ampl + d_offset;
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < 0)
+ optr[i] = t;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ double t = d_ampl*d_nco.get_phase()/M_PI;
+ if (d_nco.get_phase() < 0)
+ optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset);
+ else
+ optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset);
+ d_nco.step();
+ }
+ break;
+
+ /* The saw tooth wave rises from -PI to PI. */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2 + d_offset);
+ optr[i] = t;
+ d_nco.step();
+ }
+ break;
+
+#endif
+
+ default:
+ throw std::runtime_error ("gr_sig_source: invalid waveform");
+ }
+
+ return noutput_items;
+}
+
+void
+@NAME@::set_sampling_freq (double sampling_freq)
+{
+ d_sampling_freq = sampling_freq;
+ d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq);
+}
+
+void
+@NAME@::set_waveform (gr_waveform_t waveform)
+{
+ d_waveform = waveform;
+}
+
+void
+@NAME@::set_frequency (double frequency)
+{
+ d_frequency = frequency;
+ d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq);
+}
+
+void
+@NAME@::set_amplitude (double ampl)
+{
+ d_ampl = ampl;
+}
+
+void
+@NAME@::set_offset (@TYPE@ offset)
+{
+ d_offset = offset;
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t
new file mode 100644
index 000000000..baa82dbe2
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gr_sig_source_waveform.h>
+#include <gr_fxpt_nco.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+/*!
+ * \brief signal generator with @TYPE@ output.
+ * \ingroup source_blk
+ */
+
+class GR_CORE_API @NAME@ : public gr_sync_block {
+ friend GR_CORE_API @NAME@_sptr
+ gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double frequency, double ampl, @TYPE@ offset);
+
+ double d_sampling_freq;
+ gr_waveform_t d_waveform;
+ double d_frequency;
+ double d_ampl;
+ @TYPE@ d_offset;
+ gr_fxpt_nco d_nco;
+
+
+ @NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double wave_freq, double ampl, @TYPE@ offset);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ // ACCESSORS
+ double sampling_freq () const { return d_sampling_freq; }
+ gr_waveform_t waveform () const { return d_waveform; }
+ double frequency () const { return d_frequency; }
+ double amplitude () const { return d_ampl; }
+ @TYPE@ offset () const { return d_offset; }
+
+ // MANIPULATORS
+ void set_sampling_freq (double sampling_freq);
+ void set_waveform (gr_waveform_t waveform);
+ void set_frequency (double frequency);
+ void set_amplitude (double ampl);
+ void set_offset (@TYPE@ offset);
+};
+
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double wave_freq, double ampl, @TYPE@ offset = 0);
+
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t
new file mode 100644
index 000000000..7bd85fcb8
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double wave_freq, double ampl, @TYPE@ offset = 0);
+
+
+class @NAME@ : public gr_sync_block {
+ private:
+ @NAME@ (double sampling_freq, gr_waveform_t waveform,
+ double wave_freq, double ampl, @TYPE@ offset);
+
+ public:
+
+ // ACCESSORS
+ double sampling_freq () const { return d_sampling_freq; }
+ gr_waveform_t waveform () const { return d_waveform; }
+ double frequency () const { return d_frequency; }
+ double amplitude () const { return d_ampl; }
+ @TYPE@ offset () const { return d_offset; }
+
+ // MANIPULATORS
+ void set_sampling_freq (double sampling_freq);
+ void set_waveform (gr_waveform_t waveform);
+ void set_frequency (double frequency);
+ void set_amplitude (double ampl);
+ void set_offset (@TYPE@ offset);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h b/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h
new file mode 100644
index 000000000..9fe233ba4
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h
@@ -0,0 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef INCLUDED_GR_SIG_SOURCE_WAVEFORM_H
+#define INCLUDED_GR_SIG_SOURCE_WAVEFORM_H
+
+typedef enum {
+ GR_CONST_WAVE = 100, GR_SIN_WAVE, GR_COS_WAVE, GR_SQR_WAVE, GR_TRI_WAVE, GR_SAW_WAVE
+} gr_waveform_t;
+
+#endif /* INCLUDED_GR_SIG_SOURCE_WAVEFORM_H */
diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
new file mode 100644
index 000000000..11eb7440e
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
@@ -0,0 +1,71 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (size_t vlen)
+{
+ return gnuradio::get_initial_sptr (new @NAME@ (vlen));
+}
+
+@NAME@::@NAME@ (size_t vlen)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)*vlen),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)*vlen)),
+ d_vlen (vlen)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ if (ninputs == 1){ // negate
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
+ *optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i];
+ }
+
+ else {
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc -= ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t
new file mode 100644
index 000000000..f96c93484
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.h.t
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+/*!
+ * \brief output = input_0 - input_1 - ...)
+ * \ingroup math_blk
+ *
+ * Subtract across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen);
+
+ @NAME@ (size_t vlen);
+
+ size_t d_vlen;
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t
new file mode 100644
index 000000000..b2c510610
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004, 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (size_t vlen = 1);
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ (size_t vlen);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.cc.t
new file mode 100644
index 000000000..ed2b713db
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.cc.t
@@ -0,0 +1,129 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+
+static const unsigned int BITS_PER_TYPE = sizeof(@O_TYPE@) * 8;
+
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness)
+{
+ return @SPTR_NAME@
+ (new @NAME@ (bits_per_chunk,endianness));
+}
+
+@NAME@::@NAME@ (unsigned int bits_per_chunk,
+ gr_endianness_t endianness)
+ : gr_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, -1, sizeof (@O_TYPE@))),
+ d_bits_per_chunk(bits_per_chunk),d_endianness(endianness),d_index(0)
+{
+ assert (bits_per_chunk <= BITS_PER_TYPE);
+ assert (bits_per_chunk > 0);
+
+ set_relative_rate (bits_per_chunk/(1.0 * BITS_PER_TYPE));
+}
+
+void
+@NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ int input_required = (int) ceil( (d_index+noutput_items * 1.0 * BITS_PER_TYPE)/d_bits_per_chunk);
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = input_required;
+ }
+}
+
+unsigned int
+get_bit_be1 (const @I_TYPE@ *in_vector,unsigned int bit_addr, unsigned int bits_per_chunk) {
+ unsigned int byte_addr = (int)bit_addr/bits_per_chunk;
+ @I_TYPE@ x = in_vector[byte_addr];
+ unsigned int residue = bit_addr - byte_addr * bits_per_chunk;
+ //printf("Bit addr %d byte addr %d residue %d val %d\n",bit_addr,byte_addr,residue,(x>>(bits_per_chunk-1-residue))&1);
+ return (x >> (bits_per_chunk-1-residue))&1;
+}
+
+int
+@NAME@::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ unsigned int index_tmp = d_index;
+
+ assert (input_items.size() == output_items.size());
+ int nstreams = input_items.size();
+
+ for (int m=0; m< nstreams; m++) {
+ const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
+ index_tmp=d_index;
+
+ // per stream processing
+
+ //assert((ninput_items[m]-d_index)*d_bits_per_chunk >= noutput_items*BITS_PER_TYPE);
+
+ switch(d_endianness){
+
+ case GR_MSB_FIRST:
+ for(int i=0;i<noutput_items;i++) {
+ @O_TYPE@ tmp=0;
+ for(unsigned int j=0; j<BITS_PER_TYPE; j++) {
+ tmp = (tmp<<1) | get_bit_be1(in,index_tmp,d_bits_per_chunk);
+ index_tmp++;
+ }
+ out[i] = tmp;
+ }
+ break;
+
+ case GR_LSB_FIRST:
+ for(int i=0;i<noutput_items;i++) {
+ unsigned long tmp=0;
+ for(unsigned int j=0; j<BITS_PER_TYPE; j++) {
+ tmp = (tmp>>1)| (get_bit_be1(in,index_tmp,d_bits_per_chunk)<<(BITS_PER_TYPE-1));
+ index_tmp++;
+ }
+ out[i] = tmp;
+ }
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+
+ d_index = index_tmp;
+ consume_each ((int)(d_index/d_bits_per_chunk));
+ d_index = d_index%d_bits_per_chunk;
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t
new file mode 100644
index 000000000..a7b7b54df
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.h.t
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+#include <gr_endianness.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+GR_CORE_API @SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+/*!
+ * \brief Convert a stream of unpacked bytes or shorts into a stream of packed bytes or shorts.
+ * \ingroup converter_blk
+ *
+ * input: stream of @I_TYPE@; output: stream of @O_TYPE@
+ *
+ * This is the inverse of gr_packed_to_unpacked_XX.
+ *
+ * The low \p bits_per_chunk bits are extracted from each input byte or short.
+ * These bits are then packed densely into the output bytes or shorts, such that
+ * all 8 or 16 bits of the output bytes or shorts are filled with valid input bits.
+ * The right thing is done if bits_per_chunk is not a power of two.
+ *
+ * The combination of gr_packed_to_unpacked_XX followed by
+ * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the
+ * general case of mapping from a stream of bytes or shorts into arbitrary float
+ * or complex symbols.
+ *
+ * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb,
+ * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss,
+ * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc.
+ * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc.
+ */
+class GR_CORE_API @NAME@ : public gr_block
+{
+ friend GR_CORE_API @SPTR_NAME@
+ gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+ @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+ unsigned int d_bits_per_chunk;
+ gr_endianness_t d_endianness;
+ unsigned int d_index;
+
+ public:
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; }
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.i.t b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.i.t
new file mode 100644
index 000000000..1e978956a
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_unpacked_to_packed_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+
+class @NAME@ : public gr_block
+{
+ @NAME@ (unsigned int bits_per_chunk, gr_endianness_t endianness);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t
new file mode 100644
index 000000000..20968afe2
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t
@@ -0,0 +1,100 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <@NAME@.h>
+#include <algorithm>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+#include <stdio.h>
+
+@NAME@::@NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof(@TYPE@)),
+ gr_make_io_signature (1, 1, sizeof(@TYPE@))),
+ d_data(data),
+ d_offset(offset),
+ d_periodicity(periodicity)
+{
+ //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset);
+ // some sanity checks
+ assert(offset < periodicity);
+ assert(offset >= 0);
+ assert((size_t)periodicity > data.size());
+}
+
+int
+@NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @TYPE@ *out = (@TYPE@ *)output_items[0];
+ const @TYPE@ *in = (const @TYPE@ *)input_items[0];
+
+ int ii(0), oo(0);
+
+ while((oo < noutput_items) && (ii < ninput_items[0])) {
+
+ //printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]);
+ //printf(", d_periodicity = %d\n", d_periodicity);
+
+ if(d_offset >= ((int)d_data.size())) { // if we are in the copy region
+ int max_copy = std::min( std::min( noutput_items - oo, ninput_items[0] - ii ), d_periodicity - d_offset );
+ //printf("copy %d from input\n", max_copy);
+ memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy );
+ //printf(" * memcpy returned.\n");
+ ii += max_copy;
+ oo += max_copy;
+ d_offset = (d_offset + max_copy)%d_periodicity;
+
+ }
+ else { // if we are in the insertion region
+ int max_copy = std::min( noutput_items - oo, ((int)d_data.size()) - d_offset );
+ //printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo);
+ memcpy( &out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy );
+ //printf(" * memcpy returned.\n");
+ oo += max_copy;
+ d_offset = (d_offset + max_copy)%d_periodicity;
+ //printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset);
+ }
+
+ //printf(" # exit else, on to next loop.\n");
+ }
+ //printf(" # got out of loop\n");
+
+ //printf("consume = %d, produce = %d\n", ii, oo);
+ consume_each(ii);
+ return oo;
+}
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset)
+{
+ return gnuradio::get_initial_sptr(new @NAME@ (data, periodicity, offset));
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t
new file mode 100644
index 000000000..26f851700
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_block.h>
+
+class GR_CORE_API @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+/*!
+ * \brief source of @TYPE@'s that gets its data from a vector
+ * \ingroup source_blk
+ */
+
+class @NAME@ : public gr_block {
+ friend GR_CORE_API @NAME@_sptr
+ gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset);
+
+ std::vector<@TYPE@> d_data;
+ int d_offset;
+ int d_periodicity;
+
+ @NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset);
+
+ public:
+ void rewind() {d_offset=0;}
+ virtual int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ void set_data(const std::vector<@TYPE@> &data){ d_data = data; rewind(); }
+};
+
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset=0);
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t
new file mode 100644
index 000000000..f3341eec4
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset = 0)
+ throw(std::invalid_argument);
+
+class @NAME@ : public gr_block {
+ public:
+ void rewind();
+ void set_data(const std::vector<@TYPE@> &data);
+ private:
+ @NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset = 0);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
new file mode 100644
index 000000000..a9e3a0a3e
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.cc.t
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <@NAME@.h>
+#include <algorithm>
+#include <gr_io_signature.h>
+
+
+@NAME@::@NAME@ (int vlen)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen),
+ gr_make_io_signature (0, 0, 0)),
+ d_vlen(vlen)
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @TYPE@ *iptr = (@TYPE@ *) input_items[0];
+ for (int i = 0; i < noutput_items * d_vlen; i++)
+ d_data.push_back (iptr[i]);
+
+ return noutput_items;
+}
+
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (int vlen)
+{
+ return gnuradio::get_initial_sptr(new @NAME@ (vlen));
+}
+
+std::vector<@TYPE@>
+@NAME@::data () const
+{
+ return d_data;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
new file mode 100644
index 000000000..b9126dc7b
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.h.t
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ (int vlen = 1);
+
+
+/*!
+ * \brief @TYPE@ sink that writes to a vector
+ * \ingroup sink_blk
+ */
+
+class GR_CORE_API @NAME@ : public gr_sync_block {
+ friend GR_CORE_API @NAME@_sptr gr_make_@BASE_NAME@ (int vlen);
+ std::vector<@TYPE@> d_data;
+ int d_vlen;
+ @NAME@ (int vlen);
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void reset() {d_data.clear();}
+ void clear() {reset(); } // deprecated
+ std::vector<@TYPE@> data () const;
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
new file mode 100644
index 000000000..d4a940911
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_sink_X.i.t
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ (int vlen = 1);
+
+class @NAME@ : public gr_sync_block {
+ private:
+ @NAME@ (int vlen);
+
+ public:
+ void clear(); // deprecated
+ void reset();
+ std::vector<@TYPE@> data () const;
+};
+
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
new file mode 100644
index 000000000..9f68f9cf1
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.cc.t
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <@NAME@.h>
+#include <algorithm>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+
+@NAME@::@NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen)
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof (@TYPE@) * vlen)),
+ d_data (data),
+ d_repeat (repeat),
+ d_offset (0),
+ d_vlen (vlen)
+{
+ if ((data.size() % vlen) != 0)
+ throw std::invalid_argument("data length must be a multiple of vlen");
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @TYPE@ *optr = (@TYPE@ *) output_items[0];
+
+ if (d_repeat){
+ unsigned int size = d_data.size ();
+ unsigned int offset = d_offset;
+
+ if (size == 0)
+ return -1;
+
+ for (int i = 0; i < noutput_items*d_vlen; i++){
+ optr[i] = d_data[offset++];
+ if (offset >= size)
+ offset = 0;
+ }
+ d_offset = offset;
+ return noutput_items;
+ }
+
+ else {
+ if (d_offset >= d_data.size ())
+ return -1; // Done!
+
+ unsigned n = std::min ((unsigned) d_data.size () - d_offset,
+ (unsigned) noutput_items*d_vlen);
+ for (unsigned i = 0; i < n; i++)
+ optr[i] = d_data[d_offset + i];
+
+ d_offset += n;
+ return n/d_vlen;
+ }
+}
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen)
+{
+ return gnuradio::get_initial_sptr(new @NAME@ (data, repeat, vlen));
+}
+
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
new file mode 100644
index 000000000..fe02c1346
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.h.t
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class GR_CORE_API @NAME@;
+typedef boost::shared_ptr<@NAME@> @NAME@_sptr;
+
+/*!
+ * \brief source of @TYPE@'s that gets its data from a vector
+ * \ingroup source_blk
+ */
+
+class @NAME@ : public gr_sync_block {
+ friend GR_CORE_API @NAME@_sptr
+ gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen);
+
+ std::vector<@TYPE@> d_data;
+ bool d_repeat;
+ unsigned int d_offset;
+ int d_vlen;
+
+ @NAME@ (const std::vector<@TYPE@> &data, bool repeat, int vlen);
+
+ public:
+ void rewind() {d_offset=0;}
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ void set_data(const std::vector<@TYPE@> &data){ d_data = data; rewind(); }
+};
+
+GR_CORE_API @NAME@_sptr
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1);
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
new file mode 100644
index 000000000..4986c68a3
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_vector_source_X.i.t
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@);
+
+@NAME@_sptr
+gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, bool repeat = false, int vlen = 1)
+ throw(std::invalid_argument);
+
+class @NAME@ : public gr_sync_block {
+ public:
+ void rewind();
+ void set_data(const std::vector<@TYPE@> &data);
+ private:
+ @NAME@ (const std::vector<@TYPE@> &data, int vlen);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t
new file mode 100644
index 000000000..d6990aa4f
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_xor_XX.cc.t
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008,2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME@.h>
+#include <gr_io_signature.h>
+
+@SPTR_NAME@
+gr_make_@BASE_NAME@ ()
+{
+ return gnuradio::get_initial_sptr (new @NAME@ ());
+}
+
+@NAME@::@NAME@ ()
+ : gr_sync_block ("@BASE_NAME@",
+ gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature (1, 1, sizeof (@O_TYPE@)))
+{
+}
+
+int
+@NAME@::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0];
+
+ int ninputs = input_items.size ();
+
+ for (int i = 0; i < noutput_items; i++) {
+ @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ for (int j = 1; j < ninputs; j++)
+ acc = acc ^ ((@I_TYPE@ *) input_items[j])[i];
+
+ *optr++ = (@O_TYPE@) acc;
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t
new file mode 100644
index 000000000..8fe47d9e0
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_xor_XX.h.t
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+
+class @NAME@;
+typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+
+GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+/*!
+ * \brief output = input_0 ^ input_1 ^ , ... ^ input_N)
+ * \ingroup math_blk
+ *
+ * bitwise boolean xor across all input streams.
+ */
+class GR_CORE_API @NAME@ : public gr_sync_block
+{
+ friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+ @NAME@ ();
+
+ public:
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/gengen/gr_xor_XX.i.t b/gnuradio-core/src/lib/gengen/gr_xor_XX.i.t
new file mode 100644
index 000000000..06db5ca59
--- /dev/null
+++ b/gnuradio-core/src/lib/gengen/gr_xor_XX.i.t
@@ -0,0 +1,33 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@)
+
+@SPTR_NAME@ gr_make_@BASE_NAME@ ();
+
+class @NAME@ : public gr_sync_block
+{
+ private:
+ @NAME@ ();
+};